public function elFinderDrupal::__construct in elFinder file manager 8.2
File
- src/Controller/elFinderDrupal.php, line 14
- elFinder conenctor class
Class
- elFinderDrupal
- @file
Namespace
Drupal\elfinder\Controller
Code
public function __construct($opts) {
$this->time = $this
->utime();
$this->debug = isset($opts['debug']) && $opts['debug'] ? true : false;
setlocale(LC_ALL, !empty($opts['locale']) ? $opts['locale'] : 'en_US.UTF-8');
if (!empty($opts['bind']) && is_array($opts['bind'])) {
foreach ($opts['bind'] as $cmd => $handler) {
$this
->bind($cmd, $handler);
}
}
if (!isset($opts['roots']) || !is_array($opts['roots'])) {
$opts['roots'] = array();
}
if (method_exists($this, 'getNetVolumes')) {
foreach ($this
->getNetVolumes() as $root) {
$opts['roots'][] = $root;
}
}
foreach ($opts['roots'] as $i => $o) {
$class = 'elFinderVolume' . (isset($o['driver']) ? $o['driver'] : '');
if (class_exists($class)) {
$volume = new $class();
if ($volume
->mount($o)) {
$id = $volume
->id();
$this->volumes[$id] = $volume;
if (!$this->default && $volume
->isReadable()) {
$this->default = $this->volumes[$id];
}
}
else {
$this->mountErrors[] = 'Driver "' . $class . '" : ' . implode(' ', $volume
->error());
}
}
else {
$this->mountErrors[] = 'Driver "' . $class . '" does not exists';
}
}
$this->loaded = !empty($this->default);
$this->commands['desc'] = array(
'target' => TRUE,
'content' => FALSE,
);
$this->commands['owner'] = array(
'target' => TRUE,
'content' => FALSE,
);
$this->commands['downloadcount'] = array(
'target' => TRUE,
);
}