-
Notifications
You must be signed in to change notification settings - Fork 1
/
maintenance-sample.php
62 lines (51 loc) · 1.72 KB
/
maintenance-sample.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
namespace LordDashMe\WordpressScaffolding\Maintenance;
\define('MAINTENANCE_MODE', false);
\define('WHITELISTED_CLIENT_IP', '127.0.0.1|192.168.0.1');
if (! MAINTENANCE_MODE) {
return;
}
function getClientIP()
{
if (! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
return \trim($_SERVER['HTTP_X_FORWARDED_FOR']);
}
return \trim($_SERVER['REMOTE_ADDR']);
}
function isMaintenanceMode()
{
$whitelistedClientIP = \explode('|', WHITELISTED_CLIENT_IP);
foreach ($whitelistedClientIP as $allowedClientIP) {
$clientIp = \explode(',', \LordDashMe\WordpressScaffolding\Maintenance\getClientIP());
if (\in_array($allowedClientIP, $clientIp)) {
return false;
}
}
return true;
}
if (\LordDashMe\WordpressScaffolding\Maintenance\isMaintenanceMode()) {
?>
<!DOCTYPE html>
<html>
<head>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
</head>
<body>
<article>
<h1>We’ll be back soon!</h1>
<div>
<p>Sorry for the inconvenience but we’re performing some maintenance at the moment. If you need to you can always <a href="mailto:#">contact us</a>, otherwise we’ll be back online shortly!</p>
<p>— The Team</p>
</div>
</article>
</body>
</html>
<?php exit; } ?>