@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -32,9 +32,13 @@ |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | public function __call($_name,$value){ |
| 35 | - if(isset($value[0]) && !empty($value[0]) && is_array($value[0])) extract($value[0]); |
|
| 35 | + if(isset($value[0]) && !empty($value[0]) && is_array($value[0])) { |
|
| 36 | + extract($value[0]); |
|
| 37 | + } |
|
| 36 | 38 | $file = self::$config['paths']['widget'].'/'.self::$property.'/'.$_name.'.phtml'; |
| 37 | - if(is_file($file)) require($file); |
|
| 39 | + if(is_file($file)) { |
|
| 40 | + require($file); |
|
| 41 | + } |
|
| 38 | 42 | } |
| 39 | 43 | |
| 40 | 44 | } |
@@ -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); |
@@ -9,7 +9,9 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | $config = (new Config)->get(); |
| 11 | 11 | |
| 12 | - if(!isset($_SERVER['HTTP_ACCEPT'])) $_SERVER['HTTP_ACCEPT'] = '*/*'; |
|
| 12 | + if(!isset($_SERVER['HTTP_ACCEPT'])) { |
|
| 13 | + $_SERVER['HTTP_ACCEPT'] = '*/*'; |
|
| 14 | + } |
|
| 13 | 15 | $acceptSrc = explode(',',$_SERVER['HTTP_ACCEPT']); |
| 14 | 16 | foreach($acceptSrc as $key=>$value){ |
| 15 | 17 | $value = explode('/',$value); |
@@ -38,8 +40,7 @@ discard block |
||
| 38 | 40 | { |
| 39 | 41 | header('HTTP/1.1 304 Not Modified'); |
| 40 | 42 | exit(); |
| 41 | - } |
|
| 42 | - else |
|
| 43 | + } else |
|
| 43 | 44 | { |
| 44 | 45 | header("Last-Modified: $tsstring"); |
| 45 | 46 | header("ETag: $etag"); |
@@ -73,15 +74,21 @@ discard block |
||
| 73 | 74 | $func = require_once($file); |
| 74 | 75 | $reflection = new \ReflectionFunction($func); |
| 75 | 76 | foreach($reflection->getParameters() as $key=>$value){ |
| 76 | - if(isset($params[$value->name])) $stableParams[$value->name] = $params[$value->name]; |
|
| 77 | - else $stableParams[$value->name] = null; |
|
| 77 | + if(isset($params[$value->name])) { |
|
| 78 | + $stableParams[$value->name] = $params[$value->name]; |
|
| 79 | + } else { |
|
| 80 | + $stableParams[$value->name] = null; |
|
| 81 | + } |
|
| 78 | 82 | } |
| 79 | 83 | $name = explode('/',$method); |
| 80 | 84 | $count = count($name)-1; |
| 81 | 85 | $app = new Application; |
| 82 | 86 | foreach($name as $key=>$var){ |
| 83 | - if($count == $key) $app = call_user_method_array($var,$app,$stableParams); |
|
| 84 | - else $app = $app->{$var}; |
|
| 87 | + if($count == $key) { |
|
| 88 | + $app = call_user_method_array($var,$app,$stableParams); |
|
| 89 | + } else { |
|
| 90 | + $app = $app->{$var}; |
|
| 91 | + } |
|
| 85 | 92 | } |
| 86 | 93 | $result[$method] = $app; |
| 87 | 94 | } |
@@ -10,8 +10,11 @@ discard block |
||
| 10 | 10 | $tmp = explode('/',$this->requiestUri); |
| 11 | 11 | foreach($tmp as $key=>$value){ |
| 12 | 12 | $value = trim($value); |
| 13 | - if(empty($value)) unset($tmp[$key]); |
|
| 14 | - else $tmp[$key] = $value; |
|
| 13 | + if(empty($value)) { |
|
| 14 | + unset($tmp[$key]); |
|
| 15 | + } else { |
|
| 16 | + $tmp[$key] = $value; |
|
| 17 | + } |
|
| 15 | 18 | } |
| 16 | 19 | $tmp = array_values($tmp); |
| 17 | 20 | $this->requestUri = $tmp; |
@@ -22,8 +25,11 @@ discard block |
||
| 22 | 25 | } |
| 23 | 26 | |
| 24 | 27 | public function part($number){ |
| 25 | - if(isset($this->requestUri[$number])) return (string) urldecode($this->requestUri[$number]); |
|
| 26 | - else return ''; |
|
| 28 | + if(isset($this->requestUri[$number])) { |
|
| 29 | + return (string) urldecode($this->requestUri[$number]); |
|
| 30 | + } else { |
|
| 31 | + return ''; |
|
| 32 | + } |
|
| 27 | 33 | } |
| 28 | 34 | |
| 29 | 35 | public function host(){ |