| 1 |
<!DOCTYPE html> |
| 2 |
<html lang="en"> |
| 3 |
<head> |
| 4 |
<meta charset="UTF-8"> |
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1"> |
| 6 |
<title><?php |
| 7 |
$devman_img = defender_asset_url('/assets/img/def-stand.svg'); |
| 8 |
$devman_icon = defender_asset_url('/assets/img/defender-icon.png'); |
| 9 |
$info = defender_white_label_status(); |
| 10 |
if (strlen($info['hero_image']) > 0) { |
| 11 |
$devman_img = $info['hero_image']; |
| 12 |
} |
| 13 |
bloginfo('name') ?></title> |
| 14 |
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700|Roboto:400,500,300,300italic"> |
| 15 |
<link rel="stylesheet" href="<?php echo defender_asset_url( '/assets/css/styles.css') ?>"> |
| 16 |
<style> |
| 17 |
html, |
| 18 |
body { |
| 19 |
margin: 0; |
| 20 |
padding: 0; |
| 21 |
min-width: 100%; |
| 22 |
width: 100%; |
| 23 |
max-width: 100%; |
| 24 |
min-height: 100%; |
| 25 |
height: 100%; |
| 26 |
max-height: 100%; |
| 27 |
} |
| 28 |
|
| 29 |
.wp-defender { |
| 30 |
height: 100%; |
| 31 |
display: flex; |
| 32 |
align-items: center; |
| 33 |
font-family: Roboto; |
| 34 |
color: #000; |
| 35 |
font-size: 13px; |
| 36 |
line-height: 18px; |
| 37 |
} |
| 38 |
|
| 39 |
.container { |
| 40 |
margin: 0 auto; |
| 41 |
text-align: center; |
| 42 |
} |
| 43 |
|
| 44 |
.image { |
| 45 |
width: 128px; |
| 46 |
height: 128px; |
| 47 |
background-color: #F2F2F2; |
| 48 |
margin: 0 auto; |
| 49 |
border-radius: 50%; |
| 50 |
background-image: url("<?php echo $devman_img; ?>"); |
| 51 |
background-repeat: no-repeat; |
| 52 |
background-size: contain; |
| 53 |
background-position: center; |
| 54 |
margin-bottom: 30px; |
| 55 |
} |
| 56 |
|
| 57 |
.plugin-icon { |
| 58 |
width: 30px; |
| 59 |
height: 30px; |
| 60 |
margin: 0 auto; |
| 61 |
background-image: url("<?php echo $devman_icon; ?>"); |
| 62 |
background-repeat: no-repeat; |
| 63 |
background-size: contain; |
| 64 |
background-position: center; |
| 65 |
margin-bottom: 10px; |
| 66 |
} |
| 67 |
|
| 68 |
.powered { |
| 69 |
position: absolute; |
| 70 |
bottom: 20px; |
| 71 |
display: block; |
| 72 |
text-align: center; |
| 73 |
width: 100%; |
| 74 |
font-size: 10px; |
| 75 |
color: #C0C0C0; |
| 76 |
} |
| 77 |
|
| 78 |
.powered strong { |
| 79 |
color: #8A8A8A; |
| 80 |
font-weight: normal; |
| 81 |
} |
| 82 |
|
| 83 |
.message { |
| 84 |
font-size: 15px; |
| 85 |
line-height: 30px; |
| 86 |
text-align: center; |
| 87 |
letter-spacing: -0.25px; |
| 88 |
color: #666666; |
| 89 |
} |
| 90 |
|
| 91 |
#countdown-time { |
| 92 |
font-weight: bold; |
| 93 |
font-size: 28px; |
| 94 |
line-height: 40px; |
| 95 |
text-align: center; |
| 96 |
letter-spacing: -0.5px; |
| 97 |
color: #666666; |
| 98 |
} |
| 99 |
|
| 100 |
#remaining-time { |
| 101 |
margin-left: 10px; |
| 102 |
} |
| 103 |
.sui-icon-stopwatch::before { |
| 104 |
color: inherit !important; |
| 105 |
font-size: 24px !important; |
| 106 |
} |
| 107 |
|
| 108 |
.day-notation { |
| 109 |
font-weight: normal; |
| 110 |
} |
| 111 |
</style> |
| 112 |
</head> |
| 113 |
|
| 114 |
<body class="<?php echo 'sui-' . DEFENDER_SUI; ?>"> |
| 115 |
<div class="wp-defender"> |
| 116 |
<div class="container"> |
| 117 |
<?php |
| 118 |
if ( |
| 119 |
($info['hide_branding'] === false) || |
| 120 |
($info['hide_branding'] === true && !empty($info['hero_image'])) |
| 121 |
) { |
| 122 |
echo '<div class="image"></div>'; |
| 123 |
} |
| 124 |
?> |
| 125 |
<p class="message"><?php echo $message ?></p> |
| 126 |
<?php if ( ! empty( $remaining_time ) && is_int( $remaining_time ) && $remaining_time > 0 ) { ?> |
| 127 |
<p class="message"><?php esc_html_e("You will be able to attempt to access again in:", 'wpdef'); ?></p> |
| 128 |
<p id="countdown-time"><span class="sui-icon-stopwatch" aria-hidden="true"></span><span id="remaining-time"></span></p> |
| 129 |
<?php } ?> |
| 130 |
</div> |
| 131 |
<?php if (!$info['hide_doc_link']) { ?> |
| 132 |
<div class="powered"> |
| 133 |
<div class="plugin-icon"></div> |
| 134 |
<?php esc_html_e("Powered by", 'wpdef') ?> |
| 135 |
<strong><?php esc_html_e("Defender", 'wpdef') ?></strong> |
| 136 |
</div> |
| 137 |
<?php |
| 138 |
} |
| 139 |
?> |
| 140 |
</div> |
| 141 |
<?php if ( ! empty( $remaining_time ) && is_int( $remaining_time ) && $remaining_time > 0 ) { ?> |
| 142 |
<script> |
| 143 |
function CountDownTimer(duration, granularity) { |
| 144 |
this.duration = duration; |
| 145 |
this.granularity = granularity || 1000; |
| 146 |
this.tickFtns = []; |
| 147 |
this.running = false; |
| 148 |
} |
| 149 |
|
| 150 |
CountDownTimer.prototype.start = function() { |
| 151 |
if (this.running) { |
| 152 |
return; |
| 153 |
} |
| 154 |
this.running = true; |
| 155 |
var start = Date.now(), |
| 156 |
that = this, |
| 157 |
diff, obj; |
| 158 |
|
| 159 |
(function timer() { |
| 160 |
diff = that.duration - (((Date.now() - start) / 1000) | 0); |
| 161 |
|
| 162 |
if (diff > 0) { |
| 163 |
setTimeout(timer, that.granularity); |
| 164 |
} else { |
| 165 |
diff = 0; |
| 166 |
that.running = false; |
| 167 |
} |
| 168 |
|
| 169 |
obj = CountDownTimer.parse(diff); |
| 170 |
that.tickFtns.forEach(function(ftn) { |
| 171 |
ftn.call(this, obj); |
| 172 |
}, that); |
| 173 |
}()); |
| 174 |
}; |
| 175 |
|
| 176 |
CountDownTimer.prototype.onTick = function(ftn) { |
| 177 |
if (typeof ftn === 'function') { |
| 178 |
this.tickFtns.push(ftn); |
| 179 |
} |
| 180 |
return this; |
| 181 |
}; |
| 182 |
|
| 183 |
CountDownTimer.prototype.expired = function() { |
| 184 |
return !this.running; |
| 185 |
}; |
| 186 |
|
| 187 |
CountDownTimer.parse = function(seconds) { |
| 188 |
const DAY_IN_SECONDS = 86400; |
| 189 |
const HOUR_IN_SECONDS = 3600; |
| 190 |
const MINUTES_IN_SECONDS = 60; |
| 191 |
|
| 192 |
seconds = Number( seconds ); |
| 193 |
|
| 194 |
let days = Math.floor( seconds / DAY_IN_SECONDS ); |
| 195 |
|
| 196 |
let dayNotation = days > 1 ? 'Days' : 'Day'; |
| 197 |
|
| 198 |
let displayDays = days > 0 ? ( days + '<span class="day-notation"> ' + dayNotation + ' </span>' ) : ''; |
| 199 |
|
| 200 |
seconds %= DAY_IN_SECONDS; |
| 201 |
let hours = String( Math.floor( seconds / HOUR_IN_SECONDS ) ).padStart( 2, 0 ); |
| 202 |
|
| 203 |
seconds %= HOUR_IN_SECONDS; |
| 204 |
let minutes = String( Math.floor( seconds / MINUTES_IN_SECONDS ) ).padStart( 2, 0 ); |
| 205 |
|
| 206 |
seconds = String( seconds % MINUTES_IN_SECONDS ).padStart( 2, 0 ); |
| 207 |
|
| 208 |
return displayDays + hours + ':' + minutes + ':' + seconds; |
| 209 |
}; |
| 210 |
|
| 211 |
window.onload = function() { |
| 212 |
let display = document.getElementById("remaining-time"), |
| 213 |
timer = new CountDownTimer(<?php echo $remaining_time ?>); |
| 214 |
|
| 215 |
timer.onTick(format).onTick(pageRefresh).start(); |
| 216 |
|
| 217 |
function pageRefresh() { |
| 218 |
if (this.expired()) { |
| 219 |
setTimeout( |
| 220 |
() => { |
| 221 |
window.location.href = window.location.href; |
| 222 |
}, |
| 223 |
1000 // Intentional 1 second delay to allow browser parse headers and redirect. |
| 224 |
); |
| 225 |
} |
| 226 |
} |
| 227 |
|
| 228 |
function format(formattedTime) { |
| 229 |
display.innerHTML = formattedTime; |
| 230 |
} |
| 231 |
} |
| 232 |
</script> |
| 233 |
<?php } ?> |
| 234 |
</body> |
| 235 |
</html> |
| 236 |
|