Skip to content

Commit

Permalink
pushed to php 8
Browse files Browse the repository at this point in the history
added google drive
  • Loading branch information
simialbi committed Jul 22, 2024
1 parent 3431729 commit 73bcabd
Show file tree
Hide file tree
Showing 19 changed files with 324 additions and 234 deletions.
20 changes: 14 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,35 @@
}
],
"require": {
"php": ">=5.6",
"php": ">=8.0",
"ext-curl": "*",
"ext-gd": "*",
"yiisoft/yii2": "~2.0",
"yiisoft/yii2-bootstrap": "~2.0",
"yiisoft/yii2-jui": "~2.0",
"yiisoft/yii2-jui": "^2.0.0",
"studio-42/elfinder": "~2.1",
"rmrevin/yii2-fontawesome": "~3.0",
"simialbi/yii2-simialbi-base": ">=0.10.2 <1.0 | ^1.0.0"
},
"require-dev": {
"yiisoft/yii2-coding-standards": "~2.0",
"phpunit/phpunit": "^7.5.20"
"phpunit/phpunit": "^10.5.0",
"yiisoft/yii2-bootstrap": "^2.0.0",
"google/apiclient": "^2.17.0"
},
"suggest": {
"ext-fileinfo": "To use mime content type detection in behaviors",
"ext-exif": "To use image rotate behavior",
"simialbi/yii2-widget-crop": "Add an image cropper widget to ElFinderInput"
"google/apiclient": "To use with VolumeDriver GoogleDrive",
"simialbi/yii2-widget-crop": "Add an image cropper widget to ElFinderInput",
"yiisoft/yii2-bootstrap": "To use with bootstrap 3",
"yiisoft/yii2-bootstrap4": "To use with bootstrap 4",
"yiisoft/yii2-bootstrap5": "To use with bootstrap 5"
},
"config": {
"process-timeout": 1800
"process-timeout": 1800,
"allow-plugins": {
"yiisoft/yii2-composer": true
}
},
"autoload": {
"psr-4": {
Expand Down
24 changes: 12 additions & 12 deletions src/ElFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,25 +372,25 @@ class ElFinder extends Component
const FTP_MODE_PASSIVE = 'passive';

/**
* @var ElFinderOptions the main options of elfinder
* @var array|ElFinderOptions the main options of elfinder
*/
public $options = [];
public array|ElFinderOptions $options = [];

/**
* @var ElFinderConfiguration[] Array of arrays with per root settings. This is the only required option.
*/
public $roots = [];
public array $roots = [];

/**
* @var \elFinder api instance
*/
protected $_elfinder;
protected \elFinder $_elfinder;

/**
* @inheritdoc
* @throws InvalidConfigException
*/
public function init()
public function init(): void
{
if (empty($this->roots)) {
throw new InvalidConfigException('roots parameter must be set');
Expand All @@ -404,7 +404,7 @@ public function init()
*
* @return \elFinder
*/
public function getApi()
public function getApi(): \elFinder
{
if (empty($this->_elfinder) || !$this->_elfinder instanceof \elFinder) {
$this->setApi();
Expand All @@ -416,7 +416,7 @@ public function getApi()
/**
* Sets the elFinder API instance
*/
public function setApi()
public function setApi(): void
{
foreach ($this->roots as &$root) {
$root->path = Yii::getAlias($root->path);
Expand Down Expand Up @@ -481,7 +481,7 @@ public function setApi()
* @return boolean
* @throws InvalidConfigException
*/
public function handleApiBeforeEvent($cmd, &$args, $instance, $dstVolume)
public function handleApiBeforeEvent(string $cmd, array &$args, \elFinder $instance, \elFinderVolumeDriver $dstVolume): bool
{
$event = Yii::createObject([
'class' => 'simialbi\yii2\elfinder\base\ElFinderEvent',
Expand Down Expand Up @@ -509,7 +509,7 @@ public function handleApiBeforeEvent($cmd, &$args, $instance, $dstVolume)
* @return boolean
* @throws InvalidConfigException
*/
public function handleApiAfterEvent($cmd, &$result, $args, $instance, $dstVolume)
public function handleApiAfterEvent(string $cmd, array &$result, array $args, \elFinder $instance, \elFinderVolumeDriver $dstVolume): bool
{
$event = Yii::createObject([
'class' => 'simialbi\yii2\elfinder\base\ElFinderEvent',
Expand All @@ -531,22 +531,22 @@ public function handleApiAfterEvent($cmd, &$result, $args, $instance, $dstVolume
*
* @param string $path relative path from the upload target
* @param string $name file name
* @param string $tmpname file tmp name
* @param string $tmpName file tmp name
* @param \elFinder $instance elFinder instance
* @param \elFinderVolumeDriver $dstVolume Volume Driver instance
*
* @return boolean
* @throws InvalidConfigException
*/
public function handleApiUploadBeforeSave(&$path, &$name, $tmpname, $instance, $dstVolume)
public function handleApiUploadBeforeSave(string &$path, string &$name, string $tmpName, \elFinder $instance, \elFinderVolumeDriver $dstVolume): bool
{
$event = Yii::createObject([
'class' => 'simialbi\yii2\elfinder\base\ElFinderEvent',
'name' => self::EVENT_UPLOAD_BEFORE_SAVE,
'sender' => $instance,
'path' => $path,
'fileName' => $name,
'fileTmpName' => $tmpname,
'fileTmpName' => $tmpName,
'volume' => $dstVolume
]);
/* @var $event \simialbi\yii2\elfinder\base\ElFinderEvent */
Expand Down
Loading

0 comments on commit 73bcabd

Please sign in to comment.