Skip to content

Commit

Permalink
version 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MihailDev committed May 11, 2016
1 parent 53a6478 commit bfb35ff
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 146 deletions.
7 changes: 3 additions & 4 deletions Controller.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<?php
/**
* Created by PhpStorm.
* User: Администратор
* Date: 20.01.14
* Time: 13:26
*/

namespace mihaildev\elfinder;

use mihaildev\elfinder\volume\Local;
use Yii;
use yii\helpers\ArrayHelper;

Expand Down Expand Up @@ -39,11 +38,11 @@ public function getOptions()
$root = ['path' => $root];

if(!isset($root['class']))
$root['class'] = 'mihaildev\elfinder\LocalPath';
$root['class'] = Local::className();

$root = Yii::createObject($root);

/** @var \mihaildev\elfinder\LocalPath $root*/
/** @var \mihaildev\elfinder\volume\Local $root*/

if($root->isAvailable())
$this->_options['roots'][] = $root->getRoot();
Expand Down
63 changes: 0 additions & 63 deletions FtpPath.php

This file was deleted.

5 changes: 3 additions & 2 deletions PathController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/

namespace mihaildev\elfinder;
use mihaildev\elfinder\volume\Local;
use yii\helpers\ArrayHelper;
use yii\helpers\Url;
use Yii;
Expand Down Expand Up @@ -49,7 +50,7 @@ public function getOptions()
$root = ['path' => $root];

if(!isset($root['class']))
$root['class'] = 'mihaildev\elfinder\LocalPath';
$root['class'] = Local::className();

if(!empty($subPath)){
if(preg_match("/\./i", $subPath)){
Expand All @@ -64,7 +65,7 @@ public function getOptions()

$root = Yii::createObject($root);

/** @var \mihaildev\elfinder\LocalPath $root*/
/** @var Local $root*/

if($root->isAvailable())
$this->_options['roots'][] = $root->getRoot();
Expand Down
65 changes: 0 additions & 65 deletions S3Path.php

This file was deleted.

2 changes: 2 additions & 0 deletions views/connect.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* @var array $options
*/

define('ELFINDER_IMG_PARENT_URL', \mihaildev\elfinder\Assets::getPathUrl());

// run elFinder
$connector = new elFinderConnector(new elFinder($options));
$connector->run();
15 changes: 10 additions & 5 deletions BasePath.php → volume/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
* Time: 10:39
*/

namespace mihaildev\elfinder;
namespace mihaildev\elfinder\volume;

use Yii;
use yii\base\Component as BaseComponent;
use yii\base\Object;
use yii\helpers\ArrayHelper;
use yii\helpers\FileHelper;


/**
* @property array defaults
*/
class BasePath extends BaseComponent{
class Base extends Object{

public $driver = 'LocalFileSystem';

Expand Down Expand Up @@ -65,6 +66,10 @@ public function getDefaults(){
return $this->_defaults;
}

protected function optionsModifier($options){
return $options;
}

public function getRoot(){
$options['driver'] = $this->driver;
$options['defaults'] = $this->getDefaults();
Expand Down Expand Up @@ -94,8 +99,8 @@ public function getRoot(){
'locked' => false
];

//var_export($options);exit;
$options = $this->optionsModifier($options);

return \yii\helpers\ArrayHelper::merge($options, $this->options);
return ArrayHelper::merge($options, $this->options);
}
}
8 changes: 3 additions & 5 deletions LocalPath.php → volume/Local.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
* Time: 22:47
*/

namespace mihaildev\elfinder;
namespace mihaildev\elfinder\volume;

use Yii;

class LocalPath extends BasePath{
class Local extends Base{
public $path;

public $baseUrl = '@web';
Expand All @@ -28,9 +28,7 @@ public function getRealPath(){
return $path;
}

public function getRoot(){

$options = parent::getRoot();
protected function optionsModifier($options){

$options['path'] = $this->getRealPath();
$options['URL'] = $this->getUrl();
Expand Down
4 changes: 2 additions & 2 deletions UserPath.php → volume/UserPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
* Time: 14:13
*/

namespace mihaildev\elfinder;
namespace mihaildev\elfinder\volume;

use Yii;

class UserPath extends LocalPath{
class UserPath extends Local{
public function isAvailable(){
if(Yii::$app->user->isGuest)
return false;
Expand Down

0 comments on commit bfb35ff

Please sign in to comment.