@@ -11,16 +11,16 @@ discard block |
||
11 | 11 | |
12 | 12 | use yii\helpers\FileHelper; |
13 | 13 | |
14 | -$srcPath = __DIR__ . '/..'; |
|
14 | +$srcPath = __DIR__.'/..'; |
|
15 | 15 | |
16 | 16 | // Load default settings via dotenv from file, load local environment first, if available |
17 | 17 | if (getenv('ENV_LOCAL_FILE')) { |
18 | - $localEnv = FileHelper::normalizePath($srcPath . '/' . getenv('ENV_LOCAL_FILE')); |
|
18 | + $localEnv = FileHelper::normalizePath($srcPath.'/'.getenv('ENV_LOCAL_FILE')); |
|
19 | 19 | if (is_file($localEnv)) { |
20 | 20 | $dotenvLocal = new Dotenv\Dotenv($srcPath, getenv('ENV_LOCAL_FILE')); |
21 | 21 | $dotenvLocal->load(); |
22 | 22 | } else { |
23 | - exit("Error: ENV_LOCAL_FILE '{$localEnv}' not found" . PHP_EOL); |
|
23 | + exit("Error: ENV_LOCAL_FILE '{$localEnv}' not found".PHP_EOL); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | $dotenv->load(); |
30 | 30 | |
31 | 31 | // Basic checks & validation |
32 | -$dotenv->required('YII_DEBUG', ['', '0', '1', 'true', true]); |
|
33 | -$dotenv->required('YII_ENV', ['dev', 'prod', 'test']); |
|
32 | +$dotenv->required('YII_DEBUG', [ '', '0', '1', 'true', true ]); |
|
33 | +$dotenv->required('YII_ENV', [ 'dev', 'prod', 'test' ]); |
|
34 | 34 | $dotenv->required([ |
35 | 35 | 'YII_TRACE_LEVEL', |
36 | 36 | 'APP_NAME', |
@@ -13,7 +13,7 @@ |
||
13 | 13 | public function safeUp() |
14 | 14 | { |
15 | 15 | $table = $this->db->schema->getTableSchema('{{%migration}}'); |
16 | - if (isset($table->columns['alias'])) { |
|
16 | + if (isset($table->columns[ 'alias' ])) { |
|
17 | 17 | // Column exists |
18 | 18 | $this->alterColumn('{{%migration}}', 'alias', 'varchar(180) DEFAULT NULL'); |
19 | 19 | } |
@@ -19,22 +19,22 @@ discard block |
||
19 | 19 | 'db' => [ |
20 | 20 | 'class' => \dmstr\console\controllers\MysqlController::class, |
21 | 21 | 'noDataTables' => [ |
22 | - getenv('DATABASE_TABLE_PREFIX') . 'auth_assignment', |
|
23 | - getenv('DATABASE_TABLE_PREFIX') . 'migration', |
|
24 | - getenv('DATABASE_TABLE_PREFIX') . 'user', |
|
25 | - getenv('DATABASE_TABLE_PREFIX') . 'profile', |
|
26 | - getenv('DATABASE_TABLE_PREFIX') . 'token', |
|
27 | - getenv('DATABASE_TABLE_PREFIX') . 'social_account', |
|
28 | - getenv('DATABASE_TABLE_PREFIX') . 'log', |
|
29 | - getenv('DATABASE_TABLE_PREFIX') . 'session', |
|
30 | - getenv('DATABASE_TABLE_PREFIX') . 'audit_data', |
|
31 | - getenv('DATABASE_TABLE_PREFIX') . 'audit_entry', |
|
32 | - getenv('DATABASE_TABLE_PREFIX') . 'audit_error', |
|
33 | - getenv('DATABASE_TABLE_PREFIX') . 'audit_javascript', |
|
34 | - getenv('DATABASE_TABLE_PREFIX') . 'audit_mail', |
|
35 | - getenv('DATABASE_TABLE_PREFIX') . 'audit_trail', |
|
36 | - getenv('DATABASE_TABLE_PREFIX') . 'dmstr_contact_log', |
|
37 | - getenv('DATABASE_TABLE_PREFIX') . 'queue_manager', |
|
22 | + getenv('DATABASE_TABLE_PREFIX').'auth_assignment', |
|
23 | + getenv('DATABASE_TABLE_PREFIX').'migration', |
|
24 | + getenv('DATABASE_TABLE_PREFIX').'user', |
|
25 | + getenv('DATABASE_TABLE_PREFIX').'profile', |
|
26 | + getenv('DATABASE_TABLE_PREFIX').'token', |
|
27 | + getenv('DATABASE_TABLE_PREFIX').'social_account', |
|
28 | + getenv('DATABASE_TABLE_PREFIX').'log', |
|
29 | + getenv('DATABASE_TABLE_PREFIX').'session', |
|
30 | + getenv('DATABASE_TABLE_PREFIX').'audit_data', |
|
31 | + getenv('DATABASE_TABLE_PREFIX').'audit_entry', |
|
32 | + getenv('DATABASE_TABLE_PREFIX').'audit_error', |
|
33 | + getenv('DATABASE_TABLE_PREFIX').'audit_javascript', |
|
34 | + getenv('DATABASE_TABLE_PREFIX').'audit_mail', |
|
35 | + getenv('DATABASE_TABLE_PREFIX').'audit_trail', |
|
36 | + getenv('DATABASE_TABLE_PREFIX').'dmstr_contact_log', |
|
37 | + getenv('DATABASE_TABLE_PREFIX').'queue_manager', |
|
38 | 38 | 'filefly_hashmap', # TODO: fix prefix in module |
39 | 39 | ], |
40 | 40 | ], |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | 'class' => \yii\log\FileTarget::class, |
77 | 77 | 'logFile' => '@runtime/logs/console.log', |
78 | 78 | //'levels' => ['info', 'trace'], |
79 | - 'logVars' => [], |
|
79 | + 'logVars' => [ ], |
|
80 | 80 | 'dirMode' => YII_ENV_DEV ? 0777 : 0775, |
81 | 81 | 'fileMode' => YII_ENV_DEV ? 0666 : null, |
82 | 82 | 'enabled' => YII_DEBUG && !YII_ENV_TEST, |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | \yii\base\Event::on( |
33 | 33 | \yii\web\View::className(), |
34 | 34 | \yii\web\View::EVENT_AFTER_RENDER, |
35 | - function ($e) { |
|
35 | + function($e) { |
|
36 | 36 | // disable unbundled asset |
37 | - $e->sender->assetBundles['yii\\bootstrap\\BootstrapAsset'] = null; |
|
37 | + $e->sender->assetBundles[ 'yii\\bootstrap\\BootstrapAsset' ] = null; |
|
38 | 38 | // disable bundled asset |
39 | - $e->sender->assetBundles['bootstrap'] = null; |
|
39 | + $e->sender->assetBundles[ 'bootstrap' ] = null; |
|
40 | 40 | } |
41 | 41 | ); |
42 | 42 | } |
@@ -44,16 +44,16 @@ discard block |
||
44 | 44 | // SEO |
45 | 45 | $route = Url::toRoute(Yii::$app->controller->action->uniqueId); |
46 | 46 | if ($keywords = \Yii::$app->settings->get($route, 'app.seo.keywords', null)) { |
47 | - $this->registerMetaTag(['name' => 'keywords', 'content' => $keywords]); |
|
47 | + $this->registerMetaTag([ 'name' => 'keywords', 'content' => $keywords ]); |
|
48 | 48 | } |
49 | 49 | if ($description = \Yii::$app->settings->get($route, 'app.seo.descriptions', null)) { |
50 | - $this->registerMetaTag(['name' => 'description', 'content' => $description]); |
|
50 | + $this->registerMetaTag([ 'name' => 'description', 'content' => $description ]); |
|
51 | 51 | } |
52 | 52 | if ($title = \Yii::$app->settings->get($route, 'app.seo.titles', null)) { |
53 | 53 | $this->title = $title; |
54 | 54 | } |
55 | 55 | if ($favicon = \Yii::$app->settings->get('faviconPng', 'app.assets', null)) { |
56 | - $this->registerLinkTag(['rel' => 'shortcut icon', 'type' => 'image/png', 'href' => $favicon]); |
|
56 | + $this->registerLinkTag([ 'rel' => 'shortcut icon', 'type' => 'image/png', 'href' => $favicon ]); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | ?> |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | 'linkSelector' => '.frontend-reload', |
81 | 81 | ]) ?> |
82 | 82 | |
83 | -<?= TwigWidget::widget(['key' => '_beginBody', 'renderEmpty' => false]) ?> |
|
83 | +<?= TwigWidget::widget([ 'key' => '_beginBody', '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 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | <!-- Footer --> |
103 | 103 | <footer class="footer"> |
104 | - <?= Cell::widget(['id' => '_footer', 'requestParam' => '_global']) ?> |
|
104 | + <?= Cell::widget([ 'id' => '_footer', 'requestParam' => '_global' ]) ?> |
|
105 | 105 | </footer> |
106 | 106 | |
107 | 107 | <?php Pjax::end() ?> |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | ], |
117 | 117 | ]) ?> |
118 | 118 | |
119 | -<?= TwigWidget::widget(['key' => '_endBody', 'renderEmpty' => false]) ?> |
|
119 | +<?= TwigWidget::widget([ 'key' => '_endBody', 'renderEmpty' => false ]) ?> |
|
120 | 120 | |
121 | 121 | <?php if (Yii::$app->user->can('backend_default_index') && Yii::$app->settings->get('backendWidget', 'frontend') === 'toolbar'): ?> |
122 | 122 | <?= Toolbar::widget([ |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | public function actionConfig($key = null) |
30 | 30 | { |
31 | 31 | // get config from global variable (TODO) |
32 | - $data = $GLOBALS['config']; |
|
32 | + $data = $GLOBALS[ 'config' ]; |
|
33 | 33 | if ($key) { |
34 | 34 | $keys = explode('.', $key); |
35 | - if (isset($keys[0])) { |
|
36 | - $data = $GLOBALS['config'][$keys[0]]; |
|
35 | + if (isset($keys[ 0 ])) { |
|
36 | + $data = $GLOBALS[ 'config' ][ $keys[ 0 ] ]; |
|
37 | 37 | } |
38 | - if (isset($keys[1])) { |
|
39 | - $data = $GLOBALS['config'][$keys[0]][$keys[1]]; |
|
38 | + if (isset($keys[ 1 ])) { |
|
39 | + $data = $GLOBALS[ 'config' ][ $keys[ 0 ] ][ $keys[ 1 ] ]; |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | $this->stdout(VarDumper::dumpAsString($data)); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | public function actionVersion() |
59 | 59 | { |
60 | 60 | $this->stdout('Application Version: '); |
61 | - $this->stdout(getenv('APP_NAME') . ' '); |
|
61 | + $this->stdout(getenv('APP_NAME').' '); |
|
62 | 62 | $this->stdout(APP_VERSION); |
63 | 63 | echo "\n"; |
64 | 64 | } |
@@ -73,12 +73,12 @@ discard block |
||
73 | 73 | $this->stdout("=====================\n"); |
74 | 74 | $this->stdout("Initializing application\n"); |
75 | 75 | |
76 | - $this->interactive = (bool)getenv('APP_INTERACTIVE'); |
|
76 | + $this->interactive = (bool) getenv('APP_INTERACTIVE'); |
|
77 | 77 | |
78 | 78 | $this->stdout("\nDatabase\n"); |
79 | 79 | $this->stdout("--------\n"); |
80 | 80 | $this->run('db/create'); |
81 | - $this->run('migrate/up', ['interactive' => (bool)getenv('APP_INTERACTIVE')]); |
|
81 | + $this->run('migrate/up', [ 'interactive' => (bool) getenv('APP_INTERACTIVE') ]); |
|
82 | 82 | |
83 | 83 | $this->stdout("\nUser\n"); |
84 | 84 | $this->stdout("----\n"); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | 'default' => getenv('APP_ADMIN_PASSWORD') ?: \Yii::$app->security->generateRandomString(8), |
89 | 89 | ] |
90 | 90 | ); |
91 | - $this->run('user/create', [getenv('APP_ADMIN_EMAIL'), 'admin', $adminPassword]); |
|
91 | + $this->run('user/create', [ getenv('APP_ADMIN_EMAIL'), 'admin', $adminPassword ]); |
|
92 | 92 | |
93 | 93 | $this->stdout('Initializing modules'); |
94 | 94 | |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | $this->stdout("\nCleanup\n"); |
104 | 104 | $this->stdout("-------\n"); |
105 | 105 | $this->run('cache/flush-all'); |
106 | - $this->run('audit/cleanup', ['age' => 30, 'interactive' => (bool)getenv('APP_INTERACTIVE')]); |
|
107 | - $this->run('app/clear-assets', ['interactive' => (bool)getenv('APP_INTERACTIVE')]); |
|
106 | + $this->run('audit/cleanup', [ 'age' => 30, 'interactive' => (bool) getenv('APP_INTERACTIVE') ]); |
|
107 | + $this->run('app/clear-assets', [ 'interactive' => (bool) getenv('APP_INTERACTIVE') ]); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -118,20 +118,20 @@ discard block |
||
118 | 118 | $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]$"'; |
119 | 119 | |
120 | 120 | // create $cmd command |
121 | - $cmd = 'cd "' . $assets . '" && ls | grep -e ' . $matchRegex . ' | xargs rm -rf '; |
|
121 | + $cmd = 'cd "'.$assets.'" && ls | grep -e '.$matchRegex.' | xargs rm -rf '; |
|
122 | 122 | |
123 | 123 | // Set command |
124 | 124 | $command = new Command($cmd); |
125 | 125 | |
126 | 126 | // Prompt user |
127 | - $delete = $this->confirm("\nDo you really want to delete web assets?", ['default' => true]); |
|
127 | + $delete = $this->confirm("\nDo you really want to delete web assets?", [ 'default' => true ]); |
|
128 | 128 | |
129 | 129 | if ($delete) { |
130 | 130 | // Try to execute $command |
131 | 131 | if ($command->execute()) { |
132 | 132 | echo "Web assets have been deleted.\n\n"; |
133 | 133 | } else { |
134 | - echo "\n" . $command->getError() . "\n"; |
|
134 | + echo "\n".$command->getError()."\n"; |
|
135 | 135 | echo $command->getStdErr(); |
136 | 136 | } |
137 | 137 | } |
@@ -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,7 +79,7 @@ discard block |
||
79 | 79 | ], |
80 | 80 | 'params' => [ |
81 | 81 | 'adminEmail' => getenv('APP_ADMIN_EMAIL'), |
82 | - 'context.menuItems' => [], |
|
82 | + 'context.menuItems' => [ ], |
|
83 | 83 | 'backend.iframe.name' => getenv('APP_PARAMS_BACKEND_IFRAME_NAME') ?: '_self', |
84 | 84 | ], |
85 | 85 | 'components' => [ |
@@ -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 | 'cache' => 'cache' |
97 | 97 | ], |
98 | 98 | 'cache' => |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | 'key' => getenv('AMAZON_S3_BUCKET_PUBLIC_KEY'), |
119 | 119 | 'secret' => getenv('AMAZON_S3_BUCKET_SECRET_KEY'), |
120 | 120 | 'bucket' => getenv('AMAZON_S3_BUCKET_NAME'), |
121 | - 'prefix' => getenv('APP_NAME') . '/public', |
|
121 | + 'prefix' => getenv('APP_NAME').'/public', |
|
122 | 122 | 'region' => getenv('AMAZON_S3_BUCKET_REGION'), |
123 | 123 | ], |
124 | 124 | 'fsRuntime' => [ |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | 'common' => [ |
145 | 145 | 'class' => \codemix\streamlog\Target::class, |
146 | 146 | 'url' => 'php://stderr', |
147 | - 'levels' => ['error', 'warning'], |
|
148 | - 'logVars' => [], |
|
147 | + 'levels' => [ 'error', 'warning' ], |
|
148 | + 'logVars' => [ ], |
|
149 | 149 | 'replaceNewline' => (APP_TYPE == 'console') ? null : '', |
150 | 150 | ], |
151 | 151 | ], |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | 'user' => [ |
181 | 181 | 'class' => \dmstr\web\User::class, |
182 | 182 | 'enableAutoLogin' => true, |
183 | - 'loginUrl' => ['/user/security/login'], |
|
183 | + 'loginUrl' => [ '/user/security/login' ], |
|
184 | 184 | 'identityClass' => Da\User\Model\User::class, |
185 | - 'rootUsers' => ['admin'], |
|
185 | + 'rootUsers' => [ 'admin' ], |
|
186 | 186 | ], |
187 | 187 | 'urlManager' => [ |
188 | 188 | 'class' => \codemix\localeurls\UrlManager::class, |
@@ -213,25 +213,25 @@ discard block |
||
213 | 213 | 'auto_reload' => true, |
214 | 214 | ], |
215 | 215 | 'globals' => [ |
216 | - 'Html' => ['class' => \yii\helpers\Html::class], |
|
217 | - 'Json' => ['class' => \yii\helpers\Json::class], |
|
218 | - 'Tree' => ['class' => \dmstr\modules\pages\models\Tree::class], |
|
219 | - 'FA' => ['class' => \rmrevin\yii\fontawesome\FA::class], |
|
220 | - 'FileUrl' => ['class' => \hrzg\filemanager\helpers\Url::class], |
|
221 | - 'Url' => ['class' => \yii\helpers\Url::class], |
|
222 | - 'Markdown' => ['class' => \yii\helpers\Markdown::class], |
|
216 | + 'Html' => [ 'class' => \yii\helpers\Html::class ], |
|
217 | + 'Json' => [ 'class' => \yii\helpers\Json::class ], |
|
218 | + 'Tree' => [ 'class' => \dmstr\modules\pages\models\Tree::class ], |
|
219 | + 'FA' => [ 'class' => \rmrevin\yii\fontawesome\FA::class ], |
|
220 | + 'FileUrl' => [ 'class' => \hrzg\filemanager\helpers\Url::class ], |
|
221 | + 'Url' => [ 'class' => \yii\helpers\Url::class ], |
|
222 | + 'Markdown' => [ 'class' => \yii\helpers\Markdown::class ], |
|
223 | 223 | ], |
224 | 224 | 'functions' => [ |
225 | - 'image' => function ($imageSource, $preset = null) { |
|
225 | + 'image' => function($imageSource, $preset = null) { |
|
226 | 226 | // preset example, when using imageproxy, https://github.com/willnorris/imageproxy#examples |
227 | 227 | if (getenv('IMAGEPROXY_SIGNATURE_KEY')) { |
228 | 228 | $key = getenv('IMAGEPROXY_SIGNATURE_KEY'); |
229 | - $preset .= ',s' . strtr(base64_encode(hash_hmac('sha256', $imageSource, $key, 1)), '/+', '_-'); |
|
229 | + $preset .= ',s'.strtr(base64_encode(hash_hmac('sha256', $imageSource, $key, 1)), '/+', '_-'); |
|
230 | 230 | } |
231 | - return Yii::$app->settings->get('imgBaseUrl', 'app.frontend') . |
|
232 | - $preset . |
|
233 | - Yii::$app->settings->get('imgHostPrefix', 'app.frontend') . |
|
234 | - $imageSource . |
|
231 | + return Yii::$app->settings->get('imgBaseUrl', 'app.frontend'). |
|
232 | + $preset. |
|
233 | + Yii::$app->settings->get('imgHostPrefix', 'app.frontend'). |
|
234 | + $imageSource. |
|
235 | 235 | Yii::$app->settings->get('imgHostSuffix', 'app.frontend'); |
236 | 236 | }, |
237 | 237 | ], |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | 'modules' => [ |
246 | 246 | 'audit' => [ |
247 | 247 | 'class' => \bedezign\yii2\audit\Audit::class, |
248 | - 'accessRoles' => ['audit-module'], |
|
248 | + 'accessRoles' => [ 'audit-module' ], |
|
249 | 249 | 'layout' => $boxLayout, |
250 | 250 | 'panels' => [ |
251 | 251 | 'audit/trail' => [ |
@@ -327,15 +327,15 @@ discard block |
||
327 | 327 | 'class' => \lajax\translatemanager\Module::class, |
328 | 328 | 'root' => '@app/views', |
329 | 329 | 'layout' => $boxLayout, |
330 | - 'allowedIPs' => ['*'], |
|
331 | - 'roles' => ['translate-module'], |
|
330 | + 'allowedIPs' => [ '*' ], |
|
331 | + 'roles' => [ 'translate-module' ], |
|
332 | 332 | ], |
333 | 333 | 'user' => [ |
334 | 334 | 'class' => Da\User\Module::class, |
335 | 335 | 'layout' => '@app/views/layouts/container', |
336 | 336 | 'defaultRoute' => 'admin', |
337 | 337 | 'administratorPermissionName' => 'user-module', |
338 | - 'administrators' => ['admin'], |
|
338 | + 'administrators' => [ 'admin' ], |
|
339 | 339 | 'enableFlashMessages' => false, |
340 | 340 | 'enableRegistration' => getenv('APP_USER_ENABLE_REGISTRATION'), |
341 | 341 | ], |