@@ -48,8 +48,8 @@ |
||
48 | 48 | $alias = class_exists($module)? $module::alias(): $module; |
49 | 49 | |
50 | 50 | if (is_array($method) && !$args) { |
51 | - $args = $method; |
|
52 | - $method = 'body'; |
|
51 | + $args = $method; |
|
52 | + $method = 'body'; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | return url(implode('/', ['view', $alias, $method, self::encodeArgs($args)])); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | { |
22 | 22 | $defaultView = self::module()::view(); |
23 | 23 | |
24 | - $viewClass = is_a(static::class, ModuleView::class, true)? static::class: $defaultView; |
|
24 | + $viewClass = is_a(static::class, ModuleView::class, true) ? static::class : $defaultView; |
|
25 | 25 | |
26 | 26 | $viewAlias = null; |
27 | 27 | if ($viewClass !== $defaultView) { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | final public static function moduleLink($module, $method = 'body', $args = []) |
47 | 47 | { |
48 | - $alias = class_exists($module)? $module::alias(): $module; |
|
48 | + $alias = class_exists($module) ? $module::alias() : $module; |
|
49 | 49 | |
50 | 50 | if (is_array($method) && !$args) { |
51 | 51 | $args = $method; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @throws \Illuminate\Http\Exceptions\HttpResponseException |
65 | 65 | */ |
66 | 66 | final public static function decodeArgs($hash) { |
67 | - if (! $hash) return []; |
|
67 | + if (!$hash) return []; |
|
68 | 68 | |
69 | 69 | $args = session($hash); |
70 | 70 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | final public static function encodeArgs($args) { |
83 | 83 | $args = (array) $args; |
84 | 84 | |
85 | - if (! $args) return; |
|
85 | + if (!$args) return; |
|
86 | 86 | |
87 | 87 | $hash = md5(serialize($args)); |
88 | 88 |
@@ -64,11 +64,15 @@ discard block |
||
64 | 64 | * @throws \Illuminate\Http\Exceptions\HttpResponseException |
65 | 65 | */ |
66 | 66 | final public static function decodeArgs($hash) { |
67 | - if (! $hash) return []; |
|
67 | + if (! $hash) { |
|
68 | + return []; |
|
69 | + } |
|
68 | 70 | |
69 | 71 | $args = session($hash); |
70 | 72 | |
71 | - if (is_null($args)) abort(419); |
|
73 | + if (is_null($args)) { |
|
74 | + abort(419); |
|
75 | + } |
|
72 | 76 | |
73 | 77 | return (array) $args; |
74 | 78 | } |
@@ -82,7 +86,9 @@ discard block |
||
82 | 86 | final public static function encodeArgs($args) { |
83 | 87 | $args = (array) $args; |
84 | 88 | |
85 | - if (! $args) return; |
|
89 | + if (! $args) { |
|
90 | + return; |
|
91 | + } |
|
86 | 92 | |
87 | 93 | $hash = md5(serialize($args)); |
88 | 94 |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | { |
65 | 65 | return self::$installed = self::$installed?? self::getCached('epesi-modules-installed', function() { |
66 | 66 | try { |
67 | - $installedModules = Module::pluck('class', 'alias'); |
|
67 | + $installedModules = Module::pluck('class', 'alias'); |
|
68 | 68 | } catch (\Exception $e) { |
69 | 69 | $installedModules = collect(); |
70 | 70 | } |
@@ -104,27 +104,27 @@ discard block |
||
104 | 104 | */ |
105 | 105 | protected static function discoverModuleClasses($namespace, $basePath) |
106 | 106 | { |
107 | - $ret = collect(); |
|
107 | + $ret = collect(); |
|
108 | 108 | |
109 | - $moduleNamespace = trim($namespace, '\\'); |
|
109 | + $moduleNamespace = trim($namespace, '\\'); |
|
110 | 110 | |
111 | - $names = array_slice(explode('\\', $moduleNamespace), - 1); |
|
111 | + $names = array_slice(explode('\\', $moduleNamespace), - 1); |
|
112 | 112 | |
113 | - if ($name = $names? reset($names): '') { |
|
114 | - $moduleClass = $moduleNamespace . '\\' . $name . 'Core'; |
|
113 | + if ($name = $names? reset($names): '') { |
|
114 | + $moduleClass = $moduleNamespace . '\\' . $name . 'Core'; |
|
115 | 115 | |
116 | - if (is_subclass_of($moduleClass, ModuleCore::class)) { |
|
117 | - $ret->add($moduleClass); |
|
118 | - } |
|
119 | - } |
|
116 | + if (is_subclass_of($moduleClass, ModuleCore::class)) { |
|
117 | + $ret->add($moduleClass); |
|
118 | + } |
|
119 | + } |
|
120 | 120 | |
121 | - foreach (glob($basePath . '/*', GLOB_ONLYDIR|GLOB_NOSORT) as $path) { |
|
122 | - $subModuleNamespace = $moduleNamespace . '\\' . basename($path); |
|
121 | + foreach (glob($basePath . '/*', GLOB_ONLYDIR|GLOB_NOSORT) as $path) { |
|
122 | + $subModuleNamespace = $moduleNamespace . '\\' . basename($path); |
|
123 | 123 | |
124 | - $ret = $ret->merge(self::discoverModuleClasses($subModuleNamespace, $path)); |
|
125 | - } |
|
124 | + $ret = $ret->merge(self::discoverModuleClasses($subModuleNamespace, $path)); |
|
125 | + } |
|
126 | 126 | |
127 | - return $ret; |
|
127 | + return $ret; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -356,7 +356,6 @@ discard block |
||
356 | 356 | * |
357 | 357 | * @param string $classOrAlias |
358 | 358 | * @throws \Exception |
359 | - |
|
360 | 359 | * @return boolean |
361 | 360 | */ |
362 | 361 | public static function uninstall($classOrAlias) |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public static function isInstalled($classOrAlias) |
28 | 28 | { |
29 | - return self::getClass($classOrAlias, true)? 1: 0; |
|
29 | + return self::getClass($classOrAlias, true) ? 1 : 0; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @return string; |
49 | 49 | */ |
50 | 50 | public static function getClass($classOrAlias, $installedOnly = false) { |
51 | - $modules = $installedOnly? self::getInstalled(): self::getAll(); |
|
51 | + $modules = $installedOnly ? self::getInstalled() : self::getAll(); |
|
52 | 52 | |
53 | 53 | if (collect($modules)->contains($classOrAlias)) return $classOrAlias; |
54 | 54 | |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public static function getAll() |
82 | 82 | { |
83 | - return self::getCached('epesi-modules-available', function () { |
|
83 | + return self::getCached('epesi-modules-available', function() { |
|
84 | 84 | $modules = collect(); |
85 | - foreach (array_merge(config('epesi.modules', []), self::packageManifest()->modules()?: []) as $namespace => $path) { |
|
85 | + foreach (array_merge(config('epesi.modules', []), self::packageManifest()->modules() ?: []) as $namespace => $path) { |
|
86 | 86 | foreach (self::discoverModuleClasses($namespace, $path) as $moduleClass) { |
87 | 87 | $modules->add(['alias' => $moduleClass::alias(), 'class' => $moduleClass]); |
88 | 88 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | $names = array_slice(explode('\\', $moduleNamespace), - 1); |
112 | 112 | |
113 | - if ($name = $names? reset($names): '') { |
|
113 | + if ($name = $names ? reset($names) : '') { |
|
114 | 114 | $moduleClass = $moduleNamespace . '\\' . $name . 'Core'; |
115 | 115 | |
116 | 116 | if (is_subclass_of($moduleClass, ModuleCore::class)) { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
121 | - foreach (glob($basePath . '/*', GLOB_ONLYDIR|GLOB_NOSORT) as $path) { |
|
121 | + foreach (glob($basePath . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $path) { |
|
122 | 122 | $subModuleNamespace = $moduleNamespace . '\\' . basename($path); |
123 | 123 | |
124 | 124 | $ret = $ret->merge(self::discoverModuleClasses($subModuleNamespace, $path)); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | protected static function getCached($key, \Closure $default) |
138 | 138 | { |
139 | - if (! Cache::has($key)) { |
|
139 | + if (!Cache::has($key)) { |
|
140 | 140 | Cache::forever($key, $default()); |
141 | 141 | } |
142 | 142 | |
@@ -174,12 +174,12 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public static function collect($method, $args = []) |
176 | 176 | { |
177 | - $args = is_array($args)? $args: [$args]; |
|
177 | + $args = is_array($args) ? $args : [$args]; |
|
178 | 178 | |
179 | 179 | $installedModules = self::getInstalled(); |
180 | 180 | |
181 | 181 | // if epesi is not installed fake having the system module to enable its functionality |
182 | - if (! $installedModules->contains(\Epesi\Core\System\SystemCore::class)) { |
|
182 | + if (!$installedModules->contains(\Epesi\Core\System\SystemCore::class)) { |
|
183 | 183 | $installedModules = collect([ |
184 | 184 | 'system' => \Epesi\Core\System\SystemCore::class |
185 | 185 | ]); |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | |
188 | 188 | $ret = []; |
189 | 189 | foreach ($installedModules as $module) { |
190 | - if (! $list = $module::$method(...$args)) continue; |
|
190 | + if (!$list = $module::$method(...$args)) continue; |
|
191 | 191 | |
192 | - $ret = array_merge($ret, is_array($list)? $list: [$list]); |
|
192 | + $ret = array_merge($ret, is_array($list) ? $list : [$list]); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | return $ret; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | return true; |
209 | 209 | } |
210 | 210 | |
211 | - if (! $moduleClass = self::getClass($classOrAlias)) { |
|
211 | + if (!$moduleClass = self::getClass($classOrAlias)) { |
|
212 | 212 | throw new \Exception('Module "' . $classOrAlias . '" could not be identified'); |
213 | 213 | } |
214 | 214 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | ]); |
239 | 239 | |
240 | 240 | if ($installRecommended) { |
241 | - $installRecommended = is_array($installRecommended)? $installRecommended: $module->recommended(); |
|
241 | + $installRecommended = is_array($installRecommended) ? $installRecommended : $module->recommended(); |
|
242 | 242 | |
243 | 243 | foreach ($installRecommended as $recommendedModule) { |
244 | 244 | try { |
@@ -271,10 +271,10 @@ discard block |
||
271 | 271 | $parentModule = array_shift($unsatisfiedDependencies); |
272 | 272 | |
273 | 273 | if (self::$processing[$parentModule]?? false) { |
274 | - throw new \Exception('Cross dependency: '. $parentModule); |
|
274 | + throw new \Exception('Cross dependency: ' . $parentModule); |
|
275 | 275 | } |
276 | 276 | |
277 | - if (! self::isAvailable($parentModule)) { |
|
277 | + if (!self::isAvailable($parentModule)) { |
|
278 | 278 | throw new \Exception('Module not found: "' . $parentModule . '"'); |
279 | 279 | } |
280 | 280 | |
@@ -361,13 +361,13 @@ discard block |
||
361 | 361 | */ |
362 | 362 | public static function uninstall($classOrAlias) |
363 | 363 | { |
364 | - if (! self::isInstalled($classOrAlias)) { |
|
364 | + if (!self::isInstalled($classOrAlias)) { |
|
365 | 365 | print ('Module "' . $classOrAlias . '" is not installed!'); |
366 | 366 | |
367 | 367 | return true; |
368 | 368 | } |
369 | 369 | |
370 | - if (! $moduleClass = self::getClass($classOrAlias)) { |
|
370 | + if (!$moduleClass = self::getClass($classOrAlias)) { |
|
371 | 371 | throw new \Exception('Module "' . $classOrAlias . '" could not be identified'); |
372 | 372 | } |
373 | 373 |
@@ -36,7 +36,9 @@ discard block |
||
36 | 36 | public static function getClass($classOrAlias, $installedOnly = false) { |
37 | 37 | $modules = $installedOnly? self::getInstalled(): self::getAll(); |
38 | 38 | |
39 | - if (collect($modules)->contains($classOrAlias)) return $classOrAlias; |
|
39 | + if (collect($modules)->contains($classOrAlias)) { |
|
40 | + return $classOrAlias; |
|
41 | + } |
|
40 | 42 | |
41 | 43 | return $modules[$classOrAlias]?? null; |
42 | 44 | } |
@@ -138,7 +140,9 @@ discard block |
||
138 | 140 | |
139 | 141 | $ret = []; |
140 | 142 | foreach ($installedModules as $module) { |
141 | - if (! $list = $module::$method(...$args)) continue; |
|
143 | + if (! $list = $module::$method(...$args)) { |
|
144 | + continue; |
|
145 | + } |
|
142 | 146 | |
143 | 147 | $ret = array_merge($ret, is_array($list)? $list: [$list]); |
144 | 148 | } |
@@ -34,10 +34,10 @@ |
||
34 | 34 | */ |
35 | 35 | final public function displayModuleContent($method, $args) { |
36 | 36 | // if method not callbale abort to 'not found' |
37 | - if (! is_callable([$this, $method])) abort(404); |
|
37 | + if (!is_callable([$this, $method])) abort(404); |
|
38 | 38 | |
39 | 39 | // if user has no access abort 'no access' |
40 | - if (! $this->access()) abort(401); |
|
40 | + if (!$this->access()) abort(401); |
|
41 | 41 | |
42 | 42 | $args = $this->decodeArgs($args); |
43 | 43 |
@@ -34,10 +34,14 @@ |
||
34 | 34 | */ |
35 | 35 | final public function displayModuleContent($method, $args) { |
36 | 36 | // if method not callbale abort to 'not found' |
37 | - if (! is_callable([$this, $method])) abort(404); |
|
37 | + if (! is_callable([$this, $method])) { |
|
38 | + abort(404); |
|
39 | + } |
|
38 | 40 | |
39 | 41 | // if user has no access abort 'no access' |
40 | - if (! $this->access()) abort(401); |
|
42 | + if (! $this->access()) { |
|
43 | + abort(401); |
|
44 | + } |
|
41 | 45 | |
42 | 46 | $args = $this->decodeArgs($args); |
43 | 47 |
@@ -20,10 +20,10 @@ |
||
20 | 20 | | This value is the name of Epesi powered by as displayed. |
21 | 21 | | |
22 | 22 | */ |
23 | - 'credit' => [ |
|
24 | - 'title' => 'EPESI', |
|
25 | - 'link' => 'https://epe.si' |
|
26 | - ], |
|
23 | + 'credit' => [ |
|
24 | + 'title' => 'EPESI', |
|
25 | + 'link' => 'https://epe.si' |
|
26 | + ], |
|
27 | 27 | |
28 | 28 | /* |
29 | 29 | |-------------------------------------------------------------------------- |
@@ -2,35 +2,35 @@ |
||
2 | 2 | |
3 | 3 | if (! function_exists('epesi')) { |
4 | 4 | function ui() : Epesi\Core\UI |
5 | - { |
|
6 | - return resolve(Epesi\Core\UI::class); |
|
7 | - } |
|
5 | + { |
|
6 | + return resolve(Epesi\Core\UI::class); |
|
7 | + } |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | if (! function_exists('eval_css')) { |
11 | 11 | function eval_css($css) |
12 | - { |
|
13 | - ui()->addStyle($css); |
|
14 | - } |
|
12 | + { |
|
13 | + ui()->addStyle($css); |
|
14 | + } |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | if (! function_exists('eval_js')) { |
18 | 18 | function eval_js($js, $args = []) |
19 | - { |
|
20 | - ui()->addJS($js, $args); |
|
21 | - } |
|
19 | + { |
|
20 | + ui()->addJS($js, $args); |
|
21 | + } |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | if (! function_exists('load_css')) { |
25 | 25 | function load_css($url) |
26 | - { |
|
27 | - return ui()->requireCSS($url); |
|
28 | - } |
|
26 | + { |
|
27 | + return ui()->requireCSS($url); |
|
28 | + } |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | if (! function_exists('load_js')) { |
32 | 32 | function load_js($url) |
33 | - { |
|
34 | - return ui()->requireJS($url); |
|
35 | - } |
|
33 | + { |
|
34 | + return ui()->requireJS($url); |
|
35 | + } |
|
36 | 36 | } |
@@ -1,34 +1,34 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! function_exists('epesi')) { |
|
3 | +if (!function_exists('epesi')) { |
|
4 | 4 | function ui() : Epesi\Core\UI |
5 | 5 | { |
6 | 6 | return resolve(Epesi\Core\UI::class); |
7 | 7 | } |
8 | 8 | } |
9 | 9 | |
10 | -if (! function_exists('eval_css')) { |
|
10 | +if (!function_exists('eval_css')) { |
|
11 | 11 | function eval_css($css) |
12 | 12 | { |
13 | 13 | ui()->addStyle($css); |
14 | 14 | } |
15 | 15 | } |
16 | 16 | |
17 | -if (! function_exists('eval_js')) { |
|
17 | +if (!function_exists('eval_js')) { |
|
18 | 18 | function eval_js($js, $args = []) |
19 | 19 | { |
20 | 20 | ui()->addJS($js, $args); |
21 | 21 | } |
22 | 22 | } |
23 | 23 | |
24 | -if (! function_exists('load_css')) { |
|
24 | +if (!function_exists('load_css')) { |
|
25 | 25 | function load_css($url) |
26 | 26 | { |
27 | 27 | return ui()->requireCSS($url); |
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | -if (! function_exists('load_js')) { |
|
31 | +if (!function_exists('load_js')) { |
|
32 | 32 | function load_js($url) |
33 | 33 | { |
34 | 34 | return ui()->requireJS($url); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | { |
13 | 13 | public function index() |
14 | 14 | { |
15 | - return SystemCore::isInstalled()? redirect('home'): redirect('install'); |
|
15 | + return SystemCore::isInstalled() ? redirect('home') : redirect('install'); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | public function install(UI $ui) |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | public function home() |
38 | 38 | { |
39 | - return redirect(SystemCore::isInstalled()? \Epesi\Core\HomePage\Models\HomePage::pathOfUser(): 'install'); |
|
39 | + return redirect(SystemCore::isInstalled() ? \Epesi\Core\HomePage\Models\HomePage::pathOfUser() : 'install'); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | public function logo() |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | - if (! $view) abort(404); |
|
67 | + if (!$view) abort(404); |
|
68 | 68 | |
69 | 69 | $ui->add($view)->displayModuleContent($method, $args); |
70 | 70 |
@@ -10,66 +10,66 @@ |
||
10 | 10 | |
11 | 11 | class Controller extends BaseController |
12 | 12 | { |
13 | - public function index() |
|
14 | - { |
|
15 | - return SystemCore::isInstalled()? redirect('home'): redirect('install'); |
|
16 | - } |
|
13 | + public function index() |
|
14 | + { |
|
15 | + return SystemCore::isInstalled()? redirect('home'): redirect('install'); |
|
16 | + } |
|
17 | 17 | |
18 | - public function install(UI $ui) |
|
19 | - { |
|
20 | - // make sure the installation information is fresh |
|
21 | - ModuleManager::clearCache(); |
|
18 | + public function install(UI $ui) |
|
19 | + { |
|
20 | + // make sure the installation information is fresh |
|
21 | + ModuleManager::clearCache(); |
|
22 | 22 | |
23 | - if (SystemCore::isInstalled()) return redirect('home'); |
|
23 | + if (SystemCore::isInstalled()) return redirect('home'); |
|
24 | 24 | |
25 | - $ui->title = __(':epesi > Installation', ['epesi' => config('epesi.ui.title')]); |
|
25 | + $ui->title = __(':epesi > Installation', ['epesi' => config('epesi.ui.title')]); |
|
26 | 26 | |
27 | - $ui->initLayout('Centered'); |
|
27 | + $ui->initLayout('Centered'); |
|
28 | 28 | |
29 | - $ui->layout->set('logo', url('logo')); |
|
30 | - $ui->layout->template->setHTML('copyright', config('epesi.ui.copyright')); |
|
29 | + $ui->layout->set('logo', url('logo')); |
|
30 | + $ui->layout->template->setHTML('copyright', config('epesi.ui.copyright')); |
|
31 | 31 | |
32 | - $ui->add(new \Epesi\Core\System\SystemInstallWizard()); |
|
32 | + $ui->add(new \Epesi\Core\System\SystemInstallWizard()); |
|
33 | 33 | |
34 | - return $ui->response(); |
|
35 | - } |
|
34 | + return $ui->response(); |
|
35 | + } |
|
36 | 36 | |
37 | - public function home() |
|
38 | - { |
|
39 | - return redirect(SystemCore::isInstalled()? \Epesi\Core\HomePage\Models\HomePage::pathOfUser(): 'install'); |
|
40 | - } |
|
37 | + public function home() |
|
38 | + { |
|
39 | + return redirect(SystemCore::isInstalled()? \Epesi\Core\HomePage\Models\HomePage::pathOfUser(): 'install'); |
|
40 | + } |
|
41 | 41 | |
42 | - public function logo() |
|
43 | - { |
|
44 | - $logoFile = \Epesi\Core\System\Logo\LogoSettings::getLogoFile(); |
|
42 | + public function logo() |
|
43 | + { |
|
44 | + $logoFile = \Epesi\Core\System\Logo\LogoSettings::getLogoFile(); |
|
45 | 45 | |
46 | - return response(File::get($logoFile), 200, ['Content-type' => File::mimeType($logoFile)])->setMaxAge(604800)->setPublic(); |
|
47 | - } |
|
46 | + return response(File::get($logoFile), 200, ['Content-type' => File::mimeType($logoFile)])->setMaxAge(604800)->setPublic(); |
|
47 | + } |
|
48 | 48 | |
49 | - public function view(UI $ui, $module, $method = 'body', $args = []) |
|
50 | - { |
|
51 | - $ui->initLayout(new LayoutView()); |
|
49 | + public function view(UI $ui, $module, $method = 'body', $args = []) |
|
50 | + { |
|
51 | + $ui->initLayout(new LayoutView()); |
|
52 | 52 | |
53 | - $alias = explode(':', $module); |
|
53 | + $alias = explode(':', $module); |
|
54 | 54 | |
55 | - $moduleAlias = $alias[0]; |
|
56 | - $viewAlias = $alias[1]?? null; |
|
55 | + $moduleAlias = $alias[0]; |
|
56 | + $viewAlias = $alias[1]?? null; |
|
57 | 57 | |
58 | - $view = null; |
|
59 | - if ($module = ModuleManager::getClass($moduleAlias, true)) { |
|
60 | - $viewClass = $module::view($viewAlias); |
|
58 | + $view = null; |
|
59 | + if ($module = ModuleManager::getClass($moduleAlias, true)) { |
|
60 | + $viewClass = $module::view($viewAlias); |
|
61 | 61 | |
62 | - if (class_exists($viewClass)) { |
|
63 | - $view = new $viewClass(); |
|
64 | - } |
|
65 | - } |
|
62 | + if (class_exists($viewClass)) { |
|
63 | + $view = new $viewClass(); |
|
64 | + } |
|
65 | + } |
|
66 | 66 | |
67 | - if (! $view) abort(404); |
|
67 | + if (! $view) abort(404); |
|
68 | 68 | |
69 | - $ui->add($view)->displayModuleContent($method, $args); |
|
69 | + $ui->add($view)->displayModuleContent($method, $args); |
|
70 | 70 | |
71 | - $ui->setLocation($view->location()); |
|
71 | + $ui->setLocation($view->location()); |
|
72 | 72 | |
73 | - return $ui->response(); |
|
74 | - } |
|
73 | + return $ui->response(); |
|
74 | + } |
|
75 | 75 | } |
@@ -20,7 +20,9 @@ discard block |
||
20 | 20 | // make sure the installation information is fresh |
21 | 21 | ModuleManager::clearCache(); |
22 | 22 | |
23 | - if (SystemCore::isInstalled()) return redirect('home'); |
|
23 | + if (SystemCore::isInstalled()) { |
|
24 | + return redirect('home'); |
|
25 | + } |
|
24 | 26 | |
25 | 27 | $ui->title = __(':epesi > Installation', ['epesi' => config('epesi.ui.title')]); |
26 | 28 | |
@@ -64,7 +66,9 @@ discard block |
||
64 | 66 | } |
65 | 67 | } |
66 | 68 | |
67 | - if (! $view) abort(404); |
|
69 | + if (! $view) { |
|
70 | + abort(404); |
|
71 | + } |
|
68 | 72 | |
69 | 73 | $ui->add($view)->displayModuleContent($method, $args); |
70 | 74 |
@@ -12,11 +12,11 @@ |
||
12 | 12 | } |
13 | 13 | |
14 | 14 | final public static function requireJS($file = 'default.js', $isAsync = false, $isDefer = false) { |
15 | - return ui()->requireJS(self::assetUrl('js/'. $file), $isAsync, $isDefer); |
|
15 | + return ui()->requireJS(self::assetUrl('js/' . $file), $isAsync, $isDefer); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | final public static function requireCSS($file = 'default.css') { |
19 | - return ui()->requireCSS(self::assetUrl('css/'. $file)); |
|
19 | + return ui()->requireCSS(self::assetUrl('css/' . $file)); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -7,13 +7,13 @@ |
||
7 | 7 | |
8 | 8 | class UI extends Facade |
9 | 9 | { |
10 | - /** |
|
11 | - * Get the registered name of the component. |
|
12 | - * |
|
13 | - * @return string |
|
14 | - */ |
|
15 | - protected static function getFacadeAccessor() |
|
16 | - { |
|
17 | - return App::class; |
|
18 | - } |
|
10 | + /** |
|
11 | + * Get the registered name of the component. |
|
12 | + * |
|
13 | + * @return string |
|
14 | + */ |
|
15 | + protected static function getFacadeAccessor() |
|
16 | + { |
|
17 | + return App::class; |
|
18 | + } |
|
19 | 19 | } |
@@ -33,8 +33,7 @@ discard block |
||
33 | 33 | 'template_dir' => array_merge(ModuleManager::collect('templates', $this->skin), (array) $this->template_dir), |
34 | 34 | 'catch_error_types' => config('app.debug') ? |
35 | 35 | // debug mode |
36 | - E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_USER_DEPRECATED : |
|
37 | - // production mode |
|
36 | + E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_USER_DEPRECATED : // production mode |
|
38 | 37 | E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR |
39 | 38 | ]); |
40 | 39 | } |
@@ -149,35 +148,35 @@ discard block |
||
149 | 148 | |
150 | 149 | // jQuery |
151 | 150 | $urlJs = $this->cdn['jquery']?? $localJs; |
152 | - $this->requireJS($urlJs.'/jquery.min.js'); |
|
151 | + $this->requireJS($urlJs . '/jquery.min.js'); |
|
153 | 152 | |
154 | 153 | // Semantic UI |
155 | 154 | $urlJs = $this->cdn['semantic-ui']?? $localJs; |
156 | 155 | $urlCss = $this->cdn['semantic-ui']?? $localCss; |
157 | - $this->requireJS($urlJs.'/semantic.min.js'); |
|
158 | - $this->requireCSS($urlCss.'/semantic.min.css'); |
|
156 | + $this->requireJS($urlJs . '/semantic.min.js'); |
|
157 | + $this->requireCSS($urlCss . '/semantic.min.css'); |
|
159 | 158 | |
160 | 159 | // Serialize Object |
161 | 160 | $urlJs = $this->cdn['serialize-object']?? $localJs; |
162 | - $this->requireJS($urlJs.'/jquery.serialize-object.min.js'); |
|
161 | + $this->requireJS($urlJs . '/jquery.serialize-object.min.js'); |
|
163 | 162 | |
164 | 163 | // Agile UI |
165 | 164 | $urlJs = $this->cdn['atk']?? $localJs; |
166 | 165 | $urlCss = $this->cdn['atk']?? $localCss; |
167 | - $this->requireJS($urlJs.'/atkjs-ui.min.js'); |
|
168 | - $this->requireCSS($urlCss.'/agileui.css'); |
|
166 | + $this->requireJS($urlJs . '/atkjs-ui.min.js'); |
|
167 | + $this->requireCSS($urlCss . '/agileui.css'); |
|
169 | 168 | |
170 | 169 | // Draggable |
171 | 170 | $urlJs = $this->cdn['draggable']?? $localJs; |
172 | - $this->requireJS($urlJs.'/draggable.bundle.js'); |
|
171 | + $this->requireJS($urlJs . '/draggable.bundle.js'); |
|
173 | 172 | |
174 | 173 | // jQuery niceScroll |
175 | 174 | $urlJs = $this->cdn['jquery-nicescroll']?? $localJs; |
176 | - $this->requireJS($urlJs.'/jquery.nicescroll.js'); |
|
175 | + $this->requireJS($urlJs . '/jquery.nicescroll.js'); |
|
177 | 176 | |
178 | 177 | // clipboard.js |
179 | 178 | $urlJs = $this->cdn['clipboardjs']?? $localJs; |
180 | - $this->requireJS($urlJs.'/clipboard.js'); |
|
179 | + $this->requireJS($urlJs . '/clipboard.js'); |
|
181 | 180 | } |
182 | 181 | |
183 | 182 | /** |
@@ -260,7 +259,7 @@ discard block |
||
260 | 259 | |
261 | 260 | $key = md5(serialize(func_get_args())); |
262 | 261 | |
263 | - if (! isset($cache[$key])) { |
|
262 | + if (!isset($cache[$key])) { |
|
264 | 263 | $cache[$key] = true; |
265 | 264 | |
266 | 265 | parent::requireJS($url, $isAsync, $isDefer); |
@@ -26,21 +26,21 @@ discard block |
||
26 | 26 | { |
27 | 27 | parent::__construct([ |
28 | 28 | 'title' => config('epesi.ui.title', 'EPESI'), |
29 | - 'cdn' => array_merge($this->cdn, (array) config('epesi.ui.cdn')), |
|
29 | + 'cdn' => array_merge($this->cdn, (array) config('epesi.ui.cdn')), |
|
30 | 30 | //TODO: set the skin from admin / user selection |
31 | - 'skin' => config('epesi.ui.skin', $this->skin), |
|
32 | - 'template_dir' => array_merge(ModuleManager::collect('templates', $this->skin), (array) $this->template_dir), |
|
33 | - 'catch_error_types' => config('app.debug') ? |
|
34 | - // debug mode |
|
35 | - E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_USER_DEPRECATED : |
|
36 | - // production mode |
|
37 | - E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR |
|
31 | + 'skin' => config('epesi.ui.skin', $this->skin), |
|
32 | + 'template_dir' => array_merge(ModuleManager::collect('templates', $this->skin), (array) $this->template_dir), |
|
33 | + 'catch_error_types' => config('app.debug') ? |
|
34 | + // debug mode |
|
35 | + E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_USER_DEPRECATED : |
|
36 | + // production mode |
|
37 | + E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR |
|
38 | 38 | ]); |
39 | 39 | } |
40 | 40 | |
41 | 41 | final public static function module() |
42 | 42 | { |
43 | - return System\SystemCore::class; |
|
43 | + return System\SystemCore::class; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | public function response() |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | public function render() |
61 | 61 | { |
62 | - System\SystemCore::requireCSS('epesi.css'); |
|
62 | + System\SystemCore::requireCSS('epesi.css'); |
|
63 | 63 | |
64 | 64 | $this->addCsrfToken(); |
65 | 65 | |
@@ -82,18 +82,18 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function renderException($exception) |
84 | 84 | { |
85 | - ob_start(); |
|
86 | - if ($exception instanceof TokenMismatchException) { |
|
87 | - $this->jsRedirectHomepage(__('Session expired! Redirecting to login screen ...')); |
|
88 | - } |
|
89 | - elseif ($exception instanceof NotFoundHttpException) { |
|
90 | - $this->jsRedirectHomepage(__('Requested page not found! Redirecting to your home page ...')); |
|
91 | - } |
|
92 | - else { |
|
93 | - $this->caughtException($exception); |
|
94 | - } |
|
85 | + ob_start(); |
|
86 | + if ($exception instanceof TokenMismatchException) { |
|
87 | + $this->jsRedirectHomepage(__('Session expired! Redirecting to login screen ...')); |
|
88 | + } |
|
89 | + elseif ($exception instanceof NotFoundHttpException) { |
|
90 | + $this->jsRedirectHomepage(__('Requested page not found! Redirecting to your home page ...')); |
|
91 | + } |
|
92 | + else { |
|
93 | + $this->caughtException($exception); |
|
94 | + } |
|
95 | 95 | |
96 | - return ob_get_clean(); |
|
96 | + return ob_get_clean(); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -103,20 +103,20 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function jsRedirectHomepage($message) |
105 | 105 | { |
106 | - $homepageUrl = url(HomePage\Models\HomePage::pathOfUser()); |
|
106 | + $homepageUrl = url(HomePage\Models\HomePage::pathOfUser()); |
|
107 | 107 | |
108 | - $redirectJs = $this->jsRedirectConfirm($homepageUrl, $message)->jsRender(); |
|
108 | + $redirectJs = $this->jsRedirectConfirm($homepageUrl, $message)->jsRender(); |
|
109 | 109 | |
110 | - if ($this->isJsonRequest()) { |
|
111 | - $this->outputResponseJSON([ |
|
112 | - 'success' => true, |
|
113 | - 'message' => $message, |
|
114 | - 'atkjs' => $redirectJs |
|
115 | - ]); |
|
116 | - } |
|
117 | - else { |
|
118 | - $this->outputResponseHTML($this->getTag('script', $redirectJs)); |
|
119 | - } |
|
110 | + if ($this->isJsonRequest()) { |
|
111 | + $this->outputResponseJSON([ |
|
112 | + 'success' => true, |
|
113 | + 'message' => $message, |
|
114 | + 'atkjs' => $redirectJs |
|
115 | + ]); |
|
116 | + } |
|
117 | + else { |
|
118 | + $this->outputResponseHTML($this->getTag('script', $redirectJs)); |
|
119 | + } |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public function jsRedirectConfirm($page, $message) |
130 | 130 | { |
131 | - $redirectJs = $this->jsRedirect($page)->jsRender(); |
|
131 | + $redirectJs = $this->jsRedirect($page)->jsRender(); |
|
132 | 132 | |
133 | - return new jsExpression("if (confirm([])) { $redirectJs }", [$message]); |
|
133 | + return new jsExpression("if (confirm([])) { $redirectJs }", [$message]); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -85,11 +85,9 @@ discard block |
||
85 | 85 | ob_start(); |
86 | 86 | if ($exception instanceof TokenMismatchException) { |
87 | 87 | $this->jsRedirectHomepage(__('Session expired! Redirecting to login screen ...')); |
88 | - } |
|
89 | - elseif ($exception instanceof NotFoundHttpException) { |
|
88 | + } elseif ($exception instanceof NotFoundHttpException) { |
|
90 | 89 | $this->jsRedirectHomepage(__('Requested page not found! Redirecting to your home page ...')); |
91 | - } |
|
92 | - else { |
|
90 | + } else { |
|
93 | 91 | $this->caughtException($exception); |
94 | 92 | } |
95 | 93 | |
@@ -113,8 +111,7 @@ discard block |
||
113 | 111 | 'message' => $message, |
114 | 112 | 'atkjs' => $redirectJs |
115 | 113 | ]); |
116 | - } |
|
117 | - else { |
|
114 | + } else { |
|
118 | 115 | $this->outputResponseHTML($this->getTag('script', $redirectJs)); |
119 | 116 | } |
120 | 117 | } |