Yii 1.1.11
The Yii PHP framework team has released version 1.1.11, which includes more than a hundred improvements and bug fixes.
This release is special because it is the first since the Yii code migrated to GitHub . The community took migration very well and went all out , sending in the form of a pull-request new features, fixes, unit tests and translations.
Thank you so much for all this! Especially note: resurtm , DaSourcerer , cebe and suralc .
See a list of changes and new features . If you plan to upgrade, carefully read the instructions .
Well, now let's look at some changes.
HTML5 fields support in
The
Use like this:
A new method to get a normally readable size from a size in bytes:
Now you can return
More details in the manual.
If you used
The parameter will prohibit the use of a prefix
The second parameter (
In addition to the usual page caching, the new version can use CHttpCacheFilter . This filter sends HTTP headers that let the client know that the page content has not changed since the last request. In this case, the server does not need to resend the contents. CHttpCacheFilter is configured as well as COutputCache:
More details in the manual.
If you do not want to use one of the rules for validation when a specific script is active, then you can now specify a parameter
More details in the manual.
The new documentation sets the workflow for translation using github. Tools allow you to get all the changes made since the last translation update. We hope that this will help to keep translations of documents up to date.
This release is special because it is the first since the Yii code migrated to GitHub . The community took migration very well and went all out , sending in the form of a pull-request new features, fixes, unit tests and translations.
Thank you so much for all this! Especially note: resurtm , DaSourcerer , cebe and suralc .
See a list of changes and new features . If you plan to upgrade, carefully read the instructions .
After the release, some unpleasant errors were discovered . We are working.
Well, now let's look at some changes.
HTML5 fields support in CHtml
The
CHtml
new methods have been added:CHtml::dateField()
CHtml::rangeField()
CHtml::numberField()
CHtml::emailField()
CHtml::urlField()
CHtml::activeDateField()
CHtml::activeRangeField()
CHtml::activeNumberField()
CHtml::activeEmailField()
CHtml::activeUrlField()
Use like this:
echo CHtml::activeNumberField($model, 'fieldName');
CFormatter::formatSize()
A new method to get a normally readable size from a size in bytes:
echo Yii::app()->format->formatSize(115969);
// покажет: 113.25 KB
Console Application Return Codes
Now you can return
integer
from the action of the console application. The value will be used as the return code. More details in the manual.
CJavaScript::encode()
and js:
If you used
CJavaScript::encode()
and at the same time took value from a form or URL, your application is most likely vulnerable. To close the vulnerability, you need to pass the second parameter true
:CJavaScript::encode($userInput, true);
The parameter will prohibit the use of a prefix
js:
. If you still need to pass a JavaScript expression, frame it CJavaScriptExpression
:CJavaScript::encode(new CJavaScriptExpression('alert("Yii!");'), true);
The second parameter (
safe
) does not affect the behavior CJavaScriptExpression
.HTTP caching
In addition to the usual page caching, the new version can use CHttpCacheFilter . This filter sends HTTP headers that let the client know that the page content has not changed since the last request. In this case, the server does not need to resend the contents. CHttpCacheFilter is configured as well as COutputCache:
public function filters()
{
return array(
array(
'CHttpCacheFilter + index',
'lastModified'=>Yii::app()->db->createCommand("SELECT MAX(`update_time`) FROM {{post}}")->queryScalar(),
),
);
}
More details in the manual.
Model validation rule exception
If you do not want to use one of the rules for validation when a specific script is active, then you can now specify a parameter
except
containing a list of scripts. The syntax is the same as on
:// строка имён через запятую (пробелы игнорируются)
array('username', 'required', 'except'=>'ignore, this, scenarios, at-all',)
More details in the manual.
New tools and documentation for translators
The new documentation sets the workflow for translation using github. Tools allow you to get all the changes made since the last translation update. We hope that this will help to keep translations of documents up to date.