@@ -16,10 +16,10 @@ discard block |
||
16 | 16 | $languages = explode(',', getenv('APP_LANGUAGES')); |
17 | 17 | |
18 | 18 | // prepare asset bundle config |
19 | -$bundles = []; |
|
19 | +$bundles = [ ]; |
|
20 | 20 | if (getenv('APP_ASSET_USE_BUNDLED')) { |
21 | 21 | // include generated asset-bundle configuration |
22 | - $bundles = include Yii::getAlias('@web/bundles') . '/config.php'; |
|
22 | + $bundles = include Yii::getAlias('@web/bundles').'/config.php'; |
|
23 | 23 | // disable loading of bundles skin file, when using bundled assets |
24 | 24 | Yii::$container->set( |
25 | 25 | AdminLteAsset::className(), |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | return [ |
62 | 62 | 'id' => 'app', |
63 | 63 | 'name' => getenv('APP_TITLE'), |
64 | - 'language' => $languages[0], |
|
64 | + 'language' => $languages[ 0 ], |
|
65 | 65 | 'basePath' => dirname(__DIR__), |
66 | 66 | 'vendorPath' => '@app/../vendor', |
67 | 67 | 'runtimePath' => '@app/../runtime', |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | ], |
80 | 80 | 'params' => [ |
81 | 81 | 'adminEmail' => getenv('APP_ADMIN_EMAIL'), |
82 | - 'context.menuItems' => [], |
|
83 | - 'backend.iframe.name' => 'backend-' . getenv('HOSTNAME'), |
|
82 | + 'context.menuItems' => [ ], |
|
83 | + 'backend.iframe.name' => 'backend-'.getenv('HOSTNAME'), |
|
84 | 84 | ], |
85 | 85 | 'components' => [ |
86 | 86 | 'assetManager' => [ |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | ], |
93 | 93 | 'authManager' => [ |
94 | 94 | 'class' => \yii\rbac\DbManager::class, |
95 | - 'defaultRoles' => ['Default'], |
|
95 | + 'defaultRoles' => [ 'Default' ], |
|
96 | 96 | ], |
97 | 97 | 'cache' => getenv('APP_NO_CACHE') ? null : [ |
98 | 98 | 'class' => \yii\redis\Cache::class, |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | 'key' => getenv('AMAZON_S3_BUCKET_PUBLIC_KEY'), |
116 | 116 | 'secret' => getenv('AMAZON_S3_BUCKET_SECRET_KEY'), |
117 | 117 | 'bucket' => getenv('AMAZON_S3_BUCKET_NAME'), |
118 | - 'prefix' => getenv('APP_NAME') . '/public', |
|
118 | + 'prefix' => getenv('APP_NAME').'/public', |
|
119 | 119 | 'region' => getenv('AMAZON_S3_BUCKET_REGION'), |
120 | 120 | ], |
121 | 121 | 'fsRuntime' => [ |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | 'common' => [ |
141 | 141 | 'class' => \codemix\streamlog\Target::class, |
142 | 142 | 'url' => 'php://stderr', |
143 | - 'levels' => ['error', 'warning'], |
|
144 | - 'logVars' => [], |
|
143 | + 'levels' => [ 'error', 'warning' ], |
|
144 | + 'logVars' => [ ], |
|
145 | 145 | 'replaceNewline' => (APP_TYPE == 'console') ? null : '', |
146 | 146 | ], |
147 | 147 | ], |
@@ -176,9 +176,9 @@ discard block |
||
176 | 176 | 'user' => [ |
177 | 177 | 'class' => \dmstr\web\User::class, |
178 | 178 | 'enableAutoLogin' => true, |
179 | - 'loginUrl' => ['/user/security/login'], |
|
179 | + 'loginUrl' => [ '/user/security/login' ], |
|
180 | 180 | 'identityClass' => Da\User\Model\User::class, |
181 | - 'rootUsers' => ['admin'], |
|
181 | + 'rootUsers' => [ 'admin' ], |
|
182 | 182 | ], |
183 | 183 | 'urlManager' => [ |
184 | 184 | 'class' => \codemix\localeurls\UrlManager::class, |
@@ -209,24 +209,24 @@ discard block |
||
209 | 209 | 'auto_reload' => true, |
210 | 210 | ], |
211 | 211 | 'globals' => [ |
212 | - 'Html' => ['class' => \yii\helpers\Html::class], |
|
213 | - 'Json' => ['class' => \yii\helpers\Json::class], |
|
214 | - 'Tree' => ['class' => \dmstr\modules\pages\models\Tree::class], |
|
215 | - 'FA' => ['class' => \rmrevin\yii\fontawesome\FA::class], |
|
216 | - 'FileUrl' => ['class' => \hrzg\filemanager\helpers\Url::class], |
|
217 | - 'Url' => ['class' => \yii\helpers\Url::class], |
|
212 | + 'Html' => [ 'class' => \yii\helpers\Html::class ], |
|
213 | + 'Json' => [ 'class' => \yii\helpers\Json::class ], |
|
214 | + 'Tree' => [ 'class' => \dmstr\modules\pages\models\Tree::class ], |
|
215 | + 'FA' => [ 'class' => \rmrevin\yii\fontawesome\FA::class ], |
|
216 | + 'FileUrl' => [ 'class' => \hrzg\filemanager\helpers\Url::class ], |
|
217 | + 'Url' => [ 'class' => \yii\helpers\Url::class ], |
|
218 | 218 | ], |
219 | 219 | 'functions' => [ |
220 | - 'image' => function ($imageSource, $preset = null) { |
|
220 | + 'image' => function($imageSource, $preset = null) { |
|
221 | 221 | // preset example, when using imageproxy, https://github.com/willnorris/imageproxy#examples |
222 | 222 | if (getenv('IMAGEPROXY_SIGNATURE_KEY')) { |
223 | 223 | $key = getenv('IMAGEPROXY_SIGNATURE_KEY'); |
224 | - $preset .= ',s' . strtr(base64_encode(hash_hmac('sha256', $imageSource, $key, 1)), '/+', '_-'); |
|
224 | + $preset .= ',s'.strtr(base64_encode(hash_hmac('sha256', $imageSource, $key, 1)), '/+', '_-'); |
|
225 | 225 | } |
226 | - return Yii::$app->settings->get('imgBaseUrl', 'app.frontend') . |
|
227 | - $preset . |
|
228 | - Yii::$app->settings->get('imgHostPrefix', 'app.frontend') . |
|
229 | - $imageSource . |
|
226 | + return Yii::$app->settings->get('imgBaseUrl', 'app.frontend'). |
|
227 | + $preset. |
|
228 | + Yii::$app->settings->get('imgHostPrefix', 'app.frontend'). |
|
229 | + $imageSource. |
|
230 | 230 | Yii::$app->settings->get('imgHostSuffix', 'app.frontend'); |
231 | 231 | }, |
232 | 232 | ], |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | 'modules' => [ |
241 | 241 | 'audit' => [ |
242 | 242 | 'class' => \bedezign\yii2\audit\Audit::class, |
243 | - 'accessRoles' => ['audit-module'], |
|
243 | + 'accessRoles' => [ 'audit-module' ], |
|
244 | 244 | 'layout' => $boxLayout, |
245 | 245 | 'panels' => [ |
246 | 246 | 'audit/request', |
@@ -248,9 +248,9 @@ discard block |
||
248 | 248 | 'audit/trail', |
249 | 249 | 'audit/javascript', # enable app.assets.registerJSLoggingAsset via settings |
250 | 250 | // These provide special functionality and get loaded to activate it |
251 | - 'audit/error', // Links the extra error reporting functions (`exception()` and `errorMessage()`) |
|
252 | - 'audit/extra', // Links the data functions (`data()`) |
|
253 | - 'audit/curl', // Links the curl tracking function (`curlBegin()`, `curlEnd()` and `curlExec()`) |
|
251 | + 'audit/error', // Links the extra error reporting functions (`exception()` and `errorMessage()`) |
|
252 | + 'audit/extra', // Links the data functions (`data()`) |
|
253 | + 'audit/curl', // Links the curl tracking function (`curlBegin()`, `curlEnd()` and `curlExec()`) |
|
254 | 254 | //'audit/db', |
255 | 255 | //'audit/log', |
256 | 256 | //'audit/profiling', |
@@ -322,14 +322,14 @@ discard block |
||
322 | 322 | 'class' => \lajax\translatemanager\Module::class, |
323 | 323 | 'root' => '@app/views', |
324 | 324 | 'layout' => $boxLayout, |
325 | - 'allowedIPs' => ['*'], |
|
326 | - 'roles' => ['translate-module'], |
|
325 | + 'allowedIPs' => [ '*' ], |
|
326 | + 'roles' => [ 'translate-module' ], |
|
327 | 327 | ], |
328 | 328 | 'user' => [ |
329 | 329 | 'class' => Da\User\Module::class, |
330 | 330 | 'layout' => '@app/views/layouts/container', |
331 | 331 | 'defaultRoute' => 'admin', |
332 | - 'administrators' => ['admin'], |
|
332 | + 'administrators' => [ 'admin' ], |
|
333 | 333 | 'enableFlashMessages' => false, |
334 | 334 | 'enableRegistration' => getenv('APP_USER_ENABLE_REGISTRATION'), |
335 | 335 | ], |
@@ -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)); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | public function actionVersion() |
57 | 57 | { |
58 | 58 | $this->stdout('Application Version: '); |
59 | - $this->stdout(getenv('APP_NAME') . ' '); |
|
59 | + $this->stdout(getenv('APP_NAME').' '); |
|
60 | 60 | $this->stdout(APP_VERSION); |
61 | 61 | echo "\n"; |
62 | 62 | } |
@@ -71,12 +71,12 @@ discard block |
||
71 | 71 | $this->stdout("=====================\n"); |
72 | 72 | $this->stdout("Initializing application\n"); |
73 | 73 | |
74 | - $this->interactive = (bool)getenv('APP_INTERACTIVE'); |
|
74 | + $this->interactive = (bool) getenv('APP_INTERACTIVE'); |
|
75 | 75 | |
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 | } |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | $this->stdout("\nCleanup\n"); |
100 | 100 | $this->stdout("-------\n"); |
101 | 101 | $this->run('cache/flush-all'); |
102 | - $this->run('audit/cleanup', ['age' => 30, 'interactive' => (bool)getenv('APP_INTERACTIVE')]); |
|
103 | - $this->run('app/clear-assets', ['interactive' => (bool)getenv('APP_INTERACTIVE')]); |
|
102 | + $this->run('audit/cleanup', [ 'age' => 30, 'interactive' => (bool) getenv('APP_INTERACTIVE') ]); |
|
103 | + $this->run('app/clear-assets', [ 'interactive' => (bool) getenv('APP_INTERACTIVE') ]); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -114,20 +114,20 @@ discard block |
||
114 | 114 | $matchRegex = '"^[a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9]\?[a-z0-9]$"'; |
115 | 115 | |
116 | 116 | // create $cmd command |
117 | - $cmd = 'cd "' . $assets . '" && ls | grep -e ' . $matchRegex . ' | xargs rm -rf '; |
|
117 | + $cmd = 'cd "'.$assets.'" && ls | grep -e '.$matchRegex.' | xargs rm -rf '; |
|
118 | 118 | |
119 | 119 | // Set command |
120 | 120 | $command = new Command($cmd); |
121 | 121 | |
122 | 122 | // Prompt user |
123 | - $delete = $this->confirm("\nDo you really want to delete web assets?", ['default' => true]); |
|
123 | + $delete = $this->confirm("\nDo you really want to delete web assets?", [ 'default' => true ]); |
|
124 | 124 | |
125 | 125 | if ($delete) { |
126 | 126 | // Try to execute $command |
127 | 127 | if ($command->execute()) { |
128 | 128 | echo "Web assets have been deleted.\n\n"; |
129 | 129 | } else { |
130 | - echo "\n" . $command->getError() . "\n"; |
|
130 | + echo "\n".$command->getError()."\n"; |
|
131 | 131 | echo $command->getStdErr(); |
132 | 132 | } |
133 | 133 | } |