@@ -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 | } |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | $form->addControl('custom_logo', ['CheckBox', 'caption' => __('Use custom logo')]); |
| 35 | 35 | |
| 36 | 36 | $form->model->set([ |
| 37 | - 'title' => Variable::recall('system.title'), |
|
| 38 | - 'custom_logo' => (bool) Variable::recall('system.logo') |
|
| 37 | + 'title' => Variable::recall('system.title'), |
|
| 38 | + 'custom_logo' => (bool) Variable::recall('system.logo') |
|
| 39 | 39 | ]); |
| 40 | 40 | |
| 41 | 41 | $logo = $form->addControl('logo', [ |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $storage->move($from, $to); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - Variable::memorize('system.logo', $logo); |
|
| 79 | + Variable::memorize('system.logo', $logo); |
|
| 80 | 80 | |
| 81 | 81 | Variable::memorize('system.title', $form->model['title']); |
| 82 | 82 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | public function body() |
| 25 | 25 | { |
| 26 | 26 | $layout = View::addTo($this)->addStyle('max-width:1200px;margin:auto;'); |
| 27 | - \atk4\ui\Header::addTo($layout, [ __($this->label)]); |
|
| 27 | + \atk4\ui\Header::addTo($layout, [__($this->label)]); |
|
| 28 | 28 | $segment = View::addTo($layout, ['ui' => 'segment']); |
| 29 | 29 | |
| 30 | 30 | $form = Form::addTo($segment); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $logo->setThumbnailSrc(asset('storage/' . self::alias() . '/' . self::$defaultLogo)); |
| 54 | 54 | }); |
| 55 | 55 | |
| 56 | - $logo->onUpload(function ($files) use ($form, $logo) { |
|
| 56 | + $logo->onUpload(function($files) use ($form, $logo) { |
|
| 57 | 57 | if ($files === 'error') return $form->error('logo', __('Error uploading image')); |
| 58 | 58 | |
| 59 | 59 | $tmpPath = self::alias() . '/tmp/' . $files['name']; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | }); |
| 65 | 65 | |
| 66 | 66 | $form->onSubmit(function($form) { |
| 67 | - if ($logo = $form->model['custom_logo']? $form->model['logo']: null) { |
|
| 67 | + if ($logo = $form->model['custom_logo'] ? $form->model['logo'] : null) { |
|
| 68 | 68 | $storage = $this->storage(); |
| 69 | 69 | $from = self::alias() . '/tmp/' . $logo; |
| 70 | 70 | $to = self::alias() . '/' . $logo; |
@@ -8,79 +8,79 @@ |
||
| 8 | 8 | |
| 9 | 9 | class ActionButton extends View |
| 10 | 10 | { |
| 11 | - public $defaultTemplate = 'action_button.html'; |
|
| 11 | + public $defaultTemplate = 'action_button.html'; |
|
| 12 | 12 | |
| 13 | - public $ui = 'basic inverted action button'; |
|
| 13 | + public $ui = 'basic inverted action button'; |
|
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Icon that will appear on the button (top). |
|
| 17 | - * |
|
| 18 | - * @var string|array|Icon |
|
| 19 | - */ |
|
| 20 | - public $icon; |
|
| 15 | + /** |
|
| 16 | + * Icon that will appear on the button (top). |
|
| 17 | + * |
|
| 18 | + * @var string|array|Icon |
|
| 19 | + */ |
|
| 20 | + public $icon; |
|
| 21 | 21 | |
| 22 | - public $label; |
|
| 22 | + public $label; |
|
| 23 | 23 | |
| 24 | - public $element = 'a'; |
|
| 24 | + public $element = 'a'; |
|
| 25 | 25 | |
| 26 | - public $weight = 10; |
|
| 26 | + public $weight = 10; |
|
| 27 | 27 | |
| 28 | - public $callback; |
|
| 28 | + public $callback; |
|
| 29 | 29 | |
| 30 | - public function renderView(): void |
|
| 31 | - { |
|
| 32 | - $this->addIcon(); |
|
| 30 | + public function renderView(): void |
|
| 31 | + { |
|
| 32 | + $this->addIcon(); |
|
| 33 | 33 | |
| 34 | - $this->addLabel(); |
|
| 34 | + $this->addLabel(); |
|
| 35 | 35 | |
| 36 | - $this->addCallback(); |
|
| 36 | + $this->addCallback(); |
|
| 37 | 37 | |
| 38 | - parent::renderView(); |
|
| 39 | - } |
|
| 38 | + parent::renderView(); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - protected function addIcon() |
|
| 42 | - { |
|
| 43 | - if (! $icon = $this->getIcon()) return; |
|
| 41 | + protected function addIcon() |
|
| 42 | + { |
|
| 43 | + if (! $icon = $this->getIcon()) return; |
|
| 44 | 44 | |
| 45 | - $this->add($icon, 'Icon')->id = null; |
|
| 45 | + $this->add($icon, 'Icon')->id = null; |
|
| 46 | 46 | |
| 47 | - $this->addClass('icon'); |
|
| 47 | + $this->addClass('icon'); |
|
| 48 | 48 | |
| 49 | - return $this; |
|
| 50 | - } |
|
| 49 | + return $this; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - protected function addLabel() |
|
| 53 | - { |
|
| 54 | - $this->content = $this->label?: $this->content; |
|
| 52 | + protected function addLabel() |
|
| 53 | + { |
|
| 54 | + $this->content = $this->label?: $this->content; |
|
| 55 | 55 | |
| 56 | - return $this; |
|
| 57 | - } |
|
| 56 | + return $this; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - public function getIcon() |
|
| 60 | - { |
|
| 61 | - return is_object($this->icon)? $this->icon: new Icon($this->icon); |
|
| 62 | - } |
|
| 59 | + public function getIcon() |
|
| 60 | + { |
|
| 61 | + return is_object($this->icon)? $this->icon: new Icon($this->icon); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - public function callback($callable) |
|
| 65 | - { |
|
| 66 | - $this->callback = $callable; |
|
| 64 | + public function callback($callable) |
|
| 65 | + { |
|
| 66 | + $this->callback = $callable; |
|
| 67 | 67 | |
| 68 | - return $this; |
|
| 69 | - } |
|
| 68 | + return $this; |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - public function addCallback() |
|
| 72 | - { |
|
| 73 | - if (!$callable = $this->callback) return; |
|
| 71 | + public function addCallback() |
|
| 72 | + { |
|
| 73 | + if (!$callable = $this->callback) return; |
|
| 74 | 74 | |
| 75 | - if (is_callable($callable)) { |
|
| 76 | - $callable = JsCallback::addTo($this)->set($callable); |
|
| 77 | - } |
|
| 75 | + if (is_callable($callable)) { |
|
| 76 | + $callable = JsCallback::addTo($this)->set($callable); |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - if ($callable instanceof JsCallback) { |
|
| 80 | - $this->on('click', $callable); |
|
| 81 | - } |
|
| 79 | + if ($callable instanceof JsCallback) { |
|
| 80 | + $this->on('click', $callable); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - return $this; |
|
| 84 | - } |
|
| 83 | + return $this; |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | 86 | } |
@@ -40,7 +40,9 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | protected function addIcon() |
| 42 | 42 | { |
| 43 | - if (! $icon = $this->getIcon()) return; |
|
| 43 | + if (! $icon = $this->getIcon()) { |
|
| 44 | + return; |
|
| 45 | + } |
|
| 44 | 46 | |
| 45 | 47 | $this->add($icon, 'Icon')->id = null; |
| 46 | 48 | |
@@ -70,7 +72,9 @@ discard block |
||
| 70 | 72 | |
| 71 | 73 | public function addCallback() |
| 72 | 74 | { |
| 73 | - if (!$callable = $this->callback) return; |
|
| 75 | + if (!$callable = $this->callback) { |
|
| 76 | + return; |
|
| 77 | + } |
|
| 74 | 78 | |
| 75 | 79 | if (is_callable($callable)) { |
| 76 | 80 | $callable = JsCallback::addTo($this)->set($callable); |
@@ -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 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | protected function showEditPermissions() |
| 39 | 39 | { |
| 40 | - $permissionsData = Permission::all(['id', 'name'])->map(function($permission){ |
|
| 40 | + $permissionsData = Permission::all(['id', 'name'])->map(function($permission) { |
|
| 41 | 41 | $permission['name'] = trans(ucwords($permission['name'])); |
| 42 | 42 | |
| 43 | 43 | return $permission; |
@@ -101,19 +101,19 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | protected function columns() |
| 103 | 103 | { |
| 104 | - return $this->columns = $this->columns?: Columns::addTo($this); |
|
| 104 | + return $this->columns = $this->columns ?: Columns::addTo($this); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | protected function permissionId() |
| 108 | 108 | { |
| 109 | - return $this->app->stickyGet($this->columns()->name)?: $this->getModuleVariable('permission'); |
|
| 109 | + return $this->app->stickyGet($this->columns()->name) ?: $this->getModuleVariable('permission'); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | protected function reload($permissionExpression = null) |
| 113 | 113 | { |
| 114 | 114 | $columns = $this->columns(); |
| 115 | 115 | |
| 116 | - return $this->reload = $this->reload?: new \atk4\ui\JsReload($columns, [$columns->name => $permissionExpression?: '']); |
|
| 116 | + return $this->reload = $this->reload ?: new \atk4\ui\JsReload($columns, [$columns->name => $permissionExpression ?: '']); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | protected function getModel($array) |
@@ -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 | } |