@@ -22,10 +22,10 @@ |
||
22 | 22 | { |
23 | 23 | $to = trim($to, '/'); |
24 | 24 | if (false === $full && !Str::startsWith(App::$Alias->baseUrl, $to)) { |
25 | - $to = App::$Alias->baseUrl . '/' . $to; |
|
25 | + $to = App::$Alias->baseUrl.'/'.$to; |
|
26 | 26 | } |
27 | 27 | $redirect = new FoundationRedirect($to); |
28 | 28 | $redirect->send(); |
29 | - exit('Redirecting to ' . $to . ' ...'); |
|
29 | + exit('Redirecting to '.$to.' ...'); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | \ No newline at end of file |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $this->baseDomain = App::$Properties->get('baseDomain'); |
93 | 93 | } |
94 | 94 | // build script url |
95 | - $this->scriptUrl = App::$Request->getScheme() . '://' . $this->baseDomain; |
|
95 | + $this->scriptUrl = App::$Request->getScheme().'://'.$this->baseDomain; |
|
96 | 96 | if (App::$Properties->get('basePath') !== '/') { |
97 | 97 | $this->scriptUrl .= rtrim(App::$Properties->get('basePath'), '/'); |
98 | 98 | } |
@@ -104,27 +104,27 @@ discard block |
||
104 | 104 | |
105 | 105 | $this->baseUrlNoLang = $this->baseUrl; |
106 | 106 | if (App::$Request->languageInPath() && App::$Request->getLanguage() !== null) { |
107 | - $this->baseUrl .= '/' . App::$Request->getLanguage(); |
|
107 | + $this->baseUrl .= '/'.App::$Request->getLanguage(); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | // add cron initiation from user if enabled |
111 | 111 | if ((bool)App::$Properties->get('userCron') && env_name === 'Front') { |
112 | - $this->addPlainCode('js', 'if(Math.random() > 0.8) { $.get("' . $this->scriptUrl . '/cron.php?rand=" + Math.random()); }'); |
|
112 | + $this->addPlainCode('js', 'if(Math.random() > 0.8) { $.get("'.$this->scriptUrl.'/cron.php?rand=" + Math.random()); }'); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | // build vendor libs alias |
116 | - $this->vendorNamedLibrary['js']['jquery'] = $this->scriptUrl . '/vendor/bower/jquery/dist/jquery.min.js'; |
|
117 | - $this->vendorNamedLibrary['css']['bootstrap'] = $this->scriptUrl . '/vendor/bower/bootstrap/dist/css/bootstrap.min.css'; |
|
118 | - $this->vendorNamedLibrary['js']['bootstrap'] = $this->scriptUrl . '/vendor/bower/bootstrap/dist/js/bootstrap.min.js'; |
|
119 | - $this->vendorNamedLibrary['css']['fa'] = $this->scriptUrl . '/vendor/bower/components-font-awesome/css/font-awesome.min.css'; |
|
120 | - $this->vendorNamedLibrary['js']['jquery-ui'] = $this->scriptUrl . '/vendor/bower/jquery-ui/jquery-ui.min.js'; |
|
121 | - $this->vendorNamedLibrary['css']['jquery-ui'] = $this->scriptUrl . '/vendor/bower/jquery-ui/themes/base/jquery-ui.min.css'; |
|
116 | + $this->vendorNamedLibrary['js']['jquery'] = $this->scriptUrl.'/vendor/bower/jquery/dist/jquery.min.js'; |
|
117 | + $this->vendorNamedLibrary['css']['bootstrap'] = $this->scriptUrl.'/vendor/bower/bootstrap/dist/css/bootstrap.min.css'; |
|
118 | + $this->vendorNamedLibrary['js']['bootstrap'] = $this->scriptUrl.'/vendor/bower/bootstrap/dist/js/bootstrap.min.js'; |
|
119 | + $this->vendorNamedLibrary['css']['fa'] = $this->scriptUrl.'/vendor/bower/components-font-awesome/css/font-awesome.min.css'; |
|
120 | + $this->vendorNamedLibrary['js']['jquery-ui'] = $this->scriptUrl.'/vendor/bower/jquery-ui/jquery-ui.min.js'; |
|
121 | + $this->vendorNamedLibrary['css']['jquery-ui'] = $this->scriptUrl.'/vendor/bower/jquery-ui/themes/base/jquery-ui.min.css'; |
|
122 | 122 | |
123 | 123 | $themeAll = App::$Properties->get('theme'); |
124 | 124 | if (!isset($themeAll[env_name]) || Str::length($themeAll[env_name]) < 1) { |
125 | 125 | $themeAll[env_name] = 'default'; |
126 | 126 | } |
127 | - $this->currentViewUrl = $this->scriptUrl . '/Apps/View/' . env_name . '/' . $themeAll[env_name]; |
|
127 | + $this->currentViewUrl = $this->scriptUrl.'/Apps/View/'.env_name.'/'.$themeAll[env_name]; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | if (!class_exists($class) || !method_exists($class, $method)) |
75 | 75 | return false; |
76 | 76 | |
77 | - $callback = (string)$class . '::' . (string)$method; |
|
77 | + $callback = (string)$class.'::'.(string)$method; |
|
78 | 78 | |
79 | 79 | // add instance to cron task manager |
80 | 80 | if (!isset($this->configs['instances'][$callback])) { |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function remove($class, $method) |
94 | 94 | { |
95 | - $callback = $class . '::' . $method; |
|
95 | + $callback = $class.'::'.$method; |
|
96 | 96 | if (isset($this->configs['instances'][$callback])) { |
97 | 97 | unset($this->configs['instances'][$callback], $this->configs['log'][$callback]); |
98 | 98 | App::$Properties->writeConfig('Cron', $this->configs); |
@@ -23,8 +23,9 @@ discard block |
||
23 | 23 | { |
24 | 24 | /** @var array $configs */ |
25 | 25 | $configs = App::$Properties->getAll('Cron'); |
26 | - if (Any::isArray($configs)) |
|
27 | - $this->configs = $configs; |
|
26 | + if (Any::isArray($configs)) { |
|
27 | + $this->configs = $configs; |
|
28 | + } |
|
28 | 29 | } |
29 | 30 | |
30 | 31 | /** |
@@ -34,8 +35,9 @@ discard block |
||
34 | 35 | public function run() |
35 | 36 | { |
36 | 37 | // check if cron instances is defined |
37 | - if (!isset($this->configs['instances']) || !Any::isArray($this->configs['instances'])) |
|
38 | - return null; |
|
38 | + if (!isset($this->configs['instances']) || !Any::isArray($this->configs['instances'])) { |
|
39 | + return null; |
|
40 | + } |
|
39 | 41 | |
40 | 42 | // get timestamp |
41 | 43 | $time = time(); |
@@ -71,8 +73,9 @@ discard block |
||
71 | 73 | public function register($class, $method, $delay = 60) |
72 | 74 | { |
73 | 75 | // check if declared callback is exist over autoload |
74 | - if (!class_exists($class) || !method_exists($class, $method)) |
|
75 | - return false; |
|
76 | + if (!class_exists($class) || !method_exists($class, $method)) { |
|
77 | + return false; |
|
78 | + } |
|
76 | 79 | |
77 | 80 | $callback = (string)$class . '::' . (string)$method; |
78 | 81 |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | return true; |
42 | 42 | |
43 | 43 | // try to load from file |
44 | - $configFile = ucfirst(Str::lowerCase($configName)) . '.php'; |
|
45 | - if (File::exist('/Private/Config/' . $configFile)) { |
|
46 | - $this->data[$configName] = File::inc('/Private/Config/' . $configFile, true); |
|
44 | + $configFile = ucfirst(Str::lowerCase($configName)).'.php'; |
|
45 | + if (File::exist('/Private/Config/'.$configFile)) { |
|
46 | + $this->data[$configName] = File::inc('/Private/Config/'.$configFile, true); |
|
47 | 47 | return true; |
48 | 48 | } |
49 | 49 | |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public function writeConfig(string $configFile, array $data): bool |
134 | 134 | { |
135 | - $path = '/Private/Config/' . ucfirst(Str::lowerCase($configFile)) . '.php'; |
|
135 | + $path = '/Private/Config/'.ucfirst(Str::lowerCase($configFile)).'.php'; |
|
136 | 136 | if (!File::exist($path) || !File::writable($path)) |
137 | 137 | return false; |
138 | 138 | |
139 | - $saveData = '<?php return ' . Arr::exportVar($data) . ';'; |
|
139 | + $saveData = '<?php return '.Arr::exportVar($data).';'; |
|
140 | 140 | File::write($path, $saveData); |
141 | 141 | // overload config values if changed |
142 | 142 | $this->load($configFile, true); |
@@ -24,8 +24,9 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function __construct() |
26 | 26 | { |
27 | - if (!$this->load('default')) |
|
28 | - throw new NativeException('Default configurations is not founded: /Private/Config/Default.php'); |
|
27 | + if (!$this->load('default')) { |
|
28 | + throw new NativeException('Default configurations is not founded: /Private/Config/Default.php'); |
|
29 | + } |
|
29 | 30 | } |
30 | 31 | |
31 | 32 | /** |
@@ -37,8 +38,9 @@ discard block |
||
37 | 38 | private function load(string $configName, $overload = false): bool |
38 | 39 | { |
39 | 40 | // check if always loaded |
40 | - if (Any::isArray($this->data) && array_key_exists($configName, $this->data) && !$overload) |
|
41 | - return true; |
|
41 | + if (Any::isArray($this->data) && array_key_exists($configName, $this->data) && !$overload) { |
|
42 | + return true; |
|
43 | + } |
|
42 | 44 | |
43 | 45 | // try to load from file |
44 | 46 | $configFile = ucfirst(Str::lowerCase($configName)) . '.php'; |
@@ -61,12 +63,14 @@ discard block |
||
61 | 63 | { |
62 | 64 | $this->load($configFile); |
63 | 65 | // check if configs for this file is loaded |
64 | - if (!isset($this->data[$configFile])) |
|
65 | - return false; |
|
66 | + if (!isset($this->data[$configFile])) { |
|
67 | + return false; |
|
68 | + } |
|
66 | 69 | |
67 | 70 | // check if config key is exist |
68 | - if (!isset($this->data[$configFile][$configKey])) |
|
69 | - return false; |
|
71 | + if (!isset($this->data[$configFile][$configKey])) { |
|
72 | + return false; |
|
73 | + } |
|
70 | 74 | |
71 | 75 | $response = $this->data[$configFile][$configKey]; |
72 | 76 | |
@@ -100,8 +104,9 @@ discard block |
||
100 | 104 | public function getAll($configFile = 'default'): ?array |
101 | 105 | { |
102 | 106 | $this->load($configFile); |
103 | - if (!Any::isArray($this->data) || !array_key_exists($configFile, $this->data)) |
|
104 | - return null; |
|
107 | + if (!Any::isArray($this->data) || !array_key_exists($configFile, $this->data)) { |
|
108 | + return null; |
|
109 | + } |
|
105 | 110 | |
106 | 111 | return $this->data[$configFile]; |
107 | 112 | } |
@@ -116,8 +121,9 @@ discard block |
||
116 | 121 | public function updateConfig(string $configFile, array $newData, ?bool $mergeDeep = false): bool |
117 | 122 | { |
118 | 123 | $this->load($configFile); |
119 | - if (!isset($this->data[$configFile])) |
|
120 | - return false; |
|
124 | + if (!isset($this->data[$configFile])) { |
|
125 | + return false; |
|
126 | + } |
|
121 | 127 | |
122 | 128 | $oldData = $this->data[$configFile]; |
123 | 129 | $saveData = ($mergeDeep ? Arr::mergeRecursive($oldData, $newData) : Arr::merge($oldData, $newData)); |
@@ -133,8 +139,9 @@ discard block |
||
133 | 139 | public function writeConfig(string $configFile, array $data): bool |
134 | 140 | { |
135 | 141 | $path = '/Private/Config/' . ucfirst(Str::lowerCase($configFile)) . '.php'; |
136 | - if (!File::exist($path) || !File::writable($path)) |
|
137 | - return false; |
|
142 | + if (!File::exist($path) || !File::writable($path)) { |
|
143 | + return false; |
|
144 | + } |
|
138 | 145 | |
139 | 146 | $saveData = '<?php return ' . Arr::exportVar($data) . ';'; |
140 | 147 | File::write($path, $saveData); |