diff --git a/CHANGE.md b/CHANGE.md
index 92bee02..6cf9ff0 100644
--- a/CHANGE.md
+++ b/CHANGE.md
@@ -3,8 +3,11 @@ Change Log: `yii2-widget-fileinput`
## Version 1.1.1
-**Date:** 03-Sep-2021
+**Date:** 28-Jun-2022
+- (enh #186): New property `autoFileTypeParsing` for parsing file types.
+- (enh #185): Add Uzbek (Cyrillic) language translations.
+- (enh #184): Add Uzbek (Cyrillic) language in messages config.
- (enh #180): Enhancements to support Bootstrap v5.x.
- (bug #179): Support translations for language codes with hyphen.
diff --git a/LICENSE.md b/LICENSE.md
index d745e18..04b0288 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -1,4 +1,4 @@
-Copyright (c) 2014 - 2021, Kartik Visweswaran
+Copyright (c) 2014 - 2022, Kartik Visweswaran
Krajee.com
All rights reserved.
diff --git a/composer.json b/composer.json
index e682b4b..49d52c5 100644
--- a/composer.json
+++ b/composer.json
@@ -13,8 +13,8 @@
}
],
"require": {
- "kartik-v/yii2-krajee-base": ">=3.0.1",
- "kartik-v/bootstrap-fileinput": ">=5.0.0"
+ "kartik-v/yii2-krajee-base": ">=3.0.5",
+ "kartik-v/bootstrap-fileinput": ">=5.5.0"
},
"autoload": {
"psr-4": {
diff --git a/src/BaseAsset.php b/src/BaseAsset.php
index 3ee6be2..e786b51 100644
--- a/src/BaseAsset.php
+++ b/src/BaseAsset.php
@@ -1,7 +1,7 @@
options, 'multiple') && !ArrayHelper::getValue($this->pluginOptions, 'uploadUrl')) {
+ if (ArrayHelper::getValue($this->options, 'multiple') && !ArrayHelper::getValue($this->pluginOptions,
+ 'uploadUrl')) {
$hasModel = $this->hasModel();
if ($hasModel && strpos($this->attribute, '[]') === false) {
$this->attribute .= '[]';
@@ -117,28 +134,29 @@ protected function initWidget()
}
}
$input = $this->getInput('fileInput');
- $script = 'document.getElementById("' . $this->options['id'] . '").className.replace(/\bfile-loading\b/,"");';
+ $script = 'document.getElementById("'.$this->options['id'].'").className.replace(/\bfile-loading\b/,"");';
if ($this->showMessage) {
$validation = ArrayHelper::getValue($this->pluginOptions, 'showPreview', true) ?
Yii::t('fileinput', 'file preview and multiple file upload') :
Yii::t('fileinput', 'multiple file upload');
- $message = '' . Yii::t('fileinput', 'Note:') . ' ' .
+ $message = ''.Yii::t('fileinput', 'Note:').' '.
Yii::t(
'fileinput',
'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.',
['validation' => $validation]
);
- $content = Html::tag('div', $message, $this->messageOptions) . "";
- $input .= "\n" . $this->validateIE($content);
+ $content = Html::tag('div', $message, $this->messageOptions)."";
+ $input .= "\n".$this->validateIE($content);
}
+
return $input;
}
/**
* Validates and returns content based on IE browser version validation
*
- * @param string $content
- * @param string $validation
+ * @param string $content
+ * @param string $validation
*
* @return string
*/
@@ -149,6 +167,7 @@ protected function validateIE($content, $validation = 'lt IE 10')
/**
* Registers the asset bundle and locale
+ *
* @throws InvalidConfigException|Exception
*/
public function registerAssetBundle()
@@ -156,6 +175,9 @@ public function registerAssetBundle()
$view = $this->getView();
$this->pluginOptions['resizeImage'] = $this->resizeImages;
$this->pluginOptions['autoOrientImage'] = $this->autoOrientImages;
+ if ($this->autoFileTypeParsing) {
+ FileTypeParserAsset::register($view);
+ }
if ($this->resizeImages || $this->autoOrientImages) {
PiExifAsset::register($view);
}
@@ -178,6 +200,7 @@ public function registerAssetBundle()
/**
* Registers the needed assets
+ *
* @throws InvalidConfigException
*/
public function registerAssets()
diff --git a/src/FileInputAsset.php b/src/FileInputAsset.php
index 32d8ea7..bacddbe 100644
--- a/src/FileInputAsset.php
+++ b/src/FileInputAsset.php
@@ -1,7 +1,7 @@
+ * @since 1.0
+ */
+class FileTypeParserAsset extends BaseAsset
+{
+ /**
+ * @inheritdoc
+ */
+ public function init()
+ {
+ $this->setupAssets('js', ['js/plugins/buffer', 'js/plugins/filetype']);
+ parent::init();
+ }
+}
\ No newline at end of file
diff --git a/src/PiExifAsset.php b/src/PiExifAsset.php
index e635a79..d0f4379 100644
--- a/src/PiExifAsset.php
+++ b/src/PiExifAsset.php
@@ -1,7 +1,7 @@