Nginx Helper - Version 1.9

Version Description

Added Redis cache purge support.

Download this release

Release Info

Developer rahul286
Plugin Icon 128x128 Nginx Helper
Version 1.9
Comparing to
See all releases

Code changes from version 1.8.13 to 1.9

Files changed (45) hide show
  1. admin/assets/nginx.js +42 -26
  2. admin/assets/style.css +1 -1
  3. admin/lib/nginx-general.php +129 -65
  4. admin/lib/nginx-sidebar.php +59 -50
  5. includes/predis.php +15203 -0
  6. includes/redis-delete.php +104 -0
  7. nginx-helper.php +418 -383
  8. readme.txt +8 -5
  9. trunk/purger.php → redis-purger.php +88 -199
  10. tests/functional/custom-commands/enableAllPurgeCheckbox.js +74 -0
  11. tests/functional/custom-commands/goToAddNewPage.js +14 -0
  12. tests/functional/custom-commands/goToAddNewPost.js +16 -0
  13. tests/functional/custom-commands/nginxSettings.js +15 -0
  14. tests/functional/custom-commands/wplogin.js +14 -0
  15. tests/functional/custom-commands/wplogout.js +16 -0
  16. tests/functional/nightwatch.json +23 -0
  17. tests/functional/package.json +22 -0
  18. tests/functional/res/constants.js +15 -0
  19. tests/functional/src/purge-method-get-request-page-test.js +94 -0
  20. tests/functional/src/purge-method-get-request-post-test.js +145 -0
  21. tests/functional/src/purge-method-unlink-files-page-test.js +94 -0
  22. tests/functional/src/purge-method-unlink-files-post-test.js +145 -0
  23. trunk/admin/admin.php +0 -141
  24. trunk/admin/assets/logo.png +0 -0
  25. trunk/admin/assets/nginx-helper-icons/config.json +0 -34
  26. trunk/admin/assets/nginx-helper-icons/css/nginx-fontello.css +0 -56
  27. trunk/admin/assets/nginx-helper-icons/font/nginx-fontello.eot +0 -0
  28. trunk/admin/assets/nginx-helper-icons/font/nginx-fontello.svg +0 -15
  29. trunk/admin/assets/nginx-helper-icons/font/nginx-fontello.ttf +0 -0
  30. trunk/admin/assets/nginx-helper-icons/font/nginx-fontello.woff +0 -0
  31. trunk/admin/assets/nginx-icon-32x32.png +0 -0
  32. trunk/admin/assets/nginx.js +0 -26
  33. trunk/admin/assets/rtp-social-icons-32-32.png +0 -0
  34. trunk/admin/assets/style.css +0 -21
  35. trunk/admin/install.php +0 -98
  36. trunk/admin/lib/nginx-general.php +0 -374
  37. trunk/admin/lib/nginx-sidebar.php +0 -58
  38. trunk/admin/lib/nginx-support.php +0 -29
  39. trunk/compatibility.php +0 -37
  40. trunk/languages/nginx-helper.mo +0 -0
  41. trunk/languages/nginx-helper.po +0 -501
  42. trunk/nginx-helper.php +0 -400
  43. trunk/readme.txt +0 -297
  44. trunk/wercker.yml +0 -22
  45. trunk/wp-cli.php +0 -37
admin/assets/nginx.js CHANGED
@@ -1,26 +1,42 @@
1
- jQuery(document).ready(function() {
2
- var news_section = jQuery('#latest_news');
3
- if (news_section.length > 0) {
4
- jQuery.get(news_url, function(data) {
5
- news_section.find('.inside').html(data);
6
- });
7
- }
8
-
9
- /**
10
- * Show OR Hide options on option checkbox
11
- * @param {type} selector Selector of Checkbox and PostBox
12
- */
13
- function nginx_show_option( selector ) {
14
- jQuery( '#'+selector ).on( 'change', function (){
15
- if ( jQuery(this).is( ':checked' ) ) {
16
- jQuery( '.'+selector ).show();
17
- } else {
18
- jQuery( '.'+selector ).hide();
19
- }
20
- } );
21
- }
22
- /* Function call with parameter */
23
- nginx_show_option( 'enable_purge' );
24
- nginx_show_option( 'enable_map' );
25
- nginx_show_option( 'enable_log' );
26
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery( document ).ready( function() {
2
+ var news_section = jQuery( '#latest_news' );
3
+ if ( news_section.length > 0 ) {
4
+ jQuery.get( news_url, function( data ) {
5
+ news_section.find( '.inside' ).html( data );
6
+ } );
7
+ }
8
+
9
+ jQuery( "form#purgeall a" ).click( function( e ) {
10
+ if ( confirm( "Purging entire cache is not recommended. Would you like to continue ?" ) == true ) {
11
+ // continue submitting form
12
+ } else {
13
+ e.preventDefault();
14
+ }
15
+
16
+ } );
17
+
18
+ /**
19
+ * Show OR Hide options on option checkbox
20
+ * @param {type} selector Selector of Checkbox and PostBox
21
+ */
22
+ function nginx_show_option( selector ) {
23
+ jQuery( '#' + selector ).on( 'change', function() {
24
+ if ( jQuery( this ).is( ':checked' ) ) {
25
+ jQuery( '.' + selector ).show();
26
+ if ( selector == "cache_method_redis" ) {
27
+ jQuery( '.cache_method_fastcgi' ).hide();
28
+ } else if ( selector == "cache_method_fastcgi" ) {
29
+ jQuery( '.cache_method_redis' ).hide();
30
+ }
31
+ } else {
32
+ jQuery( '.' + selector ).hide();
33
+ }
34
+ } );
35
+ }
36
+ /* Function call with parameter */
37
+ nginx_show_option( 'cache_method_fastcgi' );
38
+ nginx_show_option( 'cache_method_redis' );
39
+ nginx_show_option( 'enable_map' );
40
+ nginx_show_option( 'enable_log' );
41
+ nginx_show_option( 'enable_purge' );
42
+ } );
admin/assets/style.css CHANGED
@@ -9,7 +9,7 @@ table.rtnginx-table:last-child { border-bottom: 0; }
9
  pre#map { background: #e5e5e5 none; border-radius: 10px; padding: 10px; }
10
  .wrap h2.rt_option_title { background: url(nginx-icon-32x32.png) 0 6px no-repeat rgba(0, 0, 0, 0); padding-left: 40px; }
11
  #poststuff h2 { padding: 0 0 0 10px; margin-top: 0; }
12
- form#purgeall .button-primary { box-shadow: inset 0 -2px rgba(0, 0, 0, 0.14);padding: 15px 30px;font-size: 1rem;border: 0;border-radius: 5px;color: #FFF;background: #DD3D36; height: auto; }
13
  form#purgeall .button-primary:hover, form#purgeall .button-primary:focus { background: #d52c24; }
14
  .nh-aligncenter { display: block; text-align: center; line-height: 2; }
15
  #latest_news .inside ul, #useful-links .inside ul { margin: 0 0 0 12px }
9
  pre#map { background: #e5e5e5 none; border-radius: 10px; padding: 10px; }
10
  .wrap h2.rt_option_title { background: url(nginx-icon-32x32.png) 0 6px no-repeat rgba(0, 0, 0, 0); padding-left: 40px; }
11
  #poststuff h2 { padding: 0 0 0 10px; margin-top: 0; }
12
+ form#purgeall .button-primary { margin-bottom: 20px; box-shadow: inset 0 -2px rgba(0, 0, 0, 0.14);padding: 15px 30px;font-size: 1rem;border: 0;border-radius: 5px;color: #FFF;background: #DD3D36; height: auto; }
13
  form#purgeall .button-primary:hover, form#purgeall .button-primary:focus { background: #d52c24; }
14
  .nh-aligncenter { display: block; text-align: center; line-height: 2; }
15
  #latest_news .inside ul, #useful-links .inside ul { margin: 0 0 0 12px }
admin/lib/nginx-general.php CHANGED
@@ -2,13 +2,15 @@
2
 
3
  namespace rtCamp\WP\Nginx {
4
 
5
- function nginx_general_options_page() {
 
6
  global $rt_wp_nginx_helper, $rt_wp_nginx_purger;
7
 
8
  $update = 0;
9
  $error_time = false;
10
  $error_log_filesize = false;
11
  $rt_wp_nginx_helper->options['enable_purge'] = (isset( $_POST['enable_purge'] ) and ( $_POST['enable_purge'] == 1) ) ? 1 : 0;
 
12
  $rt_wp_nginx_helper->options['enable_map'] = (isset( $_POST['enable_map'] ) and ( $_POST['enable_map'] == 1) ) ? 1 : 0;
13
  $rt_wp_nginx_helper->options['enable_log'] = (isset( $_POST['enable_log'] ) and ( $_POST['enable_log'] == 1) ) ? 1 : 0;
14
  $rt_wp_nginx_helper->options['enable_stamp'] = (isset( $_POST['enable_stamp'] ) and ( $_POST['enable_stamp'] == 1) ) ? 1 : 0;
@@ -51,11 +53,20 @@ namespace rtCamp\WP\Nginx {
51
 
52
  $rt_wp_nginx_helper->options['purge_method'] = ( isset( $_POST['purge_method'] ) ) ? $_POST['purge_method'] : 'get_request';
53
  }
 
 
 
 
 
54
  update_site_option( 'rt_wp_nginx_helper_options', $rt_wp_nginx_helper->options );
55
  $update = 1;
56
  }
57
  $rt_wp_nginx_helper->options = get_site_option( 'rt_wp_nginx_helper_options' );
58
 
 
 
 
 
59
  /**
60
  * Show Update Message
61
  */
@@ -77,69 +88,115 @@ namespace rtCamp\WP\Nginx {
77
  $nginx_setting_link = 'https://rtcamp.com/wordpress-nginx/tutorials/single-site/fastcgi-cache-with-purging/';
78
  }
79
  ?>
80
- <div class="postbox">
81
- <h3 class="hndle">
82
- <span><?php _e( 'Purge Cache', 'nginx-helper' ); ?></span>
83
- </h3>
84
- <form id="purgeall" action="" method="post" class="clearfix">
85
  <div class="inside">
86
- <?php $purge_url = add_query_arg( array( 'nginx_helper_action' => 'purge', 'nginx_helper_urls' => 'all' ) ); ?>
87
- <?php $nonced_url = wp_nonce_url( $purge_url, 'nginx_helper-purge_all' ); ?>
88
  <table class="form-table">
89
  <tr valign="top">
90
- <th><?php _e( 'Purge All Cache', 'nginx-helper' ); ?></th>
91
  <td>
92
- <a href="<?php echo $nonced_url; ?>" class="button-primary"><?php _e( 'Purge Cache', 'nginx-helper' ); ?></a>
 
93
  </td>
94
  </tr>
95
  </table>
96
- </div>
97
- </form>
98
- </div> <!-- End of .postbox -->
99
- <form id="post_form" method="post" action="#" name="smart_http_expire_form" class="clearfix">
100
- <div class="postbox">
101
  <h3 class="hndle">
102
- <span><?php _e( 'Plugin Options', 'nginx-helper' ); ?></span>
103
  </h3>
104
- <?php if ( !(!is_network_admin() && is_multisite() ) ) { ?>
105
  <div class="inside">
106
  <input type="hidden" name="is_submit" value="1" />
107
  <table class="form-table">
108
  <tr valign="top">
109
  <td>
110
- <input type="checkbox" value="1" id="enable_purge" name="enable_purge" <?php checked( $rt_wp_nginx_helper->options['enable_purge'], 1 ); ?> />
111
- <label for="enable_purge">
112
- <?php printf( __( 'Enable Cache Purge (<a target="_blank" href="%s" title="External settings for nginx">requires external settings for nginx</a>)', 'nginx-helper' ), $nginx_setting_link ); ?>
113
  </label>
114
  </td>
115
  </tr>
116
- <?php if ( is_network_admin() ) { ?>
117
- <tr valign="top">
118
- <td>
119
- <input type="checkbox" value="1" id="enable_map" name="enable_map"<?php checked( $rt_wp_nginx_helper->options['enable_map'], 1 ); ?> />
120
- <label for="enable_map"><?php _e( 'Enable Nginx Map.', 'nginx-helper' ); ?></label>
121
- </td>
122
- </tr>
123
- <?php } ?>
124
- <tr valign="top">
125
- <td>
126
- <input type="checkbox" value="1" id="enable_log" name="enable_log"<?php checked( $rt_wp_nginx_helper->options['enable_log'], 1 ); ?> />
127
- <label for="enable_log"><?php _e( 'Enable Logging', 'nginx-helper' ); ?></label>
128
- </td>
129
- </tr>
130
  <tr valign="top">
131
  <td>
132
- <input type="checkbox" value="1" id="enable_stamp" name="enable_stamp"<?php checked( $rt_wp_nginx_helper->options['enable_stamp'], 1 ); ?> />
133
- <label for="enable_stamp"><?php _e( 'Enable Nginx Timestamp in HTML', 'nginx-helper' ); ?></label>
 
 
134
  </td>
135
  </tr>
136
  </table>
137
  </div> <!-- End of .inside -->
138
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  <div class="postbox enable_purge"<?php echo ( $rt_wp_nginx_helper->options['enable_purge'] == false ) ? ' style="display: none;"' : ''; ?>>
141
  <h3 class="hndle">
142
- <span><?php _e( 'Purging Options', 'nginx-helper' ); ?></span>
143
  </h3>
144
  <div class="inside">
145
 
@@ -251,33 +308,39 @@ namespace rtCamp\WP\Nginx {
251
  </td>
252
  </tr>
253
  </table>
254
- <table class="form-table rtnginx-table">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
  <tr valign="top">
256
- <th scope="row">
257
- <h4><?php _e( 'Purge Method:', 'nginx-helper' ); ?></h4>
258
- </th>
259
- <td>
260
- <fieldset>
261
- <legend class="screen-reader-text">
262
- <span>&nbsp;<?php _e( 'when a post/page/custom post is published.', 'nginx-helper' ); ?></span>
263
- </legend>
264
- <label for="purge_method_get_request">
265
- <input type="radio" value="get_request" id="purge_method_get_request" name="purge_method"<?php checked( isset( $rt_wp_nginx_helper->options['purge_method'] ) ? $rt_wp_nginx_helper->options['purge_method'] : 'get_request', 'get_request' ); ?>>
266
- &nbsp;<?php _e( 'Using a GET request to <strong>PURGE/url</strong> (Default option)', 'nginx-helper' ); ?><br />
267
- <small><?php _e( 'Uses the <strong><a href="https://github.com/FRiCKLE/ngx_cache_purge">ngx_cache_purge</a></strong> module. ', 'nginx-helper' ); ?></small>
268
- </label><br />
269
- <label for="purge_method_unlink_files">
270
- <input type="radio" value="unlink_files" id="purge_method_unlink_files" name="purge_method"<?php checked( isset( $rt_wp_nginx_helper->options['purge_method'] ) ? $rt_wp_nginx_helper->options['purge_method'] : '', 'unlink_files' ); ?>>
271
- &nbsp;<?php _e( 'Delete local server cache files', 'nginx-helper' ); ?><br />
272
- <small><?php _e( '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' ); ?></small>
273
-
274
- </label><br />
275
- </fieldset>
276
- </td>
277
  </tr>
278
  </table>
279
  </div> <!-- End of .inside -->
280
- </div><?php
 
281
  } // End of if ( !( !is_network_admin() && is_multisite() ) )
282
 
283
 
@@ -307,7 +370,7 @@ namespace rtCamp\WP\Nginx {
307
  </table>
308
  </div> <!-- End of .inside -->
309
  </div>
310
- <?php } ?>
311
 
312
  <div class="postbox enable_log"<?php echo ( $rt_wp_nginx_helper->options['enable_log'] == false ) ? ' style="display: none;"' : ''; ?>>
313
  <h3 class="hndle">
@@ -357,11 +420,12 @@ namespace rtCamp\WP\Nginx {
357
  <tr>
358
  <th><label for="log_filesize"><?php _e( 'Max log file size', 'nginx-helper' ); ?></label></th>
359
  <td>
360
- <input id="log_filesize" class="small-text" type="text" name="log_filesize" value="<?php echo $rt_wp_nginx_helper->options['log_filesize'] ?>" /> <?php _e( 'Mb', 'nginx-helper' );
361
- if ( $error_log_filesize ) {
362
- ?>
 
363
  <p class="error fade" style="display: block;"><?php echo $error_log_filesize; ?></p><?php }
364
- ?>
365
  </td>
366
  </tr>
367
  </tbody>
2
 
3
  namespace rtCamp\WP\Nginx {
4
 
5
+ function nginx_general_options_page()
6
+ {
7
  global $rt_wp_nginx_helper, $rt_wp_nginx_purger;
8
 
9
  $update = 0;
10
  $error_time = false;
11
  $error_log_filesize = false;
12
  $rt_wp_nginx_helper->options['enable_purge'] = (isset( $_POST['enable_purge'] ) and ( $_POST['enable_purge'] == 1) ) ? 1 : 0;
13
+ $rt_wp_nginx_helper->options['cache_method'] = (isset( $_POST['cache_method'] ) ) ? $_POST['cache_method'] : 'enable_fastcgi';
14
  $rt_wp_nginx_helper->options['enable_map'] = (isset( $_POST['enable_map'] ) and ( $_POST['enable_map'] == 1) ) ? 1 : 0;
15
  $rt_wp_nginx_helper->options['enable_log'] = (isset( $_POST['enable_log'] ) and ( $_POST['enable_log'] == 1) ) ? 1 : 0;
16
  $rt_wp_nginx_helper->options['enable_stamp'] = (isset( $_POST['enable_stamp'] ) and ( $_POST['enable_stamp'] == 1) ) ? 1 : 0;
53
 
54
  $rt_wp_nginx_helper->options['purge_method'] = ( isset( $_POST['purge_method'] ) ) ? $_POST['purge_method'] : 'get_request';
55
  }
56
+ if ( isset( $_POST['cache_method'] ) && $_POST['cache_method'] = "enable_redis" ) {
57
+ $rt_wp_nginx_helper->options['redis_hostname'] = ( isset( $_POST['redis_hostname'] ) ) ? $_POST['redis_hostname'] : '127.0.0.1';
58
+ $rt_wp_nginx_helper->options['redis_port'] = ( isset( $_POST['redis_port'] ) ) ? $_POST['redis_port'] : '6379';
59
+ $rt_wp_nginx_helper->options['redis_prefix'] = ( isset( $_POST['redis_prefix'] ) ) ? $_POST['redis_prefix'] : 'nginx-cache:';
60
+ }
61
  update_site_option( 'rt_wp_nginx_helper_options', $rt_wp_nginx_helper->options );
62
  $update = 1;
63
  }
64
  $rt_wp_nginx_helper->options = get_site_option( 'rt_wp_nginx_helper_options' );
65
 
66
+ // set default purge method to fastcgi
67
+ if ( empty( $rt_wp_nginx_helper->options['cache_method'] ) ) {
68
+ $rt_wp_nginx_helper->options['cache_method'] = "enable_fastcgi";
69
+ }
70
  /**
71
  * Show Update Message
72
  */
88
  $nginx_setting_link = 'https://rtcamp.com/wordpress-nginx/tutorials/single-site/fastcgi-cache-with-purging/';
89
  }
90
  ?>
91
+ <form id="post_form" method="post" action="#" name="smart_http_expire_form" class="clearfix">
92
+ <div class="postbox">
93
+ <h3 class="hndle">
94
+ <span><?php _e( 'Purging Options', 'nginx-helper' ); ?></span>
95
+ </h3>
96
  <div class="inside">
 
 
97
  <table class="form-table">
98
  <tr valign="top">
 
99
  <td>
100
+ <input type="checkbox" value="1" id="enable_purge" name="enable_purge"<?php checked( $rt_wp_nginx_helper->options['enable_purge'], 1 ); ?> />
101
+ <label for="enable_purge"><?php _e( 'Enable Purge', 'nginx-helper' ); ?></label>
102
  </td>
103
  </tr>
104
  </table>
105
+ </div> <!-- End of .inside -->
106
+ </div>
107
+ <div class="postbox enable_purge"<?php echo ( $rt_wp_nginx_helper->options['enable_purge'] == false ) ? ' style="display: none;"' : ''; ?>>
 
 
108
  <h3 class="hndle">
109
+ <span><?php _e( 'Caching Method', 'nginx-helper' ); ?></span>
110
  </h3>
111
+ <?php if ( !(!is_network_admin() && is_multisite() ) ) { ?>
112
  <div class="inside">
113
  <input type="hidden" name="is_submit" value="1" />
114
  <table class="form-table">
115
  <tr valign="top">
116
  <td>
117
+ <input type="radio" value="enable_fastcgi" id="cache_method_fastcgi" name="cache_method" <?php checked( $rt_wp_nginx_helper->options['cache_method'], "enable_fastcgi" ); ?> />
118
+ <label for="cache_method_fastcgi">
119
+ <?php printf( __( 'nginx Fastcgi cache (<a target="_blank" href="%s" title="External settings for nginx">requires external settings for nginx</a>)', 'nginx-helper' ), $nginx_setting_link ); ?>
120
  </label>
121
  </td>
122
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  <tr valign="top">
124
  <td>
125
+ <input type="radio" value="enable_redis" id="cache_method_redis" name="cache_method" <?php checked( $rt_wp_nginx_helper->options['cache_method'], "enable_redis" ); ?> />
126
+ <label for="cache_method_redis">
127
+ <?php printf( __( 'Redis cache', 'nginx-helper' ) ); ?>
128
+ </label>
129
  </td>
130
  </tr>
131
  </table>
132
  </div> <!-- End of .inside -->
133
  </div>
134
+ <div class="enable_purge">
135
+ <div class="postbox cache_method_fastcgi"<?php echo ( $rt_wp_nginx_helper->options['enable_purge'] == true && $rt_wp_nginx_helper->options['cache_method'] == "enable_fastcgi" ) ? '' : ' style="display: none;"'; ?>>
136
+ <h3 class="hndle">
137
+ <span><?php _e( 'Purge Method', 'nginx-helper' ); ?></span>
138
+ </h3>
139
+ <div class="inside">
140
+ <table class="form-table rtnginx-table">
141
+ <tr valign="top">
142
+ <td>
143
+ <fieldset>
144
+ <legend class="screen-reader-text">
145
+ <span>&nbsp;<?php _e( 'when a post/page/custom post is published.', 'nginx-helper' ); ?></span>
146
+ </legend>
147
+ <label for="purge_method_get_request">
148
+ <input type="radio" value="get_request" id="purge_method_get_request" name="purge_method"<?php checked( isset( $rt_wp_nginx_helper->options['purge_method'] ) ? $rt_wp_nginx_helper->options['purge_method'] : 'get_request', 'get_request' ); ?>>
149
+ &nbsp;<?php _e( 'Using a GET request to <strong>PURGE/url</strong> (Default option)', 'nginx-helper' ); ?><br />
150
+ <small><?php _e( 'Uses the <strong><a href="https://github.com/FRiCKLE/ngx_cache_purge">ngx_cache_purge</a></strong> module. ', 'nginx-helper' ); ?></small>
151
+ </label><br />
152
+ <label for="purge_method_unlink_files">
153
+ <input type="radio" value="unlink_files" id="purge_method_unlink_files" name="purge_method"<?php checked( isset( $rt_wp_nginx_helper->options['purge_method'] ) ? $rt_wp_nginx_helper->options['purge_method'] : '', 'unlink_files' ); ?>>
154
+ &nbsp;<?php _e( 'Delete local server cache files', 'nginx-helper' ); ?><br />
155
+ <small><?php _e( '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' ); ?></small>
156
 
157
+ </label><br />
158
+ </fieldset>
159
+ </td>
160
+ </tr>
161
+ </table>
162
+ </div> <!-- End of .inside -->
163
+ </div>
164
+ <div class="postbox cache_method_redis"<?php echo ( $rt_wp_nginx_helper->options['enable_purge'] == true && $rt_wp_nginx_helper->options['cache_method'] == "enable_redis" ) ? '' : ' style="display: none;"'; ?>>
165
+ <h3 class="hndle">
166
+ <span><?php _e( 'Redis Settings', 'nginx-helper' ); ?></span>
167
+ </h3>
168
+ <div class="inside">
169
+ <table class="form-table rtnginx-table">
170
+ <?php
171
+ $redis_hostname = ( empty( $rt_wp_nginx_helper->options['redis_hostname'] ) ) ? '127.0.0.1' : $rt_wp_nginx_helper->options['redis_hostname'];
172
+ $redis_port = ( empty( $rt_wp_nginx_helper->options['redis_port'] ) ) ? '6379' : $rt_wp_nginx_helper->options['redis_port'];
173
+ $redis_prefix = ( empty( $rt_wp_nginx_helper->options['redis_prefix'] ) ) ? 'nginx-cache:' : $rt_wp_nginx_helper->options['redis_prefix'];
174
+ ?>
175
+ <tr>
176
+ <th><label for="redis_hostname"><?php _e( 'Hostname', 'nginx-helper' ); ?></label></th>
177
+ <td>
178
+ <input id="redis_hostname" class="medium-text" type="text" name="redis_hostname" value="<?php echo $redis_hostname; ?>" />
179
+ </td>
180
+ </tr>
181
+ <tr>
182
+ <th><label for="redis_port"><?php _e( 'Port', 'nginx-helper' ); ?></label></th>
183
+ <td>
184
+ <input id="redis_port" class="medium-text" type="text" name="redis_port" value="<?php echo $redis_port; ?>" />
185
+ </td>
186
+ </tr>
187
+ <tr>
188
+ <th><label for="redis_prefix"><?php _e( 'Prefix', 'nginx-helper' ); ?></label></th>
189
+ <td>
190
+ <input id="redis_prefix" class="medium-text" type="text" name="redis_prefix" value="<?php echo $redis_prefix; ?>" />
191
+ </td>
192
+ </tr>
193
+ </table>
194
+ </div> <!-- End of .inside -->
195
+ </div>
196
+ </div>
197
  <div class="postbox enable_purge"<?php echo ( $rt_wp_nginx_helper->options['enable_purge'] == false ) ? ' style="display: none;"' : ''; ?>>
198
  <h3 class="hndle">
199
+ <span><?php _e( 'Purging Conditions', 'nginx-helper' ); ?></span>
200
  </h3>
201
  <div class="inside">
202
 
308
  </td>
309
  </tr>
310
  </table>
311
+ </div> <!-- End of .inside -->
312
+ </div>
313
+ <div class="postbox">
314
+ <h3 class="hndle">
315
+ <span><?php _e( 'Debug Options', 'nginx-helper' ); ?></span>
316
+ </h3>
317
+ <div class="inside">
318
+ <input type="hidden" name="is_submit" value="1" />
319
+ <table class="form-table">
320
+ <?php if ( is_network_admin() ) { ?>
321
+ <tr valign="top">
322
+ <td>
323
+ <input type="checkbox" value="1" id="enable_map" name="enable_map"<?php checked( $rt_wp_nginx_helper->options['enable_map'], 1 ); ?> />
324
+ <label for="enable_map"><?php _e( 'Enable Nginx Map.', 'nginx-helper' ); ?></label>
325
+ </td>
326
+ </tr>
327
+ <?php } ?>
328
  <tr valign="top">
329
+ <td>
330
+ <input type="checkbox" value="1" id="enable_log" name="enable_log"<?php checked( $rt_wp_nginx_helper->options['enable_log'], 1 ); ?> />
331
+ <label for="enable_log"><?php _e( 'Enable Logging', 'nginx-helper' ); ?></label>
332
+ </td>
333
+ </tr>
334
+ <tr valign="top">
335
+ <td>
336
+ <input type="checkbox" value="1" id="enable_stamp" name="enable_stamp"<?php checked( $rt_wp_nginx_helper->options['enable_stamp'], 1 ); ?> />
337
+ <label for="enable_stamp"><?php _e( 'Enable Nginx Timestamp in HTML', 'nginx-helper' ); ?></label>
338
+ </td>
 
 
 
 
 
 
 
 
 
 
 
339
  </tr>
340
  </table>
341
  </div> <!-- End of .inside -->
342
+ </div>
343
+ <?php
344
  } // End of if ( !( !is_network_admin() && is_multisite() ) )
345
 
346
 
370
  </table>
371
  </div> <!-- End of .inside -->
372
  </div>
373
+ <?php } ?>
374
 
375
  <div class="postbox enable_log"<?php echo ( $rt_wp_nginx_helper->options['enable_log'] == false ) ? ' style="display: none;"' : ''; ?>>
376
  <h3 class="hndle">
420
  <tr>
421
  <th><label for="log_filesize"><?php _e( 'Max log file size', 'nginx-helper' ); ?></label></th>
422
  <td>
423
+ <input id="log_filesize" class="small-text" type="text" name="log_filesize" value="<?php echo $rt_wp_nginx_helper->options['log_filesize'] ?>" /> <?php
424
+ _e( 'Mb', 'nginx-helper' );
425
+ if ( $error_log_filesize ) {
426
+ ?>
427
  <p class="error fade" style="display: block;"><?php echo $error_log_filesize; ?></p><?php }
428
+ ?>
429
  </td>
430
  </tr>
431
  </tbody>
admin/lib/nginx-sidebar.php CHANGED
@@ -2,57 +2,66 @@
2
 
3
  namespace rtCamp\WP\Nginx {
4
 
5
- function default_admin_sidebar() { ?>
6
- <div class="postbox" id="support">
7
- <h3 class="hndle">
8
- <span><?php _e( 'Need Help?', 'nginx-helper' ); ?></span>
9
- </h3>
10
- <div class="inside">
11
- <p><?php printf( __( 'Please use our <a href="%s">free support forum</a>.', 'nginx-helper' ), 'http://rtcamp.com/support/forum/wordpress-nginx/' ); ?></p>
12
- </div>
13
- </div>
 
 
 
 
 
 
 
14
 
15
- <div class="postbox" id="social">
16
- <h3 class="hndle">
17
- <span><?php _e( 'Getting Social is Good', 'nginx-helper' ); ?></span>
18
- </h3>
19
- <div style="text-align:center;" class="inside">
20
- <a class="nginx-helper-facebook" title="<?php _e( 'Become a fan on Facebook', 'nginx-helper' ); ?>" target="_blank" href="http://www.facebook.com/rtCamp.solutions/"></a>
21
- <a class="nginx-helper-twitter" title="<?php _e( 'Follow us on Twitter', 'nginx-helper' ); ?>" target="_blank" href="https://twitter.com/rtcamp/"></a>
22
- <a class="nginx-helper-gplus" title="<?php _e( 'Add to Circle', 'nginx-helper' ); ?>" target="_blank" href="https://plus.google.com/110214156830549460974/posts"></a>
23
- <a class="nginx-helper-rss" title="<?php _e( 'Subscribe to our feeds', 'nginx-helper' ); ?>" target="_blank" href="http://feeds.feedburner.com/rtcamp/"></a>
24
- </div>
25
- </div>
26
 
27
- <div class="postbox" id="useful-links">
28
- <h3 class="hndle">
29
- <span><?php _e( 'Useful Links', 'nginx-helper' ); ?></span>
30
- </h3>
31
- <div class="inside">
32
- <ul role="list">
33
- <li role="listitem">
34
- <a href="https://rtcamp.com/wordpress-nginx/" title="<?php _e( 'WordPress-Nginx Solutions', 'nginx-helper' ); ?>"><?php _e( 'WordPress-Nginx Solutions', 'nginx-helper' ); ?></a>
35
- </li>
36
- <li role="listitem">
37
- <a href="https://rtcamp.com/services/wordPress-themes-design-development/" title="<?php _e( 'WordPress Theme Devleopment', 'nginx-helper' ); ?>"><?php _e( 'WordPress Theme Devleopment', 'nginx-helper' ); ?></a>
38
- </li>
39
- <li role="listitem">
40
- <a href="http://rtcamp.com/services/wordpress-plugins/" title="<?php _e( 'WordPress Plugin Development', 'nginx-helper' ); ?>"><?php _e( 'WordPress Plugin Development', 'nginx-helper' ); ?></a>
41
- </li>
42
- <li role="listitem">
43
- <a href="http://rtcamp.com/services/custom-wordpress-solutions/" title="<?php _e( 'WordPress Consultancy', 'nginx-helper' ); ?>"><?php _e( 'WordPress Consultancy', 'nginx-helper' ); ?></a>
44
- </li>
45
- <li role="listitem">
46
- <a href="https://rtcamp.com/easyengine/" title="<?php _e( 'easyengine (ee)', 'nginx-helper' ); ?>"><?php _e( 'easyengine (ee)', 'nginx-helper' ); ?></a>
47
- </li>
48
- </ul>
49
- </div>
50
- </div>
51
 
52
- <div class="postbox" id="latest_news">
53
- <div title="<?php _e( 'Click to toggle', 'nginx-helper' ); ?>" class="handlediv"><br /></div>
54
- <h3 class="hndle"><span><?php _e( 'Latest News', 'nginx-helper' ); ?></span></h3>
55
- <div class="inside"><img src ="<?php echo admin_url(); ?>/images/wpspin_light.gif" /><?php _e( 'Loading...', 'nginx-helper' ); ?></div>
56
- </div><?php
57
- } // End of default_admin_sidebar()
 
 
58
  }
2
 
3
  namespace rtCamp\WP\Nginx {
4
 
5
+ function default_admin_sidebar()
6
+ {
7
+ ?>
8
+ <?php $purge_url = add_query_arg( array( 'nginx_helper_action' => 'purge', 'nginx_helper_urls' => 'all' ) ); ?>
9
+ <?php $nonced_url = wp_nonce_url( $purge_url, 'nginx_helper-purge_all' ); ?>
10
+ <form id="purgeall" action="" method="post" class="clearfix">
11
+ <a href="<?php echo $nonced_url; ?>" class="button-primary"><?php _e( 'Purge Entire Cache', 'nginx-helper' ); ?></a>
12
+ </form>
13
+ <div class="postbox" id="support">
14
+ <h3 class="hndle">
15
+ <span><?php _e( 'Need Help?', 'nginx-helper' ); ?></span>
16
+ </h3>
17
+ <div class="inside">
18
+ <p><?php printf( __( 'Please use our <a href="%s">free support forum</a>.', 'nginx-helper' ), 'http://rtcamp.com/support/forum/wordpress-nginx/' ); ?></p>
19
+ </div>
20
+ </div>
21
 
22
+ <div class="postbox" id="social">
23
+ <h3 class="hndle">
24
+ <span><?php _e( 'Getting Social is Good', 'nginx-helper' ); ?></span>
25
+ </h3>
26
+ <div style="text-align:center;" class="inside">
27
+ <a class="nginx-helper-facebook" title="<?php _e( 'Become a fan on Facebook', 'nginx-helper' ); ?>" target="_blank" href="http://www.facebook.com/rtCamp.solutions/"></a>
28
+ <a class="nginx-helper-twitter" title="<?php _e( 'Follow us on Twitter', 'nginx-helper' ); ?>" target="_blank" href="https://twitter.com/rtcamp/"></a>
29
+ <a class="nginx-helper-gplus" title="<?php _e( 'Add to Circle', 'nginx-helper' ); ?>" target="_blank" href="https://plus.google.com/110214156830549460974/posts"></a>
30
+ <a class="nginx-helper-rss" title="<?php _e( 'Subscribe to our feeds', 'nginx-helper' ); ?>" target="_blank" href="http://feeds.feedburner.com/rtcamp/"></a>
31
+ </div>
32
+ </div>
33
 
34
+ <div class="postbox" id="useful-links">
35
+ <h3 class="hndle">
36
+ <span><?php _e( 'Useful Links', 'nginx-helper' ); ?></span>
37
+ </h3>
38
+ <div class="inside">
39
+ <ul role="list">
40
+ <li role="listitem">
41
+ <a href="https://rtcamp.com/wordpress-nginx/" title="<?php _e( 'WordPress-Nginx Solutions', 'nginx-helper' ); ?>"><?php _e( 'WordPress-Nginx Solutions', 'nginx-helper' ); ?></a>
42
+ </li>
43
+ <li role="listitem">
44
+ <a href="https://rtcamp.com/services/wordPress-themes-design-development/" title="<?php _e( 'WordPress Theme Devleopment', 'nginx-helper' ); ?>"><?php _e( 'WordPress Theme Devleopment', 'nginx-helper' ); ?></a>
45
+ </li>
46
+ <li role="listitem">
47
+ <a href="http://rtcamp.com/services/wordpress-plugins/" title="<?php _e( 'WordPress Plugin Development', 'nginx-helper' ); ?>"><?php _e( 'WordPress Plugin Development', 'nginx-helper' ); ?></a>
48
+ </li>
49
+ <li role="listitem">
50
+ <a href="http://rtcamp.com/services/custom-wordpress-solutions/" title="<?php _e( 'WordPress Consultancy', 'nginx-helper' ); ?>"><?php _e( 'WordPress Consultancy', 'nginx-helper' ); ?></a>
51
+ </li>
52
+ <li role="listitem">
53
+ <a href="https://rtcamp.com/easyengine/" title="<?php _e( 'easyengine (ee)', 'nginx-helper' ); ?>"><?php _e( 'easyengine (ee)', 'nginx-helper' ); ?></a>
54
+ </li>
55
+ </ul>
56
+ </div>
57
+ </div>
58
 
59
+ <div class="postbox" id="latest_news">
60
+ <div title="<?php _e( 'Click to toggle', 'nginx-helper' ); ?>" class="handlediv"><br /></div>
61
+ <h3 class="hndle"><span><?php _e( 'Latest News', 'nginx-helper' ); ?></span></h3>
62
+ <div class="inside"><img src ="<?php echo admin_url(); ?>/images/wpspin_light.gif" /><?php _e( 'Loading...', 'nginx-helper' ); ?></div>
63
+ </div><?php
64
+ }
65
+
66
+ // End of default_admin_sidebar()
67
  }
includes/predis.php ADDED
@@ -0,0 +1,15203 @@