@@ -4,7 +4,7 @@ |
||
| 4 | 4 | require($rootPath.'/vendor/autoload.php'); |
| 5 | 5 | require($rootPath.'/src/config/env.php'); |
| 6 | 6 | |
| 7 | -defined('YII_DEBUG') or define('YII_DEBUG', (boolean)getenv('YII_DEBUG')); |
|
| 7 | +defined('YII_DEBUG') or define('YII_DEBUG', (boolean) getenv('YII_DEBUG')); |
|
| 8 | 8 | defined('YII_ENV') or define('YII_ENV', getenv('YII_ENV')); |
| 9 | 9 | |
| 10 | 10 | require($rootPath.'/vendor/yiisoft/yii2/Yii.php'); |
@@ -18,8 +18,8 @@ |
||
| 18 | 18 | $dotenv->load(); |
| 19 | 19 | |
| 20 | 20 | // Checks & validation |
| 21 | -$dotenv->required('YII_DEBUG', ['', '0', '1', 'true', true]); |
|
| 22 | -$dotenv->required('YII_ENV', ['dev', 'prod', 'test']); |
|
| 21 | +$dotenv->required('YII_DEBUG', [ '', '0', '1', 'true', true ]); |
|
| 22 | +$dotenv->required('YII_ENV', [ 'dev', 'prod', 'test' ]); |
|
| 23 | 23 | $dotenv->required([ |
| 24 | 24 | 'YII_TRACE_LEVEL', |
| 25 | 25 | 'APP_NAME', |
@@ -5,6 +5,6 @@ |
||
| 5 | 5 | |
| 6 | 6 | <div class="site-index"> |
| 7 | 7 | |
| 8 | - <?= \dmstr\modules\prototype\widgets\TwigWidget::widget(['registerMenuItems' => true]) ?> |
|
| 8 | + <?= \dmstr\modules\prototype\widgets\TwigWidget::widget([ 'registerMenuItems' => true ]) ?> |
|
| 9 | 9 | |
| 10 | 10 | </div> |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | <?= |
| 6 | 6 | \yii\widgets\Breadcrumbs::widget( |
| 7 | 7 | [ |
| 8 | - 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], |
|
| 8 | + 'links' => isset($this->params[ 'breadcrumbs' ]) ? $this->params[ 'breadcrumbs' ] : [ ], |
|
| 9 | 9 | ] |
| 10 | 10 | ) ?> |
| 11 | 11 | </div> |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | <p style="line-height: 1.6em"> |
| 25 | 25 | Application Version <span class="label label-info"><?= getenv('APP_NAME') ?>-<?= APP_VERSION ?></span> |
| 26 | 26 | <br> |
| 27 | - Virtual Host <span class="label label-default"><?= isset($_SERVER['HTTP_HOST']) ? |
|
| 28 | - $_SERVER['HTTP_HOST'] : '' ?></span> |
|
| 27 | + Virtual Host <span class="label label-default"><?= isset($_SERVER[ 'HTTP_HOST' ]) ? |
|
| 28 | + $_SERVER[ 'HTTP_HOST' ] : '' ?></span> |
|
| 29 | 29 | <br/> |
| 30 | 30 | Hostname <span class="label label-default"><?= getenv('HOSTNAME') ?: 'local' ?></span> |
| 31 | 31 | </p> |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | <hr/> |
| 39 | 39 | |
| 40 | 40 | <div class="pull-right"> |
| 41 | - <?= Html::a(FA::icon(FA::_COG), ['/backend'], ['class' => 'btn btn-default btn-xs']) ?> |
|
| 41 | + <?= Html::a(FA::icon(FA::_COG), [ '/backend' ], [ 'class' => 'btn btn-default btn-xs' ]) ?> |
|
| 42 | 42 | </div> |
| 43 | 43 | <div class="clearfix"></div> |
| 44 | 44 | |
@@ -44,10 +44,10 @@ 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 | |
| 53 | 53 | ?> |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | <?php |
| 71 | 71 | if (Yii::$app->settings->get('enableTwigNavbar', 'app.layout', false)) { |
| 72 | - echo \dmstr\modules\prototype\widgets\TwigWidget::widget(['key' => '_navbar']); |
|
| 72 | + echo \dmstr\modules\prototype\widgets\TwigWidget::widget([ 'key' => '_navbar' ]); |
|
| 73 | 73 | } else { |
| 74 | 74 | echo $this->render('_navbar'); |
| 75 | 75 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | </div> |
| 83 | 83 | |
| 84 | 84 | <footer class="footer"> |
| 85 | - <?= Cell::widget(['id' => '_footer', 'requestParam' => '_global']) ?> |
|
| 85 | + <?= Cell::widget([ 'id' => '_footer', 'requestParam' => '_global' ]) ?> |
|
| 86 | 86 | </footer> |
| 87 | 87 | |
| 88 | 88 | <div class="phd-info" style="position: fixed; z-index: 1200; bottom: 0px; left: 10px; padding: 30px 0 0px; opacity: .3"> |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | <?= Html::a( |
| 91 | 91 | '<i class="fa fa-heartbeat"></i>', |
| 92 | 92 | '#', |
| 93 | - ['class' => 'text-muted', 'data-toggle' => 'modal', 'data-target' => '#infoModal'] |
|
| 93 | + [ 'class' => 'text-muted', 'data-toggle' => 'modal', 'data-target' => '#infoModal' ] |
|
| 94 | 94 | ) ?> |
| 95 | 95 | </p> |
| 96 | 96 | </div> |
@@ -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,54 +45,54 @@ 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 | ]; |
| 75 | 75 | |
| 76 | 76 | // context menu |
| 77 | - $menuItems[] = [ |
|
| 77 | + $menuItems[ ] = [ |
|
| 78 | 78 | 'label' => '<i class="glyphicon glyphicon-pencil"></i>', |
| 79 | - 'visible' => \Yii::$app->user->can('backend_default_index', ['route' => true]), |
|
| 80 | - 'items' => \Yii::$app->params['context.menuItems'], |
|
| 79 | + 'visible' => \Yii::$app->user->can('backend_default_index', [ 'route' => true ]), |
|
| 80 | + 'items' => \Yii::$app->params[ 'context.menuItems' ], |
|
| 81 | 81 | ]; |
| 82 | 82 | |
| 83 | 83 | $backendMenu = \dmstr\widgets\Menu::widget( |
| 84 | 84 | [ |
| 85 | - 'options' => ['class' => 'dropdown-menu'], |
|
| 85 | + 'options' => [ 'class' => 'dropdown-menu' ], |
|
| 86 | 86 | 'encodeLabels' => false, |
| 87 | 87 | 'items' => \dmstr\modules\pages\models\Tree::getMenuItems( |
| 88 | 88 | 'backend', true, \dmstr\modules\pages\models\Tree::GLOBAL_ACCESS_DOMAIN |
| 89 | 89 | ), |
| 90 | 90 | ] |
| 91 | 91 | ); |
| 92 | - $menuItems[] = [ |
|
| 92 | + $menuItems[ ] = [ |
|
| 93 | 93 | 'label' => '<i class="glyphicon glyphicon-dashboard"></i>', |
| 94 | - 'url' => ['/backend'], |
|
| 95 | - 'visible' => \Yii::$app->user->can('backend_default_index', ['route' => true]), |
|
| 94 | + 'url' => [ '/backend' ], |
|
| 95 | + 'visible' => \Yii::$app->user->can('backend_default_index', [ 'route' => true ]), |
|
| 96 | 96 | 'items' => $backendMenu, |
| 97 | 97 | ]; |
| 98 | 98 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | // render root pages |
| 113 | 113 | echo Nav::widget( |
| 114 | 114 | [ |
| 115 | - 'options' => ['class' => 'navbar-nav'], |
|
| 115 | + 'options' => [ 'class' => 'navbar-nav' ], |
|
| 116 | 116 | 'encodeLabels' => false, |
| 117 | 117 | 'items' => \dmstr\modules\pages\models\Tree::getMenuItems('root'), |
| 118 | 118 | ] |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | // render additional menu items (languages, user) |
| 122 | 122 | echo Nav::widget( |
| 123 | 123 | [ |
| 124 | - 'options' => ['class' => 'navbar-nav navbar-right'], |
|
| 124 | + 'options' => [ 'class' => 'navbar-nav navbar-right' ], |
|
| 125 | 125 | 'encodeLabels' => false, |
| 126 | 126 | 'items' => $menuItems, |
| 127 | 127 | ] |
@@ -27,14 +27,14 @@ discard block |
||
| 27 | 27 | public function actionShowConfig($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,13 +76,13 @@ 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("\nCleanup\n"); |
| 82 | 82 | $this->stdout("-------\n"); |
| 83 | 83 | $this->run('cache/flush-all'); |
| 84 | - $this->run('audit/cleanup', ['age' => 30, 'interactive' => (bool) getenv('APP_INTERACTIVE')]); |
|
| 85 | - $this->run('app/clear-assets', ['interactive' => (bool) getenv('APP_INTERACTIVE')]); |
|
| 84 | + $this->run('audit/cleanup', [ 'age' => 30, 'interactive' => (bool) getenv('APP_INTERACTIVE') ]); |
|
| 85 | + $this->run('app/clear-assets', [ 'interactive' => (bool) getenv('APP_INTERACTIVE') ]); |
|
| 86 | 86 | |
| 87 | 87 | $this->stdout("\nUser\n"); |
| 88 | 88 | $this->stdout("----\n"); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | 'default' => getenv('APP_ADMIN_PASSWORD') ?: \Yii::$app->security->generateRandomString(8), |
| 93 | 93 | ] |
| 94 | 94 | ); |
| 95 | - $this->run('user/create', [getenv('APP_ADMIN_EMAIL'), 'admin', $adminPassword]); |
|
| 95 | + $this->run('user/create', [ getenv('APP_ADMIN_EMAIL'), 'admin', $adminPassword ]); |
|
| 96 | 96 | |
| 97 | 97 | $this->stdout("\n\nDone.\n"); |
| 98 | 98 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $command = new Command($cmd); |
| 115 | 115 | |
| 116 | 116 | // Prompt user |
| 117 | - $delete = $this->confirm("\nDo you really want to delete web assets?", ['default' => true]); |
|
| 117 | + $delete = $this->confirm("\nDo you really want to delete web assets?", [ 'default' => true ]); |
|
| 118 | 118 | |
| 119 | 119 | if ($delete) { |
| 120 | 120 | // Try to execute $command |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | 'class' => 'yii\log\FileTarget', |
| 48 | 48 | 'logFile' => '@runtime/logs/console.log', |
| 49 | 49 | //'levels' => ['info', 'trace'], |
| 50 | - 'logVars' => [], |
|
| 50 | + 'logVars' => [ ], |
|
| 51 | 51 | 'enabled' => YII_DEBUG && !YII_ENV_TEST, |
| 52 | 52 | ], |
| 53 | 53 | ], |