@@ -7,23 +7,23 @@ |
||
7 | 7 | private static $config; |
8 | 8 | private static $application = []; |
9 | 9 | |
10 | - public function __construct(){ |
|
10 | + public function __construct() { |
|
11 | 11 | self::$config = (new Config)->get(); |
12 | 12 | } |
13 | 13 | |
14 | - public function __get($name){ |
|
15 | - array_push(self::$application,$name); |
|
14 | + public function __get($name) { |
|
15 | + array_push(self::$application, $name); |
|
16 | 16 | return (new self); |
17 | 17 | } |
18 | 18 | |
19 | - public function __call($name,$value){ |
|
20 | - array_push(self::$application,$name); |
|
21 | - $file = implode('/',self::$application); |
|
19 | + public function __call($name, $value) { |
|
20 | + array_push(self::$application, $name); |
|
21 | + $file = implode('/', self::$application); |
|
22 | 22 | $file = self::$config['core']['apps'].'/'.$file.'.php'; |
23 | 23 | self::$application = []; |
24 | - if(is_file($file)) { |
|
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)) $result = call_user_func_array($result, $value); |
|
27 | 27 | return $result; |
28 | 28 | } |
29 | 29 | } |
@@ -5,11 +5,11 @@ |
||
5 | 5 | |
6 | 6 | public static $config = []; |
7 | 7 | |
8 | - public function __construct($config=[]){ |
|
9 | - self::$config = array_merge(self::$config,$config); |
|
8 | + public function __construct($config = []) { |
|
9 | + self::$config = array_merge(self::$config, $config); |
|
10 | 10 | } |
11 | 11 | |
12 | - public function get(){ |
|
12 | + public function get() { |
|
13 | 13 | return self::$config; |
14 | 14 | } |
15 | 15 |
@@ -7,31 +7,31 @@ |
||
7 | 7 | private static $host; |
8 | 8 | private static $config; |
9 | 9 | |
10 | - public function __construct(){ |
|
10 | + public function __construct() { |
|
11 | 11 | # Config |
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']; |
|
15 | + if (isset(self::$host['host'])) self::$host = self::$host['host']; |
|
16 | 16 | else self::$host = '/'; |
17 | 17 | } |
18 | 18 | |
19 | - public function add($css){ |
|
20 | - if(!is_array($css)) $css = [$css]; |
|
21 | - self::$list = array_merge(self::$list,$css); |
|
19 | + public function add($css) { |
|
20 | + if (!is_array($css)) $css = [$css]; |
|
21 | + self::$list = array_merge(self::$list, $css); |
|
22 | 22 | } |
23 | 23 | |
24 | - public function get(){ |
|
24 | + public function get() { |
|
25 | 25 | $css = array_unique(self::$list); |
26 | 26 | $code = ''; |
27 | - foreach($css as $name){ |
|
27 | + foreach ($css as $name) { |
|
28 | 28 | $file = self::$config['core']['css'].'/'.$name.'.css'; |
29 | - if(is_file($file)) $code .= file_get_contents($file); |
|
29 | + if (is_file($file)) $code .= file_get_contents($file); |
|
30 | 30 | } |
31 | 31 | return "<style>$code</style>"; |
32 | 32 | } |
33 | 33 | |
34 | - public function compile(){ |
|
34 | + public function compile() { |
|
35 | 35 | # ... |
36 | 36 | } |
37 | 37 |
@@ -5,19 +5,19 @@ |
||
5 | 5 | |
6 | 6 | private static $memory = []; |
7 | 7 | |
8 | - public function add($title){ |
|
9 | - if(!is_array($title)) $title = [$title]; |
|
10 | - self::$memory = array_merge(self::$memory,$title); |
|
8 | + public function add($title) { |
|
9 | + if (!is_array($title)) $title = [$title]; |
|
10 | + self::$memory = array_merge(self::$memory, $title); |
|
11 | 11 | return $this; |
12 | 12 | } |
13 | 13 | |
14 | - public function get(){ |
|
14 | + public function get() { |
|
15 | 15 | self::$memory = array_reverse(self::$memory); |
16 | - foreach(self::$memory as $key=>$value){ |
|
16 | + foreach (self::$memory as $key=>$value) { |
|
17 | 17 | $value = urldecode($value); |
18 | 18 | self::$memory[$key] = $value; |
19 | 19 | } |
20 | - return '<meta name="description" content="'.implode(' ',self::$memory).'">'; |
|
20 | + return '<meta name="description" content="'.implode(' ', self::$memory).'">'; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | } |
@@ -5,19 +5,19 @@ |
||
5 | 5 | |
6 | 6 | private static $memory = []; |
7 | 7 | |
8 | - public function add($title){ |
|
9 | - if(!is_array($title)) $title = [$title]; |
|
10 | - self::$memory = array_merge(self::$memory,$title); |
|
8 | + public function add($title) { |
|
9 | + if (!is_array($title)) $title = [$title]; |
|
10 | + self::$memory = array_merge(self::$memory, $title); |
|
11 | 11 | return $this; |
12 | 12 | } |
13 | 13 | |
14 | - public function get(){ |
|
14 | + public function get() { |
|
15 | 15 | self::$memory = array_reverse(self::$memory); |
16 | - foreach(self::$memory as $key=>$value){ |
|
16 | + foreach (self::$memory as $key=>$value) { |
|
17 | 17 | $value = urldecode($value); |
18 | 18 | self::$memory[$key] = $value; |
19 | 19 | } |
20 | - return '<meta name="keywords" content="'.implode(',',self::$memory).'">'; |
|
20 | + return '<meta name="keywords" content="'.implode(',', self::$memory).'">'; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | } |
@@ -5,19 +5,19 @@ |
||
5 | 5 | |
6 | 6 | private static $memory = []; |
7 | 7 | |
8 | - public function add($title){ |
|
9 | - if(!is_array($title)) $title = [$title]; |
|
10 | - self::$memory = array_merge(self::$memory,$title); |
|
8 | + public function add($title) { |
|
9 | + if (!is_array($title)) $title = [$title]; |
|
10 | + self::$memory = array_merge(self::$memory, $title); |
|
11 | 11 | return $this; |
12 | 12 | } |
13 | 13 | |
14 | - public function get(){ |
|
14 | + public function get() { |
|
15 | 15 | self::$memory = array_reverse(self::$memory); |
16 | - foreach(self::$memory as $key=>$value){ |
|
16 | + foreach (self::$memory as $key=>$value) { |
|
17 | 17 | $value = urldecode($value); |
18 | 18 | self::$memory[$key] = $value; |
19 | 19 | } |
20 | - return '<title>'.implode(' - ',self::$memory).'</title>'; |
|
20 | + return '<title>'.implode(' - ', self::$memory).'</title>'; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | } |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | class View { |
5 | 5 | |
6 | - public function __get($name){ |
|
6 | + public function __get($name) { |
|
7 | 7 | (new Content)->view($name); |
8 | 8 | } |
9 | 9 |
@@ -11,14 +11,14 @@ discard block |
||
11 | 11 | private static $property; |
12 | 12 | private static $path; |
13 | 13 | |
14 | - public function __construct(){ |
|
14 | + public function __construct() { |
|
15 | 15 | # Config |
16 | 16 | self::$config = (new Config)->get(); |
17 | 17 | # Url |
18 | - self::$path = explode('/',parse_url(urldecode($_SERVER['REQUEST_URI']))['path']); |
|
19 | - foreach(self::$path as $key=>$value){ |
|
18 | + self::$path = explode('/', parse_url(urldecode($_SERVER['REQUEST_URI']))['path']); |
|
19 | + foreach (self::$path as $key=>$value) { |
|
20 | 20 | $value = trim($value); |
21 | - if(empty($value)) unset(self::$path[$key]); |
|
21 | + if (empty($value)) unset(self::$path[$key]); |
|
22 | 22 | } |
23 | 23 | self::$path = array_values(self::$path); |
24 | 24 | # Application |
@@ -31,15 +31,15 @@ discard block |
||
31 | 31 | self::$css = new Css; |
32 | 32 | } |
33 | 33 | |
34 | - public function __get($name){ |
|
35 | - self::$property= $name; |
|
34 | + public function __get($name) { |
|
35 | + self::$property = $name; |
|
36 | 36 | return new self; |
37 | 37 | } |
38 | 38 | |
39 | - public function __call($_name,$value){ |
|
40 | - if(isset($value[0]) && !empty($value[0]) && is_array($value[0])) extract($value[0]); |
|
39 | + public function __call($_name, $value) { |
|
40 | + if (isset($value[0]) && !empty($value[0]) && is_array($value[0])) extract($value[0]); |
|
41 | 41 | $file = self::$config['core']['widget'].'/'.self::$property.'/'.$_name.'.phtml'; |
42 | - if(is_file($file)) require($file); |
|
42 | + if (is_file($file)) require($file); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | } |
@@ -5,13 +5,13 @@ |
||
5 | 5 | |
6 | 6 | private $source; |
7 | 7 | |
8 | - public function __construct($source){ |
|
8 | + public function __construct($source) { |
|
9 | 9 | $this->source = $source; |
10 | 10 | } |
11 | 11 | |
12 | - public function compress(){ |
|
12 | + public function compress() { |
|
13 | 13 | $minify = $this->source; |
14 | - $minify = preg_replace('/>[\s]*</Ui','><',$minify); |
|
14 | + $minify = preg_replace('/>[\s]*</Ui', '><', $minify); |
|
15 | 15 | return $minify; |
16 | 16 | } |
17 | 17 |