@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | //TODO: set the skin from admin / user selection |
34 | 34 | $this->skin = config('epesi.app.skin', $this->skin); |
35 | 35 | |
36 | - $this->template_dir = array_merge(ModuleManager::collect('templates', $this->skin), $this->template_dir?: []); |
|
36 | + $this->template_dir = array_merge(ModuleManager::collect('templates', $this->skin), $this->template_dir ?: []); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | final public static function module() |
@@ -87,35 +87,35 @@ discard block |
||
87 | 87 | |
88 | 88 | // jQuery |
89 | 89 | $urlJs = $this->cdn['jquery']?? $localJs; |
90 | - $this->requireJS($urlJs.'/jquery.min.js'); |
|
90 | + $this->requireJS($urlJs . '/jquery.min.js'); |
|
91 | 91 | |
92 | 92 | // Semantic UI |
93 | 93 | $urlJs = $this->cdn['semantic-ui']?? $localJs; |
94 | 94 | $urlCss = $this->cdn['semantic-ui']?? $localCss; |
95 | - $this->requireJS($urlJs.'/semantic.min.js'); |
|
96 | - $this->requireCSS($urlCss.'/semantic.min.css'); |
|
95 | + $this->requireJS($urlJs . '/semantic.min.js'); |
|
96 | + $this->requireCSS($urlCss . '/semantic.min.css'); |
|
97 | 97 | |
98 | 98 | // Serialize Object |
99 | 99 | $urlJs = $this->cdn['serialize-object']?? $localJs; |
100 | - $this->requireJS($urlJs.'/jquery.serialize-object.min.js'); |
|
100 | + $this->requireJS($urlJs . '/jquery.serialize-object.min.js'); |
|
101 | 101 | |
102 | 102 | // Agile UI |
103 | 103 | $urlJs = $this->cdn['atk']?? $localJs; |
104 | 104 | $urlCss = $this->cdn['atk']?? $localCss; |
105 | - $this->requireJS($urlJs.'/atkjs-ui.min.js'); |
|
106 | - $this->requireCSS($urlCss.'/agileui.css'); |
|
105 | + $this->requireJS($urlJs . '/atkjs-ui.min.js'); |
|
106 | + $this->requireCSS($urlCss . '/agileui.css'); |
|
107 | 107 | |
108 | 108 | // Draggable |
109 | 109 | $urlJs = $this->cdn['draggable']?? $localJs; |
110 | - $this->requireJS($urlJs.'/draggable.bundle.js'); |
|
110 | + $this->requireJS($urlJs . '/draggable.bundle.js'); |
|
111 | 111 | |
112 | 112 | // jQuery niceScroll |
113 | 113 | $urlJs = $this->cdn['jquery-nicescroll']?? $localJs; |
114 | - $this->requireJS($urlJs.'/jquery.nicescroll.js'); |
|
114 | + $this->requireJS($urlJs . '/jquery.nicescroll.js'); |
|
115 | 115 | |
116 | 116 | // clipboard.js |
117 | 117 | $urlJs = $this->cdn['clipboardjs']?? $localJs; |
118 | - $this->requireJS($urlJs.'/clipboard.js'); |
|
118 | + $this->requireJS($urlJs . '/clipboard.js'); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | public function addCsrfToken() |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | $key = md5(serialize(func_get_args())); |
194 | 194 | |
195 | - if (! isset($cache[$key])) { |
|
195 | + if (!isset($cache[$key])) { |
|
196 | 196 | $cache[$key] = true; |
197 | 197 | |
198 | 198 | parent::requireJS($url, $isAsync, $isDefer); |
@@ -7,17 +7,17 @@ |
||
7 | 7 | |
8 | 8 | class SQL extends \atk4\data\Persistence\SQL |
9 | 9 | { |
10 | - /** |
|
11 | - * Take a laravel connection and pass it to ATK Data |
|
12 | - * |
|
13 | - * @param \Illuminate\Database\DatabaseManager $db The Laravel database manager |
|
14 | - * |
|
15 | - * @return \atk4\data\Persistence_SQL |
|
16 | - * @throws \atk4\data\Exception |
|
17 | - * @throws \atk4\dsql\Exception |
|
18 | - */ |
|
19 | - public function __construct(DatabaseManager $database) |
|
20 | - { |
|
21 | - parent::__construct(Connection::connect($database->connection()->getPdo())); |
|
22 | - } |
|
10 | + /** |
|
11 | + * Take a laravel connection and pass it to ATK Data |
|
12 | + * |
|
13 | + * @param \Illuminate\Database\DatabaseManager $db The Laravel database manager |
|
14 | + * |
|
15 | + * @return \atk4\data\Persistence_SQL |
|
16 | + * @throws \atk4\data\Exception |
|
17 | + * @throws \atk4\dsql\Exception |
|
18 | + */ |
|
19 | + public function __construct(DatabaseManager $database) |
|
20 | + { |
|
21 | + parent::__construct(Connection::connect($database->connection()->getPdo())); |
|
22 | + } |
|
23 | 23 | } |
24 | 24 | \ No newline at end of file |
@@ -4,14 +4,14 @@ |
||
4 | 4 | |
5 | 5 | class Utils |
6 | 6 | { |
7 | - public static function bytesToHuman($bytes) |
|
8 | - { |
|
9 | - $units = [__('B'), __('KiB'), __('MiB'), __('GiB'), __('TiB'), __('PiB')]; |
|
7 | + public static function bytesToHuman($bytes) |
|
8 | + { |
|
9 | + $units = [__('B'), __('KiB'), __('MiB'), __('GiB'), __('TiB'), __('PiB')]; |
|
10 | 10 | |
11 | - for ($i = 0; $bytes > 1024; $i++) { |
|
12 | - $bytes /= 1024; |
|
13 | - } |
|
11 | + for ($i = 0; $bytes > 1024; $i++) { |
|
12 | + $bytes /= 1024; |
|
13 | + } |
|
14 | 14 | |
15 | - return round($bytes, 2) . ' ' . $units[$i]; |
|
16 | - } |
|
15 | + return round($bytes, 2) . ' ' . $units[$i]; |
|
16 | + } |
|
17 | 17 | } |
18 | 18 | \ No newline at end of file |
@@ -12,73 +12,73 @@ |
||
12 | 12 | |
13 | 13 | class EpesiServiceProvider extends ServiceProvider |
14 | 14 | { |
15 | - /** |
|
16 | - * Booting the package. |
|
17 | - */ |
|
18 | - public function boot() |
|
19 | - { |
|
20 | - $this->ensureHttps(); |
|
15 | + /** |
|
16 | + * Booting the package. |
|
17 | + */ |
|
18 | + public function boot() |
|
19 | + { |
|
20 | + $this->ensureHttps(); |
|
21 | 21 | |
22 | - if (env('APP_DEBUG', false)) ModuleManager::clearCache(); |
|
22 | + if (env('APP_DEBUG', false)) ModuleManager::clearCache(); |
|
23 | 23 | |
24 | - Route::group(['namespace' => 'Epesi\Core\Controllers', 'middleware' => 'web'], function() { |
|
25 | - Route::any('/', 'SystemController@index'); |
|
26 | - Route::get('logo', 'SystemController@logo'); |
|
27 | - Route::any('install', 'SystemController@install'); |
|
24 | + Route::group(['namespace' => 'Epesi\Core\Controllers', 'middleware' => 'web'], function() { |
|
25 | + Route::any('/', 'SystemController@index'); |
|
26 | + Route::get('logo', 'SystemController@logo'); |
|
27 | + Route::any('install', 'SystemController@install'); |
|
28 | 28 | |
29 | - Route::group(['middleware' => ['auth', NoCacheHeaders::class]], function() { |
|
30 | - Route::any('home', 'SystemController@home')->name('home'); |
|
29 | + Route::group(['middleware' => ['auth', NoCacheHeaders::class]], function() { |
|
30 | + Route::any('home', 'SystemController@home')->name('home'); |
|
31 | 31 | |
32 | - Route::any('view/{alias}/{method?}/{args?}', 'SystemController@view'); |
|
33 | - }); |
|
34 | - }); |
|
32 | + Route::any('view/{alias}/{method?}/{args?}', 'SystemController@view'); |
|
33 | + }); |
|
34 | + }); |
|
35 | 35 | |
36 | - // call boot methods on all modules |
|
37 | - ModuleManager::call('boot'); |
|
36 | + // call boot methods on all modules |
|
37 | + ModuleManager::call('boot'); |
|
38 | 38 | |
39 | 39 | foreach (ModuleManager::collect('translations') as $path) { |
40 | 40 | $this->loadJsonTranslationsFrom($path); |
41 | 41 | } |
42 | 42 | |
43 | - // Register admin service provider if in admin mode or in console |
|
44 | - // TODO: apply access restriction to admin mode |
|
43 | + // Register admin service provider if in admin mode or in console |
|
44 | + // TODO: apply access restriction to admin mode |
|
45 | 45 | // if ($this->app->runningInConsole() || (request('admin', false) && Auth::user()->can('modify system'))) { |
46 | - if ($this->app->runningInConsole() || request('admin', false)) { |
|
47 | - $this->app->register(AdminServiceProvider::class); |
|
48 | - } |
|
49 | - } |
|
46 | + if ($this->app->runningInConsole() || request('admin', false)) { |
|
47 | + $this->app->register(AdminServiceProvider::class); |
|
48 | + } |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * Register the provider. |
|
53 | - */ |
|
54 | - public function register() |
|
55 | - { |
|
56 | - $this->app->singleton(App::class); |
|
51 | + /** |
|
52 | + * Register the provider. |
|
53 | + */ |
|
54 | + public function register() |
|
55 | + { |
|
56 | + $this->app->singleton(App::class); |
|
57 | 57 | |
58 | - $this->app->singleton( |
|
59 | - SQL::class, |
|
60 | - function ($app) { |
|
61 | - /** |
|
62 | - * Database Manager |
|
63 | - * |
|
64 | - * @var \Illuminate\Database\DatabaseManager $db |
|
65 | - */ |
|
66 | - $db = DB::getFacadeRoot(); |
|
58 | + $this->app->singleton( |
|
59 | + SQL::class, |
|
60 | + function ($app) { |
|
61 | + /** |
|
62 | + * Database Manager |
|
63 | + * |
|
64 | + * @var \Illuminate\Database\DatabaseManager $db |
|
65 | + */ |
|
66 | + $db = DB::getFacadeRoot(); |
|
67 | 67 | |
68 | - return new SQL($db); |
|
69 | - }); |
|
70 | - } |
|
68 | + return new SQL($db); |
|
69 | + }); |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * Force to set https scheme if https enabled. |
|
74 | - * |
|
75 | - * @return void |
|
76 | - */ |
|
77 | - protected function ensureHttps() |
|
78 | - { |
|
79 | - if (config('epesi.https') || config('epesi.secure')) { |
|
80 | - url()->forceScheme('https'); |
|
81 | - $this->app['request']->server->set('HTTPS', true); |
|
82 | - } |
|
83 | - } |
|
72 | + /** |
|
73 | + * Force to set https scheme if https enabled. |
|
74 | + * |
|
75 | + * @return void |
|
76 | + */ |
|
77 | + protected function ensureHttps() |
|
78 | + { |
|
79 | + if (config('epesi.https') || config('epesi.secure')) { |
|
80 | + url()->forceScheme('https'); |
|
81 | + $this->app['request']->server->set('HTTPS', true); |
|
82 | + } |
|
83 | + } |
|
84 | 84 | } |
@@ -57,7 +57,7 @@ |
||
57 | 57 | |
58 | 58 | $this->app->singleton( |
59 | 59 | SQL::class, |
60 | - function ($app) { |
|
60 | + function($app) { |
|
61 | 61 | /** |
62 | 62 | * Database Manager |
63 | 63 | * |
@@ -8,7 +8,7 @@ |
||
8 | 8 | { |
9 | 9 | public $table = 'users'; |
10 | 10 | |
11 | - function init(){ |
|
11 | + function init() { |
|
12 | 12 | parent::init(); |
13 | 13 | |
14 | 14 | $this->addFields(['name']); |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | 'icon' => 'th' |
37 | 37 | ], new LaunchPad($this)); |
38 | 38 | |
39 | - foreach(UserMenuJoint::collect() as $joint) { |
|
40 | - foreach ($joint->tools()?: [] as $tool) { |
|
39 | + foreach (UserMenuJoint::collect() as $joint) { |
|
40 | + foreach ($joint->tools() ?: [] as $tool) { |
|
41 | 41 | $this->addTool($tool); |
42 | 42 | } |
43 | 43 | |
44 | - foreach ($joint->entries()?: [] as $entry) { |
|
44 | + foreach ($joint->entries() ?: [] as $entry) { |
|
45 | 45 | $this->addEntry($entry); |
46 | 46 | } |
47 | 47 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | 'item' => ['Logout', 'icon' => 'sign out', 'attr' => ['onclick' => "event.preventDefault();$('#logout-form').submit();"]], |
60 | 60 | 'action' => url('logout'), |
61 | 61 | 'group' => '10000:user', |
62 | - 'callback' => function ($item){ |
|
62 | + 'callback' => function($item) { |
|
63 | 63 | $logoutForm = $item->add(['View', 'attr' => ['method' => 'POST', 'action' => URL::to('logout')]])->setElement('form')->addStyle(['display' => 'none']); |
64 | 64 | $logoutForm->id = 'logout-form'; |
65 | 65 | $logoutForm->add(['View', 'attr' => ['type' => 'hidden', 'name' => '_token', 'value' => csrf_token()]])->setElement('input'); |
@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | |
77 | 77 | public function getUserMenuLabel() |
78 | 78 | { |
79 | - return $this->userMenuLabel?: Auth::user()->name; |
|
79 | + return $this->userMenuLabel ?: Auth::user()->name; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | public function addEntry($entry) |
83 | 83 | { |
84 | 84 | $entry = collect(array_merge(['item' => $entry, 'group' => '00500:general', 'weight' => 10], $entry)); |
85 | 85 | |
86 | - if (! $entry->get('item')) return; |
|
86 | + if (!$entry->get('item')) return; |
|
87 | 87 | |
88 | 88 | $this->entries->add($entry); |
89 | 89 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | $item = $this->userMenu->addItem($entry['item'], $entry->get('action')); |
113 | 113 | |
114 | - if (! $callback = $entry->get('callback')) continue; |
|
114 | + if (!$callback = $entry->get('callback')) continue; |
|
115 | 115 | |
116 | 116 | $callback($item); |
117 | 117 | } |