-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathH.php
More file actions
33 lines (29 loc) · 1.09 KB
/
H.php
File metadata and controls
33 lines (29 loc) · 1.09 KB
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
<?php
class H # Helper
{
static $func = array();
static $remouteUrl = 'https://raw.githubusercontent.com/AlexSuperStar/php-Helper/master/helper/';
public static function __callstatic($name, $arguments)
{
if (!isset(self::$func[$name])) {
if (is_file('helper/' . $name . '.php')) {
self::$func[$name] = include 'helper/' . $name . '.php';
}
}
if (empty(self::$func[$name]) && self::$remouteUrl) {
$data = file_get_contents(self::$remouteUrl . $name . '.php');
if (!empty($data)) {
# TODO checkSign
file_put_contents('helper/' . $name . '.php', $data);
self::$func[$name] = include 'helper/' . $name . '.php';
} else {
trigger_error('Remoute hrlper not loaded: ' . $name, E_USER_NOTICE);
}
}
if (!empty(self::$func[$name])) {
return call_user_func_array(self::$func[$name], $arguments);
} else {
trigger_error('Hrlper not found: ' . $name, E_USER_ERROR);
}
}
}