@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | use yii\bootstrap\NavBar; |
7 | 7 | |
8 | 8 | // initialize local variables |
9 | -$menuItems = []; |
|
10 | -$languageItems = []; |
|
9 | +$menuItems = [ ]; |
|
10 | +$languageItems = [ ]; |
|
11 | 11 | |
12 | 12 | // create label for dev and test environment |
13 | 13 | switch (YII_ENV) { |
@@ -21,22 +21,22 @@ discard block |
||
21 | 21 | $debugLabel = YII_DEBUG ? "<span class='label label-danger'>DEBUG</span>" : ''; |
22 | 22 | |
23 | 23 | // add env & debug label to menu |
24 | -$menuItems[] = [ |
|
24 | +$menuItems[ ] = [ |
|
25 | 25 | 'label' => $envLabel.' '.$debugLabel, |
26 | 26 | ]; |
27 | 27 | |
28 | 28 | // prepare languages |
29 | 29 | foreach (\Yii::$app->urlManager->languages as $language) { |
30 | - $languageItems[] = [ |
|
31 | - 'url' => ['/', \Yii::$app->urlManager->languageParam => $language], |
|
30 | + $languageItems[ ] = [ |
|
31 | + 'url' => [ '/', \Yii::$app->urlManager->languageParam => $language ], |
|
32 | 32 | 'label' => $language, |
33 | 33 | ]; |
34 | 34 | } |
35 | 35 | |
36 | 36 | // add language items to menu |
37 | -$menuItems[] = [ |
|
37 | +$menuItems[ ] = [ |
|
38 | 38 | 'label' => '<i class="glyphicon glyphicon-globe"></i> '.\Yii::$app->language, |
39 | - 'options' => ['id' => 'link-languages-menu'], |
|
39 | + 'options' => [ 'id' => 'link-languages-menu' ], |
|
40 | 40 | 'items' => $languageItems, |
41 | 41 | ]; |
42 | 42 | |
@@ -45,30 +45,30 @@ discard block |
||
45 | 45 | if (\Yii::$app->user->isGuest) { |
46 | 46 | // unauthorized users |
47 | 47 | //$menuItems[] = ['label' => 'Signup', 'url' => ['/user/registration/register']]; |
48 | - $menuItems[] = [ |
|
48 | + $menuItems[ ] = [ |
|
49 | 49 | 'label' => 'Login', |
50 | - 'url' => ['/user/security/login'], |
|
51 | - 'linkOptions' => ['id' => 'link-login'], |
|
50 | + 'url' => [ '/user/security/login' ], |
|
51 | + 'linkOptions' => [ 'id' => 'link-login' ], |
|
52 | 52 | ]; |
53 | 53 | } else { |
54 | 54 | // logged in users |
55 | - $menuItems[] = [ |
|
55 | + $menuItems[ ] = [ |
|
56 | 56 | 'label' => '<i class="glyphicon glyphicon-user"></i> '.\Yii::$app->user->identity->username, |
57 | - 'options' => ['id' => 'link-user-menu'], |
|
57 | + 'options' => [ 'id' => 'link-user-menu' ], |
|
58 | 58 | 'items' => [ |
59 | 59 | [ |
60 | 60 | 'label' => '<i class="glyphicon glyphicon-user"></i> Profile', |
61 | - 'url' => ['/user/profile/show', 'id' => \Yii::$app->user->id], |
|
61 | + 'url' => [ '/user/profile/show', 'id' => \Yii::$app->user->id ], |
|
62 | 62 | ], |
63 | 63 | [ |
64 | 64 | 'label' => '<i class="glyphicon glyphicon-cog"></i> Settings', |
65 | - 'url' => ['/user/settings/profile'], |
|
65 | + 'url' => [ '/user/settings/profile' ], |
|
66 | 66 | ], |
67 | 67 | '<li class="divider"></li>', |
68 | 68 | [ |
69 | 69 | 'label' => '<i class="glyphicon glyphicon-log-out"></i> Logout', |
70 | - 'url' => ['/user/security/logout'], |
|
71 | - 'linkOptions' => ['data-method' => 'post', 'id' => 'link-logout'], |
|
70 | + 'url' => [ '/user/security/logout' ], |
|
71 | + 'linkOptions' => [ 'data-method' => 'post', 'id' => 'link-logout' ], |
|
72 | 72 | ], |
73 | 73 | ], |
74 | 74 | ]; |
@@ -78,19 +78,19 @@ discard block |
||
78 | 78 | 'key' => 'frontend.extra.menuItems', |
79 | 79 | 'renderEmpty' => false, |
80 | 80 | ]); |
81 | - $menuItems[] = '<li class="nav-extra">'.$extraButtons.'</li>'; |
|
81 | + $menuItems[ ] = '<li class="nav-extra">'.$extraButtons.'</li>'; |
|
82 | 82 | |
83 | 83 | // context menu |
84 | - $menuItems[] = [ |
|
85 | - 'options' => ['class' => 'nav-backend'], |
|
84 | + $menuItems[ ] = [ |
|
85 | + 'options' => [ 'class' => 'nav-backend' ], |
|
86 | 86 | 'label' => '<i class="glyphicon glyphicon-pencil"></i>', |
87 | - 'visible' => \Yii::$app->user->can('backend_default_index', ['route' => true]), |
|
88 | - 'items' => \Yii::$app->params['context.menuItems'], |
|
87 | + 'visible' => \Yii::$app->user->can('backend_default_index', [ 'route' => true ]), |
|
88 | + 'items' => \Yii::$app->params[ 'context.menuItems' ], |
|
89 | 89 | ]; |
90 | 90 | |
91 | 91 | $backendMenu = \dmstr\widgets\Menu::widget( |
92 | 92 | [ |
93 | - 'options' => ['class' => 'dropdown-menu'], |
|
93 | + 'options' => [ 'class' => 'dropdown-menu' ], |
|
94 | 94 | 'encodeLabels' => false, |
95 | 95 | 'items' => \dmstr\modules\pages\models\Tree::getMenuItems( |
96 | 96 | 'backend', |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | ), |
100 | 100 | ] |
101 | 101 | ); |
102 | - $menuItems[] = [ |
|
102 | + $menuItems[ ] = [ |
|
103 | 103 | 'label' => '<i class="glyphicon glyphicon-dashboard"></i>', |
104 | - 'url' => ['/backend'], |
|
105 | - 'visible' => \Yii::$app->user->can('backend_default_index', ['route' => true]), |
|
104 | + 'url' => [ '/backend' ], |
|
105 | + 'visible' => \Yii::$app->user->can('backend_default_index', [ 'route' => true ]), |
|
106 | 106 | 'items' => $backendMenu, |
107 | 107 | ]; |
108 | 108 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | // render root pages |
123 | 123 | echo Nav::widget( |
124 | 124 | [ |
125 | - 'options' => ['class' => 'navbar-nav'], |
|
125 | + 'options' => [ 'class' => 'navbar-nav' ], |
|
126 | 126 | 'encodeLabels' => false, |
127 | 127 | 'items' => \dmstr\modules\pages\models\Tree::getMenuItems('root'), |
128 | 128 | ] |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | // render additional menu items (languages, user) |
132 | 132 | echo Nav::widget( |
133 | 133 | [ |
134 | - 'options' => ['class' => 'navbar-nav navbar-right'], |
|
134 | + 'options' => [ 'class' => 'navbar-nav navbar-right' ], |
|
135 | 135 | 'encodeLabels' => false, |
136 | 136 | 'items' => $menuItems, |
137 | 137 | ] |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | $languages = explode(',', getenv('APP_LANGUAGES')); |
14 | 14 | |
15 | 15 | // prepare asset bundle config |
16 | -$bundles = []; |
|
16 | +$bundles = [ ]; |
|
17 | 17 | if (getenv('APP_ASSET_USE_BUNDLED')) { |
18 | 18 | $bundles = include Yii::getAlias('@web/bundles').'/config.php'; |
19 | 19 | } |
20 | 20 | if (getenv('APP_ASSET_DISABLE_BOOTSTRAP_BUNDLE')) { |
21 | - $bundles['yii\bootstrap\BootstrapAsset'] = [ |
|
22 | - 'css' => [], |
|
21 | + $bundles[ 'yii\bootstrap\BootstrapAsset' ] = [ |
|
22 | + 'css' => [ ], |
|
23 | 23 | ]; |
24 | 24 | } |
25 | 25 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | return [ |
42 | 42 | 'id' => 'app', |
43 | 43 | 'name' => getenv('APP_TITLE'), |
44 | - 'language' => $languages[0], |
|
44 | + 'language' => $languages[ 0 ], |
|
45 | 45 | 'basePath' => realpath(__DIR__.'/..'), |
46 | 46 | 'vendorPath' => '@app/../vendor', |
47 | 47 | 'runtimePath' => '@app/../runtime', |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | ], |
56 | 56 | 'params' => [ |
57 | 57 | 'adminEmail' => getenv('APP_ADMIN_EMAIL'), |
58 | - 'context.menuItems' => [], |
|
58 | + 'context.menuItems' => [ ], |
|
59 | 59 | 'yii.migrations' => [ |
60 | 60 | getenv('APP_MIGRATION_LOOKUP'), |
61 | 61 | '@yii/rbac/migrations', |
@@ -73,8 +73,7 @@ discard block |
||
73 | 73 | 'dirMode' => 0775, |
74 | 74 | // Hashing for distributed systems |
75 | 75 | 'hashCallback' => YII_ENV_DEV ? |
76 | - null : |
|
77 | - function ($path) { |
|
76 | + null : function($path) { |
|
78 | 77 | return YII_ENV.'-'.substr(hash('sha256', $path), 0, 8).'-'.APP_VERSION.'-'.\Yii::$app->cache->get('prototype.less.changed_at'); |
79 | 78 | }, |
80 | 79 | // Note: You need to bundle asset with `yii asset` for development/debugging |
@@ -83,7 +82,7 @@ discard block |
||
83 | 82 | ], |
84 | 83 | 'authManager' => [ |
85 | 84 | 'class' => 'dektrium\rbac\components\DbManager', |
86 | - 'defaultRoles' => ['Default'], |
|
85 | + 'defaultRoles' => [ 'Default' ], |
|
87 | 86 | ], |
88 | 87 | 'cache' => [ |
89 | 88 | 'class' => 'yii\redis\Cache', |
@@ -127,8 +126,8 @@ discard block |
||
127 | 126 | [ |
128 | 127 | 'class' => 'codemix\streamlog\Target', |
129 | 128 | 'url' => 'php://stderr', |
130 | - 'levels' => ['error', 'warning'], |
|
131 | - 'logVars' => [], |
|
129 | + 'levels' => [ 'error', 'warning' ], |
|
130 | + 'logVars' => [ ], |
|
132 | 131 | 'replaceNewline' => '' |
133 | 132 | ], |
134 | 133 | ], |
@@ -158,9 +157,9 @@ discard block |
||
158 | 157 | 'user' => [ |
159 | 158 | 'class' => 'dmstr\web\User', |
160 | 159 | 'enableAutoLogin' => true, |
161 | - 'loginUrl' => ['/user/security/login'], |
|
160 | + 'loginUrl' => [ '/user/security/login' ], |
|
162 | 161 | 'identityClass' => 'dektrium\user\models\User', |
163 | - 'rootUsers' => ['admin'], |
|
162 | + 'rootUsers' => [ 'admin' ], |
|
164 | 163 | ], |
165 | 164 | 'urlManager' => [ |
166 | 165 | 'class' => 'codemix\localeurls\UrlManager', |
@@ -168,7 +167,7 @@ discard block |
||
168 | 167 | 'showScriptName' => false, |
169 | 168 | 'enableDefaultLanguageUrlCode' => true, |
170 | 169 | 'baseUrl' => '/', |
171 | - 'rules' => [], |
|
170 | + 'rules' => [ ], |
|
172 | 171 | 'ignoreLanguageUrlPatterns' => [ |
173 | 172 | // route pattern => url pattern |
174 | 173 | '#^filefly/api#' => '#^filefly/api#', |
@@ -185,10 +184,10 @@ discard block |
||
185 | 184 | 'auto_reload' => true, |
186 | 185 | ], |
187 | 186 | 'globals' => [ |
188 | - 'html' => ['class'=>'\yii\helpers\Html'], |
|
189 | - 'Tree' => ['class'=>'\dmstr\modules\pages\models\Tree'], |
|
190 | - 'FA' => ['class'=>'\rmrevin\yii\fontawesome\FA'], |
|
191 | - 'Url' => ['class'=>'\hrzg\filemanager\helpers\Url'], |
|
187 | + 'html' => [ 'class'=>'\yii\helpers\Html' ], |
|
188 | + 'Tree' => [ 'class'=>'\dmstr\modules\pages\models\Tree' ], |
|
189 | + 'FA' => [ 'class'=>'\rmrevin\yii\fontawesome\FA' ], |
|
190 | + 'Url' => [ 'class'=>'\hrzg\filemanager\helpers\Url' ], |
|
192 | 191 | ], |
193 | 192 | 'uses' => [ |
194 | 193 | 'yii\bootstrap', |
@@ -209,15 +208,15 @@ discard block |
||
209 | 208 | 'audit/trail', |
210 | 209 | 'audit/javascript', # enable app.assets.registerJSLoggingAsset via settings |
211 | 210 | // These provide special functionality and get loaded to activate it |
212 | - 'audit/error', // Links the extra error reporting functions (`exception()` and `errorMessage()`) |
|
213 | - 'audit/extra', // Links the data functions (`data()`) |
|
214 | - 'audit/curl', // Links the curl tracking function (`curlBegin()`, `curlEnd()` and `curlExec()`) |
|
211 | + 'audit/error', // Links the extra error reporting functions (`exception()` and `errorMessage()`) |
|
212 | + 'audit/extra', // Links the data functions (`data()`) |
|
213 | + 'audit/curl', // Links the curl tracking function (`curlBegin()`, `curlEnd()` and `curlExec()`) |
|
215 | 214 | //'audit/db', |
216 | 215 | //'audit/log', |
217 | 216 | //'audit/profiling', |
218 | 217 | ], |
219 | 218 | 'ignoreActions' => [ |
220 | - (getenv('APP_AUDIT_DISABLE_ALL_ACTIONS') ? '*':'_'), |
|
219 | + (getenv('APP_AUDIT_DISABLE_ALL_ACTIONS') ? '*' : '_'), |
|
221 | 220 | 'app/*', |
222 | 221 | 'audit/*', |
223 | 222 | 'help/*', |
@@ -268,8 +267,8 @@ discard block |
||
268 | 267 | 'class' => 'lajax\translatemanager\Module', |
269 | 268 | 'root' => '@app/views', |
270 | 269 | 'layout' => '@backend/views/layouts/box', |
271 | - 'allowedIPs' => ['*'], |
|
272 | - 'roles' => ['translate-module'], |
|
270 | + 'allowedIPs' => [ '*' ], |
|
271 | + 'roles' => [ 'translate-module' ], |
|
273 | 272 | ], |
274 | 273 | 'user' => [ |
275 | 274 | 'class' => 'dektrium\user\Module', |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | // SEO |
53 | 53 | $route = Url::toRoute(Yii::$app->controller->action->uniqueId); |
54 | 54 | if ($keywords = \Yii::$app->settings->get($route, 'app.seo.keywords', null)) { |
55 | - $this->registerMetaTag(['name' => 'keywords', 'content' => $keywords]); |
|
55 | + $this->registerMetaTag([ 'name' => 'keywords', 'content' => $keywords ]); |
|
56 | 56 | } |
57 | 57 | if ($description = \Yii::$app->settings->get($route, 'app.seo.descriptions', null)) { |
58 | - $this->registerMetaTag(['name' => 'description', 'content' => $description]); |
|
58 | + $this->registerMetaTag([ 'name' => 'description', 'content' => $description ]); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | if ($favicon = \Yii::$app->settings->get('faviconPng', 'app.assets', null)) { |
62 | - $this->registerLinkTag(['rel' => 'shortcut icon', 'type'=>'image/png', 'href' => $favicon]); |
|
62 | + $this->registerLinkTag([ 'rel' => 'shortcut icon', 'type'=>'image/png', 'href' => $favicon ]); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | ?> |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | |
81 | 81 | <?php $this->beginBody() ?> |
82 | 82 | |
83 | -<?= TwigWidget::widget(['key' => '_top', 'renderEmpty'=>false]) ?> |
|
83 | +<?= TwigWidget::widget([ 'key' => '_top', 'renderEmpty'=>false ]) ?> |
|
84 | 84 | |
85 | 85 | <!-- Navbar --> |
86 | 86 | <?php |
87 | 87 | if (Yii::$app->settings->get('enableTwigNavbar', 'app.layout', false)) { |
88 | - echo \dmstr\modules\prototype\widgets\TwigWidget::widget(['key' => '_navbar']); |
|
88 | + echo \dmstr\modules\prototype\widgets\TwigWidget::widget([ 'key' => '_navbar' ]); |
|
89 | 89 | } else { |
90 | 90 | echo $this->render('_navbar'); |
91 | 91 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | <!-- Footer --> |
111 | 111 | <footer class="footer"> |
112 | - <?= Cell::widget(['id' => '_footer', 'requestParam' => '_global']) ?> |
|
112 | + <?= Cell::widget([ 'id' => '_footer', 'requestParam' => '_global' ]) ?> |
|
113 | 113 | </footer> |
114 | 114 | |
115 | 115 | <!-- Info Modal --> |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | <?= Html::a( |
119 | 119 | '<i class="fa fa-heartbeat"></i>', |
120 | 120 | '#', |
121 | - ['class' => 'text-muted', 'data-toggle' => 'modal', 'data-target' => '#infoModal'] |
|
121 | + [ 'class' => 'text-muted', 'data-toggle' => 'modal', 'data-target' => '#infoModal' ] |
|
122 | 122 | ) ?> |
123 | 123 | </p> |
124 | 124 | </div> |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | public function actionConfig($key = null) |
28 | 28 | { |
29 | 29 | // get config from global variable (TODO) |
30 | - $data = $GLOBALS['config']; |
|
30 | + $data = $GLOBALS[ 'config' ]; |
|
31 | 31 | if ($key) { |
32 | 32 | $keys = explode('.', $key); |
33 | - if (isset($keys[0])) { |
|
34 | - $data = $GLOBALS['config'][$keys[0]]; |
|
33 | + if (isset($keys[ 0 ])) { |
|
34 | + $data = $GLOBALS[ 'config' ][ $keys[ 0 ] ]; |
|
35 | 35 | } |
36 | - if (isset($keys[1])) { |
|
37 | - $data = $GLOBALS['config'][$keys[0]][$keys[1]]; |
|
36 | + if (isset($keys[ 1 ])) { |
|
37 | + $data = $GLOBALS[ 'config' ][ $keys[ 0 ] ][ $keys[ 1 ] ]; |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | $this->stdout(VarDumper::dumpAsString($data)); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $this->stdout("\nDatabase\n"); |
77 | 77 | $this->stdout("--------\n"); |
78 | 78 | $this->run('db/create'); |
79 | - $this->run('migrate/up', ['interactive' => (bool) getenv('APP_INTERACTIVE')]); |
|
79 | + $this->run('migrate/up', [ 'interactive' => (bool) getenv('APP_INTERACTIVE') ]); |
|
80 | 80 | |
81 | 81 | $this->stdout("\nUser\n"); |
82 | 82 | $this->stdout("----\n"); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | 'default' => getenv('APP_ADMIN_PASSWORD') ?: \Yii::$app->security->generateRandomString(8), |
87 | 87 | ] |
88 | 88 | ); |
89 | - $this->run('user/create', [getenv('APP_ADMIN_EMAIL'), 'admin', $adminPassword]); |
|
89 | + $this->run('user/create', [ getenv('APP_ADMIN_EMAIL'), 'admin', $adminPassword ]); |
|
90 | 90 | |
91 | 91 | $this->stdout("\n\nDone.\n"); |
92 | 92 | } |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | /** |
95 | 95 | * Clean cache, assets and audit tables |
96 | 96 | */ |
97 | - public function actionCleanup(){ |
|
97 | + public function actionCleanup() { |
|
98 | 98 | $this->stdout("\nCleanup\n"); |
99 | 99 | $this->stdout("-------\n"); |
100 | 100 | $this->run('cache/flush-all'); |
101 | - $this->run('audit/cleanup', ['age' => 30, 'interactive' => (bool) getenv('APP_INTERACTIVE')]); |
|
102 | - $this->run('app/clear-assets', ['interactive' => (bool) getenv('APP_INTERACTIVE')]); |
|
101 | + $this->run('audit/cleanup', [ 'age' => 30, 'interactive' => (bool) getenv('APP_INTERACTIVE') ]); |
|
102 | + $this->run('app/clear-assets', [ 'interactive' => (bool) getenv('APP_INTERACTIVE') ]); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $command = new Command($cmd); |
120 | 120 | |
121 | 121 | // Prompt user |
122 | - $delete = $this->confirm("\nDo you really want to delete web assets?", ['default' => true]); |
|
122 | + $delete = $this->confirm("\nDo you really want to delete web assets?", [ 'default' => true ]); |
|
123 | 123 | |
124 | 124 | if ($delete) { |
125 | 125 | // Try to execute $command |