Convert to short syntax [2].
This commit is contained in:
parent
65cc32344d
commit
4023798e42
@ -3,7 +3,7 @@ $params = require(__DIR__ . '/params.php');
|
||||
return [
|
||||
'id' => 'bootstrap-console',
|
||||
'basePath' => dirname(__DIR__),
|
||||
'preload' => array('log'),
|
||||
'preload' => ['log'],
|
||||
'controllerPath' => dirname(__DIR__) . '/commands',
|
||||
'controllerNamespace' => 'app\commands',
|
||||
'modules' => [
|
||||
|
@ -26,78 +26,78 @@ $requirementsChecker = new YiiRequirementChecker();
|
||||
/**
|
||||
* Adjust requirements according to your application specifics.
|
||||
*/
|
||||
$requirements = array(
|
||||
$requirements = [
|
||||
// Database :
|
||||
array(
|
||||
[
|
||||
'name' => 'PDO extension',
|
||||
'mandatory' => true,
|
||||
'condition' => extension_loaded('pdo'),
|
||||
'by' => 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>',
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'name' => 'PDO SQLite extension',
|
||||
'mandatory' => false,
|
||||
'condition' => extension_loaded('pdo_sqlite'),
|
||||
'by' => 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>',
|
||||
'memo' => 'Required for SQLite database.',
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'name' => 'PDO MySQL extension',
|
||||
'mandatory' => false,
|
||||
'condition' => extension_loaded('pdo_mysql'),
|
||||
'by' => 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>',
|
||||
'memo' => 'Required for MySQL database.',
|
||||
),
|
||||
],
|
||||
// Cache :
|
||||
array(
|
||||
[
|
||||
'name' => 'Memcache extension',
|
||||
'mandatory' => false,
|
||||
'condition' => extension_loaded('memcache') || extension_loaded('memcached'),
|
||||
'by' => '<a href="http://www.yiiframework.com/doc/api/CMemCache">CMemCache</a>',
|
||||
'memo' => extension_loaded('memcached') ? 'To use memcached set <a href="http://www.yiiframework.com/doc/api/CMemCache#useMemcached-detail">CMemCache::useMemcached</a> to <code>true</code>.' : ''
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'name' => 'APC extension',
|
||||
'mandatory' => false,
|
||||
'condition' => extension_loaded('apc') || extension_loaded('apc'),
|
||||
'by' => '<a href="http://www.yiiframework.com/doc/api/CApcCache">CApcCache</a>',
|
||||
),
|
||||
],
|
||||
// Additional PHP extensions :
|
||||
array(
|
||||
[
|
||||
'name' => 'Mcrypt extension',
|
||||
'mandatory' => false,
|
||||
'condition' => extension_loaded('mcrypt'),
|
||||
'by' => '<a href="http://www.yiiframework.com/doc/api/CSecurityManager">CSecurityManager</a>',
|
||||
'memo' => 'Required by encrypt and decrypt methods.'
|
||||
),
|
||||
],
|
||||
// PHP ini :
|
||||
'phpSafeMode' => array(
|
||||
'phpSafeMode' => [
|
||||
'name' => 'PHP safe mode',
|
||||
'mandatory' => false,
|
||||
'condition' => $requirementsChecker->checkPhpIniOff("safe_mode"),
|
||||
'by' => 'File uploading and console command execution',
|
||||
'memo' => '"safe_mode" should be disabled at php.ini',
|
||||
),
|
||||
'phpExposePhp' => array(
|
||||
],
|
||||
'phpExposePhp' => [
|
||||
'name' => 'Expose PHP',
|
||||
'mandatory' => false,
|
||||
'condition' => $requirementsChecker->checkPhpIniOff("expose_php"),
|
||||
'by' => 'Security reasons',
|
||||
'memo' => '"expose_php" should be disabled at php.ini',
|
||||
),
|
||||
'phpAllowUrlInclude' => array(
|
||||
],
|
||||
'phpAllowUrlInclude' => [
|
||||
'name' => 'PHP allow url include',
|
||||
'mandatory' => false,
|
||||
'condition' => $requirementsChecker->checkPhpIniOff("allow_url_include"),
|
||||
'by' => 'Security reasons',
|
||||
'memo' => '"allow_url_include" should be disabled at php.ini',
|
||||
),
|
||||
'phpSmtp' => array(
|
||||
],
|
||||
'phpSmtp' => [
|
||||
'name' => 'PHP mail SMTP',
|
||||
'mandatory' => false,
|
||||
'condition' => strlen(ini_get('SMTP'))>0,
|
||||
'by' => 'Email sending',
|
||||
'memo' => 'PHP mail SMTP server required',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
$requirementsChecker->checkYii()->check($requirements)->render();
|
||||
|
@ -4,7 +4,7 @@ $I->wantTo('ensure that contact works');
|
||||
$I->amOnPage('?r=site/contact');
|
||||
$I->see('Contact', 'h1');
|
||||
|
||||
$I->submitForm('#contact-form', array());
|
||||
$I->submitForm('#contact-form', []);
|
||||
$I->see('Contact', 'h1');
|
||||
$I->see('Name cannot be blank');
|
||||
$I->see('Email cannot be blank');
|
||||
@ -12,25 +12,25 @@ $I->see('Subject cannot be blank');
|
||||
$I->see('Body cannot be blank');
|
||||
$I->see('The verification code is incorrect');
|
||||
|
||||
$I->submitForm('#contact-form', array(
|
||||
$I->submitForm('#contact-form', [
|
||||
'ContactForm[name]' => 'tester',
|
||||
'ContactForm[email]' => 'tester.email',
|
||||
'ContactForm[subject]' => 'test subject',
|
||||
'ContactForm[body]' => 'test content',
|
||||
'ContactForm[verifyCode]' => 'testme',
|
||||
));
|
||||
]);
|
||||
$I->dontSee('Name cannot be blank', '.help-inline');
|
||||
$I->see('Email is not a valid email address.');
|
||||
$I->dontSee('Subject cannot be blank', '.help-inline');
|
||||
$I->dontSee('Body cannot be blank', '.help-inline');
|
||||
$I->dontSee('The verification code is incorrect', '.help-inline');
|
||||
|
||||
$I->submitForm('#contact-form', array(
|
||||
$I->submitForm('#contact-form', [
|
||||
'ContactForm[name]' => 'tester',
|
||||
'ContactForm[email]' => 'tester@example.com',
|
||||
'ContactForm[subject]' => 'test subject',
|
||||
'ContactForm[body]' => 'test content',
|
||||
'ContactForm[verifyCode]' => 'testme',
|
||||
));
|
||||
]);
|
||||
$I->dontSeeElement('#contact-form');
|
||||
$I->see('Thank you for contacting us. We will respond to you as soon as possible.');
|
||||
|
@ -4,20 +4,20 @@ $I->wantTo('ensure that login works');
|
||||
$I->amOnPage('?r=site/login');
|
||||
$I->see('Login', 'h1');
|
||||
|
||||
$I->submitForm('#login-form', array());
|
||||
$I->submitForm('#login-form', []);
|
||||
$I->dontSee('Logout (admin)');
|
||||
$I->see('Username cannot be blank');
|
||||
$I->see('Password cannot be blank');
|
||||
|
||||
$I->submitForm('#login-form', array(
|
||||
$I->submitForm('#login-form', [
|
||||
'LoginForm[username]' => 'admin',
|
||||
'LoginForm[password]' => 'wrong',
|
||||
));
|
||||
]);
|
||||
$I->dontSee('Logout (admin)');
|
||||
$I->see('Incorrect username or password');
|
||||
|
||||
$I->submitForm('#login-form', array(
|
||||
$I->submitForm('#login-form', [
|
||||
'LoginForm[username]' => 'admin',
|
||||
'LoginForm[password]' => 'admin',
|
||||
));
|
||||
]);
|
||||
$I->see('Logout (admin)');
|
||||
|
@ -4,7 +4,7 @@ $I->wantTo('ensure that contact works');
|
||||
$I->amOnPage('?r=site/contact');
|
||||
$I->see('Contact', 'h1');
|
||||
|
||||
$I->submitForm('#contact-form', array());
|
||||
$I->submitForm('#contact-form', []);
|
||||
$I->see('Contact', 'h1');
|
||||
$I->see('Name cannot be blank');
|
||||
$I->see('Email cannot be blank');
|
||||
@ -12,25 +12,25 @@ $I->see('Subject cannot be blank');
|
||||
$I->see('Body cannot be blank');
|
||||
$I->see('The verification code is incorrect');
|
||||
|
||||
$I->submitForm('#contact-form', array(
|
||||
$I->submitForm('#contact-form', [
|
||||
'ContactForm[name]' => 'tester',
|
||||
'ContactForm[email]' => 'tester.email',
|
||||
'ContactForm[subject]' => 'test subject',
|
||||
'ContactForm[body]' => 'test content',
|
||||
'ContactForm[verifyCode]' => 'testme',
|
||||
));
|
||||
]);
|
||||
$I->dontSee('Name cannot be blank', '.help-inline');
|
||||
$I->see('Email is not a valid email address.');
|
||||
$I->dontSee('Subject cannot be blank', '.help-inline');
|
||||
$I->dontSee('Body cannot be blank', '.help-inline');
|
||||
$I->dontSee('The verification code is incorrect', '.help-inline');
|
||||
|
||||
$I->submitForm('#contact-form', array(
|
||||
$I->submitForm('#contact-form', [
|
||||
'ContactForm[name]' => 'tester',
|
||||
'ContactForm[email]' => 'tester@example.com',
|
||||
'ContactForm[subject]' => 'test subject',
|
||||
'ContactForm[body]' => 'test content',
|
||||
'ContactForm[verifyCode]' => 'testme',
|
||||
));
|
||||
]);
|
||||
$I->dontSeeElement('#contact-form');
|
||||
$I->see('Thank you for contacting us. We will respond to you as soon as possible.');
|
||||
|
@ -4,20 +4,20 @@ $I->wantTo('ensure that login works');
|
||||
$I->amOnPage('?r=site/login');
|
||||
$I->see('Login', 'h1');
|
||||
|
||||
$I->submitForm('#login-form', array());
|
||||
$I->submitForm('#login-form', []);
|
||||
$I->dontSee('Logout (admin)');
|
||||
$I->see('Username cannot be blank');
|
||||
$I->see('Password cannot be blank');
|
||||
|
||||
$I->submitForm('#login-form', array(
|
||||
$I->submitForm('#login-form', [
|
||||
'LoginForm[username]' => 'admin',
|
||||
'LoginForm[password]' => 'wrong',
|
||||
));
|
||||
]);
|
||||
$I->dontSee('Logout (admin)');
|
||||
$I->see('Incorrect username or password');
|
||||
|
||||
$I->submitForm('#login-form', array(
|
||||
$I->submitForm('#login-form', [
|
||||
'LoginForm[username]' => 'admin',
|
||||
'LoginForm[password]' => 'admin',
|
||||
));
|
||||
]);
|
||||
$I->see('Logout (admin)');
|
||||
|
@ -21,33 +21,33 @@ app\config\AppAsset::register($this);
|
||||
<body>
|
||||
<?php $this->beginBody(); ?>
|
||||
<?php
|
||||
NavBar::begin(array(
|
||||
NavBar::begin([
|
||||
'brandLabel' => 'My Company',
|
||||
'brandUrl' => Yii::$app->homeUrl,
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'class' => 'navbar-inverse navbar-fixed-top',
|
||||
),
|
||||
));
|
||||
echo Nav::widget(array(
|
||||
'options' => array('class' => 'navbar-nav pull-right'),
|
||||
'items' => array(
|
||||
array('label' => 'Home', 'url' => array('/site/index')),
|
||||
array('label' => 'About', 'url' => array('/site/about')),
|
||||
array('label' => 'Contact', 'url' => array('/site/contact')),
|
||||
],
|
||||
]);
|
||||
echo Nav::widget([
|
||||
'options' => ['class' => 'navbar-nav pull-right'],
|
||||
'items' => [
|
||||
['label' => 'Home', 'url' => ['/site/index']],
|
||||
['label' => 'About', 'url' => ['/site/about']],
|
||||
['label' => 'Contact', 'url' => ['/site/contact']],
|
||||
Yii::$app->user->isGuest ?
|
||||
array('label' => 'Login', 'url' => array('/site/login')) :
|
||||
array('label' => 'Logout (' . Yii::$app->user->identity->username .')' ,
|
||||
'url' => array('/site/logout'),
|
||||
'linkOptions' => array('data-method' => 'post')),
|
||||
),
|
||||
));
|
||||
['label' => 'Login', 'url' => ['/site/login']] :
|
||||
['label' => 'Logout (' . Yii::$app->user->identity->username .')' ,
|
||||
'url' => ['/site/logout'],
|
||||
'linkOptions' => ['data-method' => 'post']],
|
||||
],
|
||||
]);
|
||||
NavBar::end();
|
||||
?>
|
||||
|
||||
<div class="container">
|
||||
<?php echo Breadcrumbs::widget(array(
|
||||
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : array(),
|
||||
)); ?>
|
||||
<?php echo Breadcrumbs::widget([
|
||||
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
|
||||
]); ?>
|
||||
<?php echo $content; ?>
|
||||
</div>
|
||||
|
||||
|
@ -28,17 +28,17 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-5">
|
||||
<?php $form = ActiveForm::begin(array('id' => 'contact-form')); ?>
|
||||
<?php $form = ActiveForm::begin(['id' => 'contact-form']); ?>
|
||||
<?php echo $form->field($model, 'name'); ?>
|
||||
<?php echo $form->field($model, 'email'); ?>
|
||||
<?php echo $form->field($model, 'subject'); ?>
|
||||
<?php echo $form->field($model, 'body')->textArea(array('rows' => 6)); ?>
|
||||
<?php echo $form->field($model, 'verifyCode')->widget(Captcha::className(), array(
|
||||
'options' => array('class' => 'form-control'),
|
||||
<?php echo $form->field($model, 'body')->textArea(['rows' => 6]); ?>
|
||||
<?php echo $form->field($model, 'verifyCode')->widget(Captcha::className(), [
|
||||
'options' => ['class' => 'form-control'],
|
||||
'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>',
|
||||
)); ?>
|
||||
]); ?>
|
||||
<div class="form-group">
|
||||
<?php echo Html::submitButton('Submit', array('class' => 'btn btn-primary')); ?>
|
||||
<?php echo Html::submitButton('Submit', ['class' => 'btn btn-primary']); ?>
|
||||
</div>
|
||||
<?php ActiveForm::end(); ?>
|
||||
</div>
|
||||
|
@ -15,26 +15,26 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
<p>Please fill out the following fields to login:</p>
|
||||
|
||||
<?php $form = ActiveForm::begin(array(
|
||||
<?php $form = ActiveForm::begin([
|
||||
'id' => 'login-form',
|
||||
'options' => array('class' => 'form-horizontal'),
|
||||
'fieldConfig' => array(
|
||||
'options' => ['class' => 'form-horizontal'],
|
||||
'fieldConfig' => [
|
||||
'template' => "{label}\n<div class=\"col-lg-3\">{input}</div>\n<div class=\"col-lg-8\">{error}</div>",
|
||||
'labelOptions' => array('class' => 'col-lg-1 control-label'),
|
||||
),
|
||||
)); ?>
|
||||
'labelOptions' => ['class' => 'col-lg-1 control-label'],
|
||||
],
|
||||
]); ?>
|
||||
|
||||
<?php echo $form->field($model, 'username'); ?>
|
||||
|
||||
<?php echo $form->field($model, 'password')->passwordInput(); ?>
|
||||
|
||||
<?php echo $form->field($model, 'rememberMe', array(
|
||||
<?php echo $form->field($model, 'rememberMe', [
|
||||
'template' => "<div class=\"col-lg-offset-1 col-lg-3\">{input}</div>\n<div class=\"col-lg-8\">{error}</div>",
|
||||
))->checkbox(); ?>
|
||||
])->checkbox(); ?>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-lg-offset-1 col-lg-11">
|
||||
<?php echo Html::submitButton('Login', array('class' => 'btn btn-primary')); ?>
|
||||
<?php echo Html::submitButton('Login', ['class' => 'btn btn-primary']); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1'))) {
|
||||
if (!in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'])) {
|
||||
die('You are not allowed to access this file.');
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user