| @@ -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> | 
| @@ -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> | 
| @@ -29,8 +29,8 @@ discard block | ||
| 29 | 29 | </tr> | 
| 30 | 30 | <tr> | 
| 31 | 31 | <th>Virtual Host</th> | 
| 32 | - <td><code><?= isset($_SERVER['HTTP_HOST']) ? | |
| 33 | - $_SERVER['HTTP_HOST'] : 'n/a' ?></code></td> | |
| 32 | + <td><code><?= isset($_SERVER[ 'HTTP_HOST' ]) ? | |
| 33 | + $_SERVER[ 'HTTP_HOST' ] : 'n/a' ?></code></td> | |
| 34 | 34 | </tr> | 
| 35 | 35 | <tr> | 
| 36 | 36 | <th>Hostname</th> | 
| @@ -46,7 +46,7 @@ discard block | ||
| 46 | 46 | </div> | 
| 47 | 47 | |
| 48 | 48 | <div class="pull-right"> | 
| 49 | - <?= Html::a(FA::icon(FA::_COG), ['/backend'], ['class' => 'btn btn-default btn-xs']) ?> | |
| 49 | + <?= Html::a(FA::icon(FA::_COG), [ '/backend' ], [ 'class' => 'btn btn-default btn-xs' ]) ?> | |
| 50 | 50 | </div> | 
| 51 | 51 | <div class="clearfix"></div> | 
| 52 | 52 | |
| @@ -6,22 +6,22 @@ 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 | |
| 13 | 13 | // prepare languages | 
| 14 | 14 |  foreach (\Yii::$app->urlManager->languages as $language) { | 
| 15 | - $languageItems[] = [ | |
| 16 | - 'url' => ['/', \Yii::$app->urlManager->languageParam => $language], | |
| 15 | + $languageItems[ ] = [ | |
| 16 | + 'url' => [ '/', \Yii::$app->urlManager->languageParam => $language ], | |
| 17 | 17 | 'label' => $language, | 
| 18 | 18 | ]; | 
| 19 | 19 | } | 
| 20 | 20 | |
| 21 | 21 | // add language items to menu | 
| 22 | -$menuItems[] = [ | |
| 22 | +$menuItems[ ] = [ | |
| 23 | 23 | 'label' => '<i class="glyphicon glyphicon-globe"></i> '.\Yii::$app->language, | 
| 24 | - 'options' => ['id' => 'link-languages-menu'], | |
| 24 | + 'options' => [ 'id' => 'link-languages-menu' ], | |
| 25 | 25 | 'items' => $languageItems, | 
| 26 | 26 | ]; | 
| 27 | 27 | |
| @@ -30,30 +30,30 @@ discard block | ||
| 30 | 30 |      if (\Yii::$app->user->isGuest) { | 
| 31 | 31 | // unauthorized users | 
| 32 | 32 | //$menuItems[] = ['label' => 'Signup', 'url' => ['/user/registration/register']]; | 
| 33 | - $menuItems[] = [ | |
| 33 | + $menuItems[ ] = [ | |
| 34 | 34 | 'label' => 'Login', | 
| 35 | - 'url' => ['/user/security/login'], | |
| 36 | - 'linkOptions' => ['id' => 'link-login'], | |
| 35 | + 'url' => [ '/user/security/login' ], | |
| 36 | + 'linkOptions' => [ 'id' => 'link-login' ], | |
| 37 | 37 | ]; | 
| 38 | 38 |      } else { | 
| 39 | 39 | // logged in users | 
| 40 | - $menuItems[] = [ | |
| 40 | + $menuItems[ ] = [ | |
| 41 | 41 | 'label' => '<i class="glyphicon glyphicon-user"></i> '.\Yii::$app->user->identity->username, | 
| 42 | - 'options' => ['id' => 'link-user-menu'], | |
| 42 | + 'options' => [ 'id' => 'link-user-menu' ], | |
| 43 | 43 | 'items' => [ | 
| 44 | 44 | [ | 
| 45 | 45 | 'label' => '<i class="glyphicon glyphicon-user"></i> Profile', | 
| 46 | - 'url' => ['/user/profile/show', 'id' => \Yii::$app->user->id], | |
| 46 | + 'url' => [ '/user/profile/show', 'id' => \Yii::$app->user->id ], | |
| 47 | 47 | ], | 
| 48 | 48 | [ | 
| 49 | 49 | 'label' => '<i class="glyphicon glyphicon-cog"></i> Settings', | 
| 50 | - 'url' => ['/user/settings/profile'], | |
| 50 | + 'url' => [ '/user/settings/profile' ], | |
| 51 | 51 | ], | 
| 52 | 52 | '<li class="divider"></li>', | 
| 53 | 53 | [ | 
| 54 | 54 | 'label' => '<i class="glyphicon glyphicon-log-out"></i> Logout', | 
| 55 | - 'url' => ['/user/security/logout'], | |
| 56 | - 'linkOptions' => ['data-method' => 'post', 'id' => 'link-logout'], | |
| 55 | + 'url' => [ '/user/security/logout' ], | |
| 56 | + 'linkOptions' => [ 'data-method' => 'post', 'id' => 'link-logout' ], | |
| 57 | 57 | ], | 
| 58 | 58 | ], | 
| 59 | 59 | ]; | 
| @@ -75,7 +75,7 @@ discard block | ||
| 75 | 75 | // render root pages | 
| 76 | 76 | echo Nav::widget( | 
| 77 | 77 | [ | 
| 78 | - 'options' => ['class' => 'navbar-nav'], | |
| 78 | + 'options' => [ 'class' => 'navbar-nav' ], | |
| 79 | 79 | 'encodeLabels' => false, | 
| 80 | 80 |          'items' => \dmstr\modules\pages\models\Tree::getMenuItems('root'), | 
| 81 | 81 | ] | 
| @@ -84,7 +84,7 @@ discard block | ||
| 84 | 84 | // render additional menu items (languages, user) | 
| 85 | 85 | echo Nav::widget( | 
| 86 | 86 | [ | 
| 87 | - 'options' => ['class' => 'navbar-nav navbar-right'], | |
| 87 | + 'options' => [ 'class' => 'navbar-nav navbar-right' ], | |
| 88 | 88 | 'encodeLabels' => false, | 
| 89 | 89 | 'items' => $menuItems, | 
| 90 | 90 | ] | 
| @@ -32,8 +32,8 @@ | ||
| 32 | 32 | |
| 33 | 33 | public function actionRootNode() | 
| 34 | 34 |      { | 
| 35 | - $rootNodeQuery = \dmstr\modules\pages\models\Tree::find()->where(['domain_id' => 'root']); | |
| 35 | + $rootNodeQuery = \dmstr\modules\pages\models\Tree::find()->where([ 'domain_id' => 'root' ]); | |
| 36 | 36 | $rootNode = $rootNodeQuery->one(); | 
| 37 | -        return $this->run('/pages/default/page', ['pageId' => $rootNode->id]); | |
| 37 | +        return $this->run('/pages/default/page', [ 'pageId' => $rootNode->id ]); | |
| 38 | 38 | } | 
| 39 | 39 | } | 
| @@ -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 | } | 
| @@ -2,11 +2,10 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace app\commands; | 
| 4 | 4 | |
| 5 | -use dmstr\helpers\Metadata; | |
| 5 | +use Yii; | |
| 6 | 6 | use mikehaertl\shellcommand\Command; | 
| 7 | 7 | use yii\console\Controller; | 
| 8 | 8 | use yii\helpers\VarDumper; | 
| 9 | -use Yii; | |
| 10 | 9 | |
| 11 | 10 | /** | 
| 12 | 11 | * @link http://www.diemeisterei.de/ | 
| @@ -32,18 +32,18 @@ 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 | } | 
| 43 | 43 | |
| 44 | 44 | // Favicon | 
| 45 | 45 |  if ($favicon = \Yii::$app->settings->get('faviconPng', 'app.assets', null)) { | 
| 46 | - $this->registerLinkTag(['rel' => 'shortcut icon', 'type' => 'image/png', 'href' => $favicon]); | |
| 46 | + $this->registerLinkTag([ 'rel' => 'shortcut icon', 'type' => 'image/png', 'href' => $favicon ]); | |
| 47 | 47 | } | 
| 48 | 48 | |
| 49 | 49 | ?> | 
| @@ -70,12 +70,12 @@ discard block | ||
| 70 | 70 | 'linkSelector' => '.frontend-reload', | 
| 71 | 71 | ]) ?> | 
| 72 | 72 | |
| 73 | -<?= TwigWidget::widget(['key' => '_beginBody', 'renderEmpty' => false]) ?> | |
| 73 | +<?= TwigWidget::widget([ 'key' => '_beginBody', 'renderEmpty' => false ]) ?> | |
| 74 | 74 | |
| 75 | 75 | <!-- Navbar --> | 
| 76 | 76 | <?php | 
| 77 | 77 |  if (Yii::$app->settings->get('enableTwigNavbar', 'app.layout', false)) { | 
| 78 | - echo \dmstr\modules\prototype\widgets\TwigWidget::widget(['key' => '_navbar']); | |
| 78 | + echo \dmstr\modules\prototype\widgets\TwigWidget::widget([ 'key' => '_navbar' ]); | |
| 79 | 79 |  } else { | 
| 80 | 80 |      echo $this->render('_navbar'); | 
| 81 | 81 | } | 
| @@ -91,7 +91,7 @@ discard block | ||
| 91 | 91 | |
| 92 | 92 | <!-- Footer --> | 
| 93 | 93 | <footer class="footer"> | 
| 94 | - <?= Cell::widget(['id' => '_footer', 'requestParam' => '_global']) ?> | |
| 94 | + <?= Cell::widget([ 'id' => '_footer', 'requestParam' => '_global' ]) ?> | |
| 95 | 95 | </footer> | 
| 96 | 96 | |
| 97 | 97 | <?php Pjax::end() ?> | 
| @@ -106,7 +106,7 @@ discard block | ||
| 106 | 106 | ], | 
| 107 | 107 | ]) ?> | 
| 108 | 108 | |
| 109 | -<?= TwigWidget::widget(['key' => '_endBody', 'renderEmpty' => false]) ?> | |
| 109 | +<?= TwigWidget::widget([ 'key' => '_endBody', 'renderEmpty' => false ]) ?> | |
| 110 | 110 | |
| 111 | 111 |  <?php if (Yii::$app->user->can('backend_default_index') && Yii::$app->settings->get('backendWidget', 'frontend') === 'toolbar'): ?> | 
| 112 | 112 | <?= Toolbar::widget([ | 
| @@ -10,15 +10,14 @@ | ||
| 10 | 10 | * file that was distributed with this source code. | 
| 11 | 11 | */ | 
| 12 | 12 | |
| 13 | +use Yii; | |
| 13 | 14 | use dmstr\helpers\SettingsAsset; | 
| 14 | 15 | use dmstr\modules\backend\widgets\Modal; | 
| 15 | 16 | use dmstr\modules\backend\widgets\Toolbar; | 
| 16 | 17 | use dmstr\modules\prototype\widgets\TwigWidget; | 
| 17 | 18 | use hrzg\widget\widgets\Cell; | 
| 18 | 19 | use lo\modules\noty\Wrapper; | 
| 19 | -use Yii; | |
| 20 | 20 | use yii\helpers\Html; | 
| 21 | -use yii\helpers\Url; | |
| 22 | 21 | use yii\widgets\Pjax; | 
| 23 | 22 | |
| 24 | 23 | /* @var $this \yii\web\View */ | 
| @@ -16,7 +16,7 @@ | ||
| 16 | 16 | 'view' => [ | 
| 17 | 17 | 'renderers' => [ | 
| 18 | 18 | 'twig' => [ | 
| 19 | -                    'extensions' => (getenv('TWIG_DEBUG_MODE')) ? [new Twig_Extension_Debug()] : null, | |
| 19 | +                    'extensions' => (getenv('TWIG_DEBUG_MODE')) ? [ new Twig_Extension_Debug() ] : null, | |
| 20 | 20 | 'options' => [ | 
| 21 | 21 |                          'debug' => (getenv('TWIG_DEBUG_MODE')) ? true : false, | 
| 22 | 22 | ], |