forked from rtCamp/nginx-helper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompatibility.php
37 lines (29 loc) · 970 Bytes
/
compatibility.php
1
2
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
37
<?php
namespace rtCamp\WP\Nginx {
class Compatibility {
protected $have_nginx;
public static function instance() {
static $self = false;
if (!$self) {
$self = new Compatibility();
}
return $self;
}
private function __construct() {
$this->have_nginx = ('nginx' == substr($_SERVER['SERVER_SOFTWARE'], 0, 5));
if ($this->have_nginx) {
add_filter('got_rewrite', array($this, 'got_rewrite'), 999);
// For compatibility with several plugins and nginx HTTPS proxying schemes
if (empty($_SERVER['HTTPS']) || 'off' == $_SERVER['HTTPS']) {
unset($_SERVER['HTTPS']);
}
}
}
public function got_rewrite($got) {
return true;
}
public function haveNginx() {
return $this->have_nginx;
}
}
}