array( * // key '*' is common additional volume root options * '*' => array(), * // key of elFinder::$netDrivers is each protocol volumes * 'ftp' => array() * ) * * @var array */ private $_optionsNetVolumes; /** * Max number of limits of selectable items (0 - no limit) * * Default value: 1000 * * @var int */ private $_maxTargets; /* * Throw Error on exec() * true need try{} block for $connector->run(); * * Default value: false */ private $_throwErrorOnExec; /** * Send debug to client. * * Default value: false * * @var bool */ private $_debug; /** * Bind callbacks for user actions * * @see https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options-2.1#bind * * @var array */ private $_bind; /** * Finder volume roots * * @var array */ private $_roots; /** * Constructs Finder * * @param mixed $debug */ public function __construct($debug = false) { $this->_debug = $debug; } /** * Sets bind for command actions * * @param string $commandType * @param callable $callback * * @return Options */ public function setBind($commandType, callable $callback) { $this->_bind[$commandType] = $callback; return $this; } /** * Sets debug option * * @param $debug bool * * @return Options */ public function setDebug($debug) { $this->_debug = $debug; return $this; } public function setRoot(FileRoot $root) { $this->_roots[] = $root; return $this; } public function getRoots() { $roots = []; if (isset($this->_roots)) { foreach ($this->_roots as $root) { $roots[] = $root->getOptions(); } } return $roots; } public function getOptions() { $options = []; if (isset($this->_locale)) { $options['locale'] = $this->_locale; } if (isset($this->_defaultMimefile)) { $options['defaultMimefile'] = $this->_defaultMimefile; } if (isset($this->_session)) { $options['session'] = $this->_session; } if (isset($this->_sessionCacheKey)) { $options['sessionCacheKey'] = $this->_sessionCacheKey; } if (isset($this->_base64encodeSessionData)) { $options['base64encodeSessionData'] = $this->_base64encodeSessionData; } if (isset($this->_uploadTempPath)) { $options['uploadTempPath'] = $this->_uploadTempPath; } if (isset($this->_commonTempPath)) { $options['commonTempPath'] = $this->_commonTempPath; } if (isset($this->_connectionFlagsPath)) { $options['connectionFlagsPath'] = $this->_connectionFlagsPath; } if (isset($this->_maxArcFilesSize)) { $options['maxArcFilesSize'] = $this->_maxArcFilesSize; } if (isset($this->_optionsNetVolumes)) { $options['optionsNetVolumes'] = $this->_optionsNetVolumes; } if (isset($this->_maxTargets)) { $options['maxTargets'] = $this->_maxTargets; } if (isset($this->_throwErrorOnExec)) { $options['throwErrorOnExec'] = $this->_throwErrorOnExec; } if (isset($this->_debug)) { $options['debug'] = $this->_debug; } if (isset($this->_bind)) { $options['bind'] = $this->_bind; } $options['roots'] = Hooks::applyFilter(Config::withPrefix('filter_volumes'), $this->getRoots()); $filteredOptions = Hooks::applyFilter('fm_options_filter', $options); $filteredOptions = Hooks::applyFilter(Config::withPrefix('filter_options'), $filteredOptions); if (!empty($filteredOptions['roots'])) { $options = $filteredOptions; } return $options; } }