- Enh #3636: Hide menu container tag with empty items in `yii\widgets\Menu` (arturf)
- Enh #3643: Improved Mime-Type detection by using the `mime.types` file from apache http project to dected mime types by file extension (cebe, pavel-voronin, trejder)
- Enh #3773: Added `FileValidator::mimeTypes` to support validating MIME types of files (Ragazzo)
- Enh #3774: Added `FileValidator::checkExtensionByMimeType` to support validating file types against file mime-types (Ragazzo)
- Enh: Added support for using sub-queries when building a DB query with `IN` condition (qiangxue)
- Enh: Supported adding a new response formatter without the need to reconfigure existing formatters (qiangxue)
- Enh: Added `yii\web\UrlManager::addRules()` to simplify adding new URL rules (qiangxue)
...
...
@@ -109,6 +110,7 @@ Yii Framework 2 Change Log
- Chg #3640: All cookies are now httpOnly by default in order to increase overall security (samdark)
- Chg #3687: Default `sourceLanguage` and `language` are now `en-US` in order for i18n formatter to work correctly (samdark)
- Chg #3804: Added `fileinfo` PHP extension to the basic requirement of Yii (Ragazzo)
- Chg #3866: `FileValidator::types` attribute changed to `FileValidator::extensions` (Ragazzo)
- Chg: Replaced `clearAll()` and `clearAllAssignments()` in `yii\rbac\ManagerInterface` with `removeAll()`, `removeAllRoles()`, `removeAllPermissions()`, `removeAllRules()` and `removeAllAssignments()` (qiangxue)
- Chg: Added `$user` as the first parameter of `yii\rbac\Rule::execute()` (qiangxue)
- Chg: `yii\grid\DataColumn::getDataCellValue()` visibility is now `public` to allow accessing the value from a GridView directly (cebe)
@@ -29,7 +29,13 @@ class FileValidator extends Validator
* extensions are allowed.
* @see wrongType
*/
public$types;
public$extensions;
/**
*
* @var boolean whether to check file type (extension) with mime-type. If extension produced by
* file mime-type check differs from uploaded file extension, file will be counted as not valid.
*/
public$checkExtensionByMimeType=true;
/**
* @var array|string a list of file MIME types that are allowed to be uploaded.
* This can be either an array or a string consisting of file MIME types
...
...
@@ -88,13 +94,13 @@ class FileValidator extends Validator
public$tooSmall;
/**
* @var string the error message used when the uploaded file has an extension name
* that is not listed in [[types]]. You may use the following tokens in the message:
* that is not listed in [[extensions]]. You may use the following tokens in the message:
*
* - {attribute}: the attribute name
* - {file}: the uploaded file name
* - {extensions}: the list of the allowed extensions.
*/
public$wrongType;
public$wrongExtension;
/**
* @var string the error message used if the count of multiple uploads exceeds limit.
* You may use the following tokens in the message:
...
...
@@ -130,8 +136,8 @@ class FileValidator extends Validator
if($this->tooMany===null){
$this->tooMany=Yii::t('yii','You can upload at most {limit, number} {limit, plural, one{file} other{files}}.');
}
if($this->wrongType===null){
$this->wrongType=Yii::t('yii','Only files with these extensions are allowed: {extensions}.');
if($this->wrongExtension===null){
$this->wrongExtension=Yii::t('yii','Only files with these extensions are allowed: {extensions}.');
}
if($this->tooBig===null){
$this->tooBig=Yii::t('yii','The file "{file}" is too big. Its size cannot exceed {limit, number} {limit, plural, one{byte} other{bytes}}.');
...
...
@@ -139,8 +145,8 @@ class FileValidator extends Validator
if($this->tooSmall===null){
$this->tooSmall=Yii::t('yii','The file "{file}" is too small. Its size cannot be smaller than {limit, number} {limit, plural, one{byte} other{bytes}}.');