Nginx Helper - Version 2.2.0

Version Description

  • Add filter rt_nginx_helper_fastcgi_purge_suffix to change purge suffix for FastCGI cache. #141 - by stayallive
  • Add filter rt_nginx_helper_fastcgi_purge_url_base to change purge URL base for FastCGI cache. #141 - by stayallive
  • Update our code to be in line with WordPress Coding standards in various places. #209, #225 - by abhijitrakas, chandrapatel
  • Check and verify purging is enabled before purging cache. #168 - by jaredwsmith
  • Hide Purge Cache button in admin bar when purge is disabled. #218, #219 - by mbautista, chandrapatel
  • Don't add Nginx Timestamp on WordPress login page. #204, #220 - by peixotorms, chandrapatel
Download this release

Release Info

Developer rtcamp
Plugin Icon 128x128 Nginx Helper
Version 2.2.0
Comparing to
See all releases

Code changes from version 2.1.0 to 2.2.0

admin/class-fastcgi-purger.php CHANGED
@@ -51,7 +51,7 @@ class FastCGI_Purger extends Purger {
51
  $_url_purge_base = $parse['scheme'] . '://' . $parse['host'] . $parse['path'];
52
  $_url_purge = $_url_purge_base;
53
 
54
- if ( isset( $parse['query'] ) && $parse['query'] !== '' ) {
55
  $_url_purge .= '?' . $parse['query'];
56
  }
57
 
@@ -70,7 +70,7 @@ class FastCGI_Purger extends Purger {
70
  case 'get_request':
71
  // Go to default case.
72
  default:
73
- $_url_purge_base = $parse['scheme'] . '://' . $parse['host'] . '/purge' . $parse['path'];
74
  $_url_purge = $_url_purge_base;
75
 
76
  if ( isset( $parse['query'] ) && '' !== $parse['query'] ) {
@@ -100,7 +100,7 @@ class FastCGI_Purger extends Purger {
100
 
101
  global $nginx_helper_admin;
102
 
103
- $parse = wp_parse_url( site_url() );
104
 
105
  $purge_urls = isset( $nginx_helper_admin->options['purge_url'] ) && ! empty( $nginx_helper_admin->options['purge_url'] ) ?
106
  explode( "\r\n", $nginx_helper_admin->options['purge_url'] ) : array();
@@ -131,16 +131,14 @@ class FastCGI_Purger extends Purger {
131
  $this->delete_cache_file_for( $purge_url );
132
 
133
  }
134
-
135
  }
136
-
137
  }
138
  break;
139
 
140
  case 'get_request':
141
  // Go to default case.
142
  default:
143
- $_url_purge_base = $parse['scheme'] . '://' . $parse['host'] . '/purge';
144
 
145
  if ( is_array( $purge_urls ) && ! empty( $purge_urls ) ) {
146
 
@@ -155,9 +153,7 @@ class FastCGI_Purger extends Purger {
155
  $this->do_remote_get( $purge_url );
156
 
157
  }
158
-
159
  }
160
-
161
  }
162
  break;
163
 
@@ -183,4 +179,43 @@ class FastCGI_Purger extends Purger {
183
  do_action( 'rt_nginx_helper_after_fastcgi_purge_all' );
184
  }
185
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  }
51
  $_url_purge_base = $parse['scheme'] . '://' . $parse['host'] . $parse['path'];
52
  $_url_purge = $_url_purge_base;
53
 
54
+ if ( ! empty( $parse['query'] ) ) {
55
  $_url_purge .= '?' . $parse['query'];
56
  }
57
 
70
  case 'get_request':
71
  // Go to default case.
72
  default:
73
+ $_url_purge_base = $this->purge_base_url() . $parse['path'];
74
  $_url_purge = $_url_purge_base;
75
 
76
  if ( isset( $parse['query'] ) && '' !== $parse['query'] ) {
100
 
101
  global $nginx_helper_admin;
102
 
103
+ $parse = wp_parse_url( home_url() );
104
 
105
  $purge_urls = isset( $nginx_helper_admin->options['purge_url'] ) && ! empty( $nginx_helper_admin->options['purge_url'] ) ?
106
  explode( "\r\n", $nginx_helper_admin->options['purge_url'] ) : array();
131
  $this->delete_cache_file_for( $purge_url );
132
 
133
  }
 
134
  }
 
135
  }
136
  break;
137
 
138
  case 'get_request':
139
  // Go to default case.
140
  default:
141
+ $_url_purge_base = $this->purge_base_url();
142
 
143
  if ( is_array( $purge_urls ) && ! empty( $purge_urls ) ) {
144
 
153
  $this->do_remote_get( $purge_url );
154
 
155
  }
 
156
  }
 
157
  }
158
  break;
159
 
179
  do_action( 'rt_nginx_helper_after_fastcgi_purge_all' );
180
  }
181
 
182
+ /**
183
+ * Constructs the base url to call when purging using the "get_request" method.
184
+ *
185
+ * @since 2.2.0
186
+ *
187
+ * @return string
188
+ */
189
+ private function purge_base_url() {
190
+
191
+ $parse = wp_parse_url( home_url() );
192
+
193
+ /**
194
+ * Filter to change purge suffix for FastCGI cache.
195
+ *
196
+ * @param string $suffix Purge suffix. Default is purge.
197
+ *
198
+ * @since 2.2.0
199
+ */
200
+ $path = apply_filters( 'rt_nginx_helper_fastcgi_purge_suffix', 'purge' );
201
+
202
+ // Prevent users from inserting a trailing '/' that could break the url purging.
203
+ $path = trim( $path, '/' );
204
+
205
+ $purge_url_base = $parse['scheme'] . '://' . $parse['host'] . '/' . $path;
206
+
207
+ /**
208
+ * Filter to change purge URL base for FastCGI cache.
209
+ *
210
+ * @param string $purge_url_base Purge URL base.
211
+ *
212
+ * @since 2.2.0
213
+ */
214
+ $purge_url_base = apply_filters( 'rt_nginx_helper_fastcgi_purge_url_base', $purge_url_base );
215
+
216
+ // Prevent users from inserting a trailing '/' that could break the url purging.
217
+ return untrailingslashit( $purge_url_base );
218
+
219
+ }
220
+
221
  }
admin/class-nginx-helper-admin.php CHANGED
@@ -79,10 +79,11 @@ class Nginx_Helper_Admin {
79
  $this->version = $version;
80
 
81
  /**
82
- * Define settings tabs
83
- */
84
  $this->settings_tabs = apply_filters(
85
- 'rt_nginx_helper_settings_tabs', array(
 
86
  'general' => array(
87
  'menu_title' => __( 'General', 'nginx-helper' ),
88
  'menu_slug' => 'general',
@@ -155,6 +156,11 @@ class Nginx_Helper_Admin {
155
 
156
  wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/nginx-helper-admin.js', array( 'jquery' ), $this->version, false );
157
 
 
 
 
 
 
158
  }
159
 
160
  /**
@@ -209,7 +215,7 @@ class Nginx_Helper_Admin {
209
  $link_title = __( 'Purge Current Page', 'nginx-helper' );
210
  }
211
 
212
- $purge_url = add_query_arg(
213
  array(
214
  'nginx_helper_action' => 'purge',
215
  'nginx_helper_urls' => $nginx_helper_urls,
@@ -237,7 +243,7 @@ class Nginx_Helper_Admin {
237
  * @since 2.0.0
238
  */
239
  public function nginx_helper_setting_page() {
240
- include plugin_dir_path(__FILE__ ) . 'partials/nginx-helper-admin-display.php';
241
  }
242
 
243
  /**
@@ -282,7 +288,14 @@ class Nginx_Helper_Admin {
282
  */
283
  public function nginx_helper_settings() {
284
 
285
- $options = get_site_option( 'rt_wp_nginx_helper_options', array( 'redis_hostname' => '127.0.0.1', 'redis_port' => '6379', 'redis_prefix' => 'nginx-cache:' ) );
 
 
 
 
 
 
 
286
 
287
  $data = wp_parse_args(
288
  $options,
@@ -396,18 +409,16 @@ class Nginx_Helper_Admin {
396
  ?>
397
  <li role="listitem">
398
  <?php
399
- echo wp_kses(
400
- sprintf(
401
- '<a href="%1$s" title="%2$s">%3$s</a>',
402
- esc_url( $item->get_permalink() ), esc_attr__( 'Posted ', 'nginx-helper' ) . esc_attr( $item->get_date( 'j F Y | g:i a' ) ), esc_html( $item->get_title() )
403
- ),
404
- array( 'strong' => array(), 'a' => array( 'href' => array(), 'title' => array() ) )
405
- );
406
  ?>
407
  </li>
408
  <?php
409
  }
410
-
411
  }
412
  ?>
413
  </ul>
@@ -421,13 +432,19 @@ class Nginx_Helper_Admin {
421
  */
422
  public function add_timestamps() {
423
 
424
- if ( is_admin() || (int) $this->options['enable_purge'] !== 1 || (int) $this->options['enable_stamp'] !== 1 ) {
 
 
 
 
 
 
425
  return;
426
  }
427
 
428
  foreach ( headers_list() as $header ) {
429
  list( $key, $value ) = explode( ':', $header, 2 );
430
- $key = strtolower( $key );
431
  if ( 'content-type' === $key && strpos( trim( $value ), 'text/html' ) !== 0 ) {
432
  return;
433
  }
@@ -480,7 +497,7 @@ class Nginx_Helper_Admin {
480
 
481
  $rt_all_blogs = $wpdb->get_results(
482
  $wpdb->prepare(
483
- 'SELECT blog_id, domain, path FROM ' . $wpdb->blogs . " WHERE site_id = %d AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0'",
484
  $wpdb->siteid
485
  )
486
  );
@@ -507,11 +524,8 @@ class Nginx_Helper_Admin {
507
  if ( 1 !== $blog->blog_id ) {
508
  $rt_nginx_map_array[ $blog->path ] = $blog->blog_id;
509
  }
510
-
511
  }
512
-
513
  }
514
-
515
  }
516
 
517
  if ( $rt_domain_map_sites ) {
@@ -519,7 +533,6 @@ class Nginx_Helper_Admin {
519
  foreach ( $rt_domain_map_sites as $site ) {
520
  $rt_nginx_map_array[ $site->domain ] = $site->blog_id;
521
  }
522
-
523
  }
524
 
525
  foreach ( $rt_nginx_map_array as $domain => $domain_id ) {
@@ -541,11 +554,11 @@ class Nginx_Helper_Admin {
541
 
542
  $rt_nginx_map = $this->get_map();
543
 
544
- if ( $fp = fopen( $this->functional_asset_path() . 'map.conf', 'w+' ) ) {
 
545
  fwrite( $fp, $rt_nginx_map );
546
  fclose( $fp );
547
  }
548
-
549
  }
550
 
551
  }
@@ -580,11 +593,11 @@ class Nginx_Helper_Admin {
580
  if (
581
  'future' === $new_status && $post && 'future' === $post->post_status &&
582
  (
583
- ( 'post' === $post->post_type || 'page' === $post->post_type ) ||
584
- (
585
- isset( $this->options['custom_post_types_recognized'] ) &&
586
- in_array( $post->post_type, $this->options['custom_post_types_recognized'], true )
587
- )
588
  )
589
  ) {
590
 
79
  $this->version = $version;
80
 
81
  /**
82
+ * Define settings tabs
83
+ */
84
  $this->settings_tabs = apply_filters(
85
+ 'rt_nginx_helper_settings_tabs',
86
+ array(
87
  'general' => array(
88
  'menu_title' => __( 'General', 'nginx-helper' ),
89
  'menu_slug' => 'general',
156
 
157
  wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/nginx-helper-admin.js', array( 'jquery' ), $this->version, false );
158
 
159
+ $do_localize = array(
160
+ 'purge_confirm_string' => esc_html__( 'Purging entire cache is not recommended. Would you like to continue?', 'nginx-helper' ),
161
+ );
162
+ wp_localize_script( $this->plugin_name, 'nginx_helper', $do_localize );
163
+
164
  }
165
 
166
  /**
215
  $link_title = __( 'Purge Current Page', 'nginx-helper' );
216
  }
217
 
218
+ $purge_url = add_query_arg(
219
  array(
220
  'nginx_helper_action' => 'purge',
221
  'nginx_helper_urls' => $nginx_helper_urls,
243
  * @since 2.0.0
244
  */
245
  public function nginx_helper_setting_page() {
246
+ include plugin_dir_path( __FILE__ ) . 'partials/nginx-helper-admin-display.php';
247
  }
248
 
249
  /**
288
  */
289
  public function nginx_helper_settings() {
290
 
291
+ $options = get_site_option(
292
+ 'rt_wp_nginx_helper_options',
293
+ array(
294
+ 'redis_hostname' => '127.0.0.1',
295
+ 'redis_port' => '6379',
296
+ 'redis_prefix' => 'nginx-cache:',
297
+ )
298
+ );
299
 
300
  $data = wp_parse_args(
301
  $options,
409
  ?>
410
  <li role="listitem">
411
  <?php
412
+ printf(
413
+ '<a href="%s" title="%s">%s</a>',
414
+ esc_url( $item->get_permalink() ),
415
+ esc_attr__( 'Posted ', 'nginx-helper' ) . esc_attr( $item->get_date( 'j F Y | g:i a' ) ),
416
+ esc_html( $item->get_title() )
417
+ );
 
418
  ?>
419
  </li>
420
  <?php
421
  }
 
422
  }
423
  ?>
424
  </ul>
432
  */
433
  public function add_timestamps() {
434
 
435
+ global $pagenow;
436
+
437
+ if ( is_admin() || 1 !== (int) $this->options['enable_purge'] || 1 !== (int) $this->options['enable_stamp'] ) {
438
+ return;
439
+ }
440
+
441
+ if ( ! empty( $pagenow ) && 'wp-login.php' === $pagenow ) {
442
  return;
443
  }
444
 
445
  foreach ( headers_list() as $header ) {
446
  list( $key, $value ) = explode( ':', $header, 2 );
447
+ $key = strtolower( $key );
448
  if ( 'content-type' === $key && strpos( trim( $value ), 'text/html' ) !== 0 ) {
449
  return;
450
  }
497
 
498
  $rt_all_blogs = $wpdb->get_results(
499
  $wpdb->prepare(
500
+ 'SELECT blog_id, domain, path FROM ' . $wpdb->blogs . " WHERE site_id = %d AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0'",
501
  $wpdb->siteid
502
  )
503
  );
524
  if ( 1 !== $blog->blog_id ) {
525
  $rt_nginx_map_array[ $blog->path ] = $blog->blog_id;
526
  }
 
527
  }
 
528
  }
 
529
  }
530
 
531
  if ( $rt_domain_map_sites ) {
533
  foreach ( $rt_domain_map_sites as $site ) {
534
  $rt_nginx_map_array[ $site->domain ] = $site->blog_id;
535
  }
 
536
  }
537
 
538
  foreach ( $rt_nginx_map_array as $domain => $domain_id ) {
554
 
555
  $rt_nginx_map = $this->get_map();
556
 
557
+ $fp = fopen( $this->functional_asset_path() . 'map.conf', 'w+' );
558
+ if ( $fp ) {
559
  fwrite( $fp, $rt_nginx_map );
560
  fclose( $fp );
561
  }
 
562
  }
563
 
564
  }
593
  if (
594
  'future' === $new_status && $post && 'future' === $post->post_status &&
595
  (
596
+ ( 'post' === $post->post_type || 'page' === $post->post_type ) ||
597
+ (
598
+ isset( $this->options['custom_post_types_recognized'] ) &&
599
+ in_array( $post->post_type, $this->options['custom_post_types_recognized'], true )
600
+ )
601
  )
602
  ) {
603
 
admin/class-phpredis-purger.php CHANGED
@@ -147,7 +147,6 @@ class PhpRedis_Purger extends Purger {
147
  } else {
148
  $this->log( '- Cache Not Found | ' . $_url_purge_base, 'ERROR' );
149
  }
150
-
151
  } else {
152
 
153
  $status = $this->delete_keys_by_wildcard( $_url_purge_base );
@@ -157,7 +156,6 @@ class PhpRedis_Purger extends Purger {
157
  } else {
158
  $this->log( '- Cache Not Found | ' . $_url_purge_base, 'ERROR' );
159
  }
160
-
161
  }
162
 
163
  $this->log( '* * * * *' );
@@ -171,7 +169,7 @@ class PhpRedis_Purger extends Purger {
171
 
172
  global $nginx_helper_admin;
173
 
174
- $parse = wp_parse_url( site_url() );
175
  $prefix = $nginx_helper_admin->options['redis_prefix'];
176
  $_url_purge_base = $prefix . $parse['scheme'] . 'GET' . $parse['host'];
177
 
@@ -202,7 +200,6 @@ class PhpRedis_Purger extends Purger {
202
  } else {
203
  $this->log( '- Cache Not Found | ' . $purge_url, 'ERROR' );
204
  }
205
-
206
  } else {
207
 
208
  $purge_url = $_url_purge_base . $purge_url;
@@ -213,11 +210,8 @@ class PhpRedis_Purger extends Purger {
213
  } else {
214
  $this->log( '- Cache Not Found | ' . $purge_url, 'ERROR' );
215
  }
216
-
217
  }
218
-
219
  }
220
-
221
  }
222
 
223
  }
147
  } else {
148
  $this->log( '- Cache Not Found | ' . $_url_purge_base, 'ERROR' );
149
  }
 
150
  } else {
151
 
152
  $status = $this->delete_keys_by_wildcard( $_url_purge_base );
156
  } else {
157
  $this->log( '- Cache Not Found | ' . $_url_purge_base, 'ERROR' );
158
  }
 
159
  }
160
 
161
  $this->log( '* * * * *' );
169
 
170
  global $nginx_helper_admin;
171
 
172
+ $parse = wp_parse_url( home_url() );
173
  $prefix = $nginx_helper_admin->options['redis_prefix'];
174
  $_url_purge_base = $prefix . $parse['scheme'] . 'GET' . $parse['host'];
175
 
200
  } else {
201
  $this->log( '- Cache Not Found | ' . $purge_url, 'ERROR' );
202
  }
 
203
  } else {
204
 
205
  $purge_url = $_url_purge_base . $purge_url;
210
  } else {
211
  $this->log( '- Cache Not Found | ' . $purge_url, 'ERROR' );
212
  }
 
213
  }
 
214
  }
 
215
  }
216
 
217
  }
admin/class-predis-purger.php CHANGED
@@ -73,7 +73,7 @@ class Predis_Purger extends Purger {
73
 
74
  } else { // Else purge only site specific cache.
75
 
76
- $parse = wp_parse_url( get_home_url() );
77
  $parse['path'] = empty( $parse['path'] ) ? '/' : $parse['path'];
78
  $this->delete_keys_by_wildcard( $prefix . $parse['scheme'] . 'GET' . $parse['host'] . $parse['path'] . '*' );
79
  $this->log( '* ' . get_home_url() . ' Purged! * ' );
@@ -146,7 +146,6 @@ class Predis_Purger extends Purger {
146
  } else {
147
  $this->log( '- Cache Not Found | ' . $_url_purge_base, 'ERROR' );
148
  }
149
-
150
  } else {
151
 
152
  $status = $this->delete_keys_by_wildcard( $_url_purge_base );
@@ -156,7 +155,6 @@ class Predis_Purger extends Purger {
156
  } else {
157
  $this->log( '- Cache Not Found | ' . $_url_purge_base, 'ERROR' );
158
  }
159
-
160
  }
161
 
162
  }
@@ -168,7 +166,7 @@ class Predis_Purger extends Purger {
168
 
169
  global $nginx_helper_admin;
170
 
171
- $parse = wp_parse_url( site_url() );
172
  $prefix = $nginx_helper_admin->options['redis_prefix'];
173
  $_url_purge_base = $prefix . $parse['scheme'] . 'GET' . $parse['host'];
174
 
@@ -198,7 +196,6 @@ class Predis_Purger extends Purger {
198
  } else {
199
  $this->log( '- Not Found | ' . $purge_url, 'ERROR' );
200
  }
201
-
202
  } else {
203
 
204
  $purge_url = $_url_purge_base . $purge_url;
@@ -209,11 +206,8 @@ class Predis_Purger extends Purger {
209
  } else {
210
  $this->log( '- Not Found | ' . $purge_url, 'ERROR' );
211
  }
212
-
213
  }
214
-
215
  }
216
-
217
  }
218
 
219
  }
73
 
74
  } else { // Else purge only site specific cache.
75
 
76
+ $parse = wp_parse_url( get_home_url() );
77
  $parse['path'] = empty( $parse['path'] ) ? '/' : $parse['path'];
78
  $this->delete_keys_by_wildcard( $prefix . $parse['scheme'] . 'GET' . $parse['host'] . $parse['path'] . '*' );
79
  $this->log( '* ' . get_home_url() . ' Purged! * ' );
146
  } else {
147
  $this->log( '- Cache Not Found | ' . $_url_purge_base, 'ERROR' );
148
  }
 
149
  } else {
150
 
151
  $status = $this->delete_keys_by_wildcard( $_url_purge_base );
155
  } else {
156
  $this->log( '- Cache Not Found | ' . $_url_purge_base, 'ERROR' );
157
  }
 
158
  }
159
 
160
  }
166
 
167
  global $nginx_helper_admin;
168
 
169
+ $parse = wp_parse_url( home_url() );
170
  $prefix = $nginx_helper_admin->options['redis_prefix'];
171
  $_url_purge_base = $prefix . $parse['scheme'] . 'GET' . $parse['host'];
172
 
196
  } else {
197
  $this->log( '- Not Found | ' . $purge_url, 'ERROR' );
198
  }
 
199
  } else {
200
 
201
  $purge_url = $_url_purge_base . $purge_url;
206
  } else {
207
  $this->log( '- Not Found | ' . $purge_url, 'ERROR' );
208
  }
 
209
  }
 
210
  }
 
211
  }
212
 
213
  }
admin/class-purger.php CHANGED
@@ -51,15 +51,15 @@ abstract class Purger {
51
  $oldstatus = '';
52
  $approved = $comment->comment_approved;
53
 
54
- if ( $approved === null ) {
55
  $newstatus = false;
56
- } elseif ( $approved === '1' ) {
57
  $newstatus = 'approved';
58
- } elseif ( $approved === '0' ) {
59
  $newstatus = 'unapproved';
60
- } elseif ( $approved === 'spam' ) {
61
  $newstatus = 'spam';
62
- } elseif ( $approved === 'trash' ) {
63
  $newstatus = 'trash';
64
  } else {
65
  $newstatus = false;
@@ -96,7 +96,7 @@ abstract class Purger {
96
  switch ( $newstatus ) {
97
 
98
  case 'approved':
99
- if ( 1 === (int)$nginx_helper_admin->options['purge_page_on_new_comment'] ) {
100
 
101
  $this->log( '* Comment ( ' . $_comment_id . ' ) approved. Post ( ' . $_post_id . ' ) purging...' );
102
  $this->log( '* * * * *' );
@@ -108,7 +108,7 @@ abstract class Purger {
108
  case 'spam':
109
  case 'unapproved':
110
  case 'trash':
111
- if ( 'approved' === $oldstatus && 1 === (int)$nginx_helper_admin->options['purge_page_on_deleted_comment'] ) {
112
 
113
  $this->log( '* Comment ( ' . $_comment_id . ' ) removed as ( ' . $newstatus . ' ). Post ( ' . $_post_id . ' ) purging...' );
114
  $this->log( '* * * * *' );
@@ -124,9 +124,9 @@ abstract class Purger {
124
  /**
125
  * Purge post cache.
126
  *
127
- * @param int $_ID Post id.
128
  */
129
- public function purge_post( $_ID ) {
130
 
131
  global $nginx_helper_admin, $blog_id;
132
 
@@ -139,16 +139,16 @@ abstract class Purger {
139
  case 'publish_post':
140
  $this->log( '* * * * *' );
141
  $this->log( '* Blog :: ' . addslashes( get_bloginfo( 'name' ) ) . ' ( ' . $blog_id . ' ).' );
142
- $this->log( '* Post :: ' . get_the_title( $_ID ) . ' ( ' . $_ID . ' ).' );
143
- $this->log( '* Post ( ' . $_ID . ' ) published or edited and its status is published' );
144
  $this->log( '* * * * *' );
145
  break;
146
 
147
  case 'publish_page':
148
  $this->log( '* * * * *' );
149
  $this->log( '* Blog :: ' . addslashes( get_bloginfo( 'name' ) ) . ' ( ' . $blog_id . ' ).' );
150
- $this->log( '* Page :: ' . get_the_title( $_ID ) . ' ( ' . $_ID . ' ).' );
151
- $this->log( '* Page ( ' . $_ID . ' ) published or edited and its status is published' );
152
  $this->log( '* * * * *' );
153
  break;
154
 
@@ -157,11 +157,11 @@ abstract class Purger {
157
  break;
158
 
159
  default:
160
- $_post_type = get_post_type( $_ID );
161
  $this->log( '* * * * *' );
162
  $this->log( '* Blog :: ' . addslashes( get_bloginfo( 'name' ) ) . ' ( ' . $blog_id . ' ).' );
163
- $this->log( "* Custom post type '" . $_post_type . "' :: " . get_the_title( $_ID ) . ' ( ' . $_ID . ' ).' );
164
- $this->log( "* CPT '" . $_post_type . "' ( " . $_ID . ' ) published or edited and its status is published' );
165
  $this->log( '* * * * *' );
166
  break;
167
 
@@ -176,13 +176,21 @@ abstract class Purger {
176
  if ( 'comment_post' === current_filter() || 'wp_set_comment_status' === current_filter() ) {
177
 
178
  $this->_purge_by_options(
179
- $_ID, $blog_id, $nginx_helper_admin->options['purge_page_on_new_comment'], $nginx_helper_admin->options['purge_archive_on_new_comment'], $nginx_helper_admin->options['purge_archive_on_new_comment']
 
 
 
 
180
  );
181
 
182
  } else {
183
 
184
  $this->_purge_by_options(
185
- $_ID, $blog_id, $nginx_helper_admin->options['purge_page_on_mod'], $nginx_helper_admin->options['purge_archive_on_edit'], $nginx_helper_admin->options['purge_archive_on_edit']
 
 
 
 
186
  );
187
 
188
  }
@@ -228,7 +236,6 @@ abstract class Purger {
228
  } else {
229
  $url = '';
230
  }
231
-
232
  } else {
233
  $url = get_permalink( $post_id );
234
  }
@@ -275,11 +282,8 @@ abstract class Purger {
275
  if ( $day ) {
276
  $this->purge_url( get_day_link( $year, $month, $day ) );
277
  }
278
-
279
  }
280
-
281
  }
282
-
283
  }
284
 
285
  $categories = wp_get_post_categories( $post_id );
@@ -294,7 +298,6 @@ abstract class Purger {
294
  $this->purge_url( get_category_link( $category_id ) );
295
 
296
  }
297
-
298
  }
299
 
300
  $tags = get_the_tags( $post_id );
@@ -309,7 +312,6 @@ abstract class Purger {
309
  $this->purge_url( get_tag_link( $tag->term_id ) );
310
 
311
  }
312
-
313
  }
314
 
315
  $author_id = get_post( $post_id )->post_author;
@@ -320,7 +322,6 @@ abstract class Purger {
320
  $this->purge_url( get_author_posts_url( $author_id ) );
321
 
322
  }
323
-
324
  }
325
 
326
  if ( $_purge_custom_taxa ) {
@@ -347,9 +348,7 @@ abstract class Purger {
347
  foreach ( $terms as $term ) {
348
  $this->purge_url( get_term_link( $term, $taxon ) );
349
  }
350
-
351
  }
352
-
353
  } else {
354
  $this->log( "Your built-in taxonomy '" . $taxon . "' has param '_builtin' set to false.", 'WARNING' );
355
  }
@@ -480,7 +479,6 @@ abstract class Purger {
480
  $this->log( '- - ' . $url . ' not found ( ' . $response['response']['code'] . ' )', 'WARNING' );
481
 
482
  }
483
-
484
  }
485
 
486
  /**
@@ -539,13 +537,13 @@ abstract class Purger {
539
 
540
  if ( $log_levels[ $level ] >= $log_levels[ $nginx_helper_admin->options['log_level'] ] ) {
541
 
542
- if ( $fp = fopen( $nginx_helper_admin->functional_asset_path() . 'nginx.log', 'a+' ) ) {
 
543
 
544
  fwrite( $fp, "\n" . gmdate( 'Y-m-d H:i:s ' ) . ' | ' . $level . ' | ' . $msg );
545
  fclose( $fp );
546
 
547
  }
548
-
549
  }
550
 
551
  return true;
@@ -565,21 +563,22 @@ abstract class Purger {
565
 
566
  $nginx_asset_path = $nginx_helper_admin->functional_asset_path() . 'nginx.log';
567
 
568
- if ( ! file_exists($nginx_asset_path) ) {
569
  return;
570
  }
571
 
572
  $max_size_allowed = ( is_numeric( $nginx_helper_admin->options['log_filesize'] ) ) ? $nginx_helper_admin->options['log_filesize'] * 1048576 : 5242880;
573
 
574
- $fileSize = filesize( $nginx_asset_path );
575
 
576
- if ( $fileSize > $max_size_allowed ) {
577
 
578
- $offset = $fileSize - $max_size_allowed;
579
  $file_content = file_get_contents( $nginx_asset_path, null, null, $offset );
580
  $file_content = empty( $file_content ) ? '' : strstr( $file_content, "\n" );
581
 
582
- if ( $file_content && $fp = fopen( $nginx_asset_path, 'w+' ) ) {
 
583
 
584
  fwrite( $fp, $file_content );
585
  fclose( $fp );
@@ -594,6 +593,13 @@ abstract class Purger {
594
  */
595
  public function purge_image_on_edit( $attachment_id ) {
596
 
 
 
 
 
 
 
 
597
  $this->log( 'Purging media on edit BEGIN ===' );
598
 
599
  if ( wp_attachment_is_image( $attachment_id ) ) {
@@ -610,9 +616,7 @@ abstract class Purger {
610
  if ( $resize_image ) {
611
  $this->purge_url( $resize_image[0], false );
612
  }
613
-
614
  }
615
-
616
  }
617
 
618
  $this->purge_url( get_attachment_link( $attachment_id ) );
@@ -710,7 +714,6 @@ abstract class Purger {
710
  foreach ( $nginx_helper_admin->options['purgeable_url']['urls'] as $url ) {
711
  $this->purge_url( $url, false );
712
  }
713
-
714
  } else {
715
  $this->log( '- ' . __( 'No personal urls available', 'nginx-helper' ) );
716
  }
@@ -736,11 +739,11 @@ abstract class Purger {
736
 
737
  foreach ( $categories as $category_id ) {
738
 
 
739
  $this->log( sprintf( __( "Purging category '%d'", 'nginx-helper' ), $category_id ) );
740
  $this->purge_url( get_category_link( $category_id ) );
741
 
742
  }
743
-
744
  }
745
 
746
  return true;
@@ -767,7 +770,6 @@ abstract class Purger {
767
  $this->purge_url( get_tag_link( $tag->term_id ) );
768
 
769
  }
770
-
771
  }
772
 
773
  return true;
@@ -796,6 +798,7 @@ abstract class Purger {
796
 
797
  foreach ( $custom_taxonomies as $taxon ) {
798
 
 
799
  $this->log( sprintf( '+ ' . __( "Purging custom taxonomy '%s'", 'nginx-helper' ), $taxon ) );
800
 
801
  if ( ! in_array( $taxon, array( 'category', 'post_tag', 'link_category' ), true ) ) {
@@ -807,14 +810,12 @@ abstract class Purger {
807
  foreach ( $terms as $term ) {
808
  $this->purge_url( get_term_link( $term, $taxon ) );
809
  }
810
-
811
  }
812
-
813
  } else {
 
814
  $this->log( sprintf( '- ' . __( "Your built-in taxonomy '%s' has param '_builtin' set to false.", 'nginx-helper' ), $taxon ), 'WARNING' );
815
  }
816
  }
817
-
818
  } else {
819
  $this->log( '- ' . __( 'No custom taxonomies', 'nginx-helper' ) );
820
  }
@@ -841,7 +842,6 @@ abstract class Purger {
841
  $this->purge_url( get_category_link( $c->term_id ) );
842
 
843
  }
844
-
845
  } else {
846
 
847
  $this->log( __( 'No categories archives', 'nginx-helper' ) );
@@ -870,7 +870,6 @@ abstract class Purger {
870
  $this->purge_url( get_tag_link( $t->term_id ) );
871
 
872
  }
873
-
874
  } else {
875
  $this->log( __( 'No tags archives', 'nginx-helper' ) );
876
  }
@@ -899,6 +898,7 @@ abstract class Purger {
899
 
900
  foreach ( $custom_taxonomies as $taxon ) {
901
 
 
902
  $this->log( sprintf( '+ ' . __( "Purging custom taxonomy '%s'", 'nginx-helper' ), $taxon ) );
903
 
904
  if ( ! in_array( $taxon, array( 'category', 'post_tag', 'link_category' ), true ) ) {
@@ -912,15 +912,12 @@ abstract class Purger {
912
  $this->purge_url( get_term_link( $term, $taxon ) );
913
 
914
  }
915
-
916
  }
917
-
918
  } else {
919
- $this->log( sprintf( '- ' . __( "Your built-in taxonomy '%s' has param '_builtin' set to false.", 'nginx-helper' ), $taxon ), 'WARNING' );
 
920
  }
921
-
922
  }
923
-
924
  } else {
925
  $this->log( '- ' . __( 'No custom taxonomies', 'nginx-helper' ) );
926
  }
@@ -957,7 +954,7 @@ abstract class Purger {
957
  'post_status' => 'publish',
958
  );
959
 
960
- $get_posts = new WP_Query;
961
  $_posts = $get_posts->query( $args );
962
 
963
  if ( ! empty( $_posts ) ) {
@@ -968,7 +965,6 @@ abstract class Purger {
968
  $this->purge_url( get_permalink( $p->ID ) );
969
 
970
  }
971
-
972
  } else {
973
  $this->log( '- ' . __( 'No posts', 'nginx-helper' ) );
974
  }
@@ -1005,11 +1001,15 @@ abstract class Purger {
1005
 
1006
  $_query_daily_archives = $wpdb->prepare(
1007
  "SELECT YEAR(post_date) AS %s, MONTH(post_date) AS %s, DAYOFMONTH(post_date) AS %s, count(ID) as posts
1008
- FROM $wpdb->posts
1009
- WHERE post_type = %s AND post_status = %s
1010
- GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date)
1011
- ORDER BY post_date DESC",
1012
- 'year', 'month', 'dayofmonth', 'post', 'publish'
 
 
 
 
1013
  );
1014
 
1015
  $_daily_archives = $wpdb->get_results( $_query_daily_archives ); // phpcs:ignore
@@ -1020,14 +1020,16 @@ abstract class Purger {
1020
 
1021
  $this->log(
1022
  sprintf(
1023
- '+ ' . __( "Purging daily archive '%1\$s/%2\$s/%3\$s'", 'nginx-helper' ), $_da->year, $_da->month, $_da->dayofmonth
 
 
 
1024
  )
1025
  );
1026
 
1027
  $this->purge_url( get_day_link( $_da->year, $_da->month, $_da->dayofmonth ) );
1028
 
1029
  }
1030
-
1031
  } else {
1032
  $this->log( '- ' . __( 'No daily archives', 'nginx-helper' ) );
1033
  }
@@ -1049,20 +1051,22 @@ abstract class Purger {
1049
 
1050
  $_query_monthly_archives = $wpdb->prepare(
1051
  "SELECT YEAR(post_date) AS %s, MONTH(post_date) AS %s, count(ID) as posts
1052
- FROM $wpdb->posts
1053
- WHERE post_type = %s AND post_status = %s
1054
- GROUP BY YEAR(post_date), MONTH(post_date)
1055
- ORDER BY post_date DESC",
1056
- 'year', 'month', 'post', 'publish'
 
 
 
1057
  );
1058
 
1059
  $_monthly_archives = $wpdb->get_results( $_query_monthly_archives ); // phpcs:ignore
1060
 
1061
- wp_cache_set( 'nginx_helper_monthly_archives', $_monthly_archives, 'nginx_helper', 24*60*60 );
1062
 
1063
  }
1064
 
1065
-
1066
  if ( ! empty( $_monthly_archives ) ) {
1067
 
1068
  foreach ( $_monthly_archives as $_ma ) {
@@ -1071,7 +1075,6 @@ abstract class Purger {
1071
  $this->purge_url( get_month_link( $_ma->year, $_ma->month ) );
1072
 
1073
  }
1074
-
1075
  } else {
1076
  $this->log( '- ' . __( 'No monthly archives', 'nginx-helper' ) );
1077
  }
@@ -1093,16 +1096,18 @@ abstract class Purger {
1093
 
1094
  $_query_yearly_archives = $wpdb->prepare(
1095
  "SELECT YEAR(post_date) AS %s, count(ID) as posts
1096
- FROM $wpdb->posts
1097
- WHERE post_type = %s AND post_status = %s
1098
- GROUP BY YEAR(post_date)
1099
- ORDER BY post_date DESC",
1100
- 'year', 'post', 'publish'
 
 
1101
  );
1102
 
1103
  $_yearly_archives = $wpdb->get_results( $_query_yearly_archives ); // phpcs:ignore
1104
 
1105
- wp_cache_set( 'nginx_helper_yearly_archives', $_yearly_archives, 'nginx_helper', 24*60*60 );
1106
 
1107
  }
1108
 
@@ -1110,11 +1115,11 @@ abstract class Purger {
1110
 
1111
  foreach ( $_yearly_archives as $_ya ) {
1112
 
1113
- $this->log( sprintf( '+ ' . __( "Purging yearly archive '%s'", 'nginx-helper' ), $_ya->year ) );
 
1114
  $this->purge_url( get_year_link( $_ya->year ) );
1115
 
1116
  }
1117
-
1118
  } else {
1119
  $this->log( '- ' . __( 'No yearly archives', 'nginx-helper' ) );
1120
  }
@@ -1151,6 +1156,12 @@ abstract class Purger {
1151
  */
1152
  public function purge_on_term_taxonomy_edited( $term_id, $tt_id, $taxon ) {
1153
 
 
 
 
 
 
 
1154
  $this->log( __( 'Term taxonomy edited or deleted', 'nginx-helper' ) );
1155
 
1156
  $term = get_term( $term_id, $taxon );
@@ -1181,6 +1192,12 @@ abstract class Purger {
1181
  */
1182
  public function purge_on_check_ajax_referer( $action ) {
1183
 
 
 
 
 
 
 
1184
  switch ( $action ) {
1185
 
1186
  case 'save-sidebar-widgets':
@@ -1202,38 +1219,40 @@ abstract class Purger {
1202
  * Source - http://stackoverflow.com/a/1360437/156336
1203
  *
1204
  * @param string $dir Directory.
1205
- * @param bool $deleteRootToo Delete root or not.
 
 
1206
  */
1207
- public function unlink_recursive( $dir, $deleteRootToo ) {
1208
 
1209
  if ( ! is_dir( $dir ) ) {
1210
  return;
1211
  }
1212
 
1213
- if ( ! $dh = opendir( $dir ) ) {
 
 
1214
  return;
1215
  }
1216
 
1217
- while ( false !== ( $obj = readdir( $dh ) ) ) {
 
 
1218
 
1219
- if ( $obj == '.' || $obj == '..' ) {
1220
  continue;
1221
  }
1222
 
1223
- if ( ! @unlink( $dir . '/' . $obj ) ) {
1224
  $this->unlink_recursive( $dir . '/' . $obj, false );
1225
  }
1226
-
1227
  }
1228
 
1229
- if ( $deleteRootToo ) {
1230
  rmdir( $dir );
1231
  }
1232
 
1233
  closedir( $dh );
1234
-
1235
- return;
1236
-
1237
  }
1238
 
1239
  }
51
  $oldstatus = '';
52
  $approved = $comment->comment_approved;
53
 
54
+ if ( null === $approved ) {
55
  $newstatus = false;
56
+ } elseif ( '1' === $approved ) {
57
  $newstatus = 'approved';
58
+ } elseif ( '0' === $approved ) {
59
  $newstatus = 'unapproved';
60
+ } elseif ( 'spam' === $approved ) {
61
  $newstatus = 'spam';
62
+ } elseif ( 'trash' === $approved ) {
63
  $newstatus = 'trash';
64
  } else {
65
  $newstatus = false;
96
  switch ( $newstatus ) {
97
 
98
  case 'approved':
99
+ if ( 1 === (int) $nginx_helper_admin->options['purge_page_on_new_comment'] ) {
100
 
101
  $this->log( '* Comment ( ' . $_comment_id . ' ) approved. Post ( ' . $_post_id . ' ) purging...' );
102
  $this->log( '* * * * *' );
108
  case 'spam':
109
  case 'unapproved':
110
  case 'trash':
111
+ if ( 'approved' === $oldstatus && 1 === (int) $nginx_helper_admin->options['purge_page_on_deleted_comment'] ) {
112
 
113
  $this->log( '* Comment ( ' . $_comment_id . ' ) removed as ( ' . $newstatus . ' ). Post ( ' . $_post_id . ' ) purging...' );
114
  $this->log( '* * * * *' );
124
  /**
125
  * Purge post cache.
126
  *
127
+ * @param int $post_id Post id.
128
  */
129
+ public function purge_post( $post_id ) {
130
 
131
  global $nginx_helper_admin, $blog_id;
132
 
139
  case 'publish_post':
140
  $this->log( '* * * * *' );
141
  $this->log( '* Blog :: ' . addslashes( get_bloginfo( 'name' ) ) . ' ( ' . $blog_id . ' ).' );
142
+ $this->log( '* Post :: ' . get_the_title( $post_id ) . ' ( ' . $post_id . ' ).' );
143
+ $this->log( '* Post ( ' . $post_id . ' ) published or edited and its status is published' );
144
  $this->log( '* * * * *' );
145
  break;
146
 
147
  case 'publish_page':
148
  $this->log( '* * * * *' );
149
  $this->log( '* Blog :: ' . addslashes( get_bloginfo( 'name' ) ) . ' ( ' . $blog_id . ' ).' );
150
+ $this->log( '* Page :: ' . get_the_title( $post_id ) . ' ( ' . $post_id . ' ).' );
151
+ $this->log( '* Page ( ' . $post_id . ' ) published or edited and its status is published' );
152
  $this->log( '* * * * *' );
153
  break;
154
 
157
  break;
158
 
159
  default:
160
+ $_post_type = get_post_type( $post_id );
161
  $this->log( '* * * * *' );
162
  $this->log( '* Blog :: ' . addslashes( get_bloginfo( 'name' ) ) . ' ( ' . $blog_id . ' ).' );
163
+ $this->log( "* Custom post type '" . $_post_type . "' :: " . get_the_title( $post_id ) . ' ( ' . $post_id . ' ).' );
164
+ $this->log( "* CPT '" . $_post_type . "' ( " . $post_id . ' ) published or edited and its status is published' );
165
  $this->log( '* * * * *' );
166
  break;
167
 
176
  if ( 'comment_post' === current_filter() || 'wp_set_comment_status' === current_filter() ) {
177
 
178
  $this->_purge_by_options(
179
+ $post_id,
180
+ $blog_id,
181
+ $nginx_helper_admin->options['purge_page_on_new_comment'],
182
+ $nginx_helper_admin->options['purge_archive_on_new_comment'],
183
+ $nginx_helper_admin->options['purge_archive_on_new_comment']
184
  );
185
 
186
  } else {
187
 
188
  $this->_purge_by_options(
189
+ $post_id,
190
+ $blog_id,
191
+ $nginx_helper_admin->options['purge_page_on_mod'],
192
+ $nginx_helper_admin->options['purge_archive_on_edit'],
193
+ $nginx_helper_admin->options['purge_archive_on_edit']
194
  );
195
 
196
  }
236
  } else {
237
  $url = '';
238
  }
 
239
  } else {
240
  $url = get_permalink( $post_id );
241
  }
282
  if ( $day ) {
283
  $this->purge_url( get_day_link( $year, $month, $day ) );
284
  }
 
285
  }
 
286
  }
 
287
  }
288
 
289
  $categories = wp_get_post_categories( $post_id );
298
  $this->purge_url( get_category_link( $category_id ) );
299
 
300
  }
 
301
  }
302
 
303
  $tags = get_the_tags( $post_id );
312
  $this->purge_url( get_tag_link( $tag->term_id ) );
313
 
314
  }
 
315
  }
316
 
317
  $author_id = get_post( $post_id )->post_author;
322
  $this->purge_url( get_author_posts_url( $author_id ) );
323
 
324
  }
 
325
  }
326
 
327
  if ( $_purge_custom_taxa ) {
348
  foreach ( $terms as $term ) {
349
  $this->purge_url( get_term_link( $term, $taxon ) );
350
  }
 
351
  }
 
352
  } else {
353
  $this->log( "Your built-in taxonomy '" . $taxon . "' has param '_builtin' set to false.", 'WARNING' );
354
  }
479
  $this->log( '- - ' . $url . ' not found ( ' . $response['response']['code'] . ' )', 'WARNING' );
480
 
481
  }
 
482
  }
483
 
484
  /**
537
 
538
  if ( $log_levels[ $level ] >= $log_levels[ $nginx_helper_admin->options['log_level'] ] ) {
539
 
540
+ $fp = fopen( $nginx_helper_admin->functional_asset_path() . 'nginx.log', 'a+' );
541
+ if ( $fp ) {
542
 
543
  fwrite( $fp, "\n" . gmdate( 'Y-m-d H:i:s ' ) . ' | ' . $level . ' | ' . $msg );
544
  fclose( $fp );
545
 
546
  }
 
547
  }
548
 
549
  return true;
563
 
564
  $nginx_asset_path = $nginx_helper_admin->functional_asset_path() . 'nginx.log';
565
 
566
+ if ( ! file_exists( $nginx_asset_path ) ) {
567
  return;
568
  }
569
 
570
  $max_size_allowed = ( is_numeric( $nginx_helper_admin->options['log_filesize'] ) ) ? $nginx_helper_admin->options['log_filesize'] * 1048576 : 5242880;
571
 
572
+ $file_size = filesize( $nginx_asset_path );
573
 
574
+ if ( $file_size > $max_size_allowed ) {
575
 
576
+ $offset = $file_size - $max_size_allowed;
577
  $file_content = file_get_contents( $nginx_asset_path, null, null, $offset );
578
  $file_content = empty( $file_content ) ? '' : strstr( $file_content, "\n" );
579
 
580
+ $fp = fopen( $nginx_asset_path, 'w+' );
581
+ if ( $file_content && $fp ) {
582
 
583
  fwrite( $fp, $file_content );
584
  fclose( $fp );
593
  */
594
  public function purge_image_on_edit( $attachment_id ) {
595
 
596
+ global $nginx_helper_admin;
597
+
598
+ // Do not purge if not enabled.
599
+ if ( ! $nginx_helper_admin->options['enable_purge'] ) {
600
+ return;
601
+ }
602
+
603
  $this->log( 'Purging media on edit BEGIN ===' );
604
 
605
  if ( wp_attachment_is_image( $attachment_id ) ) {
616
  if ( $resize_image ) {
617
  $this->purge_url( $resize_image[0], false );
618
  }
 
619
  }
 
620
  }
621
 
622
  $this->purge_url( get_attachment_link( $attachment_id ) );
714
  foreach ( $nginx_helper_admin->options['purgeable_url']['urls'] as $url ) {
715
  $this->purge_url( $url, false );
716
  }
 
717
  } else {
718
  $this->log( '- ' . __( 'No personal urls available', 'nginx-helper' ) );
719
  }
739
 
740
  foreach ( $categories as $category_id ) {
741
 
742
+ // translators: %d: Category ID.
743
  $this->log( sprintf( __( "Purging category '%d'", 'nginx-helper' ), $category_id ) );
744
  $this->purge_url( get_category_link( $category_id ) );
745
 
746
  }
 
747
  }
748
 
749
  return true;
770
  $this->purge_url( get_tag_link( $tag->term_id ) );
771
 
772
  }
 
773
  }
774
 
775
  return true;
798
 
799
  foreach ( $custom_taxonomies as $taxon ) {
800
 
801
+ // translators: %s: Post taxonomy name.
802
  $this->log( sprintf( '+ ' . __( "Purging custom taxonomy '%s'", 'nginx-helper' ), $taxon ) );
803
 
804
  if ( ! in_array( $taxon, array( 'category', 'post_tag', 'link_category' ), true ) ) {
810
  foreach ( $terms as $term ) {
811
  $this->purge_url( get_term_link( $term, $taxon ) );
812
  }
 
813
  }
 
814
  } else {
815
+ // translators: %s: Post taxonomy name.
816
  $this->log( sprintf( '- ' . __( "Your built-in taxonomy '%s' has param '_builtin' set to false.", 'nginx-helper' ), $taxon ), 'WARNING' );
817
  }
818
  }
 
819
  } else {
820
  $this->log( '- ' . __( 'No custom taxonomies', 'nginx-helper' ) );
821
  }
842
  $this->purge_url( get_category_link( $c->term_id ) );
843
 
844
  }
 
845
  } else {
846
 
847
  $this->log( __( 'No categories archives', 'nginx-helper' ) );
870
  $this->purge_url( get_tag_link( $t->term_id ) );
871
 
872
  }
 
873
  } else {
874
  $this->log( __( 'No tags archives', 'nginx-helper' ) );
875
  }
898
 
899
  foreach ( $custom_taxonomies as $taxon ) {
900
 
901
+ // translators: %s: Taxonomy name.
902
  $this->log( sprintf( '+ ' . __( "Purging custom taxonomy '%s'", 'nginx-helper' ), $taxon ) );
903
 
904
  if ( ! in_array( $taxon, array( 'category', 'post_tag', 'link_category' ), true ) ) {
912
  $this->purge_url( get_term_link( $term, $taxon ) );
913
 
914
  }
 
915
  }
 
916
  } else {
917
+ // translators: %s: Taxonomy name.
918
+ $this->log( sprintf( '- ' . esc_html__( "Your built-in taxonomy '%s' has param '_builtin' set to false.", 'nginx-helper' ), $taxon ), 'WARNING' );
919
  }
 
920
  }
 
921
  } else {
922
  $this->log( '- ' . __( 'No custom taxonomies', 'nginx-helper' ) );
923
  }
954
  'post_status' => 'publish',
955
  );
956
 
957
+ $get_posts = new WP_Query();
958
  $_posts = $get_posts->query( $args );
959
 
960
  if ( ! empty( $_posts ) ) {
965
  $this->purge_url( get_permalink( $p->ID ) );
966
 
967
  }
 
968
  } else {
969
  $this->log( '- ' . __( 'No posts', 'nginx-helper' ) );
970
  }
1001
 
1002
  $_query_daily_archives = $wpdb->prepare(
1003
  "SELECT YEAR(post_date) AS %s, MONTH(post_date) AS %s, DAYOFMONTH(post_date) AS %s, count(ID) as posts
1004
+ FROM $wpdb->posts
1005
+ WHERE post_type = %s AND post_status = %s
1006
+ GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date)
1007
+ ORDER BY post_date DESC",
1008
+ 'year',
1009
+ 'month',
1010
+ 'dayofmonth',
1011
+ 'post',
1012
+ 'publish'
1013
  );
1014
 
1015
  $_daily_archives = $wpdb->get_results( $_query_daily_archives ); // phpcs:ignore
1020
 
1021
  $this->log(
1022
  sprintf(
1023
+ '+ ' . __( "Purging daily archive '%1\$s/%2\$s/%3\$s'", 'nginx-helper' ),
1024
+ $_da->year,
1025
+ $_da->month,
1026
+ $_da->dayofmonth
1027
  )
1028
  );
1029
 
1030
  $this->purge_url( get_day_link( $_da->year, $_da->month, $_da->dayofmonth ) );
1031
 
1032
  }
 
1033
  } else {
1034
  $this->log( '- ' . __( 'No daily archives', 'nginx-helper' ) );
1035
  }
1051
 
1052
  $_query_monthly_archives = $wpdb->prepare(
1053
  "SELECT YEAR(post_date) AS %s, MONTH(post_date) AS %s, count(ID) as posts
1054
+ FROM $wpdb->posts
1055
+ WHERE post_type = %s AND post_status = %s
1056
+ GROUP BY YEAR(post_date), MONTH(post_date)
1057
+ ORDER BY post_date DESC",
1058
+ 'year',
1059
+ 'month',
1060
+ 'post',
1061
+ 'publish'
1062
  );
1063
 
1064
  $_monthly_archives = $wpdb->get_results( $_query_monthly_archives ); // phpcs:ignore
1065
 
1066
+ wp_cache_set( 'nginx_helper_monthly_archives', $_monthly_archives, 'nginx_helper', 24 * 60 * 60 );
1067
 
1068
  }
1069
 
 
1070
  if ( ! empty( $_monthly_archives ) ) {
1071
 
1072
  foreach ( $_monthly_archives as $_ma ) {
1075
  $this->purge_url( get_month_link( $_ma->year, $_ma->month ) );
1076
 
1077
  }
 
1078
  } else {
1079
  $this->log( '- ' . __( 'No monthly archives', 'nginx-helper' ) );
1080
  }
1096
 
1097
  $_query_yearly_archives = $wpdb->prepare(
1098
  "SELECT YEAR(post_date) AS %s, count(ID) as posts
1099
+ FROM $wpdb->posts
1100
+ WHERE post_type = %s AND post_status = %s
1101
+ GROUP BY YEAR(post_date)
1102
+ ORDER BY post_date DESC",
1103
+ 'year',
1104
+ 'post',
1105
+ 'publish'
1106
  );
1107
 
1108
  $_yearly_archives = $wpdb->get_results( $_query_yearly_archives ); // phpcs:ignore
1109
 
1110
+ wp_cache_set( 'nginx_helper_yearly_archives', $_yearly_archives, 'nginx_helper', 24 * 60 * 60 );
1111
 
1112
  }
1113
 
1115
 
1116
  foreach ( $_yearly_archives as $_ya ) {
1117
 
1118
+ // translators: %s: Year to purge cache.
1119
+ $this->log( sprintf( '+ ' . esc_html__( "Purging yearly archive '%s'", 'nginx-helper' ), $_ya->year ) );
1120
  $this->purge_url( get_year_link( $_ya->year ) );
1121
 
1122
  }
 
1123
  } else {
1124
  $this->log( '- ' . __( 'No yearly archives', 'nginx-helper' ) );
1125
  }
1156
  */
1157
  public function purge_on_term_taxonomy_edited( $term_id, $tt_id, $taxon ) {
1158
 
1159
+ global $nginx_helper_admin;
1160
+
1161
+ if ( ! $nginx_helper_admin->options['enable_purge'] ) {
1162
+ return;
1163
+ }
1164
+
1165
  $this->log( __( 'Term taxonomy edited or deleted', 'nginx-helper' ) );
1166
 
1167
  $term = get_term( $term_id, $taxon );
1192
  */
1193
  public function purge_on_check_ajax_referer( $action ) {
1194
 
1195
+ global $nginx_helper_admin;
1196
+
1197
+ if ( ! $nginx_helper_admin->options['enable_purge'] ) {
1198
+ return;
1199
+ }
1200
+
1201
  switch ( $action ) {
1202
 
1203
  case 'save-sidebar-widgets':
1219
  * Source - http://stackoverflow.com/a/1360437/156336
1220
  *
1221
  * @param string $dir Directory.
1222
+ * @param bool $delete_root_too Delete root or not.
1223
+ *
1224
+ * @return void
1225
  */
1226
+ public function unlink_recursive( $dir, $delete_root_too ) {
1227
 
1228
  if ( ! is_dir( $dir ) ) {
1229
  return;
1230
  }
1231
 
1232
+ $dh = opendir( $dir );
1233
+
1234
+ if ( ! $dh ) {
1235
  return;
1236
  }
1237
 
1238
+ $obj = readdir( $dh );
1239
+
1240
+ while ( false !== $obj ) {
1241
 
1242
+ if ( '.' === $obj || '..' === $obj ) {
1243
  continue;
1244
  }
1245
 
1246
+ if ( ! @unlink( $dir . '/' . $obj ) ) { // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
1247
  $this->unlink_recursive( $dir . '/' . $obj, false );
1248
  }
 
1249
  }
1250
 
1251
+ if ( $delete_root_too ) {
1252
  rmdir( $dir );
1253
  }
1254
 
1255
  closedir( $dh );
 
 
 
1256
  }
1257
 
1258
  }
admin/css/nginx-helper-admin.css CHANGED
@@ -4,101 +4,97 @@
4
  */
5
 
6
  .clearfix {
7
- *zoom: 1;
8
  }
9
  .clearfix:before,
10
  .clearfix:after {
11
- content: " ";
12
- display: table;
13
  }
14
  .clearfix:after {
15
- clear: both;
16
  }
17
  h4 {
18
- margin: 0;
19
  }
20
  .form-table th,
21
  .form-wrap label {
22
- vertical-align: middle;
23
  }
24
  table.rtnginx-table {
25
- border-bottom: 1px solid #EEE;
26
  }
27
  table.rtnginx-table:last-child {
28
- border-bottom: 0;
29
  }
30
  .rtnginx-table p.error {
31
- color: red;
32
  }
33
  pre#map {
34
- background: #e5e5e5 none;
35
- border-radius: 10px;
36
- padding: 10px;
37
  }
38
  .wrap h2.rt_option_title {
39
- background: url(../icons/nginx-icon-32x32.png) 0 6px no-repeat rgba(0, 0, 0, 0);
40
- padding-left: 40px;
41
  }
42
  #poststuff h2 {
43
- padding: 0 0 0 10px;
44
- margin-top: 0;
45
  }
46
  form#purgeall .button-primary {
47
- margin-bottom: 20px;
48
- box-shadow: inset 0 -2px rgba(0, 0, 0, 0.14);
49
- padding: 15px 30px;
50
- font-size: 1rem;
51
- border: 0;
52
- border-radius: 5px;
53
- color: #FFF;
54
- background: #DD3D36;
55
- height: auto;
56
  }
57
  form#purgeall .button-primary:hover,
58
  form#purgeall .button-primary:focus {
59
- background: #d52c24;
60
  }
61
  .nh-aligncenter {
62
- display: block;
63
- text-align: center;
64
- line-height: 2;
65
  }
66
  #latest_news .inside ul,
67
  #useful-links .inside ul {
68
- margin: 0 0 0 12px;
69
  }
70
  #latest_news .inside ul li,
71
  #useful-links .inside ul li {
72
- list-style: square;
73
- padding: 0 0 7px;
74
  }
75
  #social .inside a {
76
- background-color: #666;
77
- color: #FFF;
78
- display: inline-block;
79
- height: 30px;
80
- font-size: 1.25rem;
81
- line-height: 30px;
82
- margin: 10px 20px 0 0;
83
- overflow: hidden;
84
- padding: 0;
85
- text-align: center;
86
- text-decoration: none;
87
- width: 30px;
88
- -webkit-border-radius: 1000px;
89
- -moz-border-radius: 1000px;
90
- border-radius: 1000px;
91
- }
92
- #social .inside .nginx-helper-rss:hover {
93
- background-color: #FAA33D;
94
  }
 
95
  #social .inside .nginx-helper-facebook:hover {
96
- background-color: #537BBD;
97
  }
98
  #social .inside .nginx-helper-twitter:hover {
99
- background-color: #40BFF5;
100
- }
101
- #social .inside .nginx-helper-gplus:hover {
102
- background-color: #DD4B39;
103
  }
104
- .rt-purge_url { width: 100%; }
 
4
  */
5
 
6
  .clearfix {
7
+ *zoom: 1;
8
  }
9
  .clearfix:before,
10
  .clearfix:after {
11
+ content: " ";
12
+ display: table;
13
  }
14
  .clearfix:after {
15
+ clear: both;
16
  }
17
  h4 {
18
+ margin: 0;
19
  }
20
  .form-table th,
21
  .form-wrap label {
22
+ vertical-align: middle;
23
  }
24
  table.rtnginx-table {
25
+ border-bottom: 1px solid #EEE;
26
  }
27
  table.rtnginx-table:last-child {
28
+ border-bottom: 0;
29
  }
30
  .rtnginx-table p.error {
31
+ color: red;
32
  }
33
  pre#map {
34
+ background: #e5e5e5 none;
35
+ border-radius: 10px;
36
+ padding: 10px;
37
  }
38
  .wrap h2.rt_option_title {
39
+ background: url(../icons/nginx-icon-32x32.png) 0 6px no-repeat rgba(0, 0, 0, 0);
40
+ padding-left: 40px;
41
  }
42
  #poststuff h2 {
43
+ padding: 0 0 0 10px;
44
+ margin-top: 0;
45
  }
46
  form#purgeall .button-primary {
47
+ margin-bottom: 20px;
48
+ box-shadow: inset 0 -2px rgba(0, 0, 0, 0.14);
49
+ padding: 15px 30px;
50
+ font-size: 1rem;
51
+ border: 0;
52
+ border-radius: 5px;
53
+ color: #FFF;
54
+ background: #DD3D36;
55
+ height: auto;
56
  }
57
  form#purgeall .button-primary:hover,
58
  form#purgeall .button-primary:focus {
59
+ background: #d52c24;
60
  }
61
  .nh-aligncenter {
62
+ display: block;
63
+ text-align: center;
64
+ line-height: 2;
65
  }
66
  #latest_news .inside ul,
67
  #useful-links .inside ul {
68
+ margin: 0 0 0 12px;
69
  }
70
  #latest_news .inside ul li,
71
  #useful-links .inside ul li {
72
+ list-style: square;
73
+ padding: 0 0 7px;
74
  }
75
  #social .inside a {
76
+ background-color: #666;
77
+ color: #FFF;
78
+ display: inline-block;
79
+ height: 30px;
80
+ font-size: 1.25rem;
81
+ line-height: 30px;
82
+ margin: 10px 20px 0 0;
83
+ overflow: hidden;
84
+ padding: 0;
85
+ text-align: center;
86
+ text-decoration: none;
87
+ width: 30px;
88
+ -webkit-border-radius: 1000px;
89
+ -moz-border-radius: 1000px;
90
+ border-radius: 1000px;
 
 
 
91
  }
92
+
93
  #social .inside .nginx-helper-facebook:hover {
94
+ background-color: #537BBD;
95
  }
96
  #social .inside .nginx-helper-twitter:hover {
97
+ background-color: #40BFF5;
 
 
 
98
  }
99
+
100
+ .rt-purge_url { width: 100%; }
admin/icons/css/nginx-fontello.css CHANGED
@@ -1,56 +1,54 @@
1
  @font-face {
2
- font-family: 'nginx-fontello';
3
- src: url('../font/nginx-fontello.eot?7388141');
4
- src: url('../font/nginx-fontello.eot?7388141#iefix') format('embedded-opentype'),
5
- url('../font/nginx-fontello.woff?7388141') format('woff'),
6
- url('../font/nginx-fontello.ttf?7388141') format('truetype'),
7
- url('../font/nginx-fontello.svg?7388141#nginx-fontello') format('svg');
8
- font-weight: normal;
9
- font-style: normal;
10
  }
11
  /* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
12
  /* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
13
- /*
14
  @media screen and (-webkit-min-device-pixel-ratio:0) {
15
- @font-face {
16
- font-family: 'nginx-fontello';
17
- src: url('../font/nginx-fontello.svg?7388141#nginx-fontello') format('svg');
18
- }
19
  }
20
  */
21
-
22
- [class^="nginx-helper-"]:before, [class*=" nginx-helper-"]:before {
23
- font-family: "nginx-fontello";
24
- font-style: normal;
25
- font-weight: normal;
26
- speak: none;
27
-
28
- display: inline-block;
29
- text-decoration: inherit;
30
- width: 1em;
31
- margin-right: .2em;
32
- text-align: center;
33
- /* opacity: .8; */
34
-
35
- /* For safety - reset parent styles, that can break glyph codes*/
36
- font-variant: normal;
37
- text-transform: none;
38
-
39
- /* fix buttons height, for twitter bootstrap */
40
- line-height: 1em;
41
-
42
- /* Animation center compensation - margins should be symmetric */
43
- /* remove if not needed */
44
- margin-left: .2em;
45
-
46
- /* you can be more comfortable with increased icons size */
47
- /* font-size: 120%; */
48
-
49
- /* Uncomment for 3D effect */
50
- /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
51
  }
52
-
53
- .nginx-helper-rss:before { content: '\e803'; } /* '' */
54
  .nginx-helper-twitter:before { content: '\e802'; } /* '' */
55
  .nginx-helper-facebook:before { content: '\e801'; } /* '' */
56
- .nginx-helper-gplus:before { content: '\e800'; } /* '' */
1
  @font-face {
2
+ font-family: 'nginx-fontello';
3
+ src: url('../font/nginx-fontello.eot?7388141');
4
+ src: url('../font/nginx-fontello.eot?7388141#iefix') format('embedded-opentype'),
5
+ url('../font/nginx-fontello.woff?7388141') format('woff'),
6
+ url('../font/nginx-fontello.ttf?7388141') format('truetype'),
7
+ url('../font/nginx-fontello.svg?7388141#nginx-fontello') format('svg');
8
+ font-weight: normal;
9
+ font-style: normal;
10
  }
11
  /* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
12
  /* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
13
+ /* // phpcs:ignore Squiz.PHP.CommentedOutCode.Found
14
  @media screen and (-webkit-min-device-pixel-ratio:0) {
15
+ @font-face {
16
+ font-family: 'nginx-fontello';
17
+ src: url('../font/nginx-fontello.svg?7388141#nginx-fontello') format('svg');
18
+ }
19
  }
20
  */
21
+
22
+ [class^="nginx-helper-"]:before, [class*=" nginx-helper-"]:before {
23
+ font-family: "nginx-fontello";
24
+ font-style: normal;
25
+ font-weight: normal;
26
+ speak: none;
27
+
28
+ display: inline-block;
29
+ text-decoration: inherit;
30
+ width: 1em;
31
+ margin-right: .2em;
32
+ text-align: center;
33
+ /* opacity: .8; */
34
+
35
+ /* For safety - reset parent styles, that can break glyph codes*/
36
+ font-variant: normal;
37
+ text-transform: none;
38
+
39
+ /* fix buttons height, for twitter bootstrap */
40
+ line-height: 1em;
41
+
42
+ /* Animation center compensation - margins should be symmetric */
43
+ /* remove if not needed */
44
+ margin-left: .2em;
45
+
46
+ /* you can be more comfortable with increased icons size */
47
+ /* font-size: 120%; */
48
+
49
+ /* Uncomment for 3D effect */
50
+ /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
51
  }
52
+
 
53
  .nginx-helper-twitter:before { content: '\e802'; } /* '' */
54
  .nginx-helper-facebook:before { content: '\e801'; } /* '' */
 
admin/js/nginx-helper-admin.js CHANGED
@@ -1,92 +1,117 @@
 
 
 
 
 
 
1
  (function ($) {
2
- 'use strict';
3
-
4
- /**
5
- * All of the code for your admin-specific JavaScript source
6
- * should reside in this file.
7
- *
8
- * Note that this assume you're going to use jQuery, so it prepares
9
- * the $ function reference to be used within the scope of this
10
- * function.
11
- *
12
- * From here, you're able to define handlers for when the DOM is
13
- * ready:
14
- *
15
- * $(function() {
16
- *
17
- * });
18
- *
19
- * Or when the window is loaded:
20
- *
21
- * $( window ).load(function() {
22
- *
23
- * });
24
- *
25
- * ...and so on.
26
- *
27
- * Remember that ideally, we should not attach any more than a single DOM-ready or window-load handler
28
- * for any particular page. Though other scripts in WordPress core, other plugins, and other themes may
29
- * be doing this, we should try to minimize doing that in our own work.
30
- */
31
- $(function () {
32
-
33
- var news_section = jQuery( '#latest_news' );
34
-
35
- if ( news_section.length > 0 ) {
36
-
37
- var args = {
38
- 'action': 'rt_get_feeds'
39
- };
40
-
41
- jQuery.get( ajaxurl, args, function (data) {
42
- news_section.find( '.inside' ).html( data );
43
- console.log(data);
44
- });
45
-
46
- }
47
-
48
- jQuery( "form#purgeall a" ).click( function (e) {
49
-
50
- if ( confirm( "Purging entire cache is not recommended. Would you like to continue ?" ) == true ) {
51
- // continue submitting form
52
- } else {
53
- e.preventDefault();
54
- }
55
-
56
- });
57
-
58
- /**
59
- * Show OR Hide options on option checkbox
60
- * @param {type} selector Selector of Checkbox and PostBox
61
- */
62
- function nginx_show_option( selector ) {
63
-
64
- jQuery( '#' + selector ).on( 'change', function () {
65
-
66
- if ( jQuery( this ).is( ':checked' ) ) {
67
-
68
- jQuery( '.' + selector ).show();
69
-
70
- if ( selector == "cache_method_redis" ) {
71
- jQuery( '.cache_method_fastcgi' ).hide();
72
- } else if ( selector == "cache_method_fastcgi" ) {
73
- jQuery( '.cache_method_redis' ).hide();
74
- }
75
-
76
- } else {
77
- jQuery( '.' + selector ).hide();
78
- }
79
-
80
- });
81
-
82
- }
83
-
84
- /* Function call with parameter */
85
- nginx_show_option( 'cache_method_fastcgi' );
86
- nginx_show_option( 'cache_method_redis' );
87
- nginx_show_option( 'enable_map' );
88
- nginx_show_option( 'enable_log' );
89
- nginx_show_option( 'enable_purge' );
90
-
91
- });
92
- })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * File to add JavaScript for nginx-helper.
3
+ *
4
+ * @package nginx-helper
5
+ */
6
+
7
  (function ($) {
8
+ 'use strict';
9
+
10
+ /**
11
+ * All of the code for your admin-specific JavaScript source
12
+ * should reside in this file.
13
+ *
14
+ * Note that this assume you're going to use jQuery, so it prepares
15
+ * the $ function reference to be used within the scope of this
16
+ * function.
17
+ *
18
+ * From here, you're able to define handlers for when the DOM is
19
+ * ready:
20
+ *
21
+ * $(function() {
22
+ *
23
+ * });
24
+ *
25
+ * Or when the window is loaded:
26
+ *
27
+ * $( window ).load(function() {
28
+ *
29
+ * });
30
+ *
31
+ * ...and so on.
32
+ *
33
+ * Remember that ideally, we should not attach any more than a single DOM-ready or window-load handler
34
+ * for any particular page. Though other scripts in WordPress core, other plugins, and other themes may
35
+ * be doing this, we should try to minimize doing that in our own work.
36
+ */
37
+ $(
38
+ function () {
39
+
40
+ var news_section = jQuery( '#latest_news' );
41
+
42
+ if ( news_section.length > 0 ) {
43
+
44
+ var args = {
45
+ 'action': 'rt_get_feeds'
46
+ };
47
+
48
+ jQuery.get(
49
+ ajaxurl,
50
+ args,
51
+ function( data ) {
52
+ /**
53
+ * Received markup is safe and escaped appropriately.
54
+ *
55
+ * File: admin/class-nginx-helper-admin.php
56
+ * Method: nginx_helper_get_feeds();
57
+ */
58
+
59
+ // phpcs:ignore -- WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
60
+ news_section.find( '.inside' ).empty().append( data );
61
+ }
62
+ );
63
+
64
+ }
65
+
66
+ jQuery( "form#purgeall a" ).click(
67
+ function (e) {
68
+
69
+ if ( confirm( nginx_helper.purge_confirm_string ) === true ) {
70
+ // Continue submitting form.
71
+ } else {
72
+ e.preventDefault();
73
+ }
74
+
75
+ }
76
+ );
77
+
78
+ /**
79
+ * Show OR Hide options on option checkbox
80
+ *
81
+ * @param {type} selector Selector of Checkbox and PostBox
82
+ */
83
+ function nginx_show_option( selector ) {
84
+
85
+ jQuery( '#' + selector ).on(
86
+ 'change',
87
+ function () {
88
+
89
+ if ( jQuery( this ).is( ':checked' ) ) {
90
+
91
+ jQuery( '.' + selector ).show();
92
+
93
+ if ( 'cache_method_redis' === selector ) {
94
+ jQuery( '.cache_method_fastcgi' ).hide();
95
+ } else if ( selector === 'cache_method_fastcgi' ) {
96
+ jQuery( '.cache_method_redis' ).hide();
97
+ }
98
+
99
+ } else {
100
+ jQuery( '.' + selector ).hide();
101
+ }
102
+
103
+ }
104
+ );
105
+
106
+ }
107
+
108
+ /* Function call with parameter */
109
+ nginx_show_option( 'cache_method_fastcgi' );
110
+ nginx_show_option( 'cache_method_redis' );
111
+ nginx_show_option( 'enable_map' );
112
+ nginx_show_option( 'enable_log' );
113
+ nginx_show_option( 'enable_purge' );
114
+
115
+ }
116
+ );
117
+ })( jQuery );
admin/partials/nginx-helper-admin-display.php CHANGED
@@ -25,19 +25,18 @@ global $pagenow;
25
  <div id="post-body-content">
26
  <?php
27
  /* Show settinhs tabs */
28
- $current_tab = filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_STRING );
29
  $current_setting_tab = ( ! empty( $current_tab ) ) ? $current_tab : 'general';
30
 
31
  echo '<h2 class="nav-tab-wrapper">';
32
  foreach ( $this->settings_tabs as $setting_tab => $setting_name ) {
33
 
34
  $class = ( $setting_tab === $current_setting_tab ) ? ' nav-tab-active' : '';
35
- echo wp_kses(
36
- sprintf(
37
- '<a class="nav-tab%1$s" href="?page=nginx&tab=%2$s">%3$s</a>',
38
- esc_attr( $class ), esc_attr( $setting_name['menu_slug'] ), esc_html( $setting_name['menu_title'] )
39
- ),
40
- array( 'a' => array( 'href' => array(), 'class' => array(), ) )
41
  );
42
  }
43
  echo '</h2>';
@@ -45,10 +44,10 @@ global $pagenow;
45
  switch ( $current_setting_tab ) {
46
 
47
  case 'general':
48
- include plugin_dir_path(__FILE__ ) . 'nginx-helper-general-options.php';
49
  break;
50
  case 'support':
51
- include plugin_dir_path(__FILE__ ) . 'nginx-helper-support-options.php';
52
  break;
53
 
54
  }
@@ -56,7 +55,7 @@ global $pagenow;
56
  </div> <!-- End of #post-body-content -->
57
  <div id="postbox-container-1" class="postbox-container">
58
  <?php
59
- require plugin_dir_path(__FILE__ ) . 'nginx-helper-sidebar-display.php';
60
  ?>
61
  </div> <!-- End of #postbox-container-1 -->
62
  </div> <!-- End of #post-body -->
25
  <div id="post-body-content">
26
  <?php
27
  /* Show settinhs tabs */
28
+ $current_tab = filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_STRING );
29
  $current_setting_tab = ( ! empty( $current_tab ) ) ? $current_tab : 'general';
30
 
31
  echo '<h2 class="nav-tab-wrapper">';
32
  foreach ( $this->settings_tabs as $setting_tab => $setting_name ) {
33
 
34
  $class = ( $setting_tab === $current_setting_tab ) ? ' nav-tab-active' : '';
35
+ printf(
36
+ '<a class="%s" href="%s">%s</a>',
37
+ esc_attr( 'nav-tab' . $class ),
38
+ esc_url( '?page=nginx&tab=' . $setting_name['menu_slug'] ),
39
+ esc_html( $setting_name['menu_title'] )
 
40
  );
41
  }
42
  echo '</h2>';
44
  switch ( $current_setting_tab ) {
45
 
46
  case 'general':
47
+ include plugin_dir_path( __FILE__ ) . 'nginx-helper-general-options.php';
48
  break;
49
  case 'support':
50
+ include plugin_dir_path( __FILE__ ) . 'nginx-helper-support-options.php';
51
  break;
52
 
53
  }
55
  </div> <!-- End of #post-body-content -->
56
  <div id="postbox-container-1" class="postbox-container">
57
  <?php
58
+ require plugin_dir_path( __FILE__ ) . 'nginx-helper-sidebar-display.php';
59
  ?>
60
  </div> <!-- End of #postbox-container-1 -->
61
  </div> <!-- End of #post-body -->
admin/partials/nginx-helper-general-options.php CHANGED
@@ -40,7 +40,7 @@ $args = array(
40
  'purge_page_on_deleted_comment' => FILTER_SANITIZE_STRING,
41
  );
42
 
43
- $all_inputs = filter_input_array(INPUT_POST, $args);
44
 
45
  if ( isset( $all_inputs['smart_http_expire_save'] ) && 'Save All Changes' === $all_inputs['smart_http_expire_save'] ) {
46
 
@@ -117,13 +117,13 @@ if ( is_multisite() ) {
117
  <input type="radio" value="enable_fastcgi" id="cache_method_fastcgi" name="cache_method" <?php echo checked( $nginx_helper_settings['cache_method'], 'enable_fastcgi' ); ?> />
118
  <label for="cache_method_fastcgi">
119
  <?php
120
- echo wp_kses(
121
- sprintf(
122
- '%1$s (<a target="_blank" href="%2$s" title="%3$s">%4$s</a>)',
123
- esc_html__( 'nginx Fastcgi cache', 'nginx-helper' ), esc_url( $nginx_setting_link ), esc_attr__( 'External settings for nginx', 'nginx-helper' ), esc_html__( 'requires external settings for nginx', 'nginx-helper' )
124
- ),
125
- array( 'strong' => array(), 'a' => array( 'href' => array(), 'title' => array() ) )
126
- );
127
  ?>
128
  </label>
129
  </td>
@@ -161,8 +161,9 @@ if ( is_multisite() ) {
161
  <?php
162
  echo wp_kses(
163
  sprintf(
164
- '%1$s <strong>PURGE/url</strong> %2$s',
165
- esc_html__( 'Using a GET request to', 'nginx-helper' ), esc_html__( '(Default option)', 'nginx-helper' )
 
166
  ),
167
  array( 'strong' => array() )
168
  );
@@ -172,10 +173,16 @@ if ( is_multisite() ) {
172
  <?php
173
  echo wp_kses(
174
  sprintf(
175
- '%1$s <strong><a href="https://github.com/FRiCKLE/ngx_cache_purge">ngx_cache_purge</a></strong> %2$s.',
176
- esc_html__( 'Uses the', 'nginx-helper' ), esc_html__( 'module', 'nginx-helper' )
 
177
  ),
178
- array( 'strong' => array(), 'a' => array( 'href' => array() ) )
 
 
 
 
 
179
  );
180
  ?>
181
  </small>
@@ -191,10 +198,7 @@ if ( is_multisite() ) {
191
  <small>
192
  <?php
193
  echo wp_kses(
194
- sprintf(
195
- '%1$s<strong>RT_WP_NGINX_HELPER_CACHE_PATH</strong>. %2$s',
196
- esc_html__( 'Checks for matching cache file in ', 'nginx-helper' ), esc_html__( 'Does not require any other modules. Requires that the cache be stored on the same server as WordPress. You must also be using the default nginx cache options (levels=1:2) and (fastcgi_cache_key "$scheme$request_method$host$request_uri").', 'nginx-helper' )
197
- ),
198
  array( 'strong' => array() )
199
  );
200
  ?>
@@ -285,11 +289,8 @@ if ( is_multisite() ) {
285
  &nbsp;
286
  <?php
287
  echo wp_kses(
288
- sprintf(
289
- '%1$s<strong>%2$s</strong>%3$s<strong>%4$s</strong>%5$s<strong>%6$s</strong>.',
290
- esc_html__( 'when a ', 'nginx-helper' ), esc_html__( 'post', 'nginx-helper' ), esc_html__( ' (or page/custom post) is ', 'nginx-helper' ), esc_html__( 'modified', 'nginx-helper' ), esc_html__( ' or ', 'nginx-helper' ), esc_html__( 'added', 'nginx-helper' )
291
- ),
292
- array( 'strong' => array(), )
293
  );
294
  ?>
295
  </label>
@@ -309,11 +310,8 @@ if ( is_multisite() ) {
309
  &nbsp;
310
  <?php
311
  echo wp_kses(
312
- sprintf(
313
- '%1$s<strong>%2$s</strong>%3$s<strong>%4$s</strong>.',
314
- esc_html__( 'when a ', 'nginx-helper' ), esc_html__( 'published post', 'nginx-helper' ), esc_html__( ' (or page/custom post) is ', 'nginx-helper' ), esc_html__( 'trashed', 'nginx-helper' )
315
- ),
316
- array( 'strong' => array(), )
317
  );
318
  ?>
319
  </label>
@@ -343,11 +341,8 @@ if ( is_multisite() ) {
343
  &nbsp;
344
  <?php
345
  echo wp_kses(
346
- sprintf(
347
- '%1$s<strong>%2$s</strong>%3$s<strong>%4$s</strong>.',
348
- esc_html__( 'when a ', 'nginx-helper' ), esc_html__( 'post', 'nginx-helper' ), esc_html__( ' is ', 'nginx-helper' ), esc_html__( 'published', 'nginx-helper' )
349
- ),
350
- array( 'strong' => array(), )
351
  );
352
  ?>
353
  </label>
@@ -367,11 +362,8 @@ if ( is_multisite() ) {
367
  &nbsp;
368
  <?php
369
  echo wp_kses(
370
- sprintf(
371
- '%1$s<strong>%2$s</strong>%3$s<strong>%4$s</strong>.',
372
- esc_html__( 'when a ', 'nginx-helper' ), esc_html__( 'comment', 'nginx-helper' ), esc_html__( ' is ', 'nginx-helper' ), esc_html__( 'approved/published', 'nginx-helper' )
373
- ),
374
- array( 'strong' => array(), )
375
  );
376
  ?>
377
  </label>
@@ -391,11 +383,8 @@ if ( is_multisite() ) {
391
  &nbsp;
392
  <?php
393
  echo wp_kses(
394
- sprintf(
395
- '%1$s<strong>%2$s</strong>%3$s<strong>%4$s</strong>.',
396
- esc_html__( 'when a ', 'nginx-helper' ), esc_html__( 'comment', 'nginx-helper' ), esc_html__( ' is ', 'nginx-helper' ), esc_html__( 'unapproved/deleted', 'nginx-helper' )
397
- ),
398
- array( 'strong' => array(), )
399
  );
400
  ?>
401
  </label>
@@ -427,11 +416,8 @@ if ( is_multisite() ) {
427
  &nbsp;
428
  <?php
429
  echo wp_kses(
430
- sprintf(
431
- '%1$s<strong>%2$s</strong>%3$s<strong>%4$s</strong>%5$s<strong>%6$s</strong>.',
432
- esc_html__( 'when a ', 'nginx-helper' ), esc_html__( 'post', 'nginx-helper' ), esc_html__( ' (or page/custom post) is ', 'nginx-helper' ), esc_html__( 'modified', 'nginx-helper' ), esc_html__( ' or ', 'nginx-helper' ), esc_html__( 'added', 'nginx-helper' )
433
- ),
434
- array( 'strong' => array(), )
435
  );
436
  ?>
437
  </label>
@@ -451,11 +437,8 @@ if ( is_multisite() ) {
451
  &nbsp;
452
  <?php
453
  echo wp_kses(
454
- sprintf(
455
- '%1$s<strong>%2$s</strong>%3$s<strong>%4$s</strong>.',
456
- esc_html__( 'when a ', 'nginx-helper' ), esc_html__( 'published post', 'nginx-helper' ), esc_html__( ' (or page/custom post) is ', 'nginx-helper' ), esc_html__( 'trashed', 'nginx-helper' )
457
- ),
458
- array( 'strong' => array(), )
459
  );
460
  ?>
461
  </label>
@@ -476,11 +459,8 @@ if ( is_multisite() ) {
476
  &nbsp;
477
  <?php
478
  echo wp_kses(
479
- sprintf(
480
- '%1$s<strong>%2$s</strong>%3$s<strong>%4$s</strong>.',
481
- esc_html__( 'when a ', 'nginx-helper' ), esc_html__( 'comment', 'nginx-helper' ), esc_html__( ' is ', 'nginx-helper' ), esc_html__( 'approved/published', 'nginx-helper' )
482
- ),
483
- array( 'strong' => array(), )
484
  );
485
  ?>
486
  </label>
@@ -500,11 +480,8 @@ if ( is_multisite() ) {
500
  &nbsp;
501
  <?php
502
  echo wp_kses(
503
- sprintf(
504
- '%1$s<strong>%2$s</strong>%3$s<strong>%4$s</strong>.',
505
- esc_html__( 'when a ', 'nginx-helper' ), esc_html__( 'comment', 'nginx-helper' ), esc_html__( ' is ', 'nginx-helper' ), esc_html__( 'unapproved/deleted', 'nginx-helper' )
506
- ),
507
- array( 'strong' => array(), )
508
  );
509
  ?>
510
  </label>
@@ -521,11 +498,16 @@ if ( is_multisite() ) {
521
  <td>
522
  <textarea rows="5"class="rt-purge_url" id="purge_url" name="purge_url"><?php echo esc_textarea( $nginx_helper_admin->options['purge_url'] ); ?></textarea>
523
  <p class="description">
524
- Add one URL per line. URL should not contain domain name.
525
- <br>
526
- Eg: To purge http://example.com/sample-page/ add <strong>/sample-page/</strong> in above textarea.
527
- <br>
528
- '*' will only work with redis cache server.
 
 
 
 
 
529
  </p>
530
  </td>
531
  </tr>
@@ -569,10 +551,10 @@ if ( is_multisite() ) {
569
  </div> <!-- End of .inside -->
570
  </div>
571
  <?php
572
- } // End of if ( ! ( ! is_network_admin() && is_multisite() ) )
573
 
574
- if ( is_network_admin() ) {
575
- ?>
576
  <div class="postbox enable_map"<?php echo ( empty( $nginx_helper_settings['enable_map'] ) ) ? ' style="display: none;"' : ''; ?>>
577
  <h3 class="hndle">
578
  <span><?php esc_html_e( 'Nginx Map', 'nginx-helper' ); ?></span>
@@ -584,12 +566,15 @@ if ( is_network_admin() ) {
584
  <span class="error fade" style="display: block">
585
  <p>
586
  <?php
 
 
587
  echo wp_kses(
588
  sprintf(
589
- '%1$s<br /><br />%2$s<strong>%3$s</strong>',
590
- esc_html__( 'Can\'t write on map file.', 'nginx-helper' ), esc_html__( 'Check you have write permission on ', 'nginx-helper' ), esc_url( $log_path . 'map.conf' )
 
591
  ),
592
- array( 'br' => array(), 'strong' => array(), )
593
  );
594
  ?>
595
  </p>
@@ -601,12 +586,10 @@ if ( is_network_admin() ) {
601
  <tr>
602
  <th>
603
  <?php
604
- echo wp_kses(
605
- sprintf(
606
- '%1$s<br /><small>%2$s</small>',
607
- esc_html__( 'Nginx Map path to include in nginx settings', 'nginx-helper' ), esc_html__( '(recommended)', 'nginx-helper' )
608
- ),
609
- array( 'br' => array(), 'small' => array(), )
610
  );
611
  ?>
612
  </th>
@@ -617,12 +600,11 @@ if ( is_network_admin() ) {
617
  <tr>
618
  <th>
619
  <?php
620
- echo wp_kses(
621
- sprintf(
622
- '%1$s<br />%2$s<br /><small>%3$s</small>',
623
- esc_html__( 'Or,', 'nginx-helper' ), esc_html__( 'Text to manually copy and paste in nginx settings', 'nginx-helper' ), esc_html__( '(if your network is small and new sites are not added frequently)', 'nginx-helper' )
624
- ),
625
- array( 'br' => array(), 'small' => array(), )
626
  );
627
  ?>
628
  </th>
@@ -635,9 +617,9 @@ if ( is_network_admin() ) {
635
  </table>
636
  </div> <!-- End of .inside -->
637
  </div>
638
- <?php
639
- }
640
- ?>
641
  <div class="postbox enable_log"<?php echo ( empty( $nginx_helper_settings['enable_log'] ) ) ? ' style="display: none;"' : ''; ?>>
642
  <h3 class="hndle">
643
  <span><?php esc_html_e( 'Logging Options', 'nginx-helper' ); ?></span>
@@ -656,12 +638,15 @@ if ( is_network_admin() ) {
656
  <span class="error fade" style="display : block">
657
  <p>
658
  <?php
 
 
659
  echo wp_kses(
660
  sprintf(
661
- '%1$s<br /><br />%2$s<strong>%3$s</strong>',
662
- esc_html__( 'Can\'t write on log file.', 'nginx-helper' ), esc_html__( 'Check you have write permission on ', 'nginx-helper' ), esc_url( $log_path . 'nginx.log' )
 
663
  ),
664
- array( 'br' => array(), 'strong' => array(), )
665
  );
666
  ?>
667
  </p>
40
  'purge_page_on_deleted_comment' => FILTER_SANITIZE_STRING,
41
  );
42
 
43
+ $all_inputs = filter_input_array( INPUT_POST, $args );
44
 
45
  if ( isset( $all_inputs['smart_http_expire_save'] ) && 'Save All Changes' === $all_inputs['smart_http_expire_save'] ) {
46
 
117
  <input type="radio" value="enable_fastcgi" id="cache_method_fastcgi" name="cache_method" <?php echo checked( $nginx_helper_settings['cache_method'], 'enable_fastcgi' ); ?> />
118
  <label for="cache_method_fastcgi">
119
  <?php
120
+ printf(
121
+ '%s (<a target="_blank" href="%s" title="%s">%s</a>)',
122
+ esc_html__( 'nginx Fastcgi cache', 'nginx-helper' ),
123
+ esc_url( $nginx_setting_link ),
124
+ esc_attr__( 'External settings for nginx', 'nginx-helper' ),
125
+ esc_html__( 'requires external settings for nginx', 'nginx-helper' )
126
+ );
127
  ?>
128
  </label>
129
  </td>
161
  <?php
162
  echo wp_kses(
163
  sprintf(
164
+ '%1$s <strong>PURGE/url</strong> %2$s',
165
+ esc_html__( 'Using a GET request to', 'nginx-helper' ),
166
+ esc_html__( '(Default option)', 'nginx-helper' )
167
  ),
168
  array( 'strong' => array() )
169
  );
173
  <?php
174
  echo wp_kses(
175
  sprintf(
176
+ // translators: %s Nginx cache purge module link.
177
+ __( 'Uses the %s module.', 'nginx-helper' ),
178
+ '<strong><a href="https://github.com/FRiCKLE/ngx_cache_purge">ngx_cache_purge</a></strong>'
179
  ),
180
+ array(
181
+ 'strong' => array(),
182
+ 'a' => array(
183
+ 'href' => array(),
184
+ ),
185
+ )
186
  );
187
  ?>
188
  </small>
198
  <small>
199
  <?php
200
  echo wp_kses(
201
+ __( 'Checks for matching cache file in <strong>RT_WP_NGINX_HELPER_CACHE_PATH</strong>. Does not require any other modules. Requires that the cache be stored on the same server as WordPress. You must also be using the default nginx cache options (levels=1:2) and (fastcgi_cache_key "$scheme$request_method$host$request_uri").', 'nginx-helper' ),
 
 
 
202
  array( 'strong' => array() )
203
  );
204
  ?>
289
  &nbsp;
290
  <?php
291
  echo wp_kses(
292
+ __( 'when a <strong>post</strong> (or page/custom post) is <strong>modified</strong> or <strong>added</strong>.', 'nginx-helper' ),
293
+ array( 'strong' => array() )
 
 
 
294
  );
295
  ?>
296
  </label>
310
  &nbsp;
311
  <?php
312
  echo wp_kses(
313
+ __( 'when a <strong>published post</strong> (or page/custom post) is <strong>trashed</strong>', 'nginx-helper' ),
314
+ array( 'strong' => array() )
 
 
 
315
  );
316
  ?>
317
  </label>
341
  &nbsp;
342
  <?php
343
  echo wp_kses(
344
+ __( 'when a <strong>post</strong> is <strong>published</strong>.', 'nginx-helper' ),
345
+ array( 'strong' => array() )
 
 
 
346
  );
347
  ?>
348
  </label>
362
  &nbsp;
363
  <?php
364
  echo wp_kses(
365
+ __( 'when a <strong>comment</strong> is <strong>approved/published</strong>.', 'nginx-helper' ),
366
+ array( 'strong' => array() )
 
 
 
367
  );
368
  ?>
369
  </label>
383
  &nbsp;
384
  <?php
385
  echo wp_kses(
386
+ __( 'when a <strong>comment</strong> is <strong>unapproved/deleted</strong>.', 'nginx-helper' ),
387
+ array( 'strong' => array() )
 
 
 
388
  );
389
  ?>
390
  </label>
416
  &nbsp;
417
  <?php
418
  echo wp_kses(
419
+ __( 'when a <strong>post</strong> (or page/custom post) is <strong>modified</strong> or <strong>added</strong>.', 'nginx-helper' ),
420
+ array( 'strong' => array() )
 
 
 
421
  );
422
  ?>
423
  </label>
437
  &nbsp;
438
  <?php
439
  echo wp_kses(
440
+ __( 'when a <strong>published post</strong> (or page/custom post) is <strong>trashed</strong>.', 'nginx-helper' ),
441
+ array( 'strong' => array() )
 
 
 
442
  );
443
  ?>
444
  </label>
459
  &nbsp;
460
  <?php
461
  echo wp_kses(
462
+ __( 'when a <strong>comment</strong> is <strong>approved/published</strong>.', 'nginx-helper' ),
463
+ array( 'strong' => array() )
 
 
 
464
  );
465
  ?>
466
  </label>
480
  &nbsp;
481
  <?php
482
  echo wp_kses(
483
+ __( 'when a <strong>comment</strong> is <strong>unapproved/deleted</strong>.', 'nginx-helper' ),
484
+ array( 'strong' => array() )
 
 
 
485
  );
486
  ?>
487
  </label>
498
  <td>
499
  <textarea rows="5"class="rt-purge_url" id="purge_url" name="purge_url"><?php echo esc_textarea( $nginx_helper_admin->options['purge_url'] ); ?></textarea>
500
  <p class="description">
501
+ <?php
502
+ esc_html_e( 'Add one URL per line. URL should not contain domain name.', 'nginx-helper' );
503
+ echo '<br>';
504
+ echo wp_kses(
505
+ __( 'Eg: To purge http://example.com/sample-page/ add <strong>/sample-page/</strong> in above textarea.', 'nginx-helper' ),
506
+ array( 'strong' => array() )
507
+ );
508
+ echo '<br>';
509
+ esc_html_e( "'*' will only work with redis cache server.", 'nginx-helper' );
510
+ ?>
511
  </p>
512
  </td>
513
  </tr>
551
  </div> <!-- End of .inside -->
552
  </div>
553
  <?php
554
+ } // End of if.
555
 
556
+ if ( is_network_admin() ) {
557
+ ?>
558
  <div class="postbox enable_map"<?php echo ( empty( $nginx_helper_settings['enable_map'] ) ) ? ' style="display: none;"' : ''; ?>>
559
  <h3 class="hndle">
560
  <span><?php esc_html_e( 'Nginx Map', 'nginx-helper' ); ?></span>
566
  <span class="error fade" style="display: block">
567
  <p>
568
  <?php
569
+ esc_html_e( 'Can\'t write on map file.', 'nginx-helper' );
570
+ echo '<br /><br />';
571
  echo wp_kses(
572
  sprintf(
573
+ // translators: %s file url.
574
+ __( 'Check you have write permission on <strong>%s</strong>', 'nginx-helper' ),
575
+ esc_url( $log_path . 'map.conf' )
576
  ),
577
+ array( 'strong' => array() )
578
  );
579
  ?>
580
  </p>
586
  <tr>
587
  <th>
588
  <?php
589
+ printf(
590
+ '%1$s<br /><small>%2$s</small>',
591
+ esc_html__( 'Nginx Map path to include in nginx settings', 'nginx-helper' ),
592
+ esc_html__( '(recommended)', 'nginx-helper' )
 
 
593
  );
594
  ?>
595
  </th>
600
  <tr>
601
  <th>
602
  <?php
603
+ printf(
604
+ '%1$s<br />%2$s<br /><small>%3$s</small>',
605
+ esc_html__( 'Or,', 'nginx-helper' ),
606
+ esc_html__( 'Text to manually copy and paste in nginx settings', 'nginx-helper' ),
607
+ esc_html__( '(if your network is small and new sites are not added frequently)', 'nginx-helper' )
 
608
  );
609
  ?>
610
  </th>
617
  </table>
618
  </div> <!-- End of .inside -->
619
  </div>
620
+ <?php
621
+ }
622
+ ?>
623
  <div class="postbox enable_log"<?php echo ( empty( $nginx_helper_settings['enable_log'] ) ) ? ' style="display: none;"' : ''; ?>>
624
  <h3 class="hndle">
625
  <span><?php esc_html_e( 'Logging Options', 'nginx-helper' ); ?></span>
638
  <span class="error fade" style="display : block">
639
  <p>
640
  <?php
641
+ esc_html_e( 'Can\'t write on log file.', 'nginx-helper' );
642
+ echo '<br /><br />';
643
  echo wp_kses(
644
  sprintf(
645
+ // translators: %s file url.
646
+ __( 'Check you have write permission on <strong>%s</strong>', 'nginx-helper' ),
647
+ esc_url( $log_path . 'nginx.log' )
648
  ),
649
+ array( 'strong' => array() )
650
  );
651
  ?>
652
  </p>
admin/partials/nginx-helper-sidebar-display.php CHANGED
@@ -33,12 +33,11 @@ $nonced_url = wp_nonce_url( $purge_url, 'nginx_helper-purge_all' );
33
  <div class="inside">
34
  <p>
35
  <?php
36
- echo wp_kses(
37
- sprintf(
38
- '%1$s <a href=\'%2$s\'>%3$s</a>.',
39
- esc_html__( 'Please use our', 'nginx-helper' ), esc_url( 'http://rtcamp.com/support/forum/wordpress-nginx/' ), esc_html__( 'free support forum', 'nginx-helper' )
40
- ),
41
- array( 'a' => array( 'href' => array() ) )
42
  );
43
  ?>
44
  </p>
@@ -54,8 +53,6 @@ $nonced_url = wp_nonce_url( $purge_url, 'nginx_helper-purge_all' );
54
  <div style="text-align:center;" class="inside">
55
  <a class="nginx-helper-facebook" title="<?php esc_attr_e( 'Become a fan on Facebook', 'nginx-helper' ); ?>" target="_blank" href="http://www.facebook.com/rtCamp.solutions/"></a>
56
  <a class="nginx-helper-twitter" title="<?php esc_attr_e( 'Follow us on Twitter', 'nginx-helper' ); ?>" target="_blank" href="https://twitter.com/rtcamp/"></a>
57
- <a class="nginx-helper-gplus" title="<?php esc_attr_e( 'Add to Circle', 'nginx-helper' ); ?>" target="_blank" href="https://plus.google.com/110214156830549460974/posts"></a>
58
- <a class="nginx-helper-rss" title="<?php esc_attr_e( 'Subscribe to our feeds', 'nginx-helper' ); ?>" target="_blank" href="http://feeds.feedburner.com/rtcamp/"></a>
59
  </div>
60
  </div>
61
 
33
  <div class="inside">
34
  <p>
35
  <?php
36
+ printf(
37
+ '%s <a href=\'%s\'>%s</a>.',
38
+ esc_html__( 'Please use our', 'nginx-helper' ),
39
+ esc_url( 'http://rtcamp.com/support/forum/wordpress-nginx/' ),
40
+ esc_html__( 'free support forum', 'nginx-helper' )
 
41
  );
42
  ?>
43
  </p>
53
  <div style="text-align:center;" class="inside">
54
  <a class="nginx-helper-facebook" title="<?php esc_attr_e( 'Become a fan on Facebook', 'nginx-helper' ); ?>" target="_blank" href="http://www.facebook.com/rtCamp.solutions/"></a>
55
  <a class="nginx-helper-twitter" title="<?php esc_attr_e( 'Follow us on Twitter', 'nginx-helper' ); ?>" target="_blank" href="https://twitter.com/rtcamp/"></a>
 
 
56
  </div>
57
  </div>
58
 
admin/partials/nginx-helper-support-options.php CHANGED
@@ -24,7 +24,7 @@
24
  <?php esc_html_e( 'Free Support', 'nginx-helper' ); ?>
25
  </th>
26
  <td>
27
- <a href="https://rtcamp.com/support/forum/wordpress-nginx/" title="<?php esc_attr_e( 'Free Support Forum', 'nginx-helper' ); ?>" target="_blank">
28
  <?php esc_html_e( 'Link to forum', 'nginx-helper' ); ?>
29
  </a>
30
  </td>
@@ -34,7 +34,7 @@
34
  <?php esc_html_e( 'Premium Support', 'nginx-helper' ); ?>
35
  </th>
36
  <td>
37
- <a href="https://rtcamp.com/wordpress-nginx/pricing/" title="<?php esc_attr_e( 'Premium Support Forum', 'nginx-helper' ); ?>" target="_blank">
38
  <?php esc_html_e( 'Link to forum', 'nginx-helper' ); ?>
39
  </a>
40
  </td>
24
  <?php esc_html_e( 'Free Support', 'nginx-helper' ); ?>
25
  </th>
26
  <td>
27
+ <a href="https://community.easyengine.io/c/wordpress-nginx/" title="<?php esc_attr_e( 'Free Support Forum', 'nginx-helper' ); ?>" target="_blank">
28
  <?php esc_html_e( 'Link to forum', 'nginx-helper' ); ?>
29
  </a>
30
  </td>
34
  <?php esc_html_e( 'Premium Support', 'nginx-helper' ); ?>
35
  </th>
36
  <td>
37
+ <a href="https://easyengine.io/contact/" title="<?php esc_attr_e( 'Premium Support Forum', 'nginx-helper' ); ?>" target="_blank">
38
  <?php esc_html_e( 'Link to forum', 'nginx-helper' ); ?>
39
  </a>
40
  </td>
admin/predis.php CHANGED
@@ -1,4 +1,4 @@
1
- <?php
2
 
3
  /*
4
  * This file is part of the Predis package.
@@ -15200,3 +15200,4 @@ class ReplicationStrategy
15200
  }
15201
 
15202
  /* --------------------------------------------------------------------------- */
 
1
+ <?php // phpcs:disable
2
 
3
  /*
4
  * This file is part of the Predis package.
15200
  }
15201
 
15202
  /* --------------------------------------------------------------------------- */
15203
+ // phpcs:enable
wp-cli.php → class-nginx-helper-wp-cli-command.php RENAMED
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
16
  if ( ! class_exists( 'Nginx_Helper_WP_CLI_Command' ) ) {
17
 
18
  /**
19
- * Class Nginx_Helper_WP_CLI_Command
20
  */
21
  class Nginx_Helper_WP_CLI_Command extends WP_CLI_Command {
22
 
16
  if ( ! class_exists( 'Nginx_Helper_WP_CLI_Command' ) ) {
17
 
18
  /**
19
+ * Purge site cache from Nginx.
20
  */
21
  class Nginx_Helper_WP_CLI_Command extends WP_CLI_Command {
22
 
includes/class-nginx-helper-loader.php CHANGED
@@ -112,7 +112,7 @@ class Nginx_Helper_Loader {
112
  'component' => $component,
113
  'callback' => $callback,
114
  'priority' => $priority,
115
- 'accepted_args' => $accepted_args
116
  );
117
 
118
  return $hooks;
112
  'component' => $component,
113
  'callback' => $callback,
114
  'priority' => $priority,
115
+ 'accepted_args' => $accepted_args,
116
  );
117
 
118
  return $hooks;
includes/class-nginx-helper.php CHANGED
@@ -61,9 +61,9 @@ class Nginx_Helper {
61
  *
62
  * @since 2.0.0
63
  * @access public
64
- * @var string $minium_WP
65
  */
66
- protected $minimum_WP;
67
 
68
  /**
69
  * Define the core functionality of the plugin.
@@ -77,8 +77,8 @@ class Nginx_Helper {
77
  public function __construct() {
78
 
79
  $this->plugin_name = 'nginx-helper';
80
- $this->version = '2.0.1';
81
- $this->minimum_WP = '3.0';
82
 
83
  if ( ! $this->required_wp_version() ) {
84
  return;
@@ -171,7 +171,7 @@ class Nginx_Helper {
171
  $nginx_helper_admin = new Nginx_Helper_Admin( $this->get_plugin_name(), $this->get_version() );
172
 
173
  // Defines global variables.
174
- if ( ! empty( $nginx_helper_admin->options['cache_method'] ) && $nginx_helper_admin->options['cache_method'] === 'enable_redis' ) {
175
 
176
  if ( class_exists( 'Redis' ) ) { // Use PHP5-Redis extension if installed.
177
 
@@ -184,7 +184,6 @@ class Nginx_Helper {
184
  $nginx_purger = new Predis_Purger();
185
 
186
  }
187
-
188
  } else {
189
 
190
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-fastcgi-purger.php';
@@ -203,7 +202,10 @@ class Nginx_Helper {
203
  $this->loader->add_filter( 'plugin_action_links_' . NGINX_HELPER_BASENAME, $nginx_helper_admin, 'nginx_helper_settings_link' );
204
  }
205
 
206
- $this->loader->add_action( 'admin_bar_menu', $nginx_helper_admin, 'nginx_helper_toolbar_purge_link', 100 );
 
 
 
207
  $this->loader->add_action( 'wp_ajax_rt_get_feeds', $nginx_helper_admin, 'nginx_helper_get_feeds' );
208
 
209
  $this->loader->add_action( 'shutdown', $nginx_helper_admin, 'add_timestamps', 99999 );
@@ -281,7 +283,7 @@ class Nginx_Helper {
281
 
282
  global $wp_version;
283
 
284
- $wp_ok = version_compare( $wp_version, $this->minimum_WP, '>=' );
285
 
286
  if ( false === $wp_ok ) {
287
 
@@ -306,7 +308,8 @@ class Nginx_Helper {
306
  <?php
307
  printf(
308
  /* translators: %s is Minimum WP version. */
309
- esc_html__( 'Sorry, Nginx Helper requires WordPress %s or higher', 'nginx-helper' ), esc_html( $this->minimum_WP )
 
310
  );
311
  ?>
312
  </strong>
61
  *
62
  * @since 2.0.0
63
  * @access public
64
+ * @var string $minium_wp
65
  */
66
+ protected $minimum_wp;
67
 
68
  /**
69
  * Define the core functionality of the plugin.
77
  public function __construct() {
78
 
79
  $this->plugin_name = 'nginx-helper';
80
+ $this->version = '2.2.0';
81
+ $this->minimum_wp = '3.0';
82
 
83
  if ( ! $this->required_wp_version() ) {
84
  return;
171
  $nginx_helper_admin = new Nginx_Helper_Admin( $this->get_plugin_name(), $this->get_version() );
172
 
173
  // Defines global variables.
174
+ if ( ! empty( $nginx_helper_admin->options['cache_method'] ) && 'enable_redis' === $nginx_helper_admin->options['cache_method'] ) {
175
 
176
  if ( class_exists( 'Redis' ) ) { // Use PHP5-Redis extension if installed.
177
 
184
  $nginx_purger = new Predis_Purger();
185
 
186
  }
 
187
  } else {
188
 
189
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-fastcgi-purger.php';
202
  $this->loader->add_filter( 'plugin_action_links_' . NGINX_HELPER_BASENAME, $nginx_helper_admin, 'nginx_helper_settings_link' );
203
  }
204
 
205
+ if ( ! empty( $nginx_helper_admin->options['enable_purge'] ) ) {
206
+ $this->loader->add_action( 'admin_bar_menu', $nginx_helper_admin, 'nginx_helper_toolbar_purge_link', 100 );
207
+ }
208
+
209
  $this->loader->add_action( 'wp_ajax_rt_get_feeds', $nginx_helper_admin, 'nginx_helper_get_feeds' );
210
 
211
  $this->loader->add_action( 'shutdown', $nginx_helper_admin, 'add_timestamps', 99999 );
283
 
284
  global $wp_version;
285
 
286
+ $wp_ok = version_compare( $wp_version, $this->minimum_wp, '>=' );
287
 
288
  if ( false === $wp_ok ) {
289
 
308
  <?php
309
  printf(
310
  /* translators: %s is Minimum WP version. */
311
+ esc_html__( 'Sorry, Nginx Helper requires WordPress %s or higher', 'nginx-helper' ),
312
+ esc_html( $this->minimum_wp )
313
  );
314
  ?>
315
  </strong>
languages/nginx-helper.po CHANGED
@@ -1,599 +1,616 @@
1
- # Copyright (C) 2018 nginx-helper
2
- # This file is distributed under the same license as the nginx-helper package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: nginx-helper\n"
 
6
  "MIME-Version: 1.0\n"
7
  "Content-Type: text/plain; charset=UTF-8\n"
8
  "Content-Transfer-Encoding: 8bit\n"
9
- "X-Poedit-Basepath: ..\n"
10
- "X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
11
- "X-Poedit-SearchPath-0: .\n"
12
- "X-Poedit-SearchPathExcluded-0: *.js\n"
13
- "X-Poedit-SourceCharset: UTF-8\n"
14
- "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
-
16
- #: ../admin/class-nginx-helper-admin.php:87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  msgid "General"
18
  msgstr ""
19
 
20
- #: ../admin/class-nginx-helper-admin.php:91
21
  msgid "Support"
22
  msgstr ""
23
 
24
- #: ../admin/class-nginx-helper-admin.php:171, ../admin/class-nginx-helper-admin.php:172, ../admin/class-nginx-helper-admin.php:182, ../admin/class-nginx-helper-admin.php:183
25
- msgid "Nginx Helper"
26
  msgstr ""
27
 
28
- #: ../admin/class-nginx-helper-admin.php:216, ../admin/class-nginx-helper-admin.php:218
29
  msgid "Purge Cache"
30
  msgstr ""
31
 
32
- #: ../admin/class-nginx-helper-admin.php:319
 
 
 
 
33
  msgid "Settings"
34
  msgstr ""
35
 
36
- #: ../admin/class-nginx-helper-admin.php:382
37
  msgid "No items"
38
  msgstr ""
39
 
40
- #: ../admin/class-nginx-helper-admin.php:393
41
  msgid "Posted "
42
  msgstr ""
43
 
44
- #: ../admin/class-nginx-helper-admin.php:691
45
  msgid "Purge initiated"
46
  msgstr ""
47
 
48
- #: ../admin/class-purger.php:607
49
  msgid "Purging homepage (WPML) "
50
  msgstr ""
51
 
52
- #: ../admin/class-purger.php:612
53
  msgid "Purging homepage "
54
  msgstr ""
55
 
56
- #: ../admin/class-purger.php:631
57
  msgid "Purging personal urls"
58
  msgstr ""
59
 
60
- #: ../admin/class-purger.php:640
61
  msgid "No personal urls available"
62
  msgstr ""
63
 
64
- #: ../admin/class-purger.php:656
65
  msgid "Purging category archives"
66
  msgstr ""
67
 
68
- #: ../admin/class-purger.php:664
 
69
  msgid "Purging category '%d'"
70
  msgstr ""
71
 
72
- #: ../admin/class-purger.php:683
73
  msgid "Purging tags archives"
74
  msgstr ""
75
 
76
- #: ../admin/class-purger.php:691, ../admin/class-purger.php:794
 
77
  msgid "Purging tag '%1$s' ( id %2$d )"
78
  msgstr ""
79
 
80
- #: ../admin/class-purger.php:711
81
  msgid "Purging post custom taxonomies related"
82
  msgstr ""
83
 
84
- #: ../admin/class-purger.php:724, ../admin/class-purger.php:827
 
 
 
85
  msgid "Purging custom taxonomy '%s'"
86
  msgstr ""
87
 
88
- #: ../admin/class-purger.php:739, ../admin/class-purger.php:844
 
 
 
89
  msgid "Your built-in taxonomy '%s' has param '_builtin' set to false."
90
  msgstr ""
91
 
92
- #: ../admin/class-purger.php:744, ../admin/class-purger.php:850
 
93
  msgid "No custom taxonomies"
94
  msgstr ""
95
 
96
- #: ../admin/class-purger.php:757
97
  msgid "Purging all categories"
98
  msgstr ""
99
 
100
- #: ../admin/class-purger.php:765
101
  msgid "Purging category '%1$s' ( id %2$d )"
102
  msgstr ""
103
 
104
- #: ../admin/class-purger.php:772
105
  msgid "No categories archives"
106
  msgstr ""
107
 
108
- #: ../admin/class-purger.php:786
109
  msgid "Purging all tags"
110
  msgstr ""
111
 
112
- #: ../admin/class-purger.php:800
113
  msgid "No tags archives"
114
  msgstr ""
115
 
116
- #: ../admin/class-purger.php:814
117
  msgid "Purging all custom taxonomies"
118
  msgstr ""
119
 
120
- #: ../admin/class-purger.php:877
121
  msgid "Purging all posts, pages and custom post types."
122
  msgstr ""
123
 
124
- #: ../admin/class-purger.php:892
125
  msgid "Purging post id '%1$d' ( post type '%2$s' )"
126
  msgstr ""
127
 
128
- #: ../admin/class-purger.php:898
129
  msgid "No posts"
130
  msgstr ""
131
 
132
- #: ../admin/class-purger.php:912
133
  msgid "Purging all date-based archives."
134
  msgstr ""
135
 
136
- #: ../admin/class-purger.php:929
137
  msgid "Purging all daily archives."
138
  msgstr ""
139
 
140
- #: ../admin/class-purger.php:948
141
  msgid "Purging daily archive '%1$s/%2$s/%3$s'"
142
  msgstr ""
143
 
144
- #: ../admin/class-purger.php:957
145
  msgid "No daily archives"
146
  msgstr ""
147
 
148
- #: ../admin/class-purger.php:969
149
  msgid "Purging all monthly archives."
150
  msgstr ""
151
 
152
- #: ../admin/class-purger.php:995
153
  msgid "Purging monthly archive '%1$s/%2$s'"
154
  msgstr ""
155
 
156
- #: ../admin/class-purger.php:1001
157
  msgid "No monthly archives"
158
  msgstr ""
159
 
160
- #: ../admin/class-purger.php:1013
161
  msgid "Purging all yearly archives."
162
  msgstr ""
163
 
164
- #: ../admin/class-purger.php:1038
 
165
  msgid "Purging yearly archive '%s'"
166
  msgstr ""
167
 
168
- #: ../admin/class-purger.php:1044
169
  msgid "No yearly archives"
170
  msgstr ""
171
 
172
- #: ../admin/class-purger.php:1056
173
  msgid "Let's purge everything!"
174
  msgstr ""
175
 
176
- #: ../admin/class-purger.php:1062
177
  msgid "Everything purged!"
178
  msgstr ""
179
 
180
- #: ../admin/class-purger.php:1079
181
  msgid "Term taxonomy edited or deleted"
182
  msgstr ""
183
 
184
- #: ../admin/class-purger.php:1086
185
  msgid "Term taxonomy '%1$s' edited, (tt_id '%2$d', term_id '%3$d', taxonomy '%4$s')"
186
  msgstr ""
187
 
188
- #: ../admin/class-purger.php:1090
189
  msgid "A term taxonomy has been deleted from taxonomy '%1$s', (tt_id '%2$d', term_id '%3$d')"
190
  msgstr ""
191
 
192
- #: ../admin/class-purger.php:1112
193
  msgid "Widget saved, moved or removed in a sidebar"
194
  msgstr ""
195
 
196
- #: ../admin/partials/nginx-helper-admin-display.php:21
197
  msgid "Nginx Settings"
198
  msgstr ""
199
 
200
- #: ../admin/partials/nginx-helper-general-options.php:56
201
  msgid "Log file size must be a number."
202
  msgstr ""
203
 
204
- #: ../admin/partials/nginx-helper-general-options.php:66
205
  msgid "Settings saved."
206
  msgstr ""
207
 
208
- #: ../admin/partials/nginx-helper-general-options.php:93
209
  msgid "Purging Options"
210
  msgstr ""
211
 
212
- #: ../admin/partials/nginx-helper-general-options.php:100
213
  msgid "Enable Purge"
214
  msgstr ""
215
 
216
- #: ../admin/partials/nginx-helper-general-options.php:110
217
  msgid "Caching Method"
218
  msgstr ""
219
 
220
- #: ../admin/partials/nginx-helper-general-options.php:123
221
  msgid "nginx Fastcgi cache"
222
  msgstr ""
223
 
224
- #: ../admin/partials/nginx-helper-general-options.php:123
225
  msgid "External settings for nginx"
226
  msgstr ""
227
 
228
- #: ../admin/partials/nginx-helper-general-options.php:123
229
  msgid "requires external settings for nginx"
230
  msgstr ""
231
 
232
- #: ../admin/partials/nginx-helper-general-options.php:135
233
  msgid "Redis cache"
234
  msgstr ""
235
 
236
- #: ../admin/partials/nginx-helper-general-options.php:145
237
  msgid "Purge Method"
238
  msgstr ""
239
 
240
- #: ../admin/partials/nginx-helper-general-options.php:155, ../admin/partials/nginx-helper-general-options.php:337
 
241
  msgid "when a post/page/custom post is published."
242
  msgstr ""
243
 
244
- #: ../admin/partials/nginx-helper-general-options.php:165
245
  msgid "Using a GET request to"
246
  msgstr ""
247
 
248
- #: ../admin/partials/nginx-helper-general-options.php:165
249
  msgid "(Default option)"
250
  msgstr ""
251
 
252
- #: ../admin/partials/nginx-helper-general-options.php:176
253
- msgid "Uses the"
254
- msgstr ""
255
-
256
- #: ../admin/partials/nginx-helper-general-options.php:176
257
- msgid "module"
258
  msgstr ""
259
 
260
- #: ../admin/partials/nginx-helper-general-options.php:188
261
  msgid "Delete local server cache files"
262
  msgstr ""
263
 
264
- #: ../admin/partials/nginx-helper-general-options.php:196
265
- msgid "Checks for matching cache file in "
266
  msgstr ""
267
 
268
- #: ../admin/partials/nginx-helper-general-options.php:196
269
- msgid "Does not require any other modules. Requires that the cache be stored on the same server as WordPress. You must also be using the default nginx cache options (levels=1:2) and (fastcgi_cache_key \"$scheme$request_method$host$request_uri\")."
270
- msgstr ""
271
-
272
- #: ../admin/partials/nginx-helper-general-options.php:212
273
  msgid "Redis Settings"
274
  msgstr ""
275
 
276
- #: ../admin/partials/nginx-helper-general-options.php:217
277
  msgid "Hostname"
278
  msgstr ""
279
 
280
- #: ../admin/partials/nginx-helper-general-options.php:224, ../admin/partials/nginx-helper-general-options.php:239, ../admin/partials/nginx-helper-general-options.php:254
 
 
281
  msgid "Overridden by constant variables."
282
  msgstr ""
283
 
284
- #: ../admin/partials/nginx-helper-general-options.php:232
285
  msgid "Port"
286
  msgstr ""
287
 
288
- #: ../admin/partials/nginx-helper-general-options.php:247
289
  msgid "Prefix"
290
  msgstr ""
291
 
292
- #: ../admin/partials/nginx-helper-general-options.php:267
293
  msgid "Purging Conditions"
294
  msgstr ""
295
 
296
- #: ../admin/partials/nginx-helper-general-options.php:272
297
  msgid "Purge Homepage:"
298
  msgstr ""
299
 
300
- #: ../admin/partials/nginx-helper-general-options.php:279
301
  msgid "when a post/page/custom post is modified or added."
302
  msgstr ""
303
 
304
- #: ../admin/partials/nginx-helper-general-options.php:290, ../admin/partials/nginx-helper-general-options.php:314, ../admin/partials/nginx-helper-general-options.php:348, ../admin/partials/nginx-helper-general-options.php:372, ../admin/partials/nginx-helper-general-options.php:396, ../admin/partials/nginx-helper-general-options.php:432, ../admin/partials/nginx-helper-general-options.php:456, ../admin/partials/nginx-helper-general-options.php:481, ../admin/partials/nginx-helper-general-options.php:505
305
- msgid "when a "
306
- msgstr ""
307
-
308
- #: ../admin/partials/nginx-helper-general-options.php:290, ../admin/partials/nginx-helper-general-options.php:348, ../admin/partials/nginx-helper-general-options.php:432
309
- msgid "post"
310
- msgstr ""
311
-
312
- #: ../admin/partials/nginx-helper-general-options.php:290, ../admin/partials/nginx-helper-general-options.php:314, ../admin/partials/nginx-helper-general-options.php:432, ../admin/partials/nginx-helper-general-options.php:456
313
- msgid " (or page/custom post) is "
314
- msgstr ""
315
-
316
- #: ../admin/partials/nginx-helper-general-options.php:290, ../admin/partials/nginx-helper-general-options.php:432
317
- msgid "modified"
318
- msgstr ""
319
-
320
- #: ../admin/partials/nginx-helper-general-options.php:290, ../admin/partials/nginx-helper-general-options.php:432
321
- msgid " or "
322
  msgstr ""
323
 
324
- #: ../admin/partials/nginx-helper-general-options.php:290, ../admin/partials/nginx-helper-general-options.php:432
325
- msgid "added"
326
- msgstr ""
327
-
328
- #: ../admin/partials/nginx-helper-general-options.php:303
329
  msgid "when an existing post/page/custom post is modified."
330
  msgstr ""
331
 
332
- #: ../admin/partials/nginx-helper-general-options.php:314, ../admin/partials/nginx-helper-general-options.php:456
333
- msgid "published post"
334
- msgstr ""
335
-
336
- #: ../admin/partials/nginx-helper-general-options.php:314, ../admin/partials/nginx-helper-general-options.php:456
337
- msgid "trashed"
338
  msgstr ""
339
 
340
- #: ../admin/partials/nginx-helper-general-options.php:329
341
  msgid "Purge Post/Page/Custom Post Type:"
342
  msgstr ""
343
 
344
- #: ../admin/partials/nginx-helper-general-options.php:348, ../admin/partials/nginx-helper-general-options.php:372, ../admin/partials/nginx-helper-general-options.php:396, ../admin/partials/nginx-helper-general-options.php:481, ../admin/partials/nginx-helper-general-options.php:505
345
- msgid " is "
346
  msgstr ""
347
 
348
- #: ../admin/partials/nginx-helper-general-options.php:348
349
- msgid "published"
350
- msgstr ""
351
-
352
- #: ../admin/partials/nginx-helper-general-options.php:361, ../admin/partials/nginx-helper-general-options.php:470
353
  msgid "when a comment is approved/published."
354
  msgstr ""
355
 
356
- #: ../admin/partials/nginx-helper-general-options.php:372, ../admin/partials/nginx-helper-general-options.php:396, ../admin/partials/nginx-helper-general-options.php:481, ../admin/partials/nginx-helper-general-options.php:505
357
- msgid "comment"
 
358
  msgstr ""
359
 
360
- #: ../admin/partials/nginx-helper-general-options.php:372, ../admin/partials/nginx-helper-general-options.php:481
361
- msgid "approved/published"
362
- msgstr ""
363
-
364
- #: ../admin/partials/nginx-helper-general-options.php:385, ../admin/partials/nginx-helper-general-options.php:494
365
  msgid "when a comment is unapproved/deleted."
366
  msgstr ""
367
 
368
- #: ../admin/partials/nginx-helper-general-options.php:396, ../admin/partials/nginx-helper-general-options.php:505
369
- msgid "unapproved/deleted"
 
370
  msgstr ""
371
 
372
- #: ../admin/partials/nginx-helper-general-options.php:411
373
  msgid "Purge Archives:"
374
  msgstr ""
375
 
376
- #: ../admin/partials/nginx-helper-general-options.php:413
377
  msgid "(date, category, tag, author, custom taxonomies)"
378
  msgstr ""
379
 
380
- #: ../admin/partials/nginx-helper-general-options.php:421
381
  msgid "when an post/page/custom post is modified or added"
382
  msgstr ""
383
 
384
- #: ../admin/partials/nginx-helper-general-options.php:445
385
  msgid "when an existing post/page/custom post is trashed."
386
  msgstr ""
387
 
388
- #: ../admin/partials/nginx-helper-general-options.php:519
 
 
 
 
389
  msgid "Custom Purge URL:"
390
  msgstr ""
391
 
392
- #: ../admin/partials/nginx-helper-general-options.php:537
 
 
 
 
 
 
 
 
 
 
 
 
393
  msgid "Debug Options"
394
  msgstr ""
395
 
396
- #: ../admin/partials/nginx-helper-general-options.php:547
397
  msgid "Enable Nginx Map."
398
  msgstr ""
399
 
400
- #: ../admin/partials/nginx-helper-general-options.php:556
401
  msgid "Enable Logging"
402
  msgstr ""
403
 
404
- #: ../admin/partials/nginx-helper-general-options.php:564
405
  msgid "Enable Nginx Timestamp in HTML"
406
  msgstr ""
407
 
408
- #: ../admin/partials/nginx-helper-general-options.php:578
409
  msgid "Nginx Map"
410
  msgstr ""
411
 
412
- #: ../admin/partials/nginx-helper-general-options.php:590
413
  msgid "Can't write on map file."
414
  msgstr ""
415
 
416
- #: ../admin/partials/nginx-helper-general-options.php:590, ../admin/partials/nginx-helper-general-options.php:664
417
- msgid "Check you have write permission on "
 
 
418
  msgstr ""
419
 
420
- #: ../admin/partials/nginx-helper-general-options.php:607
421
  msgid "Nginx Map path to include in nginx settings"
422
  msgstr ""
423
 
424
- #: ../admin/partials/nginx-helper-general-options.php:607
425
  msgid "(recommended)"
426
  msgstr ""
427
 
428
- #: ../admin/partials/nginx-helper-general-options.php:625
429
  msgid "Or,"
430
  msgstr ""
431
 
432
- #: ../admin/partials/nginx-helper-general-options.php:625
433
  msgid "Text to manually copy and paste in nginx settings"
434
  msgstr ""
435
 
436
- #: ../admin/partials/nginx-helper-general-options.php:625
437
  msgid "(if your network is small and new sites are not added frequently)"
438
  msgstr ""
439
 
440
- #: ../admin/partials/nginx-helper-general-options.php:645
441
  msgid "Logging Options"
442
  msgstr ""
443
 
444
- #: ../admin/partials/nginx-helper-general-options.php:664
445
  msgid "Can't write on log file."
446
  msgstr ""
447
 
448
- #: ../admin/partials/nginx-helper-general-options.php:680
449
  msgid "Logs path"
450
  msgstr ""
451
 
452
- #: ../admin/partials/nginx-helper-general-options.php:692
453
  msgid "View Log"
454
  msgstr ""
455
 
456
- #: ../admin/partials/nginx-helper-general-options.php:697
457
  msgid "Log"
458
  msgstr ""
459
 
460
- #: ../admin/partials/nginx-helper-general-options.php:704
461
  msgid "Log level"
462
  msgstr ""
463
 
464
- #: ../admin/partials/nginx-helper-general-options.php:709
465
  msgid "None"
466
  msgstr ""
467
 
468
- #: ../admin/partials/nginx-helper-general-options.php:710
469
  msgid "Info"
470
  msgstr ""
471
 
472
- #: ../admin/partials/nginx-helper-general-options.php:711
473
  msgid "Warning"
474
  msgstr ""
475
 
476
- #: ../admin/partials/nginx-helper-general-options.php:712
477
  msgid "Error"
478
  msgstr ""
479
 
480
- #: ../admin/partials/nginx-helper-general-options.php:719
481
  msgid "Max log file size"
482
  msgstr ""
483
 
484
- #: ../admin/partials/nginx-helper-general-options.php:725
485
  msgid "Mb"
486
  msgstr ""
487
 
488
- #: ../admin/partials/nginx-helper-general-options.php:741
489
  msgid "Save All Changes"
490
  msgstr ""
491
 
492
- #: ../admin/partials/nginx-helper-sidebar-display.php:26
493
  msgid "Purge Entire Cache"
494
  msgstr ""
495
 
496
- #: ../admin/partials/nginx-helper-sidebar-display.php:31
497
  msgid "Need Help?"
498
  msgstr ""
499
 
500
- #: ../admin/partials/nginx-helper-sidebar-display.php:39
501
  msgid "Please use our"
502
  msgstr ""
503
 
504
- #: ../admin/partials/nginx-helper-sidebar-display.php:39
505
  msgid "free support forum"
506
  msgstr ""
507
 
508
- #: ../admin/partials/nginx-helper-sidebar-display.php:51
509
  msgid "Getting Social is Good"
510
  msgstr ""
511
 
512
- #: ../admin/partials/nginx-helper-sidebar-display.php:55
513
  msgid "Become a fan on Facebook"
514
  msgstr ""
515
 
516
- #: ../admin/partials/nginx-helper-sidebar-display.php:56
517
  msgid "Follow us on Twitter"
518
  msgstr ""
519
 
520
- #: ../admin/partials/nginx-helper-sidebar-display.php:57
521
- msgid "Add to Circle"
522
- msgstr ""
523
-
524
- #: ../admin/partials/nginx-helper-sidebar-display.php:58
525
- msgid "Subscribe to our feeds"
526
- msgstr ""
527
-
528
- #: ../admin/partials/nginx-helper-sidebar-display.php:64
529
  msgid "Useful Links"
530
  msgstr ""
531
 
532
- #: ../admin/partials/nginx-helper-sidebar-display.php:69, ../admin/partials/nginx-helper-sidebar-display.php:69
533
  msgid "WordPress-Nginx Solutions"
534
  msgstr ""
535
 
536
- #: ../admin/partials/nginx-helper-sidebar-display.php:72, ../admin/partials/nginx-helper-sidebar-display.php:72
537
  msgid "WordPress Theme Devleopment"
538
  msgstr ""
539
 
540
- #: ../admin/partials/nginx-helper-sidebar-display.php:75, ../admin/partials/nginx-helper-sidebar-display.php:75
541
  msgid "WordPress Plugin Development"
542
  msgstr ""
543
 
544
- #: ../admin/partials/nginx-helper-sidebar-display.php:78, ../admin/partials/nginx-helper-sidebar-display.php:78
545
  msgid "WordPress Consultancy"
546
  msgstr ""
547
 
548
- #: ../admin/partials/nginx-helper-sidebar-display.php:81, ../admin/partials/nginx-helper-sidebar-display.php:81
549
  msgid "easyengine (ee)"
550
  msgstr ""
551
 
552
- #: ../admin/partials/nginx-helper-sidebar-display.php:88
553
  msgid "Click to toggle"
554
  msgstr ""
555
 
556
- #: ../admin/partials/nginx-helper-sidebar-display.php:89
557
  msgid "Latest News"
558
  msgstr ""
559
 
560
- #: ../admin/partials/nginx-helper-sidebar-display.php:90
561
  msgid "Loading..."
562
  msgstr ""
563
 
564
- #: ../admin/partials/nginx-helper-support-options.php:18
565
  msgid "Support Forums"
566
  msgstr ""
567
 
568
- #: ../admin/partials/nginx-helper-support-options.php:24
569
  msgid "Free Support"
570
  msgstr ""
571
 
572
- #: ../admin/partials/nginx-helper-support-options.php:27
573
  msgid "Free Support Forum"
574
  msgstr ""
575
 
576
- #: ../admin/partials/nginx-helper-support-options.php:28, ../admin/partials/nginx-helper-support-options.php:38
 
577
  msgid "Link to forum"
578
  msgstr ""
579
 
580
- #: ../admin/partials/nginx-helper-support-options.php:34
581
  msgid "Premium Support"
582
  msgstr ""
583
 
584
- #: ../admin/partials/nginx-helper-support-options.php:37
585
  msgid "Premium Support Forum"
586
  msgstr ""
587
 
588
- #: ../includes/class-nginx-helper-activator.php:49
 
 
 
 
589
  msgid "Sorry, you need to be an administrator to use Nginx Helper"
590
  msgstr ""
591
 
592
  #. translators: %s is Minimum WP version.
593
- #: ../includes/class-nginx-helper.php:309
594
  msgid "Sorry, Nginx Helper requires WordPress %s or higher"
595
  msgstr ""
596
-
597
- #: ../wp-cli.php:40
598
- msgid "Purged Everything!"
599
- msgstr ""
1
+ # Copyright (C) 2020 rtCamp
2
+ # This file is distributed under the same license as the Nginx Helper plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Nginx Helper 2.2.0\n"
6
+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/nginx-helper\n"
7
  "MIME-Version: 1.0\n"
8
  "Content-Type: text/plain; charset=UTF-8\n"
9
  "Content-Transfer-Encoding: 8bit\n"
10
+ "POT-Creation-Date: 2020-01-06T11:08:02+05:30\n"
11
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12
+ "X-Generator: WP-CLI 2.4.0\n"
13
+ "X-Domain: nginx-helper\n"
14
+
15
+ #. Plugin Name of the plugin
16
+ #: admin/class-nginx-helper-admin.php:177
17
+ #: admin/class-nginx-helper-admin.php:178
18
+ #: admin/class-nginx-helper-admin.php:188
19
+ #: admin/class-nginx-helper-admin.php:189
20
+ msgid "Nginx Helper"
21
+ msgstr ""
22
+
23
+ #. Plugin URI of the plugin
24
+ msgid "https://rtcamp.com/nginx-helper/"
25
+ msgstr ""
26
+
27
+ #. Description of the plugin
28
+ msgid "Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does few more things."
29
+ msgstr ""
30
+
31
+ #. Author of the plugin
32
+ msgid "rtCamp"
33
+ msgstr ""
34
+
35
+ #. Author URI of the plugin
36
+ msgid "https://rtcamp.com"
37
+ msgstr ""
38
+
39
+ #: admin/class-nginx-helper-admin.php:88
40
  msgid "General"
41
  msgstr ""
42
 
43
+ #: admin/class-nginx-helper-admin.php:92
44
  msgid "Support"
45
  msgstr ""
46
 
47
+ #: admin/class-nginx-helper-admin.php:160
48
+ msgid "Purging entire cache is not recommended. Would you like to continue?"
49
  msgstr ""
50
 
51
+ #: admin/class-nginx-helper-admin.php:212
52
  msgid "Purge Cache"
53
  msgstr ""
54
 
55
+ #: admin/class-nginx-helper-admin.php:215
56
+ msgid "Purge Current Page"
57
+ msgstr ""
58
+
59
+ #: admin/class-nginx-helper-admin.php:341
60
  msgid "Settings"
61
  msgstr ""
62
 
63
+ #: admin/class-nginx-helper-admin.php:404
64
  msgid "No items"
65
  msgstr ""
66
 
67
+ #: admin/class-nginx-helper-admin.php:415
68
  msgid "Posted "
69
  msgstr ""
70
 
71
+ #: admin/class-nginx-helper-admin.php:729
72
  msgid "Purge initiated"
73
  msgstr ""
74
 
75
+ #: admin/class-purger.php:686
76
  msgid "Purging homepage (WPML) "
77
  msgstr ""
78
 
79
+ #: admin/class-purger.php:691
80
  msgid "Purging homepage "
81
  msgstr ""
82
 
83
+ #: admin/class-purger.php:710
84
  msgid "Purging personal urls"
85
  msgstr ""
86
 
87
+ #: admin/class-purger.php:718
88
  msgid "No personal urls available"
89
  msgstr ""
90
 
91
+ #: admin/class-purger.php:734
92
  msgid "Purging category archives"
93
  msgstr ""
94
 
95
+ #. translators: %d: Category ID.
96
+ #: admin/class-purger.php:743
97
  msgid "Purging category '%d'"
98
  msgstr ""
99
 
100
+ #: admin/class-purger.php:761
101
  msgid "Purging tags archives"
102
  msgstr ""
103
 
104
+ #: admin/class-purger.php:769
105
+ #: admin/class-purger.php:869
106
  msgid "Purging tag '%1$s' ( id %2$d )"
107
  msgstr ""
108
 
109
+ #: admin/class-purger.php:788
110
  msgid "Purging post custom taxonomies related"
111
  msgstr ""
112
 
113
+ #. translators: %s: Post taxonomy name.
114
+ #. translators: %s: Taxonomy name.
115
+ #: admin/class-purger.php:802
116
+ #: admin/class-purger.php:902
117
  msgid "Purging custom taxonomy '%s'"
118
  msgstr ""
119
 
120
+ #. translators: %s: Post taxonomy name.
121
+ #. translators: %s: Taxonomy name.
122
+ #: admin/class-purger.php:816
123
+ #: admin/class-purger.php:918
124
  msgid "Your built-in taxonomy '%s' has param '_builtin' set to false."
125
  msgstr ""
126
 
127
+ #: admin/class-purger.php:820
128
+ #: admin/class-purger.php:922
129
  msgid "No custom taxonomies"
130
  msgstr ""
131
 
132
+ #: admin/class-purger.php:833
133
  msgid "Purging all categories"
134
  msgstr ""
135
 
136
+ #: admin/class-purger.php:841
137
  msgid "Purging category '%1$s' ( id %2$d )"
138
  msgstr ""
139
 
140
+ #: admin/class-purger.php:847
141
  msgid "No categories archives"
142
  msgstr ""
143
 
144
+ #: admin/class-purger.php:861
145
  msgid "Purging all tags"
146
  msgstr ""
147
 
148
+ #: admin/class-purger.php:874
149
  msgid "No tags archives"
150
  msgstr ""
151
 
152
+ #: admin/class-purger.php:888
153
  msgid "Purging all custom taxonomies"
154
  msgstr ""
155
 
156
+ #: admin/class-purger.php:949
157
  msgid "Purging all posts, pages and custom post types."
158
  msgstr ""
159
 
160
+ #: admin/class-purger.php:964
161
  msgid "Purging post id '%1$d' ( post type '%2$s' )"
162
  msgstr ""
163
 
164
+ #: admin/class-purger.php:969
165
  msgid "No posts"
166
  msgstr ""
167
 
168
+ #: admin/class-purger.php:983
169
  msgid "Purging all date-based archives."
170
  msgstr ""
171
 
172
+ #: admin/class-purger.php:1000
173
  msgid "Purging all daily archives."
174
  msgstr ""
175
 
176
+ #: admin/class-purger.php:1023
177
  msgid "Purging daily archive '%1$s/%2$s/%3$s'"
178
  msgstr ""
179
 
180
+ #: admin/class-purger.php:1034
181
  msgid "No daily archives"
182
  msgstr ""
183
 
184
+ #: admin/class-purger.php:1046
185
  msgid "Purging all monthly archives."
186
  msgstr ""
187
 
188
+ #: admin/class-purger.php:1074
189
  msgid "Purging monthly archive '%1$s/%2$s'"
190
  msgstr ""
191
 
192
+ #: admin/class-purger.php:1079
193
  msgid "No monthly archives"
194
  msgstr ""
195
 
196
+ #: admin/class-purger.php:1091
197
  msgid "Purging all yearly archives."
198
  msgstr ""
199
 
200
+ #. translators: %s: Year to purge cache.
201
+ #: admin/class-purger.php:1119
202
  msgid "Purging yearly archive '%s'"
203
  msgstr ""
204
 
205
+ #: admin/class-purger.php:1124
206
  msgid "No yearly archives"
207
  msgstr ""
208
 
209
+ #: admin/class-purger.php:1136
210
  msgid "Let's purge everything!"
211
  msgstr ""
212
 
213
+ #: admin/class-purger.php:1142
214
  msgid "Everything purged!"
215
  msgstr ""
216
 
217
+ #: admin/class-purger.php:1165
218
  msgid "Term taxonomy edited or deleted"
219
  msgstr ""
220
 
221
+ #: admin/class-purger.php:1172
222
  msgid "Term taxonomy '%1$s' edited, (tt_id '%2$d', term_id '%3$d', taxonomy '%4$s')"
223
  msgstr ""
224
 
225
+ #: admin/class-purger.php:1176
226
  msgid "A term taxonomy has been deleted from taxonomy '%1$s', (tt_id '%2$d', term_id '%3$d')"
227
  msgstr ""
228
 
229
+ #: admin/class-purger.php:1204
230
  msgid "Widget saved, moved or removed in a sidebar"
231
  msgstr ""
232
 
233
+ #: admin/partials/nginx-helper-admin-display.php:21
234
  msgid "Nginx Settings"
235
  msgstr ""
236
 
237
+ #: admin/partials/nginx-helper-general-options.php:56
238
  msgid "Log file size must be a number."
239
  msgstr ""
240
 
241
+ #: admin/partials/nginx-helper-general-options.php:66
242
  msgid "Settings saved."
243
  msgstr ""
244
 
245
+ #: admin/partials/nginx-helper-general-options.php:93
246
  msgid "Purging Options"
247
  msgstr ""
248
 
249
+ #: admin/partials/nginx-helper-general-options.php:100
250
  msgid "Enable Purge"
251
  msgstr ""
252
 
253
+ #: admin/partials/nginx-helper-general-options.php:110
254
  msgid "Caching Method"
255
  msgstr ""
256
 
257
+ #: admin/partials/nginx-helper-general-options.php:122
258
  msgid "nginx Fastcgi cache"
259
  msgstr ""
260
 
261
+ #: admin/partials/nginx-helper-general-options.php:124
262
  msgid "External settings for nginx"
263
  msgstr ""
264
 
265
+ #: admin/partials/nginx-helper-general-options.php:125
266
  msgid "requires external settings for nginx"
267
  msgstr ""
268
 
269
+ #: admin/partials/nginx-helper-general-options.php:135
270
  msgid "Redis cache"
271
  msgstr ""
272
 
273
+ #: admin/partials/nginx-helper-general-options.php:145
274
  msgid "Purge Method"
275
  msgstr ""
276
 
277
+ #: admin/partials/nginx-helper-general-options.php:155
278
+ #: admin/partials/nginx-helper-general-options.php:335
279
  msgid "when a post/page/custom post is published."
280
  msgstr ""
281
 
282
+ #: admin/partials/nginx-helper-general-options.php:165
283
  msgid "Using a GET request to"
284
  msgstr ""
285
 
286
+ #: admin/partials/nginx-helper-general-options.php:166
287
  msgid "(Default option)"
288
  msgstr ""
289
 
290
+ #. translators: %s Nginx cache purge module link.
291
+ #: admin/partials/nginx-helper-general-options.php:177
292
+ msgid "Uses the %s module."
 
 
 
293
  msgstr ""
294
 
295
+ #: admin/partials/nginx-helper-general-options.php:195
296
  msgid "Delete local server cache files"
297
  msgstr ""
298
 
299
+ #: admin/partials/nginx-helper-general-options.php:201
300
+ msgid "Checks for matching cache file in <strong>RT_WP_NGINX_HELPER_CACHE_PATH</strong>. Does not require any other modules. Requires that the cache be stored on the same server as WordPress. You must also be using the default nginx cache options (levels=1:2) and (fastcgi_cache_key \"$scheme$request_method$host$request_uri\")."
301
  msgstr ""
302
 
303
+ #: admin/partials/nginx-helper-general-options.php:216
 
 
 
 
304
  msgid "Redis Settings"
305
  msgstr ""
306
 
307
+ #: admin/partials/nginx-helper-general-options.php:221
308
  msgid "Hostname"
309
  msgstr ""
310
 
311
+ #: admin/partials/nginx-helper-general-options.php:228
312
+ #: admin/partials/nginx-helper-general-options.php:243
313
+ #: admin/partials/nginx-helper-general-options.php:258
314
  msgid "Overridden by constant variables."
315
  msgstr ""
316
 
317
+ #: admin/partials/nginx-helper-general-options.php:236
318
  msgid "Port"
319
  msgstr ""
320
 
321
+ #: admin/partials/nginx-helper-general-options.php:251
322
  msgid "Prefix"
323
  msgstr ""
324
 
325
+ #: admin/partials/nginx-helper-general-options.php:271
326
  msgid "Purging Conditions"
327
  msgstr ""
328
 
329
+ #: admin/partials/nginx-helper-general-options.php:276
330
  msgid "Purge Homepage:"
331
  msgstr ""
332
 
333
+ #: admin/partials/nginx-helper-general-options.php:283
334
  msgid "when a post/page/custom post is modified or added."
335
  msgstr ""
336
 
337
+ #: admin/partials/nginx-helper-general-options.php:292
338
+ #: admin/partials/nginx-helper-general-options.php:419
339
+ msgid "when a <strong>post</strong> (or page/custom post) is <strong>modified</strong> or <strong>added</strong>."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
340
  msgstr ""
341
 
342
+ #: admin/partials/nginx-helper-general-options.php:304
 
 
 
 
343
  msgid "when an existing post/page/custom post is modified."
344
  msgstr ""
345
 
346
+ #: admin/partials/nginx-helper-general-options.php:313
347
+ msgid "when a <strong>published post</strong> (or page/custom post) is <strong>trashed</strong>"
 
 
 
 
348
  msgstr ""
349
 
350
+ #: admin/partials/nginx-helper-general-options.php:327
351
  msgid "Purge Post/Page/Custom Post Type:"
352
  msgstr ""
353
 
354
+ #: admin/partials/nginx-helper-general-options.php:344
355
+ msgid "when a <strong>post</strong> is <strong>published</strong>."
356
  msgstr ""
357
 
358
+ #: admin/partials/nginx-helper-general-options.php:356
359
+ #: admin/partials/nginx-helper-general-options.php:453
 
 
 
360
  msgid "when a comment is approved/published."
361
  msgstr ""
362
 
363
+ #: admin/partials/nginx-helper-general-options.php:365
364
+ #: admin/partials/nginx-helper-general-options.php:462
365
+ msgid "when a <strong>comment</strong> is <strong>approved/published</strong>."
366
  msgstr ""
367
 
368
+ #: admin/partials/nginx-helper-general-options.php:377
369
+ #: admin/partials/nginx-helper-general-options.php:474
 
 
 
370
  msgid "when a comment is unapproved/deleted."
371
  msgstr ""
372
 
373
+ #: admin/partials/nginx-helper-general-options.php:386
374
+ #: admin/partials/nginx-helper-general-options.php:483
375
+ msgid "when a <strong>comment</strong> is <strong>unapproved/deleted</strong>."
376
  msgstr ""
377
 
378
+ #: admin/partials/nginx-helper-general-options.php:400
379
  msgid "Purge Archives:"
380
  msgstr ""
381
 
382
+ #: admin/partials/nginx-helper-general-options.php:402
383
  msgid "(date, category, tag, author, custom taxonomies)"
384
  msgstr ""
385
 
386
+ #: admin/partials/nginx-helper-general-options.php:410
387
  msgid "when an post/page/custom post is modified or added"
388
  msgstr ""
389
 
390
+ #: admin/partials/nginx-helper-general-options.php:431
391
  msgid "when an existing post/page/custom post is trashed."
392
  msgstr ""
393
 
394
+ #: admin/partials/nginx-helper-general-options.php:440
395
+ msgid "when a <strong>published post</strong> (or page/custom post) is <strong>trashed</strong>."
396
+ msgstr ""
397
+
398
+ #: admin/partials/nginx-helper-general-options.php:496
399
  msgid "Custom Purge URL:"
400
  msgstr ""
401
 
402
+ #: admin/partials/nginx-helper-general-options.php:502
403
+ msgid "Add one URL per line. URL should not contain domain name."
404
+ msgstr ""
405
+
406
+ #: admin/partials/nginx-helper-general-options.php:505
407
+ msgid "Eg: To purge http://example.com/sample-page/ add <strong>/sample-page/</strong> in above textarea."
408
+ msgstr ""
409
+
410
+ #: admin/partials/nginx-helper-general-options.php:509
411
+ msgid "'*' will only work with redis cache server."
412
+ msgstr ""
413
+
414
+ #: admin/partials/nginx-helper-general-options.php:519
415
  msgid "Debug Options"
416
  msgstr ""
417
 
418
+ #: admin/partials/nginx-helper-general-options.php:529
419
  msgid "Enable Nginx Map."
420
  msgstr ""
421
 
422
+ #: admin/partials/nginx-helper-general-options.php:538
423
  msgid "Enable Logging"
424
  msgstr ""
425
 
426
+ #: admin/partials/nginx-helper-general-options.php:546
427
  msgid "Enable Nginx Timestamp in HTML"
428
  msgstr ""
429
 
430
+ #: admin/partials/nginx-helper-general-options.php:560
431
  msgid "Nginx Map"
432
  msgstr ""
433
 
434
+ #: admin/partials/nginx-helper-general-options.php:569
435
  msgid "Can't write on map file."
436
  msgstr ""
437
 
438
+ #. translators: %s file url.
439
+ #: admin/partials/nginx-helper-general-options.php:574
440
+ #: admin/partials/nginx-helper-general-options.php:646
441
+ msgid "Check you have write permission on <strong>%s</strong>"
442
  msgstr ""
443
 
444
+ #: admin/partials/nginx-helper-general-options.php:591
445
  msgid "Nginx Map path to include in nginx settings"
446
  msgstr ""
447
 
448
+ #: admin/partials/nginx-helper-general-options.php:592
449
  msgid "(recommended)"
450
  msgstr ""
451
 
452
+ #: admin/partials/nginx-helper-general-options.php:605
453
  msgid "Or,"
454
  msgstr ""
455
 
456
+ #: admin/partials/nginx-helper-general-options.php:606
457
  msgid "Text to manually copy and paste in nginx settings"
458
  msgstr ""
459
 
460
+ #: admin/partials/nginx-helper-general-options.php:607
461
  msgid "(if your network is small and new sites are not added frequently)"
462
  msgstr ""
463
 
464
+ #: admin/partials/nginx-helper-general-options.php:625
465
  msgid "Logging Options"
466
  msgstr ""
467
 
468
+ #: admin/partials/nginx-helper-general-options.php:641
469
  msgid "Can't write on log file."
470
  msgstr ""
471
 
472
+ #: admin/partials/nginx-helper-general-options.php:663
473
  msgid "Logs path"
474
  msgstr ""
475
 
476
+ #: admin/partials/nginx-helper-general-options.php:675
477
  msgid "View Log"
478
  msgstr ""
479
 
480
+ #: admin/partials/nginx-helper-general-options.php:680
481
  msgid "Log"
482
  msgstr ""
483
 
484
+ #: admin/partials/nginx-helper-general-options.php:687
485
  msgid "Log level"
486
  msgstr ""
487
 
488
+ #: admin/partials/nginx-helper-general-options.php:692
489
  msgid "None"
490
  msgstr ""
491
 
492
+ #: admin/partials/nginx-helper-general-options.php:693
493
  msgid "Info"
494
  msgstr ""
495
 
496
+ #: admin/partials/nginx-helper-general-options.php:694
497
  msgid "Warning"
498
  msgstr ""
499
 
500
+ #: admin/partials/nginx-helper-general-options.php:695
501
  msgid "Error"
502
  msgstr ""
503
 
504
+ #: admin/partials/nginx-helper-general-options.php:702
505
  msgid "Max log file size"
506
  msgstr ""
507
 
508
+ #: admin/partials/nginx-helper-general-options.php:708
509
  msgid "Mb"
510
  msgstr ""
511
 
512
+ #: admin/partials/nginx-helper-general-options.php:724
513
  msgid "Save All Changes"
514
  msgstr ""
515
 
516
+ #: admin/partials/nginx-helper-sidebar-display.php:26
517
  msgid "Purge Entire Cache"
518
  msgstr ""
519
 
520
+ #: admin/partials/nginx-helper-sidebar-display.php:31
521
  msgid "Need Help?"
522
  msgstr ""
523
 
524
+ #: admin/partials/nginx-helper-sidebar-display.php:38
525
  msgid "Please use our"
526
  msgstr ""
527
 
528
+ #: admin/partials/nginx-helper-sidebar-display.php:40
529
  msgid "free support forum"
530
  msgstr ""
531
 
532
+ #: admin/partials/nginx-helper-sidebar-display.php:50
533
  msgid "Getting Social is Good"
534
  msgstr ""
535
 
536
+ #: admin/partials/nginx-helper-sidebar-display.php:54
537
  msgid "Become a fan on Facebook"
538
  msgstr ""
539
 
540
+ #: admin/partials/nginx-helper-sidebar-display.php:55
541
  msgid "Follow us on Twitter"
542
  msgstr ""
543
 
544
+ #: admin/partials/nginx-helper-sidebar-display.php:61
 
 
 
 
 
 
 
 
545
  msgid "Useful Links"
546
  msgstr ""
547
 
548
+ #: admin/partials/nginx-helper-sidebar-display.php:66
549
  msgid "WordPress-Nginx Solutions"
550
  msgstr ""
551
 
552
+ #: admin/partials/nginx-helper-sidebar-display.php:69
553
  msgid "WordPress Theme Devleopment"
554
  msgstr ""
555
 
556
+ #: admin/partials/nginx-helper-sidebar-display.php:72
557
  msgid "WordPress Plugin Development"
558
  msgstr ""
559
 
560
+ #: admin/partials/nginx-helper-sidebar-display.php:75
561
  msgid "WordPress Consultancy"
562
  msgstr ""
563
 
564
+ #: admin/partials/nginx-helper-sidebar-display.php:78
565
  msgid "easyengine (ee)"
566
  msgstr ""
567
 
568
+ #: admin/partials/nginx-helper-sidebar-display.php:85
569
  msgid "Click to toggle"
570
  msgstr ""
571
 
572
+ #: admin/partials/nginx-helper-sidebar-display.php:86
573
  msgid "Latest News"
574
  msgstr ""
575
 
576
+ #: admin/partials/nginx-helper-sidebar-display.php:87
577
  msgid "Loading..."
578
  msgstr ""
579
 
580
+ #: admin/partials/nginx-helper-support-options.php:18
581
  msgid "Support Forums"
582
  msgstr ""
583
 
584
+ #: admin/partials/nginx-helper-support-options.php:24
585
  msgid "Free Support"
586
  msgstr ""
587
 
588
+ #: admin/partials/nginx-helper-support-options.php:27
589
  msgid "Free Support Forum"
590
  msgstr ""
591
 
592
+ #: admin/partials/nginx-helper-support-options.php:28
593
+ #: admin/partials/nginx-helper-support-options.php:38
594
  msgid "Link to forum"
595
  msgstr ""
596
 
597
+ #: admin/partials/nginx-helper-support-options.php:34
598
  msgid "Premium Support"
599
  msgstr ""
600
 
601
+ #: admin/partials/nginx-helper-support-options.php:37
602
  msgid "Premium Support Forum"
603
  msgstr ""
604
 
605
+ #: class-nginx-helper-wp-cli-command.php:40
606
+ msgid "Purged Everything!"
607
+ msgstr ""
608
+
609
+ #: includes/class-nginx-helper-activator.php:49
610
  msgid "Sorry, you need to be an administrator to use Nginx Helper"
611
  msgstr ""
612
 
613
  #. translators: %s is Minimum WP version.
614
+ #: includes/class-nginx-helper.php:311
615
  msgid "Sorry, Nginx Helper requires WordPress %s or higher"
616
  msgstr ""
 
 
 
 
nginx-helper.php CHANGED
@@ -3,13 +3,13 @@
3
  * Plugin Name: Nginx Helper
4
  * Plugin URI: https://rtcamp.com/nginx-helper/
5
  * Description: Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does few more things.
6
- * Version: 2.1.0
7
  * Author: rtCamp
8
  * Author URI: https://rtcamp.com
9
  * Text Domain: nginx-helper
10
  * Domain Path: /languages
11
  * Requires at least: 3.0
12
- * Tested up to: 5.2.2
13
  *
14
  * @link https://rtcamp.com/nginx-helper/
15
  * @since 2.0.0
@@ -88,7 +88,7 @@ function run_nginx_helper() {
88
  // Load WP-CLI command.
89
  if ( defined( 'WP_CLI' ) && WP_CLI ) {
90
 
91
- require_once NGINX_HELPER_BASEPATH . 'wp-cli.php';
92
  \WP_CLI::add_command( 'nginx-helper', 'Nginx_Helper_WP_CLI_Command' );
93
 
94
  }
3
  * Plugin Name: Nginx Helper
4
  * Plugin URI: https://rtcamp.com/nginx-helper/
5
  * Description: Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does few more things.
6
+ * Version: 2.2.0
7
  * Author: rtCamp
8
  * Author URI: https://rtcamp.com
9
  * Text Domain: nginx-helper
10
  * Domain Path: /languages
11
  * Requires at least: 3.0
12
+ * Tested up to: 5.3.2
13
  *
14
  * @link https://rtcamp.com/nginx-helper/
15
  * @since 2.0.0
88
  // Load WP-CLI command.
89
  if ( defined( 'WP_CLI' ) && WP_CLI ) {
90
 
91
+ require_once NGINX_HELPER_BASEPATH . 'class-nginx-helper-wp-cli-command.php';
92
  \WP_CLI::add_command( 'nginx-helper', 'Nginx_Helper_WP_CLI_Command' );
93
 
94
  }
phpcs.xml CHANGED
@@ -1,60 +1,66 @@
1
  <?xml version="1.0"?>
2
  <ruleset name="WordPress Coding Standards">
3
 
4
- <!-- Set a description for this ruleset. -->
5
- <description>A custom set of code standard rules to check for Nginx helper plugin.</description>
6
 
7
- <!-- Pass some flags to PHPCS:
8
  p flag: Show progress of the run.
9
  s flag: Show sniff codes in all reports.
10
  -->
11
- <arg value="psvn"/>
12
-
13
- <!-- Check up to 8 files simultanously. -->
14
- <arg name="parallel" value="8"/>
15
-
16
- <!-- Only check the PHP files. JS files are checked separately with JSCS and JSHint. -->
17
- <arg name="extensions" value="php"/>
18
-
19
- <!-- Check all files in this directory and the directories below it. -->
20
- <file>.</file>
21
-
22
- <!-- Exclude folders. -->
23
- <exclude-pattern>*/languages/*</exclude-pattern>
24
- <exclude-pattern>*/admin/predis.php</exclude-pattern> <!-- Predis library file -->
25
-
26
- <!-- Include the WordPress standard. -->
27
- <rule ref="WordPress-VIP-Go">
28
- <exclude name="WordPress.VIP.FileSystemWritesDisallow.directory_mkdir" />
29
- <exclude name="WordPress.WP.AlternativeFunctions.file_system_read_fopen" />
30
- <exclude name="WordPress.VIP.FileSystemWritesDisallow.file_ops_is_writable" />
31
- <exclude name="WordPress.WP.AlternativeFunctions.file_system_read_fclose" />
32
- <exclude name="WordPress.VIP.FileSystemWritesDisallow.file_ops_fwrite" />
33
- <exclude name="WordPress.VIP.FileSystemWritesDisallow.directory_rmdir" />
34
- <exclude name="WordPress.WP.AlternativeFunctions.file_system_read_fwrite" />
35
- <exclude name="WordPress.VIP.FileSystemWritesDisallow.file_ops_unlink" />
36
- </rule>
37
- <rule ref="WordPress-Docs"/>
38
-
39
- <!-- Verify that the text_domain is set to the desired text-domain.
 
 
 
 
 
 
40
  Multiple valid text domains can be provided as a comma-delimited list. -->
41
- <rule ref="WordPress.WP.I18n">
42
- <properties>
43
- <property name="text_domain" type="array" value="nginx-helper" />
44
- </properties>
45
- </rule>
46
 
47
- <!-- Verify that no WP functions are used which are deprecated or have been removed.
48
  The minimum version set here should be in line with the minimum WP version
49
  as set in the "Requires at least" tag in the readme.txt file. -->
50
- <rule ref="WordPress.WP.DeprecatedFunctions">
51
- <properties>
52
- <property name="minimum_supported_version" value="3.0" />
53
- </properties>
54
- </rule>
55
 
56
- <!-- Include sniffs for PHP cross-version compatibility. -->
57
- <rule ref="PHPCompatibility"/>
58
- <config name="testVersion" value="5.3-99.0"/>
59
 
60
- </ruleset>
1
  <?xml version="1.0"?>
2
  <ruleset name="WordPress Coding Standards">
3
 
4
+ <!-- Set a description for this ruleset. -->
5
+ <description>A custom set of code standard rules to check for Nginx helper plugin.</description>
6
 
7
+ <!-- Pass some flags to PHPCS:
8
  p flag: Show progress of the run.
9
  s flag: Show sniff codes in all reports.
10
  -->
11
+ <arg value="psvn"/>
12
+
13
+ <!-- Check up to 8 files simultanously. -->
14
+ <arg name="parallel" value="8"/>
15
+
16
+ <!-- Check PHP and JS files. -->
17
+ <arg name="extensions" value="php,js"/>
18
+
19
+ <!-- Check all files in this directory and the directories below it. -->
20
+ <file>.</file>
21
+
22
+ <!-- Exclude folders. -->
23
+ <exclude-pattern>*/languages/*</exclude-pattern>
24
+ <exclude-pattern>*/admin/predis.php</exclude-pattern> <!-- Predis library file -->
25
+ <exclude-pattern>*/vendor/*</exclude-pattern> <!-- Composer vendor directory -->
26
+
27
+ <!-- Include the WordPress standard. -->
28
+ <rule ref="WordPress">
29
+ <exclude name="PEAR.NamingConventions.ValidClassName.Invalid" />
30
+ <exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
31
+ </rule>
32
+ <rule ref="WordPress-VIP-Go">
33
+ <exclude name="WordPress.VIP.FileSystemWritesDisallow.directory_mkdir" />
34
+ <exclude name="WordPress.WP.AlternativeFunctions.file_system_read_fopen" />
35
+ <exclude name="WordPress.VIP.FileSystemWritesDisallow.file_ops_is_writable" />
36
+ <exclude name="WordPress.WP.AlternativeFunctions.file_system_read_fclose" />
37
+ <exclude name="WordPress.VIP.FileSystemWritesDisallow.file_ops_fwrite" />
38
+ <exclude name="WordPress.VIP.FileSystemWritesDisallow.directory_rmdir" />
39
+ <exclude name="WordPress.WP.AlternativeFunctions.file_system_read_fwrite" />
40
+ <exclude name="WordPress.VIP.FileSystemWritesDisallow.file_ops_unlink" />
41
+ <exclude name="WordPressVIPMinimum.Functions.RestrictedFunctions.directory_mkdir" />
42
+ <exclude name="WordPressVIPMinimum.Functions.RestrictedFunctions.directory_rmdir" />
43
+ </rule>
44
+
45
+ <!-- Verify that the text_domain is set to the desired text-domain.
46
  Multiple valid text domains can be provided as a comma-delimited list. -->
47
+ <rule ref="WordPress.WP.I18n">
48
+ <properties>
49
+ <property name="text_domain" type="array" value="nginx-helper" />
50
+ </properties>
51
+ </rule>
52
 
53
+ <!-- Verify that no WP functions are used which are deprecated or have been removed.
54
  The minimum version set here should be in line with the minimum WP version
55
  as set in the "Requires at least" tag in the readme.txt file. -->
56
+ <rule ref="WordPress.WP.DeprecatedFunctions">
57
+ <properties>
58
+ <property name="minimum_supported_version" value="3.0" />
59
+ </properties>
60
+ </rule>
61
 
62
+ <!-- Include sniffs for PHP cross-version compatibility. -->
63
+ <rule ref="PHPCompatibility"/>
64
+ <config name="testVersion" value="5.3-99.0"/>
65
 
66
+ </ruleset>
readme.txt CHANGED
@@ -1,12 +1,12 @@
1
  === Nginx Helper ===
2
- Contributors: rtcamp, rahul286, saurabhshukla, manishsongirkar36, faishal, desaiuditd, darren-slatten, jk3us, daankortenbach, telofy, pjv, llonchj, jinnko, weskoop, bcole808, gungeekatx, rohanveer, chandrapatel, gagan0123, ravanh, michaelbeil, samedwards, niwreg, entr, nuvoPoint, iam404, rittesh.patel, vishalkakadiya, BhargavBhandari90, vincent-lu, murrayjbrown, bryant1410, 1gor, matt-h, pySilver, johan-chassaing, dotsam, sanketio, petenelson, nathanielks, rigagoogoo, dslatten, jinschoi, kelin1003, vaishuagola27, rahulsprajapati, Joel-James, utkarshpatel, gsayed786, shashwatmittal, sudhiryadav, thrijith
3
  Donate Link: http://rtcamp.com/donate/
4
  Tags: nginx, cache, purge, nginx map, nginx cache, maps, fastcgi, proxy, redis, redis-cache, rewrite, permalinks
5
  License: GPLv2 or later (of-course)
6
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  Requires at least: 3.0
8
- Tested up to: 5.2.2
9
- Stable tag: 2.1.0
10
 
11
  Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does a few more things.
12
 
@@ -127,6 +127,14 @@ Please post your problem in [our free support forum](http://community.rtcamp.com
127
 
128
  == Changelog ==
129
 
 
 
 
 
 
 
 
 
130
  = 2.1.0 =
131
  * Add wildcard cache key deletion for device type cache purge. [#203](https://github.com/rtCamp/nginx-helper/pull/203) - by [pradeep910](https://github.com/pradeep910)
132
  * Add filter `rt_nginx_helper_purge_url` to filter the URL to be purged. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni)
@@ -395,5 +403,5 @@ Fix url escaping [#82](https://github.com/rtCamp/nginx-helper/pull/82) - by
395
 
396
  == Upgrade Notice ==
397
 
398
- = 2.1.0 =
399
- Nginx Helper 2.1.0, introduces new Hooks to extend cache purge, Adds support for wildcard cache key deletion for device type cache and bug fixes.
1
  === Nginx Helper ===
2
+ Contributors: rtcamp, rahul286, saurabhshukla, manishsongirkar36, faishal, desaiuditd, darren-slatten, jk3us, daankortenbach, telofy, pjv, llonchj, jinnko, weskoop, bcole808, gungeekatx, rohanveer, chandrapatel, gagan0123, ravanh, michaelbeil, samedwards, niwreg, entr, nuvoPoint, iam404, rittesh.patel, vishalkakadiya, BhargavBhandari90, vincent-lu, murrayjbrown, bryant1410, 1gor, matt-h, pySilver, johan-chassaing, dotsam, sanketio, petenelson, nathanielks, rigagoogoo, dslatten, jinschoi, kelin1003, vaishuagola27, rahulsprajapati, Joel-James, utkarshpatel, gsayed786, shashwatmittal, sudhiryadav, thrijith, stayallive, jaredwsmith, abhijitrakas
3
  Donate Link: http://rtcamp.com/donate/
4
  Tags: nginx, cache, purge, nginx map, nginx cache, maps, fastcgi, proxy, redis, redis-cache, rewrite, permalinks
5
  License: GPLv2 or later (of-course)
6
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  Requires at least: 3.0
8
+ Tested up to: 5.3.2
9
+ Stable tag: 2.2.0
10
 
11
  Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does a few more things.
12
 
127
 
128
  == Changelog ==
129
 
130
+ = 2.2.0 =
131
+ * Add filter `rt_nginx_helper_fastcgi_purge_suffix` to change purge suffix for FastCGI cache. [#141](https://github.com/rtCamp/nginx-helper/pull/141) - by [stayallive](https://github.com/stayallive)
132
+ * Add filter `rt_nginx_helper_fastcgi_purge_url_base` to change purge URL base for FastCGI cache. [#141](https://github.com/rtCamp/nginx-helper/pull/141) - by [stayallive](https://github.com/stayallive)
133
+ * Update our code to be in line with WordPress Coding standards in various places. [#209](https://github.com/rtCamp/nginx-helper/pull/209), [#225](https://github.com/rtCamp/nginx-helper/pull/225) - by [abhijitrakas](https://github.com/abhijitrakas), [chandrapatel](https://github.com/chandrapatel)
134
+ * Check and verify purging is enabled before purging cache. [#168](https://github.com/rtCamp/nginx-helper/pull/168) - by [jaredwsmith](https://github.com/jaredwsmith)
135
+ * Hide Purge Cache button in admin bar when purge is disabled. [#218](https://github.com/rtCamp/nginx-helper/issues/218), [#219](https://github.com/rtCamp/nginx-helper/pull/219) - by [mbautista](https://github.com/mbautista), [chandrapatel](https://github.com/mbautista)
136
+ * Don't add Nginx Timestamp on WordPress login page. [#204](https://github.com/rtCamp/nginx-helper/issues/204), [#220](https://github.com/rtCamp/nginx-helper/pull/220) - by [peixotorms](https://github.com/peixotorms), [chandrapatel](https://github.com/chandrapatel)
137
+
138
  = 2.1.0 =
139
  * Add wildcard cache key deletion for device type cache purge. [#203](https://github.com/rtCamp/nginx-helper/pull/203) - by [pradeep910](https://github.com/pradeep910)
140
  * Add filter `rt_nginx_helper_purge_url` to filter the URL to be purged. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni)
403
 
404
  == Upgrade Notice ==
405
 
406
+ = 2.2.0 =
407
+ Nginx Helper 2.2.0, introduces new Hooks to extend FastCGI cache purge, Adds check for verifying purge status before purging and other bug fixes.