Version Description
- Revised code for improved multisite and multidomain mapping.
Download this release
Release Info
Developer | saurabhshukla |
Plugin | Nginx Helper |
Version | 1.6 |
Comparing to | |
See all releases |
Code changes from version 1.5 to 1.6
- compatibility.php +37 -32
- nginx-helper.php +14 -9
- readme.txt +5 -3
compatibility.php
CHANGED
@@ -1,36 +1,41 @@
|
|
1 |
<?php
|
|
|
2 |
namespace rtCamp\WP\Nginx {
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
35 |
}
|
36 |
?>
|
1 |
<?php
|
2 |
+
|
3 |
namespace rtCamp\WP\Nginx {
|
4 |
+
|
5 |
+
class Compatibility {
|
6 |
+
|
7 |
+
protected $have_nginx;
|
8 |
+
|
9 |
+
public static function instance() {
|
10 |
+
static $self = false;
|
11 |
+
if ( ! $self ) {
|
12 |
+
$self = new Compatibility();
|
13 |
+
}
|
14 |
+
|
15 |
+
return $self;
|
16 |
+
}
|
17 |
+
|
18 |
+
private function __construct() {
|
19 |
+
$this->have_nginx = ('nginx' == substr( $_SERVER[ 'SERVER_SOFTWARE' ], 0, 5 ));
|
20 |
+
if ( $this->have_nginx ) {
|
21 |
+
add_filter( 'got_rewrite', array( $this, 'got_rewrite' ), 999 );
|
22 |
+
|
23 |
+
// For compatibility with several plugins and nginx HTTPS proxying schemes
|
24 |
+
if ( empty( $_SERVER[ 'HTTPS' ] ) || 'off' == $_SERVER[ 'HTTPS' ] ) {
|
25 |
+
unset( $_SERVER[ 'HTTPS' ] );
|
26 |
+
}
|
27 |
+
}
|
28 |
+
}
|
29 |
+
|
30 |
+
public function got_rewrite( $got ) {
|
31 |
+
return true;
|
32 |
+
}
|
33 |
+
|
34 |
+
public function haveNginx() {
|
35 |
+
return $this->have_nginx;
|
36 |
+
}
|
37 |
+
|
38 |
+
}
|
39 |
+
|
40 |
}
|
41 |
?>
|
nginx-helper.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Nginx Helper
|
4 |
Plugin URI: http://rtcamp.com/
|
5 |
Description: An nginx helper that serves various functions.
|
6 |
-
Version: 1.
|
7 |
Author: rtCamp
|
8 |
Author URI: http://rtcamp.com
|
9 |
Requires at least: 3.0
|
@@ -212,19 +212,24 @@ namespace rtCamp\WP\Nginx {
|
|
212 |
|
213 |
|
214 |
if ( $rt_all_blogs )
|
215 |
-
foreach ( $rt_all_blogs as $blog )
|
216 |
if ( SUBDOMAIN_INSTALL == "yes" )
|
217 |
-
$rt_nginx_map_array[
|
218 |
-
|
|
|
219 |
if ( $blog->blog_id != 1 )
|
220 |
-
$rt_nginx_map_array[
|
|
|
|
|
221 |
|
222 |
if ( $rt_domain_map_sites )
|
223 |
foreach ( $rt_domain_map_sites as $site )
|
224 |
-
$rt_nginx_map_array[
|
|
|
225 |
|
226 |
-
|
227 |
-
|
|
|
228 |
|
229 |
return $rt_nginx_map;
|
230 |
}
|
@@ -246,7 +251,7 @@ namespace rtCamp\WP\Nginx {
|
|
246 |
return;
|
247 |
if ( $this->options[ 'enable_stamp' ] != 1 )
|
248 |
return;
|
249 |
-
if ($_SERVER["CONTENT_TYPE"]!='text/html')
|
250 |
return;
|
251 |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
|
252 |
return;
|
3 |
Plugin Name: Nginx Helper
|
4 |
Plugin URI: http://rtcamp.com/
|
5 |
Description: An nginx helper that serves various functions.
|
6 |
+
Version: 1.6
|
7 |
Author: rtCamp
|
8 |
Author URI: http://rtcamp.com
|
9 |
Requires at least: 3.0
|
212 |
|
213 |
|
214 |
if ( $rt_all_blogs )
|
215 |
+
foreach ( $rt_all_blogs as $blog ){
|
216 |
if ( SUBDOMAIN_INSTALL == "yes" )
|
217 |
+
$rt_nginx_map_array['domain'] = $blog->domain;
|
218 |
+
$rt_nginx_map_array['id'] = $blog->blog_id;
|
219 |
+
}else{
|
220 |
if ( $blog->blog_id != 1 )
|
221 |
+
$rt_nginx_map_array['domain'] = $blog->path;
|
222 |
+
$rt_nginx_map_array['id'] = $blog->blog_id;
|
223 |
+
}
|
224 |
|
225 |
if ( $rt_domain_map_sites )
|
226 |
foreach ( $rt_domain_map_sites as $site )
|
227 |
+
$rt_nginx_map_array['domain'] = $site->domain;
|
228 |
+
$rt_nginx_map_array['id'] = $site->blog_id;
|
229 |
|
230 |
+
|
231 |
+
foreach ( $rt_nginx_map_array as $blog )
|
232 |
+
$rt_nginx_map .= "\t" . $blog['domain'] . "\t" . $blog['id'] . ";\n";
|
233 |
|
234 |
return $rt_nginx_map;
|
235 |
}
|
251 |
return;
|
252 |
if ( $this->options[ 'enable_stamp' ] != 1 )
|
253 |
return;
|
254 |
+
if ( $_SERVER[ "CONTENT_TYPE" ] != 'text/html' )
|
255 |
return;
|
256 |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
|
257 |
return;
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: rtcamp, rahul286, saurabhshukla
|
|
3 |
Tags: nginx, cache, purge, nginx map, nginx cache, maps, fastcgi, proxy, rewrite, permalinks
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 3.4.2
|
6 |
-
Stable tag: 1.
|
7 |
License: GPLv2 or later (of-course)
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
Donate Link: http://rtcamp.com/donate/
|
@@ -105,6 +105,8 @@ Its just that we are hyperactive on our own forum!
|
|
105 |
|
106 |
== Changelog ==
|
107 |
|
|
|
|
|
108 |
= 1.5 =
|
109 |
* Timestamp now only gets added to content-type text/html
|
110 |
* Added option to toggle timestamp creation
|
@@ -173,5 +175,5 @@ Its just that we are hyperactive on our own forum!
|
|
173 |
|
174 |
== Upgrade Notice ==
|
175 |
|
176 |
-
= 1.
|
177 |
-
|
3 |
Tags: nginx, cache, purge, nginx map, nginx cache, maps, fastcgi, proxy, rewrite, permalinks
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 3.4.2
|
6 |
+
Stable tag: 1.6
|
7 |
License: GPLv2 or later (of-course)
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
Donate Link: http://rtcamp.com/donate/
|
105 |
|
106 |
== Changelog ==
|
107 |
|
108 |
+
= 1.6 =
|
109 |
+
* Revised code for improved multisite and multidomain mapping.
|
110 |
= 1.5 =
|
111 |
* Timestamp now only gets added to content-type text/html
|
112 |
* Added option to toggle timestamp creation
|
175 |
|
176 |
== Upgrade Notice ==
|
177 |
|
178 |
+
= 1.6 =
|
179 |
+
Improved multisite, multidomain support!
|