Skip to content
This repository

Connector configuration options 

nao-pon edited this page · 28 revisions

This is a list of the available options for elFinder connector (PHP part), along with their default values. Options are specified by passing an array with certain keys as first argument to elFinder() class constructor. Example:

<?php

$opts = array(
    'locale' => '',
    'roots'  => array(
        array(
            'driver' => 'LocalFileSystem',
            'path'   => '/path/to/files/',
            'URL'    => 'http://localhost/to/files/'
        )
    )
);

// run elFinder
$connector = new elFinderConnector(new elFinder($opts));
$connector->run();

In the example above we run elFinder using default wrapper elFinderConnector.

Main options

locale

Set locale. Currently only UTF-8 locales are supported. Passed to setLocale PHP function.

Data type: string
Default value: 'en_US.UTF-8'

debug

Send debug to client.

Data type: boolean
Default value: false

bind

Bind callbacks for user actions, similar to jQuery .bind(). Accepts array(key => value) pairs where:
key is a space separated list of actions to bind to;
value is a string with function name to call
OR
value is array($instance, 'method') where $instance is instance of your callback class and method if a name of a function to call (in call $instance->method(...)).

Callback will be called with next parameters $cmd, $result, $args, $elfinder.

Data type: array
Default value: array()
Example:

<?php

/**
 * Simple callback catcher
 *
 * @param  string   $cmd       command name
 * @param  array    $result    command result
 * @param  array    $args      command arguments from client
 * @param  object   $elfinder  elFinder instance
 * @return void|true
 **/
public function mySimpleCallback($cmd, $result, $args, $elfinder) {
    // do something here
}

$opts = array(
    'bind' => array(
        'mkdir mkfile rename duplicate upload rm paste' => 'mySimpleCallback'
    ),
    'roots' => array(...)
);

Simple logging example

roots

Array of arrays with per root settings. This is the only required option.

Data type: array
Default value: array()
Example:

<?php

$opts = array(
    'roots'  => array(
        array(
            'driver' => 'LocalFileSystem',
            'path'   => '/path/to/files/',
            'URL'    => 'http://localhost/to/files/'
        ),
        array(
            'driver' => 'MySQL',
            'host'   => 'localhost',
            'user'   => 'eluser',
            'pass'   => 'elpass',
            'db'     => 'elfinder'
            'path'   => 1,
        ),
        array(
            'driver' => 'FTP',
            'host'   => '192.168.1.1',
            'user'   => 'eluser',
            'pass'   => 'elpass',
            'path'   => '/'
        )
    )
);

See more options below

Root options

TODO import options from https://github.com/Studio-42/elFinder/blob/2.x/php/elFinderVolumeDriver.class.php#L153

Something went wrong with that request. Please try again.