@@ -11,64 +11,64 @@ |
||
11 | 11 | |
12 | 12 | class Controller extends BaseController |
13 | 13 | { |
14 | - public function index() |
|
15 | - { |
|
16 | - return SystemCore::isInstalled()? redirect('home'): redirect('install'); |
|
17 | - } |
|
14 | + public function index() |
|
15 | + { |
|
16 | + return SystemCore::isInstalled()? redirect('home'): redirect('install'); |
|
17 | + } |
|
18 | 18 | |
19 | - public function install(UI $ui) |
|
20 | - { |
|
21 | - // make sure the installation information is fresh |
|
22 | - ModuleManager::clearCache(); |
|
19 | + public function install(UI $ui) |
|
20 | + { |
|
21 | + // make sure the installation information is fresh |
|
22 | + ModuleManager::clearCache(); |
|
23 | 23 | |
24 | - if (SystemCore::isInstalled()) return redirect('home'); |
|
24 | + if (SystemCore::isInstalled()) return redirect('home'); |
|
25 | 25 | |
26 | - $ui->title = __(':epesi > Installation', ['epesi' => config('epesi.ui.title')]); |
|
26 | + $ui->title = __(':epesi > Installation', ['epesi' => config('epesi.ui.title')]); |
|
27 | 27 | |
28 | - $ui->initLayout(new Layout\Centered()); |
|
28 | + $ui->initLayout(new Layout\Centered()); |
|
29 | 29 | |
30 | - $ui->layout->set('logo', url('logo')); |
|
31 | - $ui->layout->template->dangerouslySetHTML('copyright', config('epesi.ui.copyright')); |
|
30 | + $ui->layout->set('logo', url('logo')); |
|
31 | + $ui->layout->template->dangerouslySetHTML('copyright', config('epesi.ui.copyright')); |
|
32 | 32 | |
33 | - $ui->add(new \Epesi\Core\System\SystemInstallWizard()); |
|
33 | + $ui->add(new \Epesi\Core\System\SystemInstallWizard()); |
|
34 | 34 | |
35 | - return $ui->response(); |
|
36 | - } |
|
35 | + return $ui->response(); |
|
36 | + } |
|
37 | 37 | |
38 | - public function home() |
|
39 | - { |
|
40 | - return redirect(SystemCore::isInstalled()? \Epesi\Core\HomePage\Models\HomePage::pathOfUser(): 'install'); |
|
41 | - } |
|
38 | + public function home() |
|
39 | + { |
|
40 | + return redirect(SystemCore::isInstalled()? \Epesi\Core\HomePage\Models\HomePage::pathOfUser(): 'install'); |
|
41 | + } |
|
42 | 42 | |
43 | - public function logo() |
|
44 | - { |
|
45 | - $logoFile = \Epesi\Core\System\Logo\LogoSettings::getLogoFile(); |
|
43 | + public function logo() |
|
44 | + { |
|
45 | + $logoFile = \Epesi\Core\System\Logo\LogoSettings::getLogoFile(); |
|
46 | 46 | |
47 | - return response(File::get($logoFile), 200, ['Content-type' => File::mimeType($logoFile)])->setMaxAge(604800)->setPublic(); |
|
48 | - } |
|
47 | + return response(File::get($logoFile), 200, ['Content-type' => File::mimeType($logoFile)])->setMaxAge(604800)->setPublic(); |
|
48 | + } |
|
49 | 49 | |
50 | - public function view(UI $ui, $module, $method = 'body', $args = []) |
|
51 | - { |
|
52 | - $ui->initLayout(new LayoutView()); |
|
50 | + public function view(UI $ui, $module, $method = 'body', $args = []) |
|
51 | + { |
|
52 | + $ui->initLayout(new LayoutView()); |
|
53 | 53 | |
54 | - $alias = explode(':', $module); |
|
54 | + $alias = explode(':', $module); |
|
55 | 55 | |
56 | - $moduleAlias = $alias[0]; |
|
57 | - $viewAlias = $alias[1]?? null; |
|
56 | + $moduleAlias = $alias[0]; |
|
57 | + $viewAlias = $alias[1]?? null; |
|
58 | 58 | |
59 | - $view = null; |
|
60 | - if ($module = ModuleManager::getClass($moduleAlias, true)) { |
|
61 | - $viewClass = $module::view($viewAlias); |
|
59 | + $view = null; |
|
60 | + if ($module = ModuleManager::getClass($moduleAlias, true)) { |
|
61 | + $viewClass = $module::view($viewAlias); |
|
62 | 62 | |
63 | - if (class_exists($viewClass)) { |
|
64 | - $view = [$viewClass]; |
|
65 | - } |
|
66 | - } |
|
63 | + if (class_exists($viewClass)) { |
|
64 | + $view = [$viewClass]; |
|
65 | + } |
|
66 | + } |
|
67 | 67 | |
68 | - if (! $view) abort(404); |
|
68 | + if (! $view) abort(404); |
|
69 | 69 | |
70 | - $location = $ui->add($view)->displayModuleContent($method, $args)->location(); |
|
70 | + $location = $ui->add($view)->displayModuleContent($method, $args)->location(); |
|
71 | 71 | |
72 | - return $ui->setLocation($location)->response(); |
|
73 | - } |
|
72 | + return $ui->setLocation($location)->response(); |
|
73 | + } |
|
74 | 74 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | { |
14 | 14 | public function index() |
15 | 15 | { |
16 | - return SystemCore::isInstalled()? redirect('home'): redirect('install'); |
|
16 | + return SystemCore::isInstalled() ? redirect('home') : redirect('install'); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | public function install(UI $ui) |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | public function home() |
39 | 39 | { |
40 | - return redirect(SystemCore::isInstalled()? \Epesi\Core\HomePage\Models\HomePage::pathOfUser(): 'install'); |
|
40 | + return redirect(SystemCore::isInstalled() ? \Epesi\Core\HomePage\Models\HomePage::pathOfUser() : 'install'); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function logo() |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $alias = explode(':', $module); |
55 | 55 | |
56 | 56 | $moduleAlias = $alias[0]; |
57 | - $viewAlias = $alias[1]?? null; |
|
57 | + $viewAlias = $alias[1] ?? null; |
|
58 | 58 | |
59 | 59 | $view = null; |
60 | 60 | if ($module = ModuleManager::getClass($moduleAlias, true)) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | - if (! $view) abort(404); |
|
68 | + if (!$view) abort(404); |
|
69 | 69 | |
70 | 70 | $location = $ui->add($view)->displayModuleContent($method, $args)->location(); |
71 | 71 |
@@ -21,7 +21,9 @@ discard block |
||
21 | 21 | // make sure the installation information is fresh |
22 | 22 | ModuleManager::clearCache(); |
23 | 23 | |
24 | - if (SystemCore::isInstalled()) return redirect('home'); |
|
24 | + if (SystemCore::isInstalled()) { |
|
25 | + return redirect('home'); |
|
26 | + } |
|
25 | 27 | |
26 | 28 | $ui->title = __(':epesi > Installation', ['epesi' => config('epesi.ui.title')]); |
27 | 29 | |
@@ -65,7 +67,9 @@ discard block |
||
65 | 67 | } |
66 | 68 | } |
67 | 69 | |
68 | - if (! $view) abort(404); |
|
70 | + if (! $view) { |
|
71 | + abort(404); |
|
72 | + } |
|
69 | 73 | |
70 | 74 | $location = $ui->add($view)->displayModuleContent($method, $args)->location(); |
71 | 75 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $accordion = \atk4\ui\Accordion::addTo($container, ['type' => ['styled', 'fluid'], 'settings' => ['animateChildren' => false]])->setStyle(['max-width' => '800px', 'margin-left' => 'auto', 'margin-right' => 'auto']); |
43 | 43 | |
44 | 44 | if ($container == $this) { |
45 | - $this->accordion = $accordion; |
|
45 | + $this->accordion = $accordion; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | foreach ($modules as $moduleClass) { |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | $message = ob_get_clean(); |
101 | 101 | |
102 | 102 | return [ |
103 | - $this->notifySuccess($message), |
|
104 | - new \atk4\ui\JsReload($this->accordion), |
|
103 | + $this->notifySuccess($message), |
|
104 | + new \atk4\ui\JsReload($this->accordion), |
|
105 | 105 | ]; |
106 | 106 | }); |
107 | 107 | |
@@ -152,14 +152,14 @@ discard block |
||
152 | 152 | $button = \atk4\ui\Button::addTo($container, [__('Uninstall'), 'class' => ['red']]); |
153 | 153 | |
154 | 154 | $callback = $uninstallCallback = \atk4\ui\JsCallback::addTo($button, ['confirm' => __('Are you sure you want to uninstall :module', ['module' => $moduleClass::label()])])->set(function() use ($moduleClass) { |
155 | - ob_start(); |
|
155 | + ob_start(); |
|
156 | 156 | ModuleManager::uninstall($moduleClass); |
157 | 157 | |
158 | 158 | $message = ob_get_clean(); |
159 | 159 | |
160 | 160 | return [ |
161 | - $this->notifySuccess($message), |
|
162 | - new \atk4\ui\JsReload($this->accordion), |
|
161 | + $this->notifySuccess($message), |
|
162 | + new \atk4\ui\JsReload($this->accordion), |
|
163 | 163 | ]; |
164 | 164 | }); |
165 | 165 | |
@@ -194,12 +194,12 @@ discard block |
||
194 | 194 | |
195 | 195 | public function addClearCacheButton() |
196 | 196 | { |
197 | - ActionBar::addItemButton([__('Clear Cache'), 'icon' => 'refresh', 'hint' => __('Clears module cache and re-discovers all available modules')])->callback(function($callback) { |
|
197 | + ActionBar::addItemButton([__('Clear Cache'), 'icon' => 'refresh', 'hint' => __('Clears module cache and re-discovers all available modules')])->callback(function($callback) { |
|
198 | 198 | ModuleManager::clearCache(); |
199 | 199 | |
200 | 200 | return [ |
201 | 201 | new \atk4\ui\JsReload($this->accordion), |
202 | - $this->notifySuccess(__('Cache cleared!')) |
|
202 | + $this->notifySuccess(__('Cache cleared!')) |
|
203 | 203 | ]; |
204 | 204 | }); |
205 | 205 | } |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | { |
31 | 31 | $modules = ModuleManager::getAll(); |
32 | 32 | |
33 | - return $modules->filter(function ($subModuleClass) use ($modules) { |
|
34 | - return ! $modules->map(function($moduleClass){ |
|
33 | + return $modules->filter(function($subModuleClass) use ($modules) { |
|
34 | + return !$modules->map(function($moduleClass) { |
|
35 | 35 | return $moduleClass::namespace(); |
36 | 36 | })->contains($subModuleClass::parentNamespace()); |
37 | 37 | })->sort(); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | $section->add($label, 'title')->setStyle('float', 'right'); |
67 | 67 | |
68 | - $submodules = ModuleManager::getAll()->filter(function ($subModuleClass) use ($moduleClass) { |
|
68 | + $submodules = ModuleManager::getAll()->filter(function($subModuleClass) use ($moduleClass) { |
|
69 | 69 | return $subModuleClass::isSubModuleOf($moduleClass); |
70 | 70 | }); |
71 | 71 | |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | |
80 | 80 | public function formatModuleInfo($moduleClass) |
81 | 81 | { |
82 | - $moduleInfo = (array) ($moduleClass::info()?: __(' No details provided by author')); |
|
82 | + $moduleInfo = (array) ($moduleClass::info() ?: __(' No details provided by author')); |
|
83 | 83 | |
84 | 84 | $ret = []; |
85 | 85 | foreach ($moduleInfo as $label => $text) { |
86 | - $ret[] = (is_string($label)? "<strong>$label</strong>: ": '') . $text; |
|
86 | + $ret[] = (is_string($label) ? "<strong>$label</strong>: " : '') . $text; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | return implode('<br>', $ret); |
@@ -123,12 +123,12 @@ discard block |
||
123 | 123 | |
124 | 124 | $form = Form::addTo($view); |
125 | 125 | foreach ($recommended as $childModule) { |
126 | - if (! ModuleManager::isAvailable($childModule)) continue; |
|
126 | + if (!ModuleManager::isAvailable($childModule)) continue; |
|
127 | 127 | |
128 | 128 | $form->addControl($childModule::alias(), ['CheckBox', 'caption' => $childModule::label()]); |
129 | 129 | } |
130 | 130 | |
131 | - $form->onSubmit(function ($form) use ($moduleClass) { |
|
131 | + $form->onSubmit(function($form) use ($moduleClass) { |
|
132 | 132 | ob_start(); |
133 | 133 | ModuleManager::install($moduleClass, array_keys($form->getValues(), true)); |
134 | 134 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | } |
138 | 138 | |
139 | 139 | \atk4\ui\Button::addTo($view, [__('Install'), 'primary'])->on('click', [ |
140 | - isset($form)? $form->submit(): $installCallback |
|
140 | + isset($form) ? $form->submit() : $installCallback |
|
141 | 141 | ]); |
142 | 142 | }); |
143 | 143 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | ]; |
164 | 164 | }); |
165 | 165 | |
166 | - if ($dependents = ModuleManager::listDependents()[$moduleClass]?? []) { |
|
166 | + if ($dependents = ModuleManager::listDependents()[$moduleClass] ?? []) { |
|
167 | 167 | $modal = \atk4\ui\Modal::addTo($this, ['title' => __(':module Module Installation', ['module' => $moduleClass::label()])])->set(function($view) use ($moduleClass, $dependents, $uninstallCallback) { |
168 | 168 | $message = \atk4\ui\Message::addTo($view, [__('Module is required by following modules')]); |
169 | 169 |
@@ -56,8 +56,7 @@ discard block |
||
56 | 56 | $this->addUninstallButton($section, $moduleClass); |
57 | 57 | |
58 | 58 | // $this->addReinstallButton($section, $moduleClass); |
59 | - } |
|
60 | - else { |
|
59 | + } else { |
|
61 | 60 | $label = [\atk4\ui\Label::class, __('Available'), 'yellow']; |
62 | 61 | |
63 | 62 | $this->addInstallButton($section, $moduleClass); |
@@ -69,7 +68,9 @@ discard block |
||
69 | 68 | return $subModuleClass::isSubModuleOf($moduleClass); |
70 | 69 | }); |
71 | 70 | |
72 | - if ($submodules->isEmpty()) continue; |
|
71 | + if ($submodules->isEmpty()) { |
|
72 | + continue; |
|
73 | + } |
|
73 | 74 | |
74 | 75 | $this->addAccordion($section, $submodules); |
75 | 76 | } |
@@ -123,7 +124,9 @@ discard block |
||
123 | 124 | |
124 | 125 | $form = Form::addTo($view); |
125 | 126 | foreach ($recommended as $childModule) { |
126 | - if (! ModuleManager::isAvailable($childModule)) continue; |
|
127 | + if (! ModuleManager::isAvailable($childModule)) { |
|
128 | + continue; |
|
129 | + } |
|
127 | 130 | |
128 | 131 | $form->addControl($childModule::alias(), ['CheckBox', 'caption' => $childModule::label()]); |
129 | 132 | } |
@@ -28,10 +28,10 @@ |
||
28 | 28 | final public function displayModuleContent($method, $args) |
29 | 29 | { |
30 | 30 | // if method not callbale abort to 'not found' |
31 | - if (! is_callable([$this, $method])) abort(404); |
|
31 | + if (!is_callable([$this, $method])) abort(404); |
|
32 | 32 | |
33 | 33 | // if user has no access abort 'no access' |
34 | - if (! $this->access()) abort(401); |
|
34 | + if (!$this->access()) abort(401); |
|
35 | 35 | |
36 | 36 | $args = $this->decodeArgs($args); |
37 | 37 |
@@ -28,10 +28,14 @@ |
||
28 | 28 | final public function displayModuleContent($method, $args) |
29 | 29 | { |
30 | 30 | // if method not callbale abort to 'not found' |
31 | - if (! is_callable([$this, $method])) abort(404); |
|
31 | + if (! is_callable([$this, $method])) { |
|
32 | + abort(404); |
|
33 | + } |
|
32 | 34 | |
33 | 35 | // if user has no access abort 'no access' |
34 | - if (! $this->access()) abort(401); |
|
36 | + if (! $this->access()) { |
|
37 | + abort(401); |
|
38 | + } |
|
35 | 39 | |
36 | 40 | $args = $this->decodeArgs($args); |
37 | 41 |
@@ -4,24 +4,24 @@ |
||
4 | 4 | |
5 | 5 | trait Notifies |
6 | 6 | { |
7 | - public function notify($options) |
|
8 | - { |
|
9 | - $options = array_merge(['duration'=> 1500], is_array($options)? $options: ['message' => $options]); |
|
7 | + public function notify($options) |
|
8 | + { |
|
9 | + $options = array_merge(['duration'=> 1500], is_array($options)? $options: ['message' => $options]); |
|
10 | 10 | |
11 | - return new \atk4\ui\JsToast($options); |
|
12 | - } |
|
11 | + return new \atk4\ui\JsToast($options); |
|
12 | + } |
|
13 | 13 | |
14 | - public function notifySuccess($options) |
|
15 | - { |
|
16 | - $options = array_merge(['class' => 'success'], is_array($options)? $options: ['message' => $options]); |
|
14 | + public function notifySuccess($options) |
|
15 | + { |
|
16 | + $options = array_merge(['class' => 'success'], is_array($options)? $options: ['message' => $options]); |
|
17 | 17 | |
18 | - return $this->notify($options); |
|
19 | - } |
|
18 | + return $this->notify($options); |
|
19 | + } |
|
20 | 20 | |
21 | - public function notifyError($options) |
|
22 | - { |
|
23 | - $options = array_merge(['class' => 'error'], is_array($options)? $options: ['message' => $options]); |
|
21 | + public function notifyError($options) |
|
22 | + { |
|
23 | + $options = array_merge(['class' => 'error'], is_array($options)? $options: ['message' => $options]); |
|
24 | 24 | |
25 | - return $this->notify($options); |
|
26 | - } |
|
25 | + return $this->notify($options); |
|
26 | + } |
|
27 | 27 | } |
28 | 28 | \ No newline at end of file |
@@ -6,21 +6,21 @@ |
||
6 | 6 | { |
7 | 7 | public function notify($options) |
8 | 8 | { |
9 | - $options = array_merge(['duration'=> 1500], is_array($options)? $options: ['message' => $options]); |
|
9 | + $options = array_merge(['duration'=> 1500], is_array($options) ? $options : ['message' => $options]); |
|
10 | 10 | |
11 | 11 | return new \atk4\ui\JsToast($options); |
12 | 12 | } |
13 | 13 | |
14 | 14 | public function notifySuccess($options) |
15 | 15 | { |
16 | - $options = array_merge(['class' => 'success'], is_array($options)? $options: ['message' => $options]); |
|
16 | + $options = array_merge(['class' => 'success'], is_array($options) ? $options : ['message' => $options]); |
|
17 | 17 | |
18 | 18 | return $this->notify($options); |
19 | 19 | } |
20 | 20 | |
21 | 21 | public function notifyError($options) |
22 | 22 | { |
23 | - $options = array_merge(['class' => 'error'], is_array($options)? $options: ['message' => $options]); |
|
23 | + $options = array_merge(['class' => 'error'], is_array($options) ? $options : ['message' => $options]); |
|
24 | 24 | |
25 | 25 | return $this->notify($options); |
26 | 26 | } |
@@ -7,168 +7,168 @@ |
||
7 | 7 | |
8 | 8 | class PackageManifest |
9 | 9 | { |
10 | - /** |
|
11 | - * The filesystem instance. |
|
12 | - * |
|
13 | - * @var \Illuminate\Filesystem\Filesystem |
|
14 | - */ |
|
15 | - public $files; |
|
16 | - |
|
17 | - /** |
|
18 | - * The base path. |
|
19 | - * |
|
20 | - * @var string |
|
21 | - */ |
|
22 | - public $basePath; |
|
23 | - |
|
24 | - /** |
|
25 | - * The vendor path. |
|
26 | - * |
|
27 | - * @var string |
|
28 | - */ |
|
29 | - public $vendorPath; |
|
30 | - |
|
31 | - /** |
|
32 | - * The manifest path. |
|
33 | - * |
|
34 | - * @var string|null |
|
35 | - */ |
|
36 | - public $manifestPath; |
|
37 | - |
|
38 | - /** |
|
39 | - * The loaded manifest array. |
|
40 | - * |
|
41 | - * @var array |
|
42 | - */ |
|
43 | - public $manifest; |
|
44 | - |
|
45 | - /** |
|
46 | - * Create a new package manifest instance. |
|
47 | - * |
|
48 | - * @param \Illuminate\Filesystem\Filesystem $files |
|
49 | - * @param string $basePath |
|
50 | - * @param string $manifestPath |
|
51 | - * @return void |
|
52 | - */ |
|
53 | - public function __construct(Filesystem $files, $basePath, $manifestPath) |
|
54 | - { |
|
55 | - $this->files = $files; |
|
56 | - $this->basePath = $basePath; |
|
57 | - $this->manifestPath = $manifestPath; |
|
58 | - $this->vendorPath = $basePath.'/vendor'; |
|
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * Get all of the integrator class names for all packages. |
|
63 | - * |
|
64 | - * @return array |
|
65 | - */ |
|
66 | - public function joints() |
|
67 | - { |
|
68 | - return collect($this->getManifest())->flatMap(function ($configuration) { |
|
69 | - return (array) ($configuration['joints'] ?? []); |
|
70 | - })->filter()->all(); |
|
71 | - } |
|
10 | + /** |
|
11 | + * The filesystem instance. |
|
12 | + * |
|
13 | + * @var \Illuminate\Filesystem\Filesystem |
|
14 | + */ |
|
15 | + public $files; |
|
16 | + |
|
17 | + /** |
|
18 | + * The base path. |
|
19 | + * |
|
20 | + * @var string |
|
21 | + */ |
|
22 | + public $basePath; |
|
23 | + |
|
24 | + /** |
|
25 | + * The vendor path. |
|
26 | + * |
|
27 | + * @var string |
|
28 | + */ |
|
29 | + public $vendorPath; |
|
30 | + |
|
31 | + /** |
|
32 | + * The manifest path. |
|
33 | + * |
|
34 | + * @var string|null |
|
35 | + */ |
|
36 | + public $manifestPath; |
|
37 | + |
|
38 | + /** |
|
39 | + * The loaded manifest array. |
|
40 | + * |
|
41 | + * @var array |
|
42 | + */ |
|
43 | + public $manifest; |
|
44 | + |
|
45 | + /** |
|
46 | + * Create a new package manifest instance. |
|
47 | + * |
|
48 | + * @param \Illuminate\Filesystem\Filesystem $files |
|
49 | + * @param string $basePath |
|
50 | + * @param string $manifestPath |
|
51 | + * @return void |
|
52 | + */ |
|
53 | + public function __construct(Filesystem $files, $basePath, $manifestPath) |
|
54 | + { |
|
55 | + $this->files = $files; |
|
56 | + $this->basePath = $basePath; |
|
57 | + $this->manifestPath = $manifestPath; |
|
58 | + $this->vendorPath = $basePath.'/vendor'; |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * Get all of the integrator class names for all packages. |
|
63 | + * |
|
64 | + * @return array |
|
65 | + */ |
|
66 | + public function joints() |
|
67 | + { |
|
68 | + return collect($this->getManifest())->flatMap(function ($configuration) { |
|
69 | + return (array) ($configuration['joints'] ?? []); |
|
70 | + })->filter()->all(); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Get all of the module declared for all packages. |
|
75 | - * |
|
76 | - * @return array |
|
77 | - */ |
|
78 | - public function modules() |
|
79 | - { |
|
80 | - return collect($this->getManifest())->flatMap(function ($configuration, $package) { |
|
81 | - return array_map(function($moduleRelativePath) use ($package) { |
|
82 | - return str_ireplace('/', DIRECTORY_SEPARATOR, implode('/', [$this->vendorPath, $package, $moduleRelativePath])); |
|
83 | - }, (array) ($configuration['modules'] ?? [])); |
|
84 | - })->filter()->all(); |
|
85 | - } |
|
86 | - |
|
87 | - /** |
|
88 | - * Get the current package manifest. |
|
89 | - * |
|
90 | - * @return array |
|
91 | - */ |
|
92 | - protected function getManifest() |
|
93 | - { |
|
94 | - if (isset($this->manifest)) { |
|
95 | - return $this->manifest; |
|
96 | - } |
|
97 | - |
|
98 | - if (! file_exists($this->manifestPath)) { |
|
99 | - $this->build(); |
|
100 | - } |
|
73 | + /** |
|
74 | + * Get all of the module declared for all packages. |
|
75 | + * |
|
76 | + * @return array |
|
77 | + */ |
|
78 | + public function modules() |
|
79 | + { |
|
80 | + return collect($this->getManifest())->flatMap(function ($configuration, $package) { |
|
81 | + return array_map(function($moduleRelativePath) use ($package) { |
|
82 | + return str_ireplace('/', DIRECTORY_SEPARATOR, implode('/', [$this->vendorPath, $package, $moduleRelativePath])); |
|
83 | + }, (array) ($configuration['modules'] ?? [])); |
|
84 | + })->filter()->all(); |
|
85 | + } |
|
86 | + |
|
87 | + /** |
|
88 | + * Get the current package manifest. |
|
89 | + * |
|
90 | + * @return array |
|
91 | + */ |
|
92 | + protected function getManifest() |
|
93 | + { |
|
94 | + if (isset($this->manifest)) { |
|
95 | + return $this->manifest; |
|
96 | + } |
|
97 | + |
|
98 | + if (! file_exists($this->manifestPath)) { |
|
99 | + $this->build(); |
|
100 | + } |
|
101 | 101 | |
102 | - return $this->manifest = file_exists($this->manifestPath) ? |
|
103 | - $this->files->getRequire($this->manifestPath) : []; |
|
104 | - } |
|
105 | - |
|
106 | - /** |
|
107 | - * Build the manifest and write it to disk. |
|
108 | - * |
|
109 | - * @return void |
|
110 | - */ |
|
111 | - public function build() |
|
112 | - { |
|
113 | - $packages = []; |
|
114 | - |
|
115 | - if ($this->files->exists($path = $this->vendorPath.'/composer/installed.json')) { |
|
116 | - $packages = json_decode($this->files->get($path), true); |
|
117 | - } |
|
118 | - |
|
119 | - $ignoreAll = in_array('*', $ignore = $this->packagesToIgnore()); |
|
120 | - |
|
121 | - $this->write(collect($packages['packages'])->mapWithKeys(function ($package) { |
|
122 | - return [$this->format($package['name']) => $package['extra']['epesi'] ?? []]; |
|
123 | - })->each(function ($configuration) use (&$ignore) { |
|
124 | - $ignore = array_merge($ignore, $configuration['dont-discover'] ?? []); |
|
125 | - })->reject(function ($configuration, $package) use ($ignore, $ignoreAll) { |
|
126 | - return $ignoreAll || in_array($package, $ignore); |
|
127 | - })->filter()->all()); |
|
128 | - } |
|
129 | - |
|
130 | - /** |
|
131 | - * Format the given package name. |
|
132 | - * |
|
133 | - * @param string $package |
|
134 | - * @return string |
|
135 | - */ |
|
136 | - protected function format($package) |
|
137 | - { |
|
138 | - return str_replace($this->vendorPath.'/', '', $package); |
|
139 | - } |
|
140 | - |
|
141 | - /** |
|
142 | - * Get all of the package names that should be ignored. |
|
143 | - * |
|
144 | - * @return array |
|
145 | - */ |
|
146 | - protected function packagesToIgnore() |
|
147 | - { |
|
148 | - if (! file_exists($this->basePath.'/composer.json')) { |
|
149 | - return []; |
|
150 | - } |
|
151 | - |
|
152 | - return json_decode(file_get_contents( |
|
153 | - $this->basePath.'/composer.json' |
|
154 | - ), true)['extra']['epesi']['dont-discover'] ?? []; |
|
155 | - } |
|
156 | - |
|
157 | - /** |
|
158 | - * Write the given manifest array to disk. |
|
159 | - * |
|
160 | - * @param array $manifest |
|
161 | - * @return void |
|
162 | - * @throws \Exception |
|
163 | - */ |
|
164 | - protected function write(array $manifest) |
|
165 | - { |
|
166 | - if (! is_writable(dirname($this->manifestPath))) { |
|
167 | - throw new Exception('The '.dirname($this->manifestPath).' directory must be present and writable.'); |
|
168 | - } |
|
169 | - |
|
170 | - $this->files->put( |
|
171 | - $this->manifestPath, '<?php return '.var_export($manifest, true).';' |
|
172 | - ); |
|
173 | - } |
|
102 | + return $this->manifest = file_exists($this->manifestPath) ? |
|
103 | + $this->files->getRequire($this->manifestPath) : []; |
|
104 | + } |
|
105 | + |
|
106 | + /** |
|
107 | + * Build the manifest and write it to disk. |
|
108 | + * |
|
109 | + * @return void |
|
110 | + */ |
|
111 | + public function build() |
|
112 | + { |
|
113 | + $packages = []; |
|
114 | + |
|
115 | + if ($this->files->exists($path = $this->vendorPath.'/composer/installed.json')) { |
|
116 | + $packages = json_decode($this->files->get($path), true); |
|
117 | + } |
|
118 | + |
|
119 | + $ignoreAll = in_array('*', $ignore = $this->packagesToIgnore()); |
|
120 | + |
|
121 | + $this->write(collect($packages['packages'])->mapWithKeys(function ($package) { |
|
122 | + return [$this->format($package['name']) => $package['extra']['epesi'] ?? []]; |
|
123 | + })->each(function ($configuration) use (&$ignore) { |
|
124 | + $ignore = array_merge($ignore, $configuration['dont-discover'] ?? []); |
|
125 | + })->reject(function ($configuration, $package) use ($ignore, $ignoreAll) { |
|
126 | + return $ignoreAll || in_array($package, $ignore); |
|
127 | + })->filter()->all()); |
|
128 | + } |
|
129 | + |
|
130 | + /** |
|
131 | + * Format the given package name. |
|
132 | + * |
|
133 | + * @param string $package |
|
134 | + * @return string |
|
135 | + */ |
|
136 | + protected function format($package) |
|
137 | + { |
|
138 | + return str_replace($this->vendorPath.'/', '', $package); |
|
139 | + } |
|
140 | + |
|
141 | + /** |
|
142 | + * Get all of the package names that should be ignored. |
|
143 | + * |
|
144 | + * @return array |
|
145 | + */ |
|
146 | + protected function packagesToIgnore() |
|
147 | + { |
|
148 | + if (! file_exists($this->basePath.'/composer.json')) { |
|
149 | + return []; |
|
150 | + } |
|
151 | + |
|
152 | + return json_decode(file_get_contents( |
|
153 | + $this->basePath.'/composer.json' |
|
154 | + ), true)['extra']['epesi']['dont-discover'] ?? []; |
|
155 | + } |
|
156 | + |
|
157 | + /** |
|
158 | + * Write the given manifest array to disk. |
|
159 | + * |
|
160 | + * @param array $manifest |
|
161 | + * @return void |
|
162 | + * @throws \Exception |
|
163 | + */ |
|
164 | + protected function write(array $manifest) |
|
165 | + { |
|
166 | + if (! is_writable(dirname($this->manifestPath))) { |
|
167 | + throw new Exception('The '.dirname($this->manifestPath).' directory must be present and writable.'); |
|
168 | + } |
|
169 | + |
|
170 | + $this->files->put( |
|
171 | + $this->manifestPath, '<?php return '.var_export($manifest, true).';' |
|
172 | + ); |
|
173 | + } |
|
174 | 174 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $this->files = $files; |
56 | 56 | $this->basePath = $basePath; |
57 | 57 | $this->manifestPath = $manifestPath; |
58 | - $this->vendorPath = $basePath.'/vendor'; |
|
58 | + $this->vendorPath = $basePath . '/vendor'; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function joints() |
67 | 67 | { |
68 | - return collect($this->getManifest())->flatMap(function ($configuration) { |
|
68 | + return collect($this->getManifest())->flatMap(function($configuration) { |
|
69 | 69 | return (array) ($configuration['joints'] ?? []); |
70 | 70 | })->filter()->all(); |
71 | 71 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function modules() |
79 | 79 | { |
80 | - return collect($this->getManifest())->flatMap(function ($configuration, $package) { |
|
80 | + return collect($this->getManifest())->flatMap(function($configuration, $package) { |
|
81 | 81 | return array_map(function($moduleRelativePath) use ($package) { |
82 | 82 | return str_ireplace('/', DIRECTORY_SEPARATOR, implode('/', [$this->vendorPath, $package, $moduleRelativePath])); |
83 | 83 | }, (array) ($configuration['modules'] ?? [])); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | return $this->manifest; |
96 | 96 | } |
97 | 97 | |
98 | - if (! file_exists($this->manifestPath)) { |
|
98 | + if (!file_exists($this->manifestPath)) { |
|
99 | 99 | $this->build(); |
100 | 100 | } |
101 | 101 | |
@@ -112,17 +112,17 @@ discard block |
||
112 | 112 | { |
113 | 113 | $packages = []; |
114 | 114 | |
115 | - if ($this->files->exists($path = $this->vendorPath.'/composer/installed.json')) { |
|
115 | + if ($this->files->exists($path = $this->vendorPath . '/composer/installed.json')) { |
|
116 | 116 | $packages = json_decode($this->files->get($path), true); |
117 | 117 | } |
118 | 118 | |
119 | 119 | $ignoreAll = in_array('*', $ignore = $this->packagesToIgnore()); |
120 | 120 | |
121 | - $this->write(collect($packages['packages'])->mapWithKeys(function ($package) { |
|
121 | + $this->write(collect($packages['packages'])->mapWithKeys(function($package) { |
|
122 | 122 | return [$this->format($package['name']) => $package['extra']['epesi'] ?? []]; |
123 | - })->each(function ($configuration) use (&$ignore) { |
|
123 | + })->each(function($configuration) use (&$ignore) { |
|
124 | 124 | $ignore = array_merge($ignore, $configuration['dont-discover'] ?? []); |
125 | - })->reject(function ($configuration, $package) use ($ignore, $ignoreAll) { |
|
125 | + })->reject(function($configuration, $package) use ($ignore, $ignoreAll) { |
|
126 | 126 | return $ignoreAll || in_array($package, $ignore); |
127 | 127 | })->filter()->all()); |
128 | 128 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | protected function format($package) |
137 | 137 | { |
138 | - return str_replace($this->vendorPath.'/', '', $package); |
|
138 | + return str_replace($this->vendorPath . '/', '', $package); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | */ |
146 | 146 | protected function packagesToIgnore() |
147 | 147 | { |
148 | - if (! file_exists($this->basePath.'/composer.json')) { |
|
148 | + if (!file_exists($this->basePath . '/composer.json')) { |
|
149 | 149 | return []; |
150 | 150 | } |
151 | 151 | |
152 | 152 | return json_decode(file_get_contents( |
153 | - $this->basePath.'/composer.json' |
|
153 | + $this->basePath . '/composer.json' |
|
154 | 154 | ), true)['extra']['epesi']['dont-discover'] ?? []; |
155 | 155 | } |
156 | 156 | |
@@ -163,12 +163,12 @@ discard block |
||
163 | 163 | */ |
164 | 164 | protected function write(array $manifest) |
165 | 165 | { |
166 | - if (! is_writable(dirname($this->manifestPath))) { |
|
167 | - throw new Exception('The '.dirname($this->manifestPath).' directory must be present and writable.'); |
|
166 | + if (!is_writable(dirname($this->manifestPath))) { |
|
167 | + throw new Exception('The ' . dirname($this->manifestPath) . ' directory must be present and writable.'); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | $this->files->put( |
171 | - $this->manifestPath, '<?php return '.var_export($manifest, true).';' |
|
171 | + $this->manifestPath, '<?php return ' . var_export($manifest, true) . ';' |
|
172 | 172 | ); |
173 | 173 | } |
174 | 174 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | $form->addControl('language', [\atk4\ui\Form\Control\Dropdown::class, 'values' => $values, 'caption' => __('Select Language'), 'iconLeft' => 'globe'], ['required'=>true])->set($wizard->recall('language', 'en')); |
82 | 82 | |
83 | - $form->onSubmit(function ($form) use ($wizard) { |
|
83 | + $form->onSubmit(function($form) use ($wizard) { |
|
84 | 84 | $wizard->memorize('language', $form->model->get('language')); |
85 | 85 | |
86 | 86 | App::setLocale($form->model->get('language')); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $form->addControl('support', [\atk4\ui\Form\Control\Checkbox::class, 'caption' => __('I will not remove "Support -> About" credit page from the application menu.')], ['required'=>true]); |
113 | 113 | $form->addControl('store', [\atk4\ui\Form\Control\Checkbox::class, 'caption' => __('I will not remove or rename ":epesi Store" links from the application.', ['epesi' => config('epesi.ui.title')])], ['required'=>true]); |
114 | 114 | |
115 | - $form->onSubmit(function ($form) use ($wizard) { |
|
115 | + $form->onSubmit(function($form) use ($wizard) { |
|
116 | 116 | return $wizard->jsNext(); |
117 | 117 | }); |
118 | 118 | |
@@ -140,12 +140,12 @@ discard block |
||
140 | 140 | $form->addControl('create', [\atk4\ui\Form\Control\Checkbox::class, 'caption' => __('Create New Database')])->on('change', new \atk4\ui\JsExpression('if ($(event.target).is(":checked")) alert([])', [__('WARNING: Make sure you have CREATE access level to do this!')])); |
141 | 141 | |
142 | 142 | foreach ($wizard->recall('connection', []) as $name => $value) { |
143 | - if (! $field = $form->fields[$name]?? null) continue; |
|
143 | + if (!$field = $form->fields[$name] ?? null) continue; |
|
144 | 144 | |
145 | 145 | $field->set($value); |
146 | 146 | } |
147 | 147 | |
148 | - $form->onSubmit(function ($form) use ($wizard) { |
|
148 | + $form->onSubmit(function($form) use ($wizard) { |
|
149 | 149 | $connection = $form->model->get(); |
150 | 150 | |
151 | 151 | $wizard->memorize('connection', $connection); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | |
194 | 194 | $form->model->setMulti($wizard->recall('user', [])); |
195 | 195 | |
196 | - $form->validate(function ($form) use ($wizard) { |
|
196 | + $form->validate(function($form) use ($wizard) { |
|
197 | 197 | $wizard->memorize('user', $form->model->get()); |
198 | 198 | |
199 | 199 | return $wizard->jsNext(); |
@@ -140,7 +140,9 @@ |
||
140 | 140 | $form->addControl('create', [\atk4\ui\Form\Control\Checkbox::class, 'caption' => __('Create New Database')])->on('change', new \atk4\ui\JsExpression('if ($(event.target).is(":checked")) alert([])', [__('WARNING: Make sure you have CREATE access level to do this!')])); |
141 | 141 | |
142 | 142 | foreach ($wizard->recall('connection', []) as $name => $value) { |
143 | - if (! $field = $form->fields[$name]?? null) continue; |
|
143 | + if (! $field = $form->fields[$name]?? null) { |
|
144 | + continue; |
|
145 | + } |
|
144 | 146 | |
145 | 147 | $field->set($value); |
146 | 148 | } |
@@ -7,19 +7,19 @@ |
||
7 | 7 | |
8 | 8 | class Module extends Model |
9 | 9 | { |
10 | - use HasEpesiConnection; |
|
10 | + use HasEpesiConnection; |
|
11 | 11 | |
12 | - public $table = 'modules'; |
|
12 | + public $table = 'modules'; |
|
13 | 13 | |
14 | - protected function init(): void |
|
15 | - { |
|
16 | - parent::init(); |
|
14 | + protected function init(): void |
|
15 | + { |
|
16 | + parent::init(); |
|
17 | 17 | |
18 | - $this->addFields([ |
|
19 | - 'class', |
|
20 | - 'alias', |
|
21 | - 'priority' => ['default' => 0], |
|
22 | - 'state' => ['default' => 1] |
|
23 | - ]); |
|
24 | - } |
|
18 | + $this->addFields([ |
|
19 | + 'class', |
|
20 | + 'alias', |
|
21 | + 'priority' => ['default' => 0], |
|
22 | + 'state' => ['default' => 1] |
|
23 | + ]); |
|
24 | + } |
|
25 | 25 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | class Variable extends Model |
10 | 10 | { |
11 | - use HasEpesiConnection; |
|
11 | + use HasEpesiConnection; |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @var Collection |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | |
28 | 28 | protected function init(): void |
29 | 29 | { |
30 | - parent::init(); |
|
30 | + parent::init(); |
|
31 | 31 | |
32 | - $this->addFields([ |
|
33 | - 'name', |
|
34 | - 'value' => ['type' => 'text', 'serialize' => 'json'] |
|
35 | - ]); |
|
32 | + $this->addFields([ |
|
33 | + 'name', |
|
34 | + 'value' => ['type' => 'text', 'serialize' => 'json'] |
|
35 | + ]); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | public static function recall($name, $default = null) { |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | $variable = self::create()->addCondition('name', $name)->tryLoadAny(); |
58 | 58 | |
59 | 59 | if ($variable->loaded()) { |
60 | - $variable->save(compact('value')); |
|
60 | + $variable->save(compact('value')); |
|
61 | 61 | } |
62 | 62 | else { |
63 | - $variable->insert(compact('name', 'value')); |
|
63 | + $variable->insert(compact('name', 'value')); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | public $strict_types = false; |
21 | 21 | |
22 | 22 | private static function cache() { |
23 | - if(isset(self::$variables)) return; |
|
23 | + if (isset(self::$variables)) return; |
|
24 | 24 | |
25 | 25 | self::$variables = self::pluck('value', 'name'); |
26 | 26 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | - public static function forget($name, $throwError=true) { |
|
67 | + public static function forget($name, $throwError = true) { |
|
68 | 68 | self::cache(); |
69 | 69 | |
70 | 70 | if (!self::$variables->has($name) && $throwError) { |
@@ -20,7 +20,9 @@ discard block |
||
20 | 20 | public $strict_types = false; |
21 | 21 | |
22 | 22 | private static function cache() { |
23 | - if(isset(self::$variables)) return; |
|
23 | + if(isset(self::$variables)) { |
|
24 | + return; |
|
25 | + } |
|
24 | 26 | |
25 | 27 | self::$variables = self::pluck('value', 'name'); |
26 | 28 | } |
@@ -38,7 +40,9 @@ discard block |
||
38 | 40 | public static function recall($name, $default = null) { |
39 | 41 | self::cache(); |
40 | 42 | |
41 | - if (!self::$variables->has($name)) return $default; |
|
43 | + if (!self::$variables->has($name)) { |
|
44 | + return $default; |
|
45 | + } |
|
42 | 46 | |
43 | 47 | return self::$variables->get($name, $default) ?? $default; |
44 | 48 | } |
@@ -58,8 +62,7 @@ discard block |
||
58 | 62 | |
59 | 63 | if ($variable->loaded()) { |
60 | 64 | $variable->save(compact('value')); |
61 | - } |
|
62 | - else { |
|
65 | + } else { |
|
63 | 66 | $variable->insert(compact('name', 'value')); |
64 | 67 | } |
65 | 68 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | protected function showEditPermissions() |
37 | 37 | { |
38 | - $permissionsData = Permission::all(['id', 'name'])->map(function($permission){ |
|
38 | + $permissionsData = Permission::all(['id', 'name'])->map(function($permission) { |
|
39 | 39 | $permission['name'] = trans(ucwords($permission['name'])); |
40 | 40 | |
41 | 41 | return $permission; |
@@ -99,19 +99,19 @@ discard block |
||
99 | 99 | |
100 | 100 | protected function columns() |
101 | 101 | { |
102 | - return $this->columns = $this->columns?: Columns::addTo($this); |
|
102 | + return $this->columns = $this->columns ?: Columns::addTo($this); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | protected function permissionId() |
106 | 106 | { |
107 | - return $this->getApp()->stickyGet($this->columns()->name)?: $this->getModuleVariable('permission'); |
|
107 | + return $this->getApp()->stickyGet($this->columns()->name) ?: $this->getModuleVariable('permission'); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | protected function reload($permissionExpression = null) |
111 | 111 | { |
112 | 112 | $columns = $this->columns(); |
113 | 113 | |
114 | - return $this->reload = $this->reload?: new \atk4\ui\JsReload($columns, [$columns->name => $permissionExpression?: '']); |
|
114 | + return $this->reload = $this->reload ?: new \atk4\ui\JsReload($columns, [$columns->name => $permissionExpression ?: '']); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | protected function getModel($array) |