@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | public static function downloadRelative(string $path): string |
| 21 | 21 | { |
| 22 | - return '/img/download/' . ltrim($path, '/') . self::getSuffix(); |
|
| 22 | + return '/img/download/'.ltrim($path, '/').self::getSuffix(); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -27,6 +27,6 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public static function imageRelative(string $path): string |
| 29 | 29 | { |
| 30 | - return '/img/stream/' . ltrim($path, '/') . self::getSuffix(); |
|
| 30 | + return '/img/stream/'.ltrim($path, '/').self::getSuffix(); |
|
| 31 | 31 | } |
| 32 | 32 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | use yii\widgets\ActiveForm; |
| 20 | 20 | |
| 21 | 21 | // Disable the submit-button while submitting to prevent duplicated requests |
| 22 | -Event::on(ActiveForm::class, ActiveForm::EVENT_INIT, function () { |
|
| 22 | +Event::on(ActiveForm::class, ActiveForm::EVENT_INIT, function() { |
|
| 23 | 23 | Yii::$app->controller->view->registerJs(<<<JS |
| 24 | 24 | $(document).on('beforeSubmit', 'form', function() { |
| 25 | 25 | $(this).find('[type=submit]').attr('disabled', true).addClass('disabled'); |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | // Settings for web-application only |
| 32 | 32 | return [ |
| 33 | - 'on registerMenuItems' => function ($event) { |
|
| 33 | + 'on registerMenuItems' => function($event) { |
|
| 34 | 34 | if ($event->sender instanceof ContextMenuItemsInterface) { |
| 35 | - Yii::$app->params['context.menuItems'] = ArrayHelper::merge( |
|
| 36 | - Yii::$app->params['context.menuItems'], |
|
| 35 | + Yii::$app->params[ 'context.menuItems' ] = ArrayHelper::merge( |
|
| 36 | + Yii::$app->params[ 'context.menuItems' ], |
|
| 37 | 37 | $event->sender->getMenuItems() |
| 38 | 38 | ); |
| 39 | 39 | } |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | 'web' => [ |
| 54 | 54 | 'class' => Target::class, |
| 55 | 55 | 'url' => 'php://stdout', |
| 56 | - 'levels' => ['info', 'trace'], |
|
| 57 | - 'logVars' => [], |
|
| 56 | + 'levels' => [ 'info', 'trace' ], |
|
| 57 | + 'logVars' => [ ], |
|
| 58 | 58 | 'replaceNewline' => YII_DEBUG ? null : '', |
| 59 | 59 | 'enabled' => YII_DEBUG && !YII_ENV_TEST, |
| 60 | 60 | ], |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | 'settings' => [ |
| 78 | 78 | 'class' => SettingsModule::class, |
| 79 | 79 | 'layout' => '@backend/views/layouts/box', |
| 80 | - 'accessRoles' => ['settings-module'], |
|
| 80 | + 'accessRoles' => [ 'settings-module' ], |
|
| 81 | 81 | ], |
| 82 | 82 | ], |
| 83 | 83 | ]; |
@@ -76,10 +76,10 @@ discard block |
||
| 76 | 76 | $languages = explode(',', getenv('APP_LANGUAGES')); |
| 77 | 77 | |
| 78 | 78 | // prepare asset bundle config |
| 79 | -$bundles = []; |
|
| 79 | +$bundles = [ ]; |
|
| 80 | 80 | if (getenv('APP_ASSET_USE_BUNDLED')) { |
| 81 | 81 | // include generated asset-bundle configuration |
| 82 | - $bundles = include Yii::getAlias('@web/bundles') . '/config.php'; |
|
| 82 | + $bundles = include Yii::getAlias('@web/bundles').'/config.php'; |
|
| 83 | 83 | // disable loading of bundles skin file, when using bundled assets |
| 84 | 84 | Yii::$container->set( |
| 85 | 85 | AdminLteAsset::class, |
@@ -97,10 +97,10 @@ discard block |
||
| 97 | 97 | PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => 0 |
| 98 | 98 | ]; |
| 99 | 99 | if (getenv('MYSQL_ATTR_SSL_CA')) { |
| 100 | - $dbAttributes[PDO::MYSQL_ATTR_SSL_CA] = getenv('MYSQL_ATTR_SSL_CA'); |
|
| 100 | + $dbAttributes[ PDO::MYSQL_ATTR_SSL_CA ] = getenv('MYSQL_ATTR_SSL_CA'); |
|
| 101 | 101 | } |
| 102 | 102 | } else { |
| 103 | - $dbAttributes = []; |
|
| 103 | + $dbAttributes = [ ]; |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | // Enable S3 component, if ENVs are set (BC) |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | 'enableCaching' => !YII_ENV_DEV |
| 118 | 118 | ]; |
| 119 | 119 | |
| 120 | -$fallbackLanguage = getenv('APP_FALLBACK_LANGUAGE') ?: explode(',', getenv('APP_LANGUAGES'))[0]; |
|
| 120 | +$fallbackLanguage = getenv('APP_FALLBACK_LANGUAGE') ?: explode(',', getenv('APP_LANGUAGES'))[ 0 ]; |
|
| 121 | 121 | $timezone = getenv('APP_TIMEZONE') ?: 'Europe/Berlin'; |
| 122 | 122 | $locale = getenv('APP_LOCALE') ?: 'de-DE'; |
| 123 | 123 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $common = [ |
| 126 | 126 | 'id' => 'app', |
| 127 | 127 | 'name' => getenv('APP_TITLE'), |
| 128 | - 'language' => $languages[0], |
|
| 128 | + 'language' => $languages[ 0 ], |
|
| 129 | 129 | 'basePath' => '@app', |
| 130 | 130 | 'vendorPath' => '@root/vendor', |
| 131 | 131 | 'runtimePath' => '@root/runtime', |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | ], |
| 144 | 144 | 'params' => [ |
| 145 | 145 | 'adminEmail' => getenv('APP_ADMIN_EMAIL'), |
| 146 | - 'context.menuItems' => [], |
|
| 146 | + 'context.menuItems' => [ ], |
|
| 147 | 147 | 'backend.iframe.name' => getenv('APP_PARAMS_BACKEND_IFRAME_NAME') ?: '_self', |
| 148 | 148 | 'backend.browserSupport' => [ |
| 149 | 149 | 'Chrome' => 87, |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | 'container' => [ |
| 160 | 160 | 'definitions' => [ |
| 161 | 161 | AuthDbManagerComponent::class => [ |
| 162 | - 'defaultRoles' => ['Default'], |
|
| 162 | + 'defaultRoles' => [ 'Default' ], |
|
| 163 | 163 | 'cache' => 'cache' |
| 164 | 164 | ], |
| 165 | 165 | AdminController::class => [ |
@@ -183,23 +183,23 @@ discard block |
||
| 183 | 183 | 'rules' => [ |
| 184 | 184 | [ |
| 185 | 185 | 'allow' => true, |
| 186 | - 'actions' => ['index'], |
|
| 187 | - 'roles' => ['@'], |
|
| 186 | + 'actions' => [ 'index' ], |
|
| 187 | + 'roles' => [ '@' ], |
|
| 188 | 188 | ], |
| 189 | 189 | [ |
| 190 | 190 | 'allow' => true, |
| 191 | - 'actions' => ['show'], |
|
| 191 | + 'actions' => [ 'show' ], |
|
| 192 | 192 | // allow for all logged in users |
| 193 | 193 | #'roles' => ['@'], |
| 194 | 194 | // allow only if user has 'user' grant or requested his own profile (check by user->id) |
| 195 | - 'matchCallback' => function ($action) { |
|
| 195 | + 'matchCallback' => function($action) { |
|
| 196 | 196 | if (\Yii::$app->user->isGuest) { |
| 197 | 197 | return false; |
| 198 | 198 | } |
| 199 | 199 | if (\Yii::$app->user->can('user')) { |
| 200 | 200 | return true; |
| 201 | 201 | } |
| 202 | - if (\Yii::$app->user->id === (int)Yii::$app->request->getQueryParam('id')) { |
|
| 202 | + if (\Yii::$app->user->id === (int) Yii::$app->request->getQueryParam('id')) { |
|
| 203 | 203 | return true; |
| 204 | 204 | } |
| 205 | 205 | return false; |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | 'converter' => [ |
| 224 | 224 | 'class' => 'yii\web\AssetConverter', |
| 225 | 225 | 'commands' => [ |
| 226 | - 'less' => ['css', 'nodepkg-linuxstatic lessc {from} {to} --no-color --source-map'], |
|
| 226 | + 'less' => [ 'css', 'nodepkg-linuxstatic lessc {from} {to} --no-color --source-map' ], |
|
| 227 | 227 | ], |
| 228 | 228 | ], |
| 229 | 229 | ], |
@@ -292,8 +292,8 @@ discard block |
||
| 292 | 292 | 'common' => [ |
| 293 | 293 | 'class' => Target::class, |
| 294 | 294 | 'url' => 'php://stderr', |
| 295 | - 'levels' => ['error', 'warning'], |
|
| 296 | - 'logVars' => [], |
|
| 295 | + 'levels' => [ 'error', 'warning' ], |
|
| 296 | + 'logVars' => [ ], |
|
| 297 | 297 | 'replaceNewline' => APP_TYPE === 'console' ? null : '' |
| 298 | 298 | ] |
| 299 | 299 | ] |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | 'transport' => [ |
| 306 | 306 | 'scheme' => getenv('APP_MAILER_SCHEME') ?: 'smtp', |
| 307 | 307 | 'host' => getenv('APP_MAILER_HOST'), |
| 308 | - 'port' => (int)getenv('APP_MAILER_PORT'), |
|
| 308 | + 'port' => (int) getenv('APP_MAILER_PORT'), |
|
| 309 | 309 | 'encryption' => getenv('APP_MAILER_ENCRYPTION'), |
| 310 | 310 | 'username' => getenv('APP_MAILER_USERNAME'), |
| 311 | 311 | 'password' => getenv('APP_MAILER_PASSWORD') |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | 'charset' => 'UTF-8', |
| 315 | 315 | 'replyTo' => getenv('APP_MAILER_REPLY_TO'), |
| 316 | 316 | 'returnPath' => getenv('APP_MAILER_RETURN_PATH'), |
| 317 | - 'from' => [getenv('APP_MAILER_FROM') => getenv('APP_TITLE')] |
|
| 317 | + 'from' => [ getenv('APP_MAILER_FROM') => getenv('APP_TITLE') ] |
|
| 318 | 318 | ] |
| 319 | 319 | ], |
| 320 | 320 | 'queue' => [ |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | 'channel' => getenv('APP_QUEUE_CHANNEL'), |
| 323 | 323 | 'mutex' => 'queueMutex', |
| 324 | 324 | 'as log' => LogBehavior::class, |
| 325 | - 'on ' . Queue::EVENT_AFTER_ERROR => function (ExecEvent $event) { |
|
| 325 | + 'on '.Queue::EVENT_AFTER_ERROR => function(ExecEvent $event) { |
|
| 326 | 326 | if ($event->error instanceof Throwable) { |
| 327 | 327 | Yii::$app->getModule('audit')->exception($event->error); |
| 328 | 328 | } else { |
@@ -352,9 +352,9 @@ discard block |
||
| 352 | 352 | 'user' => [ |
| 353 | 353 | 'class' => User::class, |
| 354 | 354 | 'enableAutoLogin' => true, |
| 355 | - 'loginUrl' => ['/user/security/login'], |
|
| 355 | + 'loginUrl' => [ '/user/security/login' ], |
|
| 356 | 356 | 'identityClass' => UserModel::class, |
| 357 | - 'rootUsers' => ['admin'] |
|
| 357 | + 'rootUsers' => [ 'admin' ] |
|
| 358 | 358 | ], |
| 359 | 359 | 'urlManager' => [ |
| 360 | 360 | 'class' => UrlManager::class, |
@@ -390,18 +390,18 @@ discard block |
||
| 390 | 390 | 'auto_reload' => true |
| 391 | 391 | ], |
| 392 | 392 | 'globals' => [ |
| 393 | - 'Html' => ['class' => Html::class], |
|
| 394 | - 'Json' => ['class' => Json::class], |
|
| 395 | - 'Tree' => ['class' => Tree::class], |
|
| 396 | - 'FA' => ['class' => FA::class], |
|
| 397 | - 'Url' => ['class' => Url::class], |
|
| 398 | - 'Markdown' => ['class' => Markdown::class] |
|
| 393 | + 'Html' => [ 'class' => Html::class ], |
|
| 394 | + 'Json' => [ 'class' => Json::class ], |
|
| 395 | + 'Tree' => [ 'class' => Tree::class ], |
|
| 396 | + 'FA' => [ 'class' => FA::class ], |
|
| 397 | + 'Url' => [ 'class' => Url::class ], |
|
| 398 | + 'Markdown' => [ 'class' => Markdown::class ] |
|
| 399 | 399 | ], |
| 400 | 400 | 'functions' => [ |
| 401 | - 'image' => function ($imageSource, $preset = '') { |
|
| 401 | + 'image' => function($imageSource, $preset = '') { |
|
| 402 | 402 | return ImageUrlHelper::image($imageSource, $preset); |
| 403 | 403 | }, |
| 404 | - 't' => function ($category, $message, $params = [], $language = null) { |
|
| 404 | + 't' => function($category, $message, $params = [ ], $language = null) { |
|
| 405 | 405 | return Yii::t($category, $message, $params, $language); |
| 406 | 406 | } |
| 407 | 407 | ], |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | 'modules' => [ |
| 416 | 416 | 'audit' => [ |
| 417 | 417 | 'class' => AuditModule::class, |
| 418 | - 'accessRoles' => ['audit-module'], |
|
| 418 | + 'accessRoles' => [ 'audit-module' ], |
|
| 419 | 419 | 'layout' => $boxLayout, |
| 420 | 420 | 'panels' => [ |
| 421 | 421 | 'audit/trail' => [ |
@@ -471,11 +471,11 @@ discard block |
||
| 471 | 471 | 'local' => 'fsLocal', |
| 472 | 472 | 'runtime' => 'fsRuntime' |
| 473 | 473 | ], |
| 474 | - 'urlCallback' => function ($item) { |
|
| 475 | - $urls = []; |
|
| 476 | - if ($item['type'] === 'file') { |
|
| 477 | - $urls['Image'] = ImageUrlHelper::imageRelative($item['path']); |
|
| 478 | - $urls['Download'] = ImageUrlHelper::downloadRelative($item['path']); |
|
| 474 | + 'urlCallback' => function($item) { |
|
| 475 | + $urls = [ ]; |
|
| 476 | + if ($item[ 'type' ] === 'file') { |
|
| 477 | + $urls[ 'Image' ] = ImageUrlHelper::imageRelative($item[ 'path' ]); |
|
| 478 | + $urls[ 'Download' ] = ImageUrlHelper::downloadRelative($item[ 'path' ]); |
|
| 479 | 479 | } |
| 480 | 480 | return $urls; |
| 481 | 481 | }, |
@@ -520,12 +520,12 @@ discard block |
||
| 520 | 520 | [ |
| 521 | 521 | 'connection' => 'db', |
| 522 | 522 | 'table' => '{{%hrzg_widget_template}}', |
| 523 | - 'columns' => ['twig_template'] |
|
| 523 | + 'columns' => [ 'twig_template' ] |
|
| 524 | 524 | ], |
| 525 | 525 | [ |
| 526 | 526 | 'connection' => 'db', |
| 527 | 527 | 'table' => '{{%twig}}', |
| 528 | - 'columns' => ['value'] |
|
| 528 | + 'columns' => [ 'value' ] |
|
| 529 | 529 | ] |
| 530 | 530 | ], |
| 531 | 531 | 'scanners' => [ |
@@ -534,8 +534,8 @@ discard block |
||
| 534 | 534 | ScannerJavaScriptFunction::class, |
| 535 | 535 | ScannerDatabase::class |
| 536 | 536 | ], |
| 537 | - 'allowedIPs' => ['*'], |
|
| 538 | - 'roles' => ['translate-module'] |
|
| 537 | + 'allowedIPs' => [ '*' ], |
|
| 538 | + 'roles' => [ 'translate-module' ] |
|
| 539 | 539 | ], |
| 540 | 540 | 'user' => [ |
| 541 | 541 | 'class' => UserModule::class, |
@@ -543,12 +543,12 @@ discard block |
||
| 543 | 543 | 'enableGdprCompliance' => true, |
| 544 | 544 | 'defaultRoute' => 'admin', |
| 545 | 545 | 'administratorPermissionName' => 'user-module', |
| 546 | - 'administrators' => ['admin'], |
|
| 546 | + 'administrators' => [ 'admin' ], |
|
| 547 | 547 | 'enableFlashMessages' => false, |
| 548 | 548 | 'generatePasswords' => true, |
| 549 | 549 | 'enableRegistration' => getenv('APP_USER_ENABLE_REGISTRATION'), |
| 550 | 550 | 'mailParams' => [ |
| 551 | - 'fromEmail' => [getenv('APP_MAILER_FROM') => getenv('APP_TITLE')] |
|
| 551 | + 'fromEmail' => [ getenv('APP_MAILER_FROM') => getenv('APP_TITLE') ] |
|
| 552 | 552 | ], |
| 553 | 553 | 'gdprPrivacyPolicyUrl' => '/datenschutz' |
| 554 | 554 | ], |
@@ -564,16 +564,16 @@ discard block |
||
| 564 | 564 | ]; |
| 565 | 565 | |
| 566 | 566 | if ($s3Enabled) { |
| 567 | - $common['components']['fsS3'] = [ |
|
| 567 | + $common[ 'components' ][ 'fsS3' ] = [ |
|
| 568 | 568 | 'class' => AwsS3Filesystem::class, |
| 569 | 569 | 'key' => getenv('AMAZON_S3_BUCKET_PUBLIC_KEY'), |
| 570 | 570 | 'secret' => getenv('AMAZON_S3_BUCKET_SECRET_KEY'), |
| 571 | 571 | 'bucket' => getenv('AMAZON_S3_BUCKET_NAME'), |
| 572 | - 'prefix' => getenv('APP_NAME') . '/public', |
|
| 572 | + 'prefix' => getenv('APP_NAME').'/public', |
|
| 573 | 573 | 'region' => getenv('AMAZON_S3_BUCKET_REGION') |
| 574 | 574 | ]; |
| 575 | 575 | |
| 576 | - $common['modules']['filefly']['filesystemComponents']['s3'] = 'fsS3'; |
|
| 576 | + $common[ 'modules' ][ 'filefly' ][ 'filesystemComponents' ][ 's3' ] = 'fsS3'; |
|
| 577 | 577 | } |
| 578 | 578 | |
| 579 | 579 | return $common; |