Commit 82dc3b12 by Carsten Brandt

Merge branch 'master' into redis

* master: (131 commits) css fix. Finished model generator. more tests for FileHelper Added note about theme asset bundle to bootstrap widgets guide fixed typos in ArrayHelperBase phpdoc More tests for ArrayHelper and Inflector Fixed typo and code style Fixes #21: implemented jQueryUI Slider Fixes #790: added visible for Nav and Dropdown finished rule generation for model generator. bug fix of form generator. minor fixes of debugger. Added SafeValidator. fix dataProvider getSort() cleanup MemCache timeout API after #804 Added failureCallback, reduced timeouts to 1s Mentioning that timeoutms is available in memcache only. set default format for gridview to text Removed extra line Added timeoutms parameter in MemCache ... Conflicts: tests/unit/data/config.php
parents b84097c1 c86d5970
......@@ -6,6 +6,7 @@
*/
namespace backend\config;
use yii\web\AssetBundle;
/**
......
<?php
return array(
'adminEmail' => 'admin@example.com',
);
\ No newline at end of file
);
......@@ -17,7 +17,7 @@ class SiteController extends Controller
{
$model = new LoginForm();
if ($model->load($_POST) && $model->login()) {
return $this->redirect(array('site/index'));
return $this->goHome();
} else {
return $this->render('login', array(
'model' => $model,
......@@ -28,6 +28,6 @@ class SiteController extends Controller
public function actionLogout()
{
Yii::$app->user->logout();
return $this->redirect(array('site/index'));
return $this->goHome();
}
}
<?php
use backend\config\AppAsset;
use yii\helpers\Html;
use yii\widgets\Menu;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
/**
......@@ -14,50 +15,50 @@ AppAsset::register($this);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta charset="<?php echo Yii::$app->charset; ?>"/>
<title><?php echo Html::encode($this->title); ?></title>
<?php $this->head(); ?>
</head>
<body>
<div class="container">
<?php $this->beginBody(); ?>
<div class="masthead">
<h3 class="muted">My Company</h3>
<div class="navbar fullwidth">
<div class="navbar-inner">
<div class="container">
<?php echo Menu::widget(array(
'options' => array('class' => 'nav'),
'items' => array(
array('label' => 'Home', 'url' => array('/site/index')),
Yii::$app->user->isGuest ?
array('label' => 'Login', 'url' => array('/site/login')) :
array('label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => array('/site/logout')),
),
)); ?>
</div>
</div>
</div>
<!-- /.navbar -->
</div>
<?php
NavBar::begin(array(
'brandLabel' => 'My Company',
'brandUrl' => Yii::$app->homeUrl,
'options' => array(
'class' => 'navbar-inverse navbar-fixed-top',
),
));
$menuItems = array(
array('label' => 'Home', 'url' => array('/site/index')),
);
if (Yii::$app->user->isGuest) {
$menuItems[] = array('label' => 'Login', 'url' => array('/site/login'));
} else {
$menuItems[] = array('label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => array('/site/logout'));
}
echo Nav::widget(array(
'options' => array('class' => 'navbar-nav pull-right'),
'items' => $menuItems,
));
NavBar::end();
?>
<div class="container">
<?php echo Breadcrumbs::widget(array(
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : array(),
)); ?>
<?php echo $content; ?>
</div>
<hr>
<footer class="footer">
<div class="container">
<p class="pull-left">&copy; My Company <?php echo date('Y'); ?></p>
<p class="pull-right"><?php echo Yii::powered(); ?></p>
</div>
</footer>
<div class="footer">
<p>&copy; My Company <?php echo date('Y'); ?></p>
<p>
<?php echo Yii::powered(); ?>
Template by <a href="http://twitter.github.io/bootstrap/">Twitter Bootstrap</a>
</p>
</div>
<?php $this->endBody(); ?>
</div>
</body>
</html>
<?php $this->endPage(); ?>
......@@ -2,46 +2,52 @@
/**
* @var yii\base\View $this
*/
$this->title = 'Welcome';
$this->title = 'My Yii Application';
?>
<div class="jumbotron">
<h1>Welcome!</h1>
<div class="site-index">
<p class="lead">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus
commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
<a class="btn btn-large btn-success" href="http://www.yiiframework.com">Get started with Yii</a>
</div>
<div class="jumbotron">
<h1>Congratulations!</h1>
<hr>
<p class="lead">You have successfully created your Yii-powered application.</p>
<!-- Example row of columns -->
<div class="row-fluid">
<div class="span4">
<h2>Heading</h2>
<p><a class="btn btn-lg btn-success" href="http://www.yiiframework.com">Get started with Yii</a></p>
</div>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris
condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod.
Donec sed odio dui. </p>
<div class="body-content">
<p><a class="btn" href="#">View details &raquo;</a></p>
</div>
<div class="span4">
<h2>Heading</h2>
<div class="row">
<div class="col-lg-4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris
condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod.
Donec sed odio dui. </p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur.</p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div>
<div class="span4">
<h2>Heading</h2>
<p><a class="btn btn-default" href="http://www.yiiframework.com/doc/">Yii Documentation &raquo;</a></p>
</div>
<div class="col-lg-4">
<h2>Heading</h2>
<p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta
felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum
massa.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur.</p>
<p><a class="btn btn-default" href="http://www.yiiframework.com/forum/">Yii Forum &raquo;</a></p>
</div>
<div class="col-lg-4">
<h2>Heading</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur.</p>
<p><a class="btn btn-default" href="http://www.yiiframework.com/extensions/">Yii Extensions &raquo;</a></p>
</div>
</div>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div>
</div>
......@@ -10,15 +10,21 @@ use yii\widgets\ActiveForm;
$this->title = 'Login';
$this->params['breadcrumbs'][] = $this->title;
?>
<h1><?php echo Html::encode($this->title); ?></h1>
<div class="site-login">
<h1><?php echo Html::encode($this->title); ?></h1>
<p>Please fill out the following fields to login:</p>
<p>Please fill out the following fields to login:</p>
<?php $form = ActiveForm::begin(array('options' => array('class' => 'form-horizontal'))); ?>
<?php echo $form->field($model, 'username')->textInput(); ?>
<?php echo $form->field($model, 'password')->passwordInput(); ?>
<?php echo $form->field($model, 'rememberMe')->checkbox(); ?>
<div class="form-actions">
<?php echo Html::submitButton('Login', array('class' => 'btn btn-primary')); ?>
<div class="row">
<div class="col-lg-5">
<?php $form = ActiveForm::begin(array('id' => 'login-form')); ?>
<?php echo $form->field($model, 'username'); ?>
<?php echo $form->field($model, 'password')->passwordInput(); ?>
<?php echo $form->field($model, 'rememberMe')->checkbox(); ?>
<div class="form-group">
<?php echo Html::submitButton('Login', array('class' => 'btn btn-primary')); ?>
</div>
<?php ActiveForm::end(); ?>
</div>
</div>
<?php ActiveForm::end(); ?>
</div>
body {
padding-top: 20px;
padding-bottom: 60px;
padding-top: 70px;
}
/* Custom container */
.container {
margin: 0 auto;
max-width: 1000px;
.footer {
border-top: 1px solid #ddd;
margin-top: 30px;
padding-top: 15px;
padding-bottom: 30px;
}
.container > hr {
margin: 60px 0;
}
/* Main marketing message and sign up button */
.jumbotron {
margin: 80px 0;
text-align: center;
}
.jumbotron h1 {
font-size: 100px;
line-height: 1;
}
.jumbotron .lead {
font-size: 24px;
line-height: 1.25;
text-align: center;
background-color: transparent;
}
.jumbotron .btn {
font-size: 21px;
padding: 14px 24px;
}
/* Supporting marketing content */
.marketing {
margin: 60px 0;
}
.marketing p + h4 {
margin-top: 28px;
}
/* Customize the navbar links to be fill the entire space of the .navbar */
.navbar.fullwidth .navbar-inner {
padding: 0;
}
.navbar.fullwidth .nav {
margin: 0;
display: table;
width: 100%;
}
.navbar.fullwidth .nav li {
display: table-cell;
width: 1%;
float: none;
}
.navbar.fullwidth .nav li a {
font-weight: bold;
text-align: center;
border-left: 1px solid rgba(255, 255, 255, .75);
border-right: 1px solid rgba(0, 0, 0, .1);
}
.navbar.fullwidth .nav li:first-child a {
border-left: 0;
border-radius: 3px 0 0 3px;
}
.navbar.fullwidth .nav li:last-child a {
border-right: 0;
border-radius: 0 3px 3px 0;
font-size: 21px;
padding: 14px 24px;
}
<?php
return array(
'adminEmail' => 'admin@example.com',
);
\ No newline at end of file
);
......@@ -2,8 +2,8 @@
// comment out the following line to disable debug mode
defined('YII_DEBUG') or define('YII_DEBUG', true);
require(__DIR__ . '/../../vendor/yiisoft/yii2/yii/Yii.php');
require(__DIR__ . '/../../vendor/autoload.php');
require(__DIR__ . '/../../vendor/yiisoft/yii2/yii/Yii.php');
$config = yii\helpers\ArrayHelper::merge(
require(__DIR__ . '/../config/main.php'),
......
......@@ -3,8 +3,8 @@
// comment out the following line to disable debug mode
defined('YII_DEBUG') or define('YII_DEBUG', true);
require(__DIR__ . '/../../vendor/yiisoft/yii2/yii/Yii.php');
require(__DIR__ . '/../../vendor/autoload.php');
require(__DIR__ . '/../../vendor/yiisoft/yii2/yii/Yii.php');
Yii::importNamespaces(require(__DIR__ . '/../../vendor/composer/autoload_namespaces.php'));
$config = yii\helpers\ArrayHelper::merge(
......
......@@ -13,8 +13,8 @@ defined('YII_DEBUG') or define('YII_DEBUG', true);
// fcgi doesn't have STDIN defined by default
defined('STDIN') or define('STDIN', fopen('php://stdin', 'r'));
require(__DIR__ . '/vendor/yiisoft/yii2/yii/Yii.php');
require(__DIR__ . '/vendor/autoload.php');
require(__DIR__ . '/vendor/yiisoft/yii2/yii/Yii.php');
Yii::importNamespaces(require(__DIR__ . '/vendor/composer/autoload_namespaces.php'));
$config = yii\helpers\ArrayHelper::merge(
......
......@@ -2,8 +2,8 @@
// comment out the following line to disable debug mode
defined('YII_DEBUG') or define('YII_DEBUG', false);
require(__DIR__ . '/../../vendor/yiisoft/yii2/yii/Yii.php');
require(__DIR__ . '/../../vendor/autoload.php');
require(__DIR__ . '/../../vendor/yiisoft/yii2/yii/Yii.php');
$config = yii\helpers\ArrayHelper::merge(
require(__DIR__ . '/../config/main.php'),
......
......@@ -3,8 +3,8 @@
// comment out the following line to disable debug mode
defined('YII_DEBUG') or define('YII_DEBUG', false);
require(__DIR__ . '/../../vendor/yiisoft/yii2/yii/Yii.php');
require(__DIR__ . '/../../vendor/autoload.php');
require(__DIR__ . '/../../vendor/yiisoft/yii2/yii/Yii.php');
Yii::importNamespaces(require(__DIR__ . '/../../vendor/composer/autoload_namespaces.php'));
$config = yii\helpers\ArrayHelper::merge(
......
......@@ -13,8 +13,8 @@ defined('YII_DEBUG') or define('YII_DEBUG', false);
// fcgi doesn't have STDIN defined by default
defined('STDIN') or define('STDIN', fopen('php://stdin', 'r'));
require(__DIR__ . '/vendor/yiisoft/yii2/yii/Yii.php');
require(__DIR__ . '/vendor/autoload.php');
require(__DIR__ . '/vendor/yiisoft/yii2/yii/Yii.php');
Yii::importNamespaces(require(__DIR__ . '/vendor/composer/autoload_namespaces.php'));
$config = yii\helpers\ArrayHelper::merge(
......
......@@ -6,6 +6,7 @@
*/
namespace frontend\config;
use yii\web\AssetBundle;
/**
......
<?php
return array(
'adminEmail' => 'admin@example.com',
);
\ No newline at end of file
);
......@@ -30,7 +30,7 @@ class SiteController extends Controller
{
$model = new LoginForm();
if ($model->load($_POST) && $model->login()) {
return $this->redirect(array('site/index'));
return $this->goHome();
} else {
return $this->render('login', array(
'model' => $model,
......@@ -41,7 +41,7 @@ class SiteController extends Controller
public function actionLogout()
{
Yii::$app->user->logout();
return $this->redirect(array('site/index'));
return $this->goHome();
}
public function actionContact()
......@@ -68,7 +68,7 @@ class SiteController extends Controller
$model->setScenario('signup');
if ($model->load($_POST) && $model->save()) {
if (Yii::$app->getUser()->login($model)) {
$this->redirect('index');
return $this->goHome();
}
}
......@@ -84,7 +84,7 @@ class SiteController extends Controller
if ($model->load($_POST) && $model->validate()) {
if ($this->sendPasswordResetEmail($model->email)) {
Yii::$app->getSession()->setFlash('success', 'Check your email for further instructions.');
$this->redirect('index');
return $this->goHome();
} else {
Yii::$app->getSession()->setFlash('error', 'There was an error sending email.');
}
......@@ -108,7 +108,7 @@ class SiteController extends Controller
$model->scenario = 'resetPassword';
if ($model->load($_POST) && $model->save()) {
Yii::$app->getSession()->setFlash('success', 'New password was saved.');
$this->redirect('index');
return $this->goHome();
}
return $this->render('resetPassword', array(
......
<?php
use frontend\config\AppAsset;
use yii\helpers\Html;
use yii\widgets\Menu;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use frontend\widgets\Alert;
......@@ -15,62 +16,54 @@ AppAsset::register($this);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta charset="<?php echo Yii::$app->charset; ?>"/>
<title><?php echo Html::encode($this->title); ?></title>
<?php $this->head(); ?>
</head>
<body>
<div class="container">
<?php $this->beginBody(); ?>
<div class="masthead">
<h3 class="muted">My Company</h3>
<div class="navbar fullwidth">
<div class="navbar-inner">
<div class="container">
<?php
$menuItems = array(
array('label' => 'Home', 'url' => array('/site/index')),
array('label' => 'About', 'url' => array('/site/about')),
array('label' => 'Contact', 'url' => array('/site/contact')),
);
if (Yii::$app->user->isGuest) {
$menuItems[] = array('label' => 'Signup', 'url' => array('/site/signup'));
$menuItems[] = array('label' => 'Login', 'url' => array('/site/login'));
}
else {
$menuItems[] = array('label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => array('/site/logout'));
}
echo Menu::widget(array(
'options' => array('class' => 'nav'),
'items' => $menuItems,
));
?>
</div>
</div>
</div>
<!-- /.navbar -->
</div>
<?php
NavBar::begin(array(
'brandLabel' => 'My Company',
'brandUrl' => Yii::$app->homeUrl,
'options' => array(
'class' => 'navbar-inverse navbar-fixed-top',
),
));
$menuItems = array(
array('label' => 'Home', 'url' => array('/site/index')),
array('label' => 'About', 'url' => array('/site/about')),
array('label' => 'Contact', 'url' => array('/site/contact')),
);
if (Yii::$app->user->isGuest) {
$menuItems[] = array('label' => 'Signup', 'url' => array('/site/signup'));
$menuItems[] = array('label' => 'Login', 'url' => array('/site/login'));
} else {
$menuItems[] = array('label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => array('/site/logout'));
}
echo Nav::widget(array(
'options' => array('class' => 'navbar-nav pull-right'),
'items' => $menuItems,
));
NavBar::end();
?>
<div class="container">
<?php echo Breadcrumbs::widget(array(
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : array(),
)); ?>
<?php echo Alert::widget()?>
<?php echo $content; ?>
</div>
<hr>
<footer class="footer">
<div class="container">
<p class="pull-left">&copy; My Company <?php echo date('Y'); ?></p>
<p class="pull-right"><?php echo Yii::powered(); ?></p>
</div>
</footer>
<div class="footer">
<p>&copy; My Company <?php echo date('Y'); ?></p>
<p>
<?php echo Yii::powered(); ?>
Template by <a href="http://twitter.github.io/bootstrap/">Twitter Bootstrap</a>
</p>
</div>
<?php $this->endBody(); ?>
</div>
</body>
</html>
<?php $this->endPage(); ?>
<?php
use yii\helpers\Html;
/**
* @var yii\base\View $this
*/
$this->title = 'About';
$this->params['breadcrumbs'][] = $this->title;
?>
<h1><?php echo Html::encode($this->title); ?></h1>
<p>
This is the About page. You may modify the following file to customize its content:
</p>
<div class="site-about">
<h1><?php echo Html::encode($this->title); ?></h1>
<code><?php echo __FILE__; ?></code>
<p>This is the About page. You may modify the following file to customize its content:</p>
<code><?php echo __FILE__; ?></code>
</div>
......@@ -11,24 +11,29 @@ use yii\captcha\Captcha;
$this->title = 'Contact';
$this->params['breadcrumbs'][] = $this->title;
?>
<h1><?php echo Html::encode($this->title); ?></h1>
<div class="site-contact">
<h1><?php echo Html::encode($this->title); ?></h1>
<p>
If you have business inquiries or other questions, please fill out the following form to contact us. Thank you.
</p>
<p>
If you have business inquiries or other questions, please fill out the following form to contact us. Thank you.
</p>
<?php $form = ActiveForm::begin(array(
'options' => array('class' => 'form-horizontal'),
'fieldConfig' => array('inputOptions' => array('class' => 'input-xlarge')),
)); ?>
<?php echo $form->field($model, 'name')->textInput(); ?>
<?php echo $form->field($model, 'email')->textInput(); ?>
<?php echo $form->field($model, 'subject')->textInput(); ?>
<?php echo $form->field($model, 'body')->textArea(array('rows' => 6)); ?>
<?php echo $form->field($model, 'verifyCode')->widget(Captcha::className(), array(
'options' => array('class' => 'input-medium'),
)); ?>
<div class="form-actions">
<?php echo Html::submitButton('Submit', array('class' => 'btn btn-primary')); ?>
<div class="row">
<div class="col-lg-5">
<?php $form = ActiveForm::begin(array('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'),
'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')); ?>
</div>
<?php ActiveForm::end(); ?>
</div>
</div>
<?php ActiveForm::end(); ?>
</div>
......@@ -2,46 +2,52 @@
/**
* @var yii\base\View $this
*/
$this->title = 'Welcome';
$this->title = 'My Yii Application';
?>
<div class="jumbotron">
<h1>Welcome!</h1>
<div class="site-index">
<p class="lead">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus
commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
<a class="btn btn-large btn-success" href="http://www.yiiframework.com">Get started with Yii</a>
</div>
<div class="jumbotron">
<h1>Congratulations!</h1>
<hr>
<p class="lead">You have successfully created your Yii-powered application.</p>
<!-- Example row of columns -->
<div class="row-fluid">
<div class="span4">
<h2>Heading</h2>
<p><a class="btn btn-lg btn-success" href="http://www.yiiframework.com">Get started with Yii</a></p>
</div>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris
condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod.
Donec sed odio dui. </p>
<div class="body-content">
<p><a class="btn" href="#">View details &raquo;</a></p>
</div>
<div class="span4">
<h2>Heading</h2>
<div class="row">
<div class="col-lg-4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris
condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod.
Donec sed odio dui. </p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur.</p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div>
<div class="span4">
<h2>Heading</h2>
<p><a class="btn btn-default" href="http://www.yiiframework.com/doc/">Yii Documentation &raquo;</a></p>
</div>
<div class="col-lg-4">
<h2>Heading</h2>
<p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta
felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum
massa.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur.</p>
<p><a class="btn btn-default" href="http://www.yiiframework.com/forum/">Yii Forum &raquo;</a></p>
</div>
<div class="col-lg-4">
<h2>Heading</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur.</p>
<p><a class="btn btn-default" href="http://www.yiiframework.com/extensions/">Yii Extensions &raquo;</a></p>
</div>
</div>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div>
</div>
......@@ -10,17 +10,24 @@ use yii\widgets\ActiveForm;
$this->title = 'Login';
$this->params['breadcrumbs'][] = $this->title;
?>
<h1><?php echo Html::encode($this->title); ?></h1>
<div class="site-login">
<h1><?php echo Html::encode($this->title); ?></h1>
<p>Please fill out the following fields to login:</p>
<p>Please fill out the following fields to login:</p>
<?php $form = ActiveForm::begin(array('options' => array('class' => 'form-horizontal'))); ?>
<?php echo $form->field($model, 'username')->textInput(); ?>
<?php echo $form->field($model, 'password')->passwordInput(); ?>
<?php echo $form->field($model, 'rememberMe')->checkbox(); ?>
<div class="form-actions">
<?php echo Html::submitButton('Login', array('class' => 'btn btn-primary')); ?>
<div class="row">
<div class="col-lg-5">
<?php $form = ActiveForm::begin(array('id' => 'login-form')); ?>
<?php echo $form->field($model, 'username'); ?>
<?php echo $form->field($model, 'password')->passwordInput(); ?>
<?php echo $form->field($model, 'rememberMe')->checkbox(); ?>
<div style="color:#999;margin:1em 0">
If you forgot your password you can <?php echo Html::a('reset it', array('site/request-password-reset'))?>.
</div>
<div class="form-group">
<?php echo Html::submitButton('Login', array('class' => 'btn btn-primary')); ?>
</div>
<?php ActiveForm::end(); ?>
</div>
</div>
<?php ActiveForm::end(); ?>
<p>If you forgot your password you can <?php echo Html::a('reset it', array('site/request-password-reset'))?>.</p>
\ No newline at end of file
</div>
......@@ -5,18 +5,24 @@ use yii\widgets\ActiveForm;
/**
* @var yii\base\View $this
* @var yii\widgets\ActiveForm $form
* @var frontend\models\User $model
* @var common\models\User $model
*/
$this->title = 'Request password reset';
$this->params['breadcrumbs'][] = $this->title;
?>
<h1><?php echo Html::encode($this->title); ?></h1>
<div class="site-request-password-reset">
<h1><?php echo Html::encode($this->title); ?></h1>
<p>Please fill out your email. A link to reset password will be sent there.</p>
<p>Please fill out your email. A link to reset password will be sent there.</p>
<?php $form = ActiveForm::begin(array('options' => array('class' => 'form-horizontal'))); ?>
<?php echo $form->field($model, 'email')->textInput(); ?>
<div class="form-actions">
<?php echo Html::submitButton('Send', array('class' => 'btn btn-primary')); ?>
<div class="row">
<div class="col-lg-5">
<?php $form = ActiveForm::begin(array('id' => 'request-password-reset-form')); ?>
<?php echo $form->field($model, 'email'); ?>
<div class="form-group">
<?php echo Html::submitButton('Send', array('class' => 'btn btn-primary')); ?>
</div>
<?php ActiveForm::end(); ?>
</div>
</div>
<?php ActiveForm::end(); ?>
</div>
......@@ -10,13 +10,19 @@ use yii\widgets\ActiveForm;
$this->title = 'Reset password';
$this->params['breadcrumbs'][] = $this->title;
?>
<h1><?php echo Html::encode($this->title); ?></h1>
<div class="site-reset-password">
<h1><?php echo Html::encode($this->title); ?></h1>
<p>Please choose your new password:</p>
<p>Please choose your new password:</p>
<?php $form = ActiveForm::begin(array('options' => array('class' => 'form-horizontal'))); ?>
<?php echo $form->field($model, 'password')->passwordInput(); ?>
<div class="form-actions">
<?php echo Html::submitButton('Save', array('class' => 'btn btn-primary')); ?>
<div class="row">
<div class="col-lg-5">
<?php $form = ActiveForm::begin(array('id' => 'reset-password-form')); ?>
<?php echo $form->field($model, 'password')->passwordInput(); ?>
<div class="form-group">
<?php echo Html::submitButton('Save', array('class' => 'btn btn-primary')); ?>
</div>
<?php ActiveForm::end(); ?>
</div>
</div>
<?php ActiveForm::end(); ?>
</div>
......@@ -10,15 +10,21 @@ use yii\widgets\ActiveForm;
$this->title = 'Signup';
$this->params['breadcrumbs'][] = $this->title;
?>
<h1><?php echo Html::encode($this->title); ?></h1>
<div class="site-signup">
<h1><?php echo Html::encode($this->title); ?></h1>
<p>Please fill out the following fields to signup:</p>
<p>Please fill out the following fields to signup:</p>
<?php $form = ActiveForm::begin(array('options' => array('class' => 'form-horizontal'))); ?>
<?php echo $form->field($model, 'username')->textInput(); ?>
<?php echo $form->field($model, 'email')->textInput(); ?>
<?php echo $form->field($model, 'password')->passwordInput(); ?>
<div class="form-actions">
<?php echo Html::submitButton('Signup', array('class' => 'btn btn-primary')); ?>
<div class="row">
<div class="col-lg-5">
<?php $form = ActiveForm::begin(array('id' => 'form-signup')); ?>
<?php echo $form->field($model, 'username'); ?>
<?php echo $form->field($model, 'email'); ?>
<?php echo $form->field($model, 'password')->passwordInput(); ?>
<div class="form-group">
<?php echo Html::submitButton('Signup', array('class' => 'btn btn-primary')); ?>
</div>
<?php ActiveForm::end(); ?>
</div>
</div>
<?php ActiveForm::end(); ?>
</div>
body {
padding-top: 20px;
padding-bottom: 60px;
padding-top: 70px;
}
/* Custom container */
.container {
margin: 0 auto;
max-width: 1000px;
.footer {
border-top: 1px solid #ddd;
margin-top: 30px;
padding-top: 15px;
padding-bottom: 30px;
}
.container > hr {
margin: 60px 0;
}
/* Main marketing message and sign up button */
.jumbotron {
margin: 80px 0;
text-align: center;
}
.jumbotron h1 {
font-size: 100px;
line-height: 1;
}
.jumbotron .lead {
font-size: 24px;
line-height: 1.25;
text-align: center;
background-color: transparent;
}
.jumbotron .btn {
font-size: 21px;
padding: 14px 24px;
}
/* Supporting marketing content */
.marketing {
margin: 60px 0;
}
.marketing p + h4 {
margin-top: 28px;
}
/* Customize the navbar links to be fill the entire space of the .navbar */
.navbar.fullwidth .navbar-inner {
padding: 0;
}
.navbar.fullwidth .nav {
margin: 0;
display: table;
width: 100%;
}
.navbar.fullwidth .nav li {
display: table-cell;
width: 1%;
float: none;
}
.navbar.fullwidth .nav li a {
font-weight: bold;
text-align: center;
border-left: 1px solid rgba(255, 255, 255, .75);
border-right: 1px solid rgba(0, 0, 0, .1);
}
.navbar.fullwidth .nav li:first-child a {
border-left: 0;
border-radius: 3px 0 0 3px;
}
.navbar.fullwidth .nav li:last-child a {
border-right: 0;
border-radius: 0 3px 3px 0;
font-size: 21px;
padding: 14px 24px;
}
......@@ -24,13 +24,13 @@ class Alert extends \yii\bootstrap\Alert
public function init()
{
if ($this->body = \Yii::$app->getSession()->getFlash('error')) {
Html::addCssClass($this->options, 'alert-error');
Html::addCssClass($this->options, 'alert-danger');
} elseif ($this->body = \Yii::$app->getSession()->getFlash('success')) {
Html::addCssClass($this->options, 'alert-success');
} elseif ($this->body = \Yii::$app->getSession()->getFlash('info')) {
Html::addCssClass($this->options, 'alert-info');
} elseif ($this->body = \Yii::$app->getSession()->getFlash('warning')) {
Html::addCssClass($this->options, 'alert-warning');
} else {
$this->_doNotRender = true;
return;
......
......@@ -31,7 +31,7 @@ class SiteController extends Controller
{
$model = new LoginForm();
if ($model->load($_POST) && $model->login()) {
return $this->redirect(array('site/index'));
return $this->goHome();
} else {
return $this->render('login', array(
'model' => $model,
......@@ -42,7 +42,7 @@ class SiteController extends Controller
public function actionLogout()
{
Yii::$app->user->logout();
return $this->redirect(array('site/index'));
return $this->goHome();
}
public function actionContact()
......
<?php
use yii\bootstrap\NavBar;
use yii\helpers\Html;
use yii\widgets\Menu;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
/**
......@@ -14,7 +14,7 @@ app\config\AppAsset::register($this);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta charset="<?php echo Yii::$app->charset; ?>"/>
<title><?php echo Html::encode($this->title); ?></title>
<?php $this->head(); ?>
</head>
......@@ -28,8 +28,8 @@ app\config\AppAsset::register($this);
'class' => 'navbar-inverse navbar-fixed-top',
),
));
echo Menu::widget(array(
'options' => array('class' => 'nav navbar-nav pull-right'),
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')),
......@@ -37,7 +37,8 @@ app\config\AppAsset::register($this);
Yii::$app->user->isGuest ?
array('label' => 'Login', 'url' => array('/site/login')) :
array('label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => array('/site/logout')),
)));
),
));
NavBar::end();
?>
......
......@@ -29,15 +29,15 @@ $this->params['breadcrumbs'][] = $this->title;
<div class="row">
<div class="col-lg-5">
<?php $form = ActiveForm::begin(array('id' => 'contact-form')); ?>
<?php echo $form->field($model, 'name')->textInput(); ?>
<?php echo $form->field($model, 'email')->textInput(); ?>
<?php echo $form->field($model, 'subject')->textInput(); ?>
<?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'),
'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>',
)); ?>
<div class="form-actions">
<div class="form-group">
<?php echo Html::submitButton('Submit', array('class' => 'btn btn-primary')); ?>
</div>
<?php ActiveForm::end(); ?>
......
......@@ -11,7 +11,7 @@ $this->title = 'My Yii Application';
<p class="lead">You have successfully created your Yii-powered application.</p>
<p><a class="btn btn-large btn-success" href="http://www.yiiframework.com">Get started with Yii</a></p>
<p><a class="btn btn-lg btn-success" href="http://www.yiiframework.com">Get started with Yii</a></p>
</div>
<div class="body-content">
......
......@@ -18,13 +18,17 @@ $this->params['breadcrumbs'][] = $this->title;
<div class="row">
<div class="col-lg-3">
<?php $form = ActiveForm::begin(array('id' => 'login-form')); ?>
<?php echo $form->field($model, 'username')->textInput(); ?>
<?php echo $form->field($model, 'username'); ?>
<?php echo $form->field($model, 'password')->passwordInput(); ?>
<?php echo $form->field($model, 'rememberMe')->checkbox(); ?>
<div class="form-actions">
<div class="form-group">
<?php echo Html::submitButton('Login', array('class' => 'btn btn-primary')); ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<div class="col-lg-5" style="color:#999;margin:1em;padding-top:60px">
You may login with <strong>admin/admin</strong> or <strong>demo/demo</strong>.<br>
To modify the username/password, please check out the code <code>app\models\User::$users</code>.
</div>
</div>
</div>
body {
padding-top: 70px;
padding-top: 70px;
}
.footer {
border-top: 1px solid #ddd;
margin-top: 30px;
padding-top: 15px;
padding-bottom: 30px;
border-top: 1px solid #ddd;
margin-top: 30px;
padding-top: 15px;
padding-bottom: 30px;
}
.jumbotron {
text-align: center;
background-color: transparent;
text-align: center;
background-color: transparent;
}
.jumbotron .btn {
font-size: 21px;
padding: 14px 24px;
font-size: 21px;
padding: 14px 24px;
}
......@@ -8,8 +8,8 @@ defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'test');
require_once(__DIR__ . '/../vendor/yiisoft/yii2/yii/Yii.php');
require_once(__DIR__ . '/../vendor/autoload.php');
require_once(__DIR__ . '/../vendor/yiisoft/yii2/yii/Yii.php');
Yii::importNamespaces(require(__DIR__ . '/../vendor/composer/autoload_namespaces.php'));
$config = require(__DIR__ . '/../config/web-test.php');
......
......@@ -4,8 +4,8 @@
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
require(__DIR__ . '/../vendor/yiisoft/yii2/yii/Yii.php');
require(__DIR__ . '/../vendor/autoload.php');
require(__DIR__ . '/../vendor/yiisoft/yii2/yii/Yii.php');
Yii::importNamespaces(require(__DIR__ . '/../vendor/composer/autoload_namespaces.php'));
$config = require(__DIR__ . '/../config/web.php');
......
......@@ -13,8 +13,8 @@ defined('YII_DEBUG') or define('YII_DEBUG', true);
// fcgi doesn't have STDIN defined by default
defined('STDIN') or define('STDIN', fopen('php://stdin', 'r'));
require(__DIR__ . '/vendor/yiisoft/yii2/yii/Yii.php');
require(__DIR__ . '/vendor/autoload.php');
require(__DIR__ . '/vendor/yiisoft/yii2/yii/Yii.php');
Yii::importNamespaces(require(__DIR__ . '/vendor/composer/autoload_namespaces.php'));
$config = require(__DIR__ . '/config/console.php');
......
......@@ -33,7 +33,7 @@ class ClassmapController extends Controller
$mapFile = YII_PATH . '/classes.php';
}
$options = array(
'filter' => function($path) {
'filter' => function ($path) {
if (is_file($path)) {
$file = basename($path);
if ($file[0] < 'A' || $file[0] > 'Z') {
......@@ -49,17 +49,19 @@ class ClassmapController extends Controller
'/debug/',
'/console/',
'/test/',
'/gii/',
),
);
$files = FileHelper::findFiles($root, $options);
$map = array();
foreach ($files as $file) {
if (($pos = strpos($file, $root)) !== 0) {
die("Something wrong: $file");
die("Something wrong: $file\n");
}
$path = str_replace('\\', '/', substr($file, strlen($root)));
$map[] = "\t'yii" . substr(str_replace('/', '\\', $path), 0, -4) . "' => YII_PATH . '$path',";
$map[$path] = "\t'yii" . substr(str_replace('/', '\\', $path), 0, -4) . "' => YII_PATH . '$path',";
}
ksort($map);
$map = implode("\n", $map);
$output = <<<EOD
<?php
......@@ -80,10 +82,10 @@ $map
EOD;
if (is_file($mapFile) && file_get_contents($mapFile) === $output) {
echo "Nothing changed.";
echo "Nothing changed.\n";
} else {
file_put_contents($mapFile, $output);
echo "Class map saved in $mapFile";
echo "Class map saved in $mapFile\n";
}
}
}
Advanced application template
=============================
This template is for large projects developed in teams where backend is divided from frontend, application is deployed
to multiple servers etc. This application template also goes a bit further regarding features and provides essential
database, signup and password restore out of the box.
Installation
------------
### Install via Composer
If you do not have [Composer](http://getcomposer.org/), you may download it from
[http://getcomposer.org/](http://getcomposer.org/) or run the following command on Linux/Unix/MacOS:
~~~
curl -s http://getcomposer.org/installer | php
~~~
You can then install the application using the following command:
~~~
php composer.phar create-project --stability=dev yiisoft/yii2-app-advanced /path/to/yii-application
~~~
Getting started
---------------
After you install the application, you have to conduct the following steps to initialize
the installed application. You only need to do these once for all.
1. Execute the `init` command and select `dev` as environment.
---
php /path/to/yii-application/init
---
2. Create a new database. It is assumed that MySQL InnoDB is used. If not, adjust `console/migrations/m130524_201442_init.php`.
3. In `common/config/params.php` set your database details in `components.db` values.
4. Set document roots of your Web server:
- for frontend `/path/to/yii-application/frontend/web/` and using the URL `http://frontend/`
- for backend `/path/to/yii-application/backend/web/` and using the URL `http://backend/`
Directory structure
-------------------
The root directory contains the following subdirectories:
- `backend` - backend web application.
- `common` - files common to all applications.
- `console` - console application.
- `environments` - environment configs.
- `frontend` - frontend web application.
Root directory contains a set of files.
- `.gitignore` contains a list of directories ignored by git version system. If you need something never get to your source
code repository, add it there.
- `composer.json` - Composer config described in detail below.
- `init` - initialization script described in "Composer config described in detail below".
- `init.bat` - same for Windows.
- `LICENSE.md` - license info. Put your project license there. Especially when opensourcing.
- `README.md` - basic info about installing template. Consider replacing it with information about your project and its
installation.
- `requirements.php` - Yii requirements checker.
- `yii` - console application bootstrap.
- `yii.bat` - same for Windows.
Applications
------------
There are three applications in advanced template: frontend, backend and console. Frontend is typically what is presented
to end user, the project itself. Backend is admin panel, analytics and such functionality. Console is typically used for
cron jobs and low-level server management. Also it's used during application deployment and handles migrations and assets.
There's also a `common` directory that contains files used by more than one application. For example, `User` model.
frontend and backend are both web applications and both contain `web` directory. That's the webroot you should point your
webserver to.
Each application has its own namespace and alias corresponding to its name. Same applies to common directory.
Configuration and environments
------------------------------
There are multiple problems with straightforward approach to configuration:
- Each team member has its own configuration options. Committing such config will affect other team members.
- Production database password and API keys should not end up in repository.
- There are multiple servers: development, testing, production. Each should have its own configuration.
- Defining all configuration options for each case is very repetitive and takes too much time to maintain.
In order to solve these issues Yii introduces environments concept that is very simple. Each environment is represented
by a set of files under `environments` directory. `init` command is used to switch between these. What is really does is
just copying everything from environment directory over the root directory where all applications are.
Typically environment contains application bootstrap files such as `index.php` and config files suffixed with
`-local.php`. These are added to `.gitignore` and never added to source code repository.
In order to avoid duplication configurations are overriding each other. For example, frontend reads configuration in the
following order:
- `frontend/config/main.php`
- `frontend/config/main-local.php`
Parameters are read in the following order:
- `common/config/params.php`
- `common/config/params-local.php`
- `frontend/config/params.php`
- `frontend/config/params-local.php`
The later config file overrides the former.
Another difference is that most application component configurations are moved to params. Since params are read from
`common` as well it allows you to specify database connection in one file and it will be then used for all applications.
Configuring Composer
--------------------
After application template is installed it's a good idea to adjust default `composer.json` that can be found in the root
directory:
```javascript
{
"name": "yiisoft/yii2-app-advanced",
"description": "Yii 2 Advanced Application Template",
"keywords": ["yii", "framework", "advanced", "application template"],
"homepage": "http://www.yiiframework.com/",
"type": "project",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
"minimum-stability": "dev",
"require": {
"php": ">=5.3.0",
"yiisoft/yii2": "dev-master",
"yiisoft/yii2-composer": "dev-master"
},
"scripts": {
"post-create-project-cmd": [
"yii\\composer\\InstallHandler::setPermissions"
]
},
"extra": {
"yii-install-writable": [
"backend/runtime",
"backend/web/assets",
"console/runtime",
"console/migrations",
"frontend/runtime",
"frontend/web/assets"
]
}
}
```
First we're updating basic information. Change `name`, `description`, `keywords`, `homepage` and `support` to match
your project.
Now the interesting part. You can add more packages your application needs to `require` section.
For example, to use markdown helper you need to add `michelf/php-markdown`. All these packages are coming from
[packagist.org](https://packagist.org/) so feel free to browse the website for useful code.
After your `composer.json` is changed you can run `php composer.phar update`, wait till packages are downloaded and
installed and then just use them. Autoloading of classes will be handled automatically.
Basic application template
==========================
This template is a perfect fit for small projects or learning Yii2.
The application has four pages: the homepage, the about page, the contact page and the login page.
The contact page displays a contact form that users can fill in to submit their inquiries to the webmaster,
and the login page allows users to be authenticated before accessing privileged contents.
Installation
------------
If you do not have [Composer](http://getcomposer.org/), you may download it from
[http://getcomposer.org/](http://getcomposer.org/) or run the following command on Linux/Unix/MacOS:
~~~
curl -s http://getcomposer.org/installer | php
~~~
You can then install the Bootstrap Application using the following command:
~~~
php composer.phar create-project --stability=dev yiisoft/yii2-app-basic /path/to/yii-application
~~~
Now set document root directory of your Web server to /path/to/yii-application/web and you should be able to access the application using the URL `http://localhost/`.
Directory structure
-------------------
The basic application does not divide application directories much. Here's the basic structure:
- `commands` - console controllers.
- `config` - configuration.
- `controllers` - web controllers.
- `models` - application models.
- `runtime` - logs, states, file cache.
- `views` - view templates.
- `web` - webroot.
Root directory contains a set of files.
- `.gitignore` contains a list of directories ignored by git version system. If you need something never get to your source
code repository, add it there.
- `codeception.yml` - Codeception config.
- `composer.json` - Composer config described in detail below.
- `LICENSE.md` - license info. Put your project license there. Especially when opensourcing.
- `README.md` - basic info about installing template. Consider replacing it with information about your project and its
installation.
- `requirements.php` - Yii requirements checker.
- `yii` - console application bootstrap.
- `yii.bat` - same for Windows.
### config
This directory contains configuration files:
- `AppAsset.php` - definition of application assets such as CSS, JavaScript etc. Check [Managing assets](assets.md) for
details.
- `console.php` - console application configuration.
- `params.php` - common application parameters.
- `web.php` - web application configuration.
- `web-test.php` - web application configuration used when running functional tests.
All these files except `AppAsset.php` are returning arrays used to configure corresponding application properties. Check
[Configuration](configuration.md) guide section for details.
### views
Views directory contains templates your application is using. In the basic template there are:
```
layouts
main.php
site
about.php
contact.php
error.php
index.php
login.php
```
`layouts` contains HTML layouts i.e. page markup except content: doctype, head section, main menu, footer etc.
The rest are typically controller views. By convention these are located in subdirectories matching controller id. For
`SiteController` views are under `site`. Names of the views themselves are typically match controller action names.
Partials are often named starting with underscore.
### web
Directory is a webroot. Typically a webserver is pointed into it.
```
assets
css
index.php
index-test.php
```
`assets` contains published asset files such as CSS, JavaScript etc. Publishing process is automatic so you don't need
to do anything with this directory other than making sure Yii has enough permissions to write to it.
`css` contains plain CSS files and is useful for global CSS that isn't going to be compressed or merged by assets manager.
`index.php` is the main web application bootstrap and is the central entry point for it. `index-test.php` is the entry
point for functional testing.
Configuring Composer
--------------------
After application template is installed it's a good idea to adjust default `composer.json` that can be found in the root
directory:
```javascript
{
"name": "yiisoft/yii2-app-basic",
"description": "Yii 2 Basic Application Template",
"keywords": ["yii", "framework", "basic", "application template"],
"homepage": "http://www.yiiframework.com/",
"type": "project",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
"minimum-stability": "dev",
"require": {
"php": ">=5.3.0",
"yiisoft/yii2": "dev-master",
"yiisoft/yii2-composer": "dev-master"
},
"scripts": {
"post-create-project-cmd": [
"yii\\composer\\InstallHandler::setPermissions"
]
},
"extra": {
"yii-install-writable": [
"runtime",
"web/assets"
],
"yii-install-executable": [
"yii"
]
}
}
```
First we're updating basic information. Change `name`, `description`, `keywords`, `homepage` and `support` to match
your project.
Now the interesting part. You can add more packages your application needs to `require` section.
For example, to use markdown helper you need to add `michelf/php-markdown`. All these packages are coming from
[packagist.org](https://packagist.org/) so feel free to browse the website for useful code.
After your `composer.json` is changed you can run `php composer.phar update`, wait till packages are downloaded and
installed and then just use them. Autoloading of classes will be handled automatically.
Bootstrap widgets
=================
Yii includes support of [Bootstrap 3](http://getbootstrap.com/) markup and components framework out of the box. It is an
excellent framework that allows you to speed up development a lot.
Bootstrap is generally about two parts:
- Basics such as grid system, typography, helper classes and responsive utilities.
- Ready to use components such as menus, pagination, modal boxes, tabs etc.
Basics
------
Yii doesn't wrap bootstrap basics into PHP code since HTML is very simple by itself in this case. You can find details
about using the basics at [bootstrap documentation website](http://getbootstrap.com/css/). Still Yii provides a
convenient way to include bootstrap assets in your pages with a single line added to `AppAsset.php` located in your
`config` directory:
```php
public $depends = array(
'yii\web\YiiAsset',
'yii\bootstrap\BootstrapAsset', // this line
// 'yii\bootstrap\BootstrapThemeAsset' // uncomment to apply bootstrap 2 style to bootstrap 3
);
```
Using bootstrap through Yii asset manager allows you to minimize its resources and combine with your own resources when
needed.
Yii widgets
-----------
Most complex bootstrap components are wrapped into Yii widgets to allow more robust syntax and integrate with
framework features. All widgets belong to `\yii\bootstrap` namespace:
- Alert
- Button
- ButtonDropdown
- ButtonGroup
- Carousel
- Collapse
- Dropdown
- Modal
- Nav
- NavBar
- Progress
- Tabs
Bootstrap with Yii
==================
Yii provides a few ready-to-use application templates. Based on your needs, you may
choose one of them to bootstrap your project.
In the following, we describe how to get started with the "Yii 2 Basic Application Template".
### Install via Composer
If you do not have [Composer](http://getcomposer.org/), you may download it from
[http://getcomposer.org/](http://getcomposer.org/) or run the following command on Linux/Unix/MacOS:
~~~
curl -s http://getcomposer.org/installer | php
~~~
You can then install the Bootstrap Application using the following command:
~~~
php composer.phar create-project --stability=dev yiisoft/yii2-app-basic yii-basic
~~~
Now you should be able to access the Bootstrap Application using the URL `http://localhost/yii-basic/web/`,
assuming `yii-basic` is directly under the document root of your Web server.
As you can see, the application has four pages: the homepage, the about page,
the contact page and the login page. The contact page displays a contact
form that users can fill in to submit their inquiries to the webmaster,
and the login page allows users to be authenticated before accessing privileged contents.
The following diagram shows the directory structure of this application.
~~~
yii-basic/
yii yii command line script for Unix/Linux
yii.bat yii command line script for Windows
requirements.php the requirement checker script
commands/ containing customized yii console commands
config/ containing configuration files
console.php the console application configuration
main.php the Web application configuration
controllers/ containing controller class files
SiteController.php the default controller class
vendor/ containing third-party extensions and libraries
models/ containing model class files
User.php the User model
LoginForm.php the form model for 'login' action
ContactForm.php the form model for 'contact' action
runtime/ containing temporarily generated files
views/ containing controller view and layout files
layouts/ containing layout view files
main.php the base layout shared by all pages
site/ containing view files for the 'site' controller
about.php the view for the 'about' action
contact.php the view for the 'contact' action
index.php the view for the 'index' action
login.php the view for the 'login' action
web/ containing Web-accessible resources
index.php Web application entry script file
assets/ containing published resource files
css/ containing CSS files
~~~
TBD
......@@ -50,7 +50,7 @@ is a summary of the available cache components:
the server doesn't have actual cache support, we can use this cache component. When an actual cache support
is enabled, we can switch to use the corresponding cache component. In both cases, we can use the same
code `Yii::$app->cache->get($key)` to attempt retrieving a piece of data without worrying that
`Yii::$all->cache` might be `null`.
`Yii::$app->cache` might be `null`.
* [[\yii\caching\FileCache]]: uses standard files to store cached data. This is particular suitable
to cache large chunk of data (such as pages).
......@@ -119,7 +119,7 @@ public function getCachedData()
$value = Yii::$app->getCache()->get($key);
if ($value === false) {
$value = /* regenerate value because it is not found in cache and then save it in cache for later use */;
Yii::$app->cache->set($id, $value);
Yii::$app->cache->set($key, $value);
}
return $value;
}
......
Configuration
=============
In Yii application and majority of components have sensible defaults so it's unlikely you spend lots of time configuring
it. Still there are some mandatory options such as database connection you should set up.
How application is configured depends on application template but there are some general principles applying in any case.
Configuring options in bootstrap file
-------------------------------------
For each application in Yii there is at least one bootstrap file. For web applications it's typically `index.php`, for
console applications it's `yii`. Both are doing nearly the same job:
1. Setting common constants.
2. Including Yii itself.
3. Including Composer autoloader.
4. Reading config file into `$config`.
5. Creating new application instance using `$config` and running it.
Bootstrap file is not the part of framework but your application so it's OK to adjust it to fit your application. Typical
adjustments are the value of `YII_DEBUG` that should never be `true` on production and the way config is read.
Configuring application instance
--------------------------------
It was mentioned above that application is configured in bootstrap file when its instance is created. Config is typically
stored in a PHP file in `/config` directory of the application and looks like the following:
```php
<?php
return array(
'id' => 'applicationId',
'basePath' => dirname(__DIR__),
'components' => array(
// ...
),
'params' => require(__DIR__ . '/params.php'),
);
```
In the above array keys are names of application properties. Depending on application type you can check properties of
either `\yii\web\Application` or `\yii\console\Application`. Both are extended from `\yii\base\Application`.
> Note that you can configure not only public class properties but anything accessible via setter. For example, to
configure runtime path you can use key named `runtimePath`. There's no such property in the application class but
since there's a corresponding setter named `setRuntimePath` it will be properly configured.
Configuring application components
----------------------------------
Majority of Yii functionality are application components. These are attached to application via its `components` property:
```php
<?php
return array(
'id' => 'applicationId',
'basePath' => dirname(__DIR__),
'components' => array(
'cache' => array(
'class' => 'yii\caching\FileCache',
),
'user' => array(
'identityClass' => 'app\models\User',
),
'errorHandler' => array(
'errorAction' => 'site/error',
),
'log' => array(
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => array(
array(
'class' => 'yii\log\FileTarget',
'levels' => array('error', 'warning'),
),
),
),
),
// ...
);
```
In the above four components are configured: `cache`, `user`, `errorHandler`, `log`. Each entry key is a component ID
and the value is the configuration array. ID is used to access the component like `\Yii::$app->myComponent`.
Configuration array has one special key named `class` that sets component class. The rest of the keys and values are used
to configure component properties in the same way as top-level keys are used to configure application properties.
Each application has predefined set of the components. In case of configuring one of these `class` key is omitted and
application default class is used instead. You can check `registerCoreComponents` method of the application you are using
to get a list of component IDs and corresponding classes.
Note that Yii is smart enough to configure the component when it's actually used i.e. if `cache` is never used it will
not be instantiated and configured at all.
Setting component defaults classwide
------------------------------------
TBD
......@@ -59,7 +59,7 @@ If user isn't specifying any route i.e. using URL like `http://example.com/`, Yi
used. It is determined by [[\yii\web\Application::defaultRoute]] method and is `site` by default meaning that `SiteController`
will be loaded.
A controller has a default action. When the user request does not specify which action to execute by usign an URL such as
A controller has a default action. When the user request does not specify which action to execute by using an URL such as
`http://example.com/?r=site`, the default action will be executed. By default, the default action is named as `index`.
It can be changed by setting the [[\yii\base\Controller::defaultAction]] property.
......@@ -187,4 +187,4 @@ Catching all incoming requests
See also
--------
- [Console](console.md)
\ No newline at end of file
- [Console](console.md)
Debug toolbar and debugger
==========================
Yii2 includes a handy toolbar to aid faster development and debugging as well as debugger. Toolbar displays information
about currently opened page while using debugger you can analyze data collected before.
Installing and configuring
--------------------------
How to use it
-------------
Creating your own panels
------------------------
Error Handling
==============
Error handling in Yii is different from plain PHP. First of all, all non-fatal errors are converted to exceptions so
you can use `try`-`catch` to work with these. Second, even fatal errors are rendered in a nice way. In debug mode that
means you have a trace and a piece of code where it happened so it takes less time to analyze and fix it.
Working with forms
==================
......@@ -7,9 +7,15 @@ Getting started
===============
- [Installation](installation.md)
- [Bootstrap with Yii](bootstrap.md)
- [Configuration](configuration.md)
Application templates
=====================
- [Basic](apps-basic.md)
- [Advanced](apps-advanced.md)
- [Creating your own application template](apps-own.md)
Base concepts
=============
......@@ -41,18 +47,27 @@ Security and access control
- [Security](security.md)
- Role based access control
Data providers, lists and grids
===============================
- Overview
- Data providers
- Grids
- Lists
Toolbox
=======
- [Automatic Code Generation](gii.md)
- Debug toolbar
- [Debug toolbar and debugger](debugger.md)
- [Error Handling](error.md)
- [Logging](logging.md)
More
====
- [Form](form.md)
- [Bootstrap widgets](bootstrap-widgets.md)
- [Working with forms](form.md)
- [Model validation reference](validation.md)
- [Caching](caching.md)
- [Internationalization](i18n.md)
......@@ -60,5 +75,6 @@ More
- [Theming](theming.md)
- [Console Application](console.md)
- [Performance Tuning](performance.md)
- [Managing assets](assets.md)
- [Testing](testing.md)
- [Upgrading from 1.1 to 2.0](upgrade-from-v1.md)
......@@ -4,7 +4,15 @@ Installation
Installing via Composer
-----------------------
The recommended way of installing Yii is by using Composer package manager.
The recommended way of installing Yii is by using [Composer](http://getcomposer.org/) package manager. If you do not
have it, you may download it from [http://getcomposer.org/](http://getcomposer.org/) or run the following command:
```
curl -s http://getcomposer.org/installer | php
```
Yii provides a few ready-to-use application templates. Based on your needs, you may choose one of them to bootstrap
your project.
There are two application templates available:
......@@ -12,7 +20,8 @@ There are two application templates available:
- [advanced](https://github.com/yiisoft/yii2-app-advanced) that is a set of frontend, backend, console, common
(shared code) and environments support.
Please refer to installation instructions on these pages.
Please refer to installation instructions on these pages. To read more about ideas behing these application templates and
proposed usage refer to [basic application template](apps-basic.md) and [advanced application template](apps-advanced.md).
Installing from zip
-------------------
......@@ -108,7 +117,10 @@ server {
set $fsn $fastcgi_script_name;
}
#for php-cgi
fastcgi_pass 127.0.0.1:9000;
#for php-fpm
#fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fsn;
......
......@@ -143,6 +143,9 @@ class EmployeeController extends \yii\web\Controller
}
```
In the example above we are using [Active Record](active-record.md). For basic form models it's rarely needed to
use scenarios since form model is typically used for a single form.
Validation
----------
......
......@@ -5,7 +5,7 @@ Yii is a high-performance, component-based PHP framework for developing
large-scale Web applications rapidly. It enables maximum reusability in Web
programming and can significantly accelerate your Web application development
process. The name Yii (pronounced `Yee` or `[ji:]`) is an acronym for
"**Yes It Is!**".
**Yes It Is!**.
Requirements
......@@ -37,4 +37,4 @@ How does Yii Compare with Other Frameworks?
- Syntax and overall development usability are taken seriously.
- Performance is one of the key goals.
- We are constantly watching other web frameworks out there and getting the best ideas in. Initial Yii release was heavily
influenced by Ruby on Rails. Still, we aren't blindly copying anyhting.
\ No newline at end of file
influenced by Ruby on Rails. Still, we aren't blindly copying anything.
......@@ -116,7 +116,7 @@ If a whole page remains relative static, we can use the page caching approach to
save the rendering cost for the whole page.
### Leveraging HTTP to save procesing time and bandwidth
### Leveraging HTTP to save processing time and bandwidth
TBD
......@@ -134,7 +134,7 @@ but it may slow down INSERT, UPDATE or DELETE queries.
For complex queries, it is recommended to create a database view for it instead
of issuing the queries inside the PHP code and asking DBMS to parse them repetitively.
Do not overuse Active Record. Although Active Record is good at modelling data
Do not overuse Active Record. Although Active Record is good at modeling data
in an OOP fashion, it actually degrades performance due to the fact that it needs
to create one or several objects to represent each row of query result. For data
intensive applications, using DAO or database APIs at lower level could be
......
......@@ -169,7 +169,7 @@ WHERE (`status` = 10) AND (`title` LIKE '%yii%')
Order
-----
For odering results `orderBy` and `addOrderBy` could be used:
For ordering results `orderBy` and `addOrderBy` could be used:
```php
$query->orderBy(array(
......
Security
========
Hashing and verifyig passwords
Hashing and verifying passwords
------------------------------
It is important not to store passwords in plain text but, contrary to popular belief, just using `md5` or `sha1` to
......@@ -78,4 +78,10 @@ Securing Cookies
----------------
- validation
- httpOnly
\ No newline at end of file
- httpOnly
See also
--------
- [Views security](view.md#security)
......@@ -149,11 +149,12 @@ $content = Yii::$app->view->renderFile($viewFile, $params);
Also, there is no more `CClientScript` in Yii 2.0. The `View` class has taken over its role
with significant improvements. For more details, please see the "assets" subsection.
While Yii 2.0 continues to use PHP as its main template language, it comes with built-in
support for two popular template engines: Smarty and Twig. The Prado template engine is
While Yii 2.0 continues to use PHP as its main template language, it comes with two official extensions
adding support for two popular template engines: Smarty and Twig. The Prado template engine is
no longer supported. To use these template engines, you just need to use `tpl` as the file
extension for your Smarty views, or `twig` for Twig views. You may also configure the
`View::renderers` property to use other template engines.
`View::renderers` property to use other template engines. See [Using template engines](template.md) section
of the guide for more details.
Models
......@@ -209,6 +210,8 @@ Because of the above change, Yii 2.0 no longer has "safe" and "unsafe" validator
If your model only has one scenario (very common), you do not have to overwrite `scenarios()`,
and everything will still work like the 1.1 way.
To learn more about Yii 2.0 models refer to [Models](model.md) section of the guide.
Controllers
-----------
......@@ -216,6 +219,7 @@ Controllers
The `render()` and `renderPartial()` methods now return the rendering results instead of directly
sending them out. You have to `echo` them explicitly, e.g., `echo $this->render(...);`.
To learn more about Yii 2.0 controllers refer to [Controller](controller.md) section of the guide.
Widgets
-------
......@@ -331,14 +335,14 @@ introduces the class map (via `Yii::$classMap`) to overcome this difficulty.
------------
Yii 2.0 introduces the *field* concept for building a form using `ActiveForm`. A field
is a container consisting of a label, an input, and an error message. It is represented
as an `ActiveField` object. Using fields, you can build a form more cleanly than before:
is a container consisting of a label, an input, an error message, and/or a hint text.
It is represented as an `ActiveField` object. Using fields, you can build a form more cleanly than before:
```php
<?php $form = yii\widgets\ActiveForm::begin(); ?>
<?php echo $form->field($model, 'username')->textInput(); ?>
<?php echo $form->field($model, 'username'); ?>
<?php echo $form->field($model, 'password')->passwordInput(); ?>
<div class="form-actions">
<div class="form-group">
<?php echo Html::submitButton('Login'); ?>
</div>
<?php yii\widgets\ActiveForm::end(); ?>
......
Yii 2.0 Public Preview - Composer Installer
======================
===========================================
Thank you for choosing Yii - a high-performance component-based PHP framework.
......@@ -13,33 +13,32 @@ without prior notices. **Yii 2.0 is not ready for production use yet.**
This is the yii2 composer installer.
Installation
----------------
------------
This extension offers you enhanced composer handling for your yii2-project. It will therefor require you to use composer.
`
php composer.phar require yiisoft/yii2-composer *
php composer.phar require yiisoft/yii2-composer "*"
`
*Note: You might have to run `php composer.phar selfupdate` before using this extension.*
Usage & Documentation
-----------
---------------------
This extensions allows you to hook to certain composer events and prepare your yii2-app for usage.
After the package is installed, the composer.json file has to be modified to enable this extension.
To see it in action take a look at the example apps in the repository:
[Basic](https://github.com/suralc/yii2/blob/master/apps/basic/composer.json#L27)
[Advanced](https://github.com/suralc/yii2/blob/extensions-readme/apps/advanced/composer.json)
However it might be useful to read through the official composer [documentation](http://getcomposer.org/doc/articles/scripts.md) to understand what this extension can to for you and what it can't.
You can also use this as an template to create your own composer additions to ease development and deployment of your app.
- [Basic](https://github.com/suralc/yii2/blob/master/apps/basic/composer.json#L27)
- [Advanced](https://github.com/suralc/yii2/blob/extensions-readme/apps/advanced/composer.json)
However it might be useful to read through the official composer [documentation](http://getcomposer.org/doc/articles/scripts.md)
to understand what this extension can do for you and what it can't.
You can also use this as a template to create your own composer additions to ease development and deployment of your app.
Yii 2.0 Public Preview - JUI Extension
======================
======================================
Thank you for choosing Yii - a high-performance component-based PHP framework.
......@@ -13,13 +13,15 @@ without prior notices. **Yii 2.0 is not ready for production use yet.**
This is the yii2-jui extension.
Installation
----------------
------------
The preferred way to install this extension is [composer](http://getcomposer.org/download/).
Either run
```
php composer.phar require yiisoft/yii2-jui*
php composer.phar require yiisoft/yii2-jui "*"
```
or add
......@@ -33,23 +35,21 @@ to the require section of your composer.json.
Usage & Documentation
-----------
---------------------
This extension provides multiple widgets to work with jquery.ui, as well as a set of compatible jquery.ui files.
You can use these widgets in your view files after you have registered the corresponding assets.
Example:
-----------
```php
echo ProgressBar::widget(array(
'clientOptions' => array(
'value' => 75,
),
));
```
For further instructions refer to the guide (once it is finished)
For further instructions refer to the yii guide.
......@@ -5,88 +5,64 @@
* @license http://www.yiiframework.com/license/
*/
namespace yii\bootstrap;
namespace yii\jui;
use Yii;
use yii\base\InvalidConfigException;
use yii\base\Model;
use yii\helpers\Html;
/**
* Typeahead renders a typehead bootstrap javascript component.
* Slider renders a slider jQuery UI widget.
*
* For example,
* For example:
*
* ```php
* echo TypeAhead::widget(array(
* echo Slider::widget(array(
* 'model' => $model,
* 'attribute' => 'country',
* 'attribute' => 'amount',
* 'clientOptions' => array(
* 'source' => array('USA', 'ESP'),
* 'min' => 1,
* 'max' => 10,
* ),
* ));
* ```
*
* The following example will use the name property instead
* The following example will use the name property instead:
*
* ```php
* echo TypeAhead::widget(array(
* 'name' => 'country',
* echo Slider::widget(array(
* 'name' => 'amount',
* 'clientOptions' => array(
* 'source' => array('USA', 'ESP'),
* 'min' => 1,
* 'max' => 10,
* ),
* ));
*```
*
* @see http://twitter.github.io/bootstrap/javascript.html#typeahead
* @author Antonio Ramirez <amigo.cobos@gmail.com>
* @see http://api.jqueryui.com/slider/
* @author Alexander Makarov <sam@rmcreative.ru>
* @since 2.0
*/
class Typeahead extends Widget
class Slider extends InputWidget
{
/**
* @var \yii\base\Model the data model that this widget is associated with
*/
public $model;
/**
* @var string the model attribute that this widget is associated with
*/
public $attribute;
/**
* @var string the input name. This must be set if [[model]] and [[attribute]] are not set.
*/
public $name;
/**
* @var string the input value.
*/
public $value;
/**
* Renders the widget
* Renders the widget.
*/
public function run()
{
echo $this->renderField();
$this->registerPlugin('typeahead');
echo $this->renderWidget();
$this->registerWidget('slider', SliderAsset::className());
}
/**
* Renders the TypeAhead field. If [[model]] has been specified then it will render an active field.
* If [[model]] is null or not from an [[Model]] instance, then the field will be rendered according to
* the [[name]] attribute.
* @return string the rendering result
* @throws InvalidConfigException when none of the required attributes are set to render the textInput.
* That is, if [[model]] and [[attribute]] are not set, then [[name]] is required.
* Renders the Slider widget.
* @return string the rendering result.
*/
public function renderField()
public function renderWidget()
{
if ($this->model instanceof Model && $this->attribute !== null) {
if ($this->hasModel()) {
return Html::activeTextInput($this->model, $this->attribute, $this->options);
} elseif ($this->name !== null) {
return Html::textInput($this->name, $this->value, $this->options);
} else {
throw new InvalidConfigException("Either 'name' or 'model' and 'attribute' properties must be specified.");
return Html::textInput($this->name, $this->value, $this->options);
}
}
}
Yii 2.0 Public Preview - Mutex Extension
======================
========================================
Thank you for choosing Yii - a high-performance component-based PHP framework.
......@@ -13,13 +13,15 @@ without prior notices. **Yii 2.0 is not ready for production use yet.**
This is the yii2-mutex extension.
Installation
----------------
------------
The prefered way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
php composer.phar require yiisoft/yii2-mutex *
php composer.phar require yiisoft/yii2-mutex "*"
```
or add
......@@ -33,12 +35,8 @@ to the require section of your composer.json.
Usage & Documentation
-----------
---------------------
This component can be used to perform actions similar to the concept of [mutual exclusion](http://en.wikipedia.org/wiki/Mutual_exclusion).
For concrete examples and advanced usage refer to the guide.
For concrete examples and advanced usage refer to the yii guide.
Yii 2.0 Public Preview - Smarty View Renderer
======================
=============================================
Thank you for choosing Yii - a high-performance component-based PHP framework.
......@@ -13,13 +13,15 @@ without prior notices. **Yii 2.0 is not ready for production use yet.**
This is the yii2-smarty extension.
Installation
----------------
------------
The prefered way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
php composer.phar require yiisoft/yii2-smarty *
php composer.phar require yiisoft/yii2-smarty "*"
```
or add
......@@ -33,12 +35,13 @@ to the require section of your composer.json.
Usage & Documentation
-----------
---------------------
This extension has to be registered prior to usage.
To enable this view renderer add it to the $rendereres property of your view object.
Example:
Example:
```php
<?php
// config.php
......@@ -58,8 +61,4 @@ return array(
);
```
For further instructions refer to the related section in the guide.
For further instructions refer to the related section in the yii guide.
Yii 2.0 Public Preview - Twig View Renderer
======================
===========================================
Thank you for choosing Yii - a high-performance component-based PHP framework.
......@@ -13,13 +13,15 @@ without prior notices. **Yii 2.0 is not ready for production use yet.**
This is the yii2-twig extension.
Installation
----------------
------------
The prefered way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
php composer.phar require yiisoft/yii2-twig *
php composer.phar require yiisoft/yii2-twig "*"
```
or add
......@@ -33,7 +35,7 @@ to the require section of your composer.json.
Usage & Documentation
-----------
---------------------
This extension has to be registered prior to usage.
To enable this view renderer add it to the $rendereres property of your view object.
......@@ -59,6 +61,4 @@ return array(
);
```
For further instructions refer to the related section in the guide.
For further instructions refer to the related section in the yii guide.
......@@ -20,7 +20,7 @@
"minimum-stability": "dev",
"require": {
"yiisoft/yii2": "*",
"twig/twig": "v1.13.2"
"twig/twig": "1.13.*"
},
"autoload": {
"psr-0": { "yii\\twig": "" }
......
......@@ -46,7 +46,7 @@ class ViewRenderer extends BaseViewRenderer
'cache' => Yii::getAlias($this->cachePath),
), $this->options));
$this->twig->addFunction('path', new \Twig_Function_Function(function($path, $args = array()){
$this->twig->addFunction('path', new \Twig_Function_Function(function ($path, $args = array()) {
return Html::url(array_merge(array($path), $args));
}));
......
......@@ -66,7 +66,9 @@
"require": {
"php": ">=5.3.7",
"ext-mbstring": "*",
"lib-pcre": "*"
"lib-pcre": "*",
"phpspec/php-diff": "1.0.*",
"ezyang/htmlpurifier": "4.5.*"
},
"autoload": {
"psr-0": { "yii\\": "/" }
......@@ -74,7 +76,6 @@
"suggest": {
"michelf/php-markdown": "Required by Markdown.",
"twig/twig": "Required by TwigViewRenderer.",
"smarty/smarty": "Required by SmartyViewRenderer.",
"ezyang/htmlpurifier": "Required by HtmlPurifier."
"smarty/smarty": "Required by SmartyViewRenderer."
}
}
......@@ -22,5 +22,5 @@ class Yii extends \yii\YiiBase
{
}
spl_autoload_register(array('Yii', 'autoload'));
spl_autoload_register(array('Yii', 'autoload'), true, true);
Yii::$classMap = include(__DIR__ . '/classes.php');
......@@ -69,11 +69,6 @@ class YiiBase
*/
public static $classMap = array();
/**
* @var boolean whether to search PHP include_path when autoloading unknown classes.
* You may want to turn this off if you are also using autoloaders from other libraries.
*/
public static $enableIncludePath = false;
/**
* @var \yii\console\Application|\yii\web\Application the application instance
*/
public static $app;
......@@ -338,12 +333,11 @@ class YiiBase
* 3. If the class is named in PEAR style (e.g. `PHPUnit_Framework_TestCase`),
* it will attempt to include the file associated with the corresponding path alias
* (e.g. `@PHPUnit/Framework/TestCase.php`);
* 4. Search PHP include_path for the actual class file if [[enableIncludePath]] is true;
* 5. If none of the above succeeds, do nothing so that other autoloaders have the chance
* to load the class.
*
* @param string $className the fully qualified class name without leading backslash
* @return boolean whether the class has been loaded successfully
* This autoloader allows loading classes that follow the [PSR-0 standard](http://www.php-fig.org/psr/0/).
* Therefor a path alias has to be defined for each top-level namespace.
*
* @param string $className the fully qualified class name without a leading backslash "\"
* @throws UnknownClassException if the class does not exist in the class file
*/
public static function autoload($className)
......@@ -363,32 +357,21 @@ class YiiBase
$path = str_replace('_', '/', $className) . '.php';
}
// try via path alias first
if (strpos($path, '/') !== false) {
$fullPath = static::getAlias('@' . $path, false);
if ($fullPath !== false && is_file($fullPath)) {
$classFile = $fullPath;
// try loading via path alias
if (strpos($path, '/') === false) {
return;
} else {
$classFile = static::getAlias('@' . $path, false);
if ($classFile === false || !is_file($classFile)) {
return;
}
}
// search include_path
if (!isset($classFile) && self::$enableIncludePath && ($fullPath = stream_resolve_include_path($path)) !== false) {
$classFile = $fullPath;
}
if (!isset($classFile)) {
// return here, not trying to include a file to
// let other autoloaders try loading the class
return false;
}
}
include($classFile);
if (class_exists($className, false) || interface_exists($className, false) ||
function_exists('trait_exists') && trait_exists($className, false)) {
return true;
} else {
if (!class_exists($className, false) && !interface_exists($className, false) &&
(!function_exists('trait_exists') || !trait_exists($className, false))) {
throw new UnknownClassException("Unable to find '$className' in file: $classFile");
}
}
......
......@@ -32,7 +32,7 @@
* // ... private functions and properties go here ...
*
* return pub;
* });
* })(jQuery);
* ~~~
*
* Using this structure, you can define public and private functions/properties for a module.
......
......@@ -169,7 +169,7 @@ abstract class Application extends Module
public function registerErrorHandlers()
{
if (YII_ENABLE_ERROR_HANDLER) {
//ini_set('display_errors', 0);
ini_set('display_errors', 0);
set_exception_handler(array($this, 'handleException'));
set_error_handler(array($this, 'handleError'), error_reporting());
if ($this->memoryReserveSize > 0) {
......@@ -419,7 +419,6 @@ abstract class Application extends Module
// disable error capturing to avoid recursive errors while handling exceptions
restore_error_handler();
restore_exception_handler();
try {
$this->logException($exception);
if (($handler = $this->getErrorHandler()) !== null) {
......@@ -472,7 +471,7 @@ abstract class Application extends Module
foreach ($trace as $frame) {
if ($frame['function'] == '__toString') {
$this->handleException($exception);
return;
exit(1);
}
}
......
......@@ -114,17 +114,15 @@ class ErrorHandler extends Component
'exception' => $exception,
));
}
} elseif ($exception instanceof Arrayable) {
$response->data = $exception;
} else {
if ($exception instanceof Arrayable) {
$response->data = $exception;
} else {
$response->data = array(
'type' => get_class($exception),
'name' => 'Exception',
'message' => $exception->getMessage(),
'code' => $exception->getCode(),
);
}
$response->data = array(
'type' => get_class($exception),
'name' => 'Exception',
'message' => $exception->getMessage(),
'code' => $exception->getCode(),
);
}
if ($exception instanceof HttpException) {
......
......@@ -314,11 +314,7 @@ class Formatter extends Component
protected function normalizeDatetimeValue($value)
{
if (is_string($value)) {
if (ctype_digit($value) || $value[0] === '-' && ctype_digit(substr($value, 1))) {
return (int)$value;
} else {
return strtotime($value);
}
return is_numeric($value) || $value === '' ? (int)$value : strtotime($value);
} elseif ($value instanceof DateTime) {
return $value->getTimestamp();
} else {
......
......@@ -8,7 +8,7 @@
namespace yii\base;
/**
* UnknownClassException represents an exception caused by accessing an unknown class.
* UnknownClassException represents an exception caused by using an unknown class.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
......
......@@ -577,7 +577,7 @@ class View extends Component
$bundle = $am->getBundle($name);
$this->assetBundles[$name] = false;
$bundle->registerAssets($this);
$this->assetBundles[$name] = true;
$this->assetBundles[$name] = $bundle;
} elseif ($this->assetBundles[$name] === false) {
throw new InvalidConfigException("A circular dependency is detected for bundle '$name'.");
}
......@@ -654,7 +654,7 @@ class View extends Component
* - [[POS_BEGIN]]: at the beginning of the body section
* - [[POS_END]]: at the end of the body section
* - [[POS_READY]]: enclosed within jQuery(document).ready(). This is the default value.
* Note that by using this position, the method will automatically register the jquery js file.
* Note that by using this position, the method will automatically register the jQuery js file.
*
* @param string $key the key that identifies the JS code block. If null, it will use
* $js as the key. If two JS code blocks are registered with the same key, the latter
......
......@@ -18,6 +18,5 @@ class BootstrapAsset extends AssetBundle
public $sourcePath = '@yii/bootstrap/assets';
public $css = array(
'css/bootstrap.css',
'css/bootstrap-glyphicons.css',
);
}
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\bootstrap;
use yii\web\AssetBundle;
/**
* Bootstrap 2 theme for Bootstrap 3
*
* @author Alexander Makarov <sam@rmcreative.ru>
* @since 2.0
*/
class BootstrapThemeAsset extends AssetBundle
{
public $sourcePath = '@yii/bootstrap/assets';
public $css = array(
'css/bootstrap-theme.css',
);
public $depends = array(
'yii\bootstrap\BootstrapAsset',
);
}
......@@ -17,7 +17,7 @@ use yii\helpers\Html;
* ```php
* echo Button::widget(array(
* 'label' => 'Action',
* 'options' => array('class' => 'btn-large'),
* 'options' => array('class' => 'btn-lg'),
* ));
* ```
* @see http://twitter.github.io/bootstrap/javascript.html#buttons
......
......@@ -21,16 +21,14 @@ use yii\helpers\Html;
class Dropdown extends Widget
{
/**
* @var array list of menu items in the dropdown. Each array element represents a single
* menu with the following structure:
* @var array list of menu items in the dropdown. Each array element can be either an HTML string,
* or an array representing a single menu with the following structure:
*
* - label: string, required, the label of the item link
* - url: string, optional, the url of the item link. Defaults to "#".
* - visible: boolean, optional, whether this menu item is visible. Defaults to true.
* - linkOptions: array, optional, the HTML attributes of the item link.
* - options: array, optional, the HTML attributes of the item.
* - items: array, optional, the dropdown items configuration array. if `items` is set, then `url` of the parent
* item will be ignored and automatically set to "#"
*
* @see https://github.com/twitter/bootstrap/issues/5050#issuecomment-11741727
*/
public $items = array();
/**
......@@ -67,7 +65,11 @@ class Dropdown extends Widget
protected function renderItems($items)
{
$lines = array();
foreach ($items as $item) {
foreach ($items as $i => $item) {
if (isset($item['visible']) && !$item['visible']) {
unset($items[$i]);
continue;
}
if (is_string($item)) {
$lines[] = $item;
continue;
......@@ -79,13 +81,7 @@ class Dropdown extends Widget
$options = ArrayHelper::getValue($item, 'options', array());
$linkOptions = ArrayHelper::getValue($item, 'linkOptions', array());
$linkOptions['tabindex'] = '-1';
if (isset($item['items'])) {
Html::addCssClass($options, 'dropdown-submenu');
$content = Html::a($label, '#', $linkOptions) . $this->renderItems($item['items']);
} else {
$content = Html::a($label, ArrayHelper::getValue($item, 'url', '#'), $linkOptions);
}
$content = Html::a($label, ArrayHelper::getValue($item, 'url', '#'), $linkOptions);
$lines[] = Html::tag('li', $content, $options);
}
......
......@@ -88,6 +88,8 @@ class Modal extends Widget
echo $this->renderToggleButton() . "\n";
echo Html::beginTag('div', $this->options) . "\n";
echo Html::beginTag('div', array('class' => 'modal-dialog')) . "\n";
echo Html::beginTag('div', array('class' => 'modal-content')) . "\n";
echo $this->renderHeader() . "\n";
echo $this->renderBodyBegin() . "\n";
}
......@@ -99,6 +101,8 @@ class Modal extends Widget
{
echo "\n" . $this->renderBodyEnd();
echo "\n" . $this->renderFooter();
echo "\n" . Html::endTag('div'); // modal-content
echo "\n" . Html::endTag('div'); // modal-dialog
echo "\n" . Html::endTag('div');
$this->registerPlugin('modal');
......@@ -195,7 +199,9 @@ class Modal extends Widget
protected function initOptions()
{
$this->options = array_merge(array(
'class' => 'modal hide',
'class' => 'fade',
'role' => 'dialog',
'tabindex' => -1,
), $this->options);
Html::addCssClass($this->options, 'modal');
......
......@@ -7,6 +7,7 @@
namespace yii\bootstrap;
use Yii;
use yii\base\InvalidConfigException;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
......@@ -21,9 +22,8 @@ use yii\helpers\Html;
* 'items' => array(
* array(
* 'label' => 'Home',
* 'url' => '/',
* 'url' => array('site/index'),
* 'linkOptions' => array(...),
* 'active' => true,
* ),
* array(
* 'label' => 'Dropdown',
......@@ -60,10 +60,11 @@ class Nav extends Widget
*
* - label: string, required, the nav item label.
* - url: optional, the item's URL. Defaults to "#".
* - visible: boolean, optional, whether this menu item is visible. Defaults to true.
* - linkOptions: array, optional, the HTML attributes of the item's link.
* - options: array, optional, the HTML attributes of the item container (LI).
* - active: boolean, optional, whether the item should be on active state or not.
* - dropdown: array|string, optional, the configuration array for creating a [[Dropdown]] widget,
* - items: array|string, optional, the configuration array for creating a [[Dropdown]] widget,
* or a string representing the dropdown menu. Note that Bootstrap does not support sub-dropdown menus.
*/
public $items = array();
......@@ -71,6 +72,26 @@ class Nav extends Widget
* @var boolean whether the nav items labels should be HTML-encoded.
*/
public $encodeLabels = true;
/**
* @var boolean whether to automatically activate items according to whether their route setting
* matches the currently requested route.
* @see isItemActive
*/
public $activateItems = true;
/**
* @var string the route used to determine if a menu item is active or not.
* If not set, it will use the route of the current request.
* @see params
* @see isItemActive
*/
public $route;
/**
* @var array the parameters used to determine if a menu item is active or not.
* If not set, it will use `$_GET`.
* @see route
* @see isItemActive
*/
public $params;
/**
......@@ -79,6 +100,12 @@ class Nav extends Widget
public function init()
{
parent::init();
if ($this->route === null && Yii::$app->controller !== null) {
$this->route = Yii::$app->controller->getRoute();
}
if ($this->params === null) {
$this->params = $_GET;
}
Html::addCssClass($this->options, 'nav');
}
......@@ -97,7 +124,11 @@ class Nav extends Widget
public function renderItems()
{
$items = array();
foreach ($this->items as $item) {
foreach ($this->items as $i => $item) {
if (isset($item['visible']) && !$item['visible']) {
unset($items[$i]);
continue;
}
$items[] = $this->renderItem($item);
}
......@@ -124,7 +155,13 @@ class Nav extends Widget
$url = Html::url(ArrayHelper::getValue($item, 'url', '#'));
$linkOptions = ArrayHelper::getValue($item, 'linkOptions', array());
if (ArrayHelper::getValue($item, 'active')) {
if (isset($item['active'])) {
$active = ArrayHelper::remove($item, 'active', false);
} else {
$active = $this->isItemActive($item);
}
if ($active) {
Html::addCssClass($options, 'active');
}
......@@ -144,4 +181,38 @@ class Nav extends Widget
return Html::tag('li', Html::a($label, $url, $linkOptions) . $items, $options);
}
/**
* Checks whether a menu item is active.
* This is done by checking if [[route]] and [[params]] match that specified in the `url` option of the menu item.
* When the `url` option of a menu item is specified in terms of an array, its first element is treated
* as the route for the item and the rest of the elements are the associated parameters.
* Only when its route and parameters match [[route]] and [[params]], respectively, will a menu item
* be considered active.
* @param array $item the menu item to be checked
* @return boolean whether the menu item is active
*/
protected function isItemActive($item)
{
if (isset($item['url']) && is_array($item['url']) && isset($item['url'][0])) {
$route = $item['url'][0];
if ($route[0] !== '/' && Yii::$app->controller) {
$route = Yii::$app->controller->module->getUniqueId() . '/' . $route;
}
if (ltrim($route, '/') !== $this->route) {
return false;
}
unset($item['url']['#']);
if (count($item['url']) > 1) {
foreach (array_splice($item['url'], 1) as $name => $value) {
if (!isset($this->params[$name]) || $this->params[$name] != $value) {
return false;
}
}
}
return true;
}
return false;
}
}
......@@ -21,7 +21,7 @@ use yii\helpers\Html;
* use yii\widgets\Menu;
*
* NavBar::begin(array('brandLabel' => 'NavBar Test'));
* echo Menu::widget(array(
* echo Nav::widget(array(
* 'items' => array(
* array('label' => 'Home', 'url' => array('/site/index')),
* array('label' => 'About', 'url' => array('/site/about')),
......@@ -37,11 +37,7 @@ use yii\helpers\Html;
class NavBar extends Widget
{
/**
* @var boolean whether to enable a collapsing responsive navbar.
*/
public $responsive = true;
/**
* @var string the text of the brand.
* @var string the text of the brand. Note that this is not HTML-encoded.
* @see http://twitter.github.io/bootstrap/components.html#navbar
*/
public $brandLabel;
......@@ -55,6 +51,7 @@ class NavBar extends Widget
*/
public $brandOptions = array();
public $screenReaderToggleText = 'Toggle navigation';
/**
* Initializes the widget.
......@@ -63,18 +60,23 @@ class NavBar extends Widget
{
parent::init();
$this->clientOptions = false;
Html::addCssClass($this->options, 'navbar');
Html::addCssClass($this->options, 'navbar navbar-default');
Html::addCssClass($this->brandOptions, 'navbar-brand');
echo Html::beginTag('div', $this->options);
if ($this->responsive) {
echo Html::beginTag('div', array('class' => 'container'));
echo $this->renderToggleButton();
echo Html::beginTag('div', array('class' => 'nav-collapse collapse navbar-responsive-collapse'));
if (empty($this->options['role'])) {
$this->options['role'] = 'navigation';
}
echo Html::beginTag('nav', $this->options);
echo Html::beginTag('div', array('class' => 'container'));
echo Html::beginTag('div', array('class' => 'navbar-header'));
echo $this->renderToggleButton();
if ($this->brandLabel !== null) {
echo Html::a($this->brandLabel, $this->brandUrl, $this->brandOptions);
}
echo Html::endTag('div');
echo Html::beginTag('div', array('class' => 'collapse navbar-collapse navbar-ex1-collapse'));
}
/**
......@@ -82,11 +84,10 @@ class NavBar extends Widget
*/
public function run()
{
if ($this->responsive) {
echo Html::endTag('div');
echo Html::endTag('div');
}
echo Html::endTag('div');
echo Html::endTag('div');
echo Html::endTag('nav');
BootstrapPluginAsset::register($this->getView());
}
......@@ -97,10 +98,11 @@ class NavBar extends Widget
protected function renderToggleButton()
{
$bar = Html::tag('span', '', array('class' => 'icon-bar'));
return Html::button("{$bar}\n{$bar}\n{$bar}", array(
$screenReader = '<span class="sr-only">'.$this->screenReaderToggleText.'</span>';
return Html::button("{$screenReader}\n{$bar}\n{$bar}\n{$bar}", array(
'class' => 'navbar-toggle',
'data-toggle' => 'collapse',
'data-target' => '.navbar-responsive-collapse',
'data-target' => '.navbar-ex1-collapse',
));
}
}
@font-face{font-family:'Glyphicons Halflings';src:url('../fonts/glyphiconshalflings-regular.eot');src:url('../fonts/glyphiconshalflings-regular.eot?#iefix') format('embedded-opentype'),url('../fonts/glyphiconshalflings-regular.woff') format('woff'),url('../fonts/glyphiconshalflings-regular.ttf') format('truetype'),url('../fonts/glyphiconshalflings-regular.svg#glyphicons_halflingsregular') format('svg')}.glyphicon:before{font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-plus:before{content:"\002b"}.glyphicon-minus:before{content:"\2212"}.glyphicon-asterisk:before{content:"\002a"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-euro:before{content:"\20ac"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse:before{content:"\e159"}.glyphicon-collapse-top:before{content:"\e160"}
/* This beautiful CSS-File has been crafted with LESS (lesscss.org) and compiled by simpLESS (wearekiss.com/simpless) */
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment