PluginProbe ʕ •ᴥ•ʔ
Wordfence Security – Firewall, Malware Scan, and Login Security / 1.4.2
Wordfence Security – Firewall, Malware Scan, and Login Security v1.4.2
8.2.2 8.2.1 8.2.0 3.7.1 3.7.2 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.8.8 3.8.9 3.9.1 4.0.1 4.0.2 4.0.3 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.0.9 5.1.1 5.1.2 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.2.1 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.1 5.3.10 5.3.11 5.3.12 5.3.2 5.3.3 5.3.4 5.3.5 5.3.6 5.3.7 5.3.8 5.3.9 6.0.1 6.0.10 6.0.11 6.0.12 6.0.14 6.0.15 6.0.16 6.0.17 6.0.18 6.0.19 6.0.2 6.0.20 6.0.21 6.0.22 6.0.23 6.0.24 6.0.25 6.0.3 6.0.4 6.0.5 6.0.6 6.0.7 6.0.8 6.0.9 6.1.1 6.1.10 6.1.11 6.1.12 6.1.14 6.1.15 6.1.16 6.1.17 6.1.2 6.1.3 6.1.4 6.1.5 6.1.6 6.1.7 6.1.8 6.1.9 6.2.0 6.2.1 6.2.10 6.2.2 6.2.3 6.2.4 6.2.5 6.2.6 6.2.7 6.2.8 6.2.9 6.3.0 6.3.1 6.3.10 6.3.11 6.3.12 6.3.14 6.3.15 6.3.16 6.3.17 6.3.18 6.3.19 6.3.2 6.3.20 6.3.21 6.3.22 6.3.3 6.3.4 6.3.5 6.3.6 6.3.7 6.3.8 6.3.9 7.0.1 7.0.2 7.0.3 7.0.4 7.0.5 7.1.0 7.1.1 7.1.10 7.1.11 7.1.12 7.1.14 7.1.15 7.1.16 7.1.17 7.1.18 7.1.19 7.1.2 7.1.20 7.1.3 7.1.4 7.1.5 7.1.6 7.1.7 7.1.8 7.1.9 7.10.0 7.10.1 7.10.2 7.10.3 7.10.4 7.10.5 7.10.6 7.10.7 7.11.0 7.11.1 7.11.2 7.11.3 7.11.4 7.11.5 7.11.6 7.11.7 7.2.1 7.2.2 7.2.3 7.2.4 7.2.5 7.3.1 7.3.2 7.3.3 7.3.4 7.3.5 7.3.6 7.4.0 7.4.1 7.4.10 7.4.11 7.4.12 7.4.14 7.4.2 7.4.3 trunk 7.4.4 1.1 7.4.5 1.2 7.4.6 1.3 7.4.7 1.3.1 7.4.8 1.3.2 7.4.9 1.3.3 7.5.0 1.4.2 7.5.1 1.4.3 7.5.10 1.4.4 7.5.11 1.4.5 7.5.2 1.4.6 7.5.3 1.4.7 7.5.4 1.4.8 7.5.5 1.5.1 7.5.6 1.5.2 7.5.7 1.5.3 7.5.8 1.5.4 7.5.9 1.5.5 7.6.0 1.5.6 7.6.1 2.0.1 7.6.2 2.0.2 7.7.0 2.0.3 7.7.1 2.0.5 7.8.0 2.0.6 7.8.1 2.0.7 7.8.2 2.1.0 7.9.0 2.1.1 7.9.1 2.1.2 7.9.2 2.1.3 7.9.3 2.1.4 8.0.0 2.1.5 8.0.1 3.0.2 8.0.2 3.0.3 8.0.3 3.0.4 8.0.4 3.0.5 8.0.5 3.0.6 8.1.0 3.0.7 8.1.1 3.0.8 8.1.2 3.0.9 8.1.3 3.1.0 8.1.4 3.1.1 v1.4.1 3.1.2 3.1.4 3.1.6 3.2.1 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.4.1 3.4.4 3.4.5 3.5.1 3.5.2 3.6.1 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.6.9
wordfence / lib / wfUtils.php
wordfence / lib Last commit date
Diff 14 years ago geshi 14 years ago .htaccess 14 years ago Diff.php 14 years ago IPTraf.php 14 years ago diffResult.php 14 years ago dropAll.php 14 years ago email_genericAlert.php 14 years ago email_newIssues.php 14 years ago geshi.php 14 years ago menu_activity.php 14 years ago menu_blockedIPs.php 14 years ago menu_config.php 14 years ago menu_options.php 14 years ago menu_scan.php 14 years ago sysinfo.php 14 years ago wf503.php 14 years ago wfAPI.php 14 years ago wfAction.php 14 years ago wfBrowscap.php 14 years ago wfBrowscapCache.php 14 years ago wfConfig.php 14 years ago wfCrawl.php 14 years ago wfDB.php 14 years ago wfDict.php 14 years ago wfIssues.php 14 years ago wfLockedOut.php 14 years ago wfLog.php 14 years ago wfModTracker.php 14 years ago wfRate.php 14 years ago wfScanEngine.php 14 years ago wfSchema.php 14 years ago wfUtils.php 14 years ago wfViewResult.php 14 years ago wordfenceClass.php 14 years ago wordfenceConstants.php 14 years ago wordfenceHash.php 14 years ago wordfenceScanner.php 14 years ago wordfenceURLHoover.php 14 years ago
wfUtils.php
150 lines
1 <?php
2 class wfUtils {
3 private static $reverseLookupCache = array();
4 public static function makeTimeAgo($secs, $noSeconds = false) {
5 if($secs < 1){
6 return "a moment";
7 }
8 $months = floor($secs / (86400 * 30));
9 $days = floor($secs / 86400);
10 $hours = floor($secs / 3600);
11 $minutes = floor($secs / 60);
12 if($months) {
13 $days -= $months * 30;
14 return self::pluralize($months, 'month', $days, 'day');
15 } else if($days) {
16 $hours -= $days * 24;
17 return self::pluralize($days, 'day', $hours, 'hour');
18 } else if($hours) {
19 $minutes -= $hours * 60;
20 return self::pluralize($hours, 'hour', $minutes, 'min');
21 } else if($minutes) {
22 $secs -= $minutes * 60;
23 return self::pluralize($minutes, 'min');
24 } else {
25 if($noSeconds){
26 return "less than a minute";
27 } else {
28 return floor($secs) . " secs";
29 }
30 }
31 }
32 public static function pluralize($m1, $t1, $m2 = false, $t2 = false) {
33 if($m1 != 1) {
34 $t1 = $t1 . 's';
35 }
36 if($m2 != 1) {
37 $t2 = $t2 . 's';
38 }
39 if($m1 && $m2){
40 return "$m1 $t1 $m2 $t2";
41 } else {
42 return "$m1 $t1";
43 }
44 }
45 public static function formatBytes($bytes, $precision = 2) {
46 $units = array('B', 'KB', 'MB', 'GB', 'TB');
47
48 $bytes = max($bytes, 0);
49 $pow = floor(($bytes ? log($bytes) : 0) / log(1024));
50 $pow = min($pow, count($units) - 1);
51
52 // Uncomment one of the following alternatives
53 $bytes /= pow(1024, $pow);
54 // $bytes /= (1 << (10 * $pow));
55
56 return round($bytes, $precision) . ' ' . $units[$pow];
57 }
58 public static function inet_ntoa($ip){
59 $long = 4294967295 - ($ip - 1);
60 return long2ip(-$long);
61 }
62 public static function inet_aton($ip){
63 return sprintf("%u", ip2long($ip));
64 }
65 public static function getBaseURL(){
66 return plugins_url() . '/wordfence/';
67 }
68 public static function getPluginBaseDir(){
69 return ABSPATH . 'wp-content/plugins/';
70 }
71 public static function getIP(){
72 $ip = 0;
73 if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])){
74 $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
75 }
76 if((! $ip) && isset($_SERVER['REMOTE_ADDR'])){
77 $ip = $_SERVER['REMOTE_ADDR'];
78 }
79 return $ip;
80 }
81 public static function getRequestedURL(){
82 return ($_SERVER['HTTPS'] ? 'https' : 'http') . '://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
83 }
84 public static function reverseLookup($IP){
85 if(! isset(self::$reverseLookupCache[$IP])){
86 $ptr = implode(".", array_reverse(explode(".",$IP))) . ".in-addr.arpa";
87 $host = dns_get_record($ptr, DNS_PTR);
88 if($host == null){
89 self::$reverseLookupCache[$IP] = '';
90 } else {
91 self::$reverseLookupCache[$IP] = $host[0]['target'];
92 }
93 }
94 return self::$reverseLookupCache[$IP];
95 }
96 public static function editUserLink($userID){
97 return get_admin_url() . 'user-edit.php?user_id=' . $userID;
98 }
99 public static function wdie($err){
100 $trace=debug_backtrace(); $caller=array_shift($trace);
101 error_log("Wordfence error in " . $caller['file'] . " line " . $caller['line'] . ": $err");
102 exit();
103 }
104 public static function tmpl($file, $data){
105 extract($data);
106 ob_start();
107 include $file;
108 return ob_get_contents() . (ob_end_clean() ? "" : "");
109 }
110 public static function bigRandomHex(){
111 return dechex(rand(0, 2147483647)) . dechex(rand(0, 2147483647)) . dechex(rand(0, 2147483647));
112 }
113 public static function encrypt($str){
114 $key = wfConfig::get('encKey');
115 if(! $key){
116 error_log("Wordfence error: No encryption key found!");
117 exit();
118 }
119 $db = new wfDB();
120 return $db->querySingle("select HEX(AES_ENCRYPT('%s', '%s')) as val", $str, $key);
121 }
122 public static function decrypt($str){
123 $key = wfConfig::get('encKey');
124 if(! $key){
125 error_log("Wordfence error: No encryption key found!");
126 exit();
127 }
128 $db = new wfDB();
129 return $db->querySingle("select AES_DECRYPT(UNHEX('%s'), '%s') as val", $str, $key);
130 }
131 public static function logCaller(){
132 $trace=debug_backtrace();
133 $caller=array_shift($trace);
134 $c2 = array_shift($trace);
135 error_log("Caller for " . $caller['file'] . " line " . $caller['line'] . " is " . $c2['file'] . ' line ' . $c2['line']);
136 }
137 public static function getWPVersion(){
138 global $wp_version;
139 global $wordfence_wp_version;
140 if(isset($wordfence_wp_version)){
141 return $wordfence_wp_version;
142 } else {
143 return $wp_version;
144 }
145 }
146 }
147
148
149 ?>
150