PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 3.1.0
Defender Security – Malware Scanner, Login Security & Firewall v3.1.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / src / component / timer.php

timer.php in Defender Security – Malware Scanner, Login Security & Firewall 3.1.0, at src/component/timer.php

38 lines 591 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WP_Defender\Component;
4
5 use Calotes\Base\Component;
6
7 class Timer extends Component {
8 protected $clock;
9
10 public function __construct() {
11 $this->start();
12 }
13
14 public function get_max_time() {
15 $max = ini_get( 'max_execution_time' );
16 if ( ! filter_var( $max, FILTER_VALIDATE_INT ) ) {
17 $max = 30;
18 }
19
20 return $max / 2;
21 }
22
23 public function start() {
24 $this->clock = time();
25 }
26
27 /**
28 * @return bool
29 */
30 public function check() {
31 $eslaped = time() - $this->clock;
32 if ( ( $eslaped / 1000 ) >= $this->get_max_time() ) {
33 return false;
34 }
35
36 return true;
37 }
38 }