@@ -23,7 +23,9 @@ |
||
23 | 23 | self::$application = []; |
24 | 24 | if(is_file($file)) { |
25 | 25 | $result = require($file); |
26 | - if(is_callable($result)) $result = call_user_func_array($result,$value); |
|
26 | + if(is_callable($result)) { |
|
27 | + $result = call_user_func_array($result,$value); |
|
28 | + } |
|
27 | 29 | return $result; |
28 | 30 | } |
29 | 31 | } |
@@ -25,7 +25,9 @@ discard block |
||
25 | 25 | self::$path = explode('/',parse_url(urldecode($_SERVER['REQUEST_URI']))['path']); |
26 | 26 | foreach(self::$path as $key=>$value){ |
27 | 27 | $value = trim($value); |
28 | - if(empty($value)) unset(self::$path[$key]); |
|
28 | + if(empty($value)) { |
|
29 | + unset(self::$path[$key]); |
|
30 | + } |
|
29 | 31 | } |
30 | 32 | self::$path = array_values(self::$path); |
31 | 33 | # Application |
@@ -47,15 +49,20 @@ discard block |
||
47 | 49 | # Uri |
48 | 50 | self::$uri = explode('/',$_SERVER['REQUEST_URI']); |
49 | 51 | foreach(self::$uri as $key=>$value){ |
50 | - if(empty($value)) unset(self::$uri[$key]); |
|
51 | - else self::$uri[$key] = urldecode($value); |
|
52 | + if(empty($value)) { |
|
53 | + unset(self::$uri[$key]); |
|
54 | + } else { |
|
55 | + self::$uri[$key] = urldecode($value); |
|
56 | + } |
|
52 | 57 | } |
53 | 58 | self::$uri = array_values(self::$uri); |
54 | 59 | } |
55 | 60 | |
56 | 61 | public function view($name){ |
57 | 62 | $file = $this->file($name); |
58 | - if(is_file($file)) require $file; |
|
63 | + if(is_file($file)) { |
|
64 | + require $file; |
|
65 | + } |
|
59 | 66 | } |
60 | 67 | |
61 | 68 | public function page(){ |
@@ -103,7 +110,9 @@ discard block |
||
103 | 110 | $nextUri = implode('/',array_slice($uri,0,$i+1)); |
104 | 111 | $getFile = function($type) use($path,$nextUri){ |
105 | 112 | $file = $path.'/'.$nextUri.'/index.'.$type; |
106 | - if(is_file($file)) return $file; |
|
113 | + if(is_file($file)) { |
|
114 | + return $file; |
|
115 | + } |
|
107 | 116 | return null; |
108 | 117 | }; |
109 | 118 | $filePhtml = $getFile('phtml'); |
@@ -12,12 +12,17 @@ discard block |
||
12 | 12 | self::$config = (new Config)->get(); |
13 | 13 | # Host |
14 | 14 | self::$host = parse_url('http://'.$_SERVER['HTTP_HOST']); |
15 | - if(isset(self::$host['host'])) self::$host = self::$host['host']; |
|
16 | - else self::$host = '/'; |
|
15 | + if(isset(self::$host['host'])) { |
|
16 | + self::$host = self::$host['host']; |
|
17 | + } else { |
|
18 | + self::$host = '/'; |
|
19 | + } |
|
17 | 20 | } |
18 | 21 | |
19 | 22 | public function add($css){ |
20 | - if(!is_array($css)) $css = [$css]; |
|
23 | + if(!is_array($css)) { |
|
24 | + $css = [$css]; |
|
25 | + } |
|
21 | 26 | self::$list = array_merge(self::$list,$css); |
22 | 27 | } |
23 | 28 | |
@@ -26,7 +31,9 @@ discard block |
||
26 | 31 | $code = ''; |
27 | 32 | foreach($css as $name){ |
28 | 33 | $file = self::$config['core']['css'].'/'.$name.'.css'; |
29 | - if(is_file($file)) $code .= file_get_contents($file); |
|
34 | + if(is_file($file)) { |
|
35 | + $code .= file_get_contents($file); |
|
36 | + } |
|
30 | 37 | } |
31 | 38 | return "<style>$code</style>"; |
32 | 39 | } |
@@ -7,7 +7,9 @@ discard block |
||
7 | 7 | |
8 | 8 | $config = (new Config)->get(); |
9 | 9 | |
10 | - if(!isset($_SERVER['HTTP_ACCEPT'])) $_SERVER['HTTP_ACCEPT'] = '*/*'; |
|
10 | + if(!isset($_SERVER['HTTP_ACCEPT'])) { |
|
11 | + $_SERVER['HTTP_ACCEPT'] = '*/*'; |
|
12 | + } |
|
11 | 13 | $acceptSrc = explode(',',$_SERVER['HTTP_ACCEPT']); |
12 | 14 | foreach($acceptSrc as $key=>$value){ |
13 | 15 | $value = explode('/',$value); |
@@ -44,15 +46,21 @@ discard block |
||
44 | 46 | $func = require_once($file); |
45 | 47 | $reflection = new \ReflectionFunction($func); |
46 | 48 | foreach($reflection->getParameters() as $key=>$value){ |
47 | - if(isset($params[$value->name])) $stableParams[$value->name] = $params[$value->name]; |
|
48 | - else $stableParams[$value->name] = null; |
|
49 | + if(isset($params[$value->name])) { |
|
50 | + $stableParams[$value->name] = $params[$value->name]; |
|
51 | + } else { |
|
52 | + $stableParams[$value->name] = null; |
|
53 | + } |
|
49 | 54 | } |
50 | 55 | $name = explode('/',$method); |
51 | 56 | $count = count($name)-1; |
52 | 57 | $app = new Application; |
53 | 58 | foreach($name as $key=>$var){ |
54 | - if($count == $key) $app = call_user_method_array($var,$app,$stableParams); |
|
55 | - else $app = $app->{$var}; |
|
59 | + if($count == $key) { |
|
60 | + $app = call_user_method_array($var,$app,$stableParams); |
|
61 | + } else { |
|
62 | + $app = $app->{$var}; |
|
63 | + } |
|
56 | 64 | } |
57 | 65 | $result[$method] = $app; |
58 | 66 | } |
@@ -6,7 +6,9 @@ |
||
6 | 6 | private static $memory = []; |
7 | 7 | |
8 | 8 | public function add($title){ |
9 | - if(!is_array($title)) $title = [$title]; |
|
9 | + if(!is_array($title)) { |
|
10 | + $title = [$title]; |
|
11 | + } |
|
10 | 12 | self::$memory = array_merge(self::$memory,$title); |
11 | 13 | return $this; |
12 | 14 | } |
@@ -18,7 +18,9 @@ discard block |
||
18 | 18 | self::$path = explode('/',parse_url(urldecode($_SERVER['REQUEST_URI']))['path']); |
19 | 19 | foreach(self::$path as $key=>$value){ |
20 | 20 | $value = trim($value); |
21 | - if(empty($value)) unset(self::$path[$key]); |
|
21 | + if(empty($value)) { |
|
22 | + unset(self::$path[$key]); |
|
23 | + } |
|
22 | 24 | } |
23 | 25 | self::$path = array_values(self::$path); |
24 | 26 | # Application |
@@ -37,9 +39,13 @@ discard block |
||
37 | 39 | } |
38 | 40 | |
39 | 41 | public function __call($_name,$value){ |
40 | - if(isset($value[0]) && !empty($value[0]) && is_array($value[0])) extract($value[0]); |
|
42 | + if(isset($value[0]) && !empty($value[0]) && is_array($value[0])) { |
|
43 | + extract($value[0]); |
|
44 | + } |
|
41 | 45 | $file = self::$config['core']['widget'].'/'.self::$property.'/'.$_name.'.phtml'; |
42 | - if(is_file($file)) require($file); |
|
46 | + if(is_file($file)) { |
|
47 | + require($file); |
|
48 | + } |
|
43 | 49 | } |
44 | 50 | |
45 | 51 | } |
@@ -6,7 +6,9 @@ |
||
6 | 6 | private static $memory = []; |
7 | 7 | |
8 | 8 | public function add($title){ |
9 | - if(!is_array($title)) $title = [$title]; |
|
9 | + if(!is_array($title)) { |
|
10 | + $title = [$title]; |
|
11 | + } |
|
10 | 12 | self::$memory = array_merge(self::$memory,$title); |
11 | 13 | return $this; |
12 | 14 | } |
@@ -6,7 +6,9 @@ |
||
6 | 6 | private static $memory = []; |
7 | 7 | |
8 | 8 | public function add($title){ |
9 | - if(!is_array($title)) $title = [$title]; |
|
9 | + if(!is_array($title)) { |
|
10 | + $title = [$title]; |
|
11 | + } |
|
10 | 12 | self::$memory = array_merge(self::$memory,$title); |
11 | 13 | return $this; |
12 | 14 | } |
@@ -12,19 +12,27 @@ discard block |
||
12 | 12 | self::$config = (new Config)->get(); |
13 | 13 | # Host |
14 | 14 | self::$host = parse_url('http://'.$_SERVER['HTTP_HOST']); |
15 | - if(isset(self::$host['host'])) self::$host = self::$host['host']; |
|
16 | - else self::$host = '/'; |
|
15 | + if(isset(self::$host['host'])) { |
|
16 | + self::$host = self::$host['host']; |
|
17 | + } else { |
|
18 | + self::$host = '/'; |
|
19 | + } |
|
17 | 20 | } |
18 | 21 | |
19 | 22 | public function add($js){ |
20 | - if(!is_array($js)) $js = [$js]; |
|
23 | + if(!is_array($js)) { |
|
24 | + $js = [$js]; |
|
25 | + } |
|
21 | 26 | self::$list = array_merge(self::$list,$js); |
22 | 27 | } |
23 | 28 | |
24 | 29 | public function get(){ |
25 | 30 | $js = array_unique(self::$list); |
26 | - if(!empty($js)) $jsQuery = '?'.implode(':',$js); |
|
27 | - else $jsQuery = ''; |
|
31 | + if(!empty($js)) { |
|
32 | + $jsQuery = '?'.implode(':',$js); |
|
33 | + } else { |
|
34 | + $jsQuery = ''; |
|
35 | + } |
|
28 | 36 | return '<script async src="http://'.self::$host.'/javascript.js'.$jsQuery.'"></script>'; |
29 | 37 | } |
30 | 38 | |
@@ -33,7 +41,9 @@ discard block |
||
33 | 41 | $code = ''; |
34 | 42 | foreach($js as $name){ |
35 | 43 | $file = self::$config['core']['js'].'/'.$name.'.js'; |
36 | - if(is_file($file)) $code .= file_get_contents($file); |
|
44 | + if(is_file($file)) { |
|
45 | + $code .= file_get_contents($file); |
|
46 | + } |
|
37 | 47 | } |
38 | 48 | $minifier = new \MatthiasMullie\Minify\JS(); |
39 | 49 | $minifier->add($code); |