本文整理汇总了PHP中elFinderConnector类的典型用法代码示例。如果您正苦于以下问题:PHP elFinderConnector类的具体用法?PHP elFinderConnector怎么用?PHP elFinderConnector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了elFinderConnector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleOptions
public function handleOptions()
{
$opts = array('debug' => true, 'roots' => array(array('driver' => 'LocalFileSystem', 'path' => APP_DIR . '/media/' . $_GET["path"], 'URL' => '/www/media/' . $_GET["path"], 'uploadDeny' => array('all'), 'uploadAllow' => array('image', 'text/plain'), 'uploadOrder' => array('deny', 'allow'), 'accessControl' => 'access', 'fileMode' => 0644, 'attributes' => $this->getHiddenDirectories()), array('driver' => 'LocalFileSystem', 'path' => APP_DIR . '/images', 'URL' => '/www/images', 'uploadDeny' => array('all'), 'uploadAllow' => array('image', 'text/plain'), 'uploadOrder' => array('deny', 'allow'), 'accessControl' => 'access', 'fileMode' => 0644, 'attributes' => $this->getHiddenDirectories())));
// Run elFinder
$connector = new \elFinderConnector(new \elFinder($opts));
$connector->run();
}
示例2: load
public function load()
{
error_reporting(0);
// Set E_ALL for debuging
import("@.ORG.elfinder.elFinderConnector");
import("@.ORG.elfinder.elFinder");
import("@.ORG.elfinder.elFinderVolumeDriver");
import("@.ORG.elfinder.elFinderVolumeLocalFileSystem");
//include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderConnector.class.php';
//include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinder.class.php';
//include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeDriver.class.php';
//include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeLocalFileSystem.class.php';
// Required for MySQL storage connector
// include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeMySQL.class.php';
// Required for FTP connector support
// include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeFTP.class.php';
/**
* Simple function to demonstrate how to control file access using "accessControl" callback.
* This method will disable accessing files/folders starting from '.' (dot)
*
* @param string $attr attribute name (read|write|locked|hidden)
* @param string $path file path relative to volume root directory started with directory separator
* @return bool|null
**/
function access($attr, $path, $data, $volume)
{
return strpos(basename($path), '.') === 0 ? !($attr == 'read' || $attr == 'write') : null;
// else elFinder decide it itself
}
$opts = array('roots' => array(array('driver' => 'LocalFileSystem', 'path' => BASE_PATH . '/uploads/', 'URL' => __ROOT__ . '/uploads/', 'accessControl' => 'access')));
// run elFinder
$connector = new elFinderConnector(new elFinder($opts));
$connector->run();
}
示例3: doExecute
/**
* Method to run this controller.
*
* @return mixed
*/
protected function doExecute()
{
// Init some API objects
// ================================================================================
$elfinder_path = WINDWALKER . '/src/Elfinder/Connect/';
include_once $elfinder_path . 'elFinderConnector.class.php';
include_once $elfinder_path . 'elFinder.class.php';
include_once $elfinder_path . 'elFinderVolumeDriver.class.php';
/**
* Simple function to demonstrate how to control file access using "accessControl" callback.
* This method will disable accessing files/folders starting from '.' (dot)
*
* @param string $attr attribute name (read|write|locked|hidden)
* @param string $path file path relative to volume root directory started with directory separator
*
* @return bool|null
*/
function access($attr, $path)
{
// If file/folder begins with '.' (dot). Set read+write to false, other (locked+hidden) set to true
if (strpos(basename($path), '.') === 0) {
return !($attr == 'read' || $attr == 'write');
} else {
return null;
}
}
$opts = array('roots' => array(array('driver' => 'LocalFileSystem', 'path' => JPath::clean(JPATH_ROOT . '/images/quickicons'), 'URL' => JPath::clean(JURI::root(true) . '/images/quickicons/'), 'tmbPath' => JPath::clean(JPATH_ROOT . '/cache/aqi-finder-thumb'), 'tmbURL' => JURI::root(true) . '/cache/aqi-finder-thumb', 'tmp' => JPath::clean(JPATH_ROOT . '/cache/aqi-finder-temp'), 'accessControl' => 'access', 'uploadDeny' => array('text/x-php'), 'disabled' => array('archive', 'extract', 'rename', 'mkfile'))));
foreach ($opts['roots'] as $driver) {
include_once $elfinder_path . 'elFinderVolume' . $driver['driver'] . '.class.php';
}
// Run elFinder
$connector = new elFinderConnector(new elFinder($opts));
$connector->run();
exit;
}
示例4: actionConnector
/**
* Connector action
*/
public function actionConnector()
{
/** @var ElFinderComponent $elFinder */
$elFinder = Yii::$app->get('elFinder');
$roots = array_map(function ($root) {
/** @var Root $root */
return $root->getOptions();
}, $elFinder->roots);
/** @var FilesystemComponent $filesystem */
$filesystem = Yii::$app->get('filesystem');
foreach ($elFinder->filesystems as $key => $root) {
if (is_string($root)) {
$key = $root;
$root = [];
}
$fs = $filesystem->get($key);
if ($fs instanceof Filesystem) {
$defaults = ['driver' => 'Flysystem', 'filesystem' => $fs, 'alias' => Inflector::titleize($key)];
$roots[] = array_merge($defaults, $root);
}
}
$options = array('locale' => '', 'roots' => $roots);
$connector = new \elFinderConnector(new \elFinder($options));
$connector->run();
}
示例5: connector
public function connector()
{
$this->controller->autoRender = false;
$options = Configure::read('Elfinder.options');
$connector = new elFinderConnector(new elFinder($options));
$connector->run();
}
示例6: connector
function connector()
{
$mainframe = JFactory::getApplication();
$params = JComponentHelper::getParams('com_digicom');
$root = $params->get('ftp_source_path', 'digicom');
$folder = JRequest::getVar('folder', $root, 'default', 'path');
if (JString::trim($folder) == "") {
$folder = $root;
} else {
// Ensure that we are always below the root directory
if (strpos($folder, $root) !== 0) {
$folder = $root;
}
}
// Disable debug
JRequest::setVar('debug', false);
$url = JURI::root(true) . '/' . $folder;
$path = JPATH_SITE . '/' . JPath::clean($folder);
JPath::check($path);
include_once JPATH_COMPONENT_ADMINISTRATOR . '/libs/elfinder/elFinderConnector.class.php';
include_once JPATH_COMPONENT_ADMINISTRATOR . '/libs/elfinder/elFinder.class.php';
include_once JPATH_COMPONENT_ADMINISTRATOR . '/libs/elfinder/elFinderVolumeDriver.class.php';
include_once JPATH_COMPONENT_ADMINISTRATOR . '/libs/elfinder/elFinderVolumeLocalFileSystem.class.php';
function access($attr, $path, $data, $volume)
{
$mainframe = JFactory::getApplication();
// Hide PHP files.
$ext = strtolower(JFile::getExt(basename($path)));
if ($ext == 'php') {
return true;
}
// Hide files and folders starting with .
if (strpos(basename($path), '.') === 0 && $attr == 'hidden') {
return true;
}
// Read only access for front-end. Full access for administration section.
switch ($attr) {
case 'read':
return true;
break;
case 'write':
return $mainframe->isSite() ? false : true;
break;
case 'locked':
return $mainframe->isSite() ? true : false;
break;
case 'hidden':
return false;
break;
}
}
if ($mainframe->isAdmin()) {
$permissions = array('read' => true, 'write' => true);
} else {
$permissions = array('read' => true, 'write' => false);
}
$options = array('debug' => false, 'roots' => array(array('driver' => 'LocalFileSystem', 'path' => $path, 'URL' => $url, 'accessControl' => 'access', 'defaults' => $permissions)));
$connector = new elFinderConnector(new elFinder($options));
$connector->run();
}
示例7: run
public function run()
{
$opts = array('bind' => array('mkdir' => 'dirCreated', 'mkfile' => 'mkfileDone', 'rm' => 'rmDone', 'rename' => 'renameDone', 'upload' => 'uploadFileDone'), 'debug' => true, 'roots' => array(array('driver' => 'LocalFileSystem', 'path' => base64_decode(getRParam('elfinder_path')), 'URL' => base64_decode(getRParam('elfinder_url')), 'accessControl' => 'access')));
// run elFinder
$connector = new elFinderConnector(new elFinder($opts));
$connector->run();
}
示例8: run
public function run()
{
$this->options = array_merge($this->options, array('roots' => array(array('driver' => 'LocalFileSystem', 'path' => Yii::getPathOfAlias('webroot.uploads'), 'URL' => Yii::app()->baseUrl . '/uploads/', 'rootAlias' => 'Home'))));
// $fm = new elFinder($this->options);
// $fm->run();
$fm = new elFinderConnector(new elFinder($this->options));
$fm->run();
}
示例9: doExecute
/**
* Method to run this controller.
*
* @return mixed
*/
protected function doExecute()
{
\JLoader::register('elFinderConnector', REMOTEIMAGE_ADMIN . '/src/Elfinder/elFinderConnector.class.php');
\JLoader::register('elFinder', REMOTEIMAGE_ADMIN . '/src/Elfinder/elFinder.class.php');
\JLoader::register('elFinderVolumeDriver', REMOTEIMAGE_ADMIN . '/src/Elfinder/elFinderVolumeDriver.class.php');
\JLoader::register('elFinderVolumeLocalFileSystem', REMOTEIMAGE_ADMIN . '/src/Elfinder/elFinderVolumeLocalFileSystem.class.php');
\JLoader::register('elFinderVolumeFTP', REMOTEIMAGE_ADMIN . '/src/Elfinder/elFinderVolumeFTP.class.php');
// Required for MySQL storage connector
// \JLoader::register('elFinderVolumeMySQL', REMOTEIMAGE_ADMIN . '/src/Elfinder/elFinderVolumeMySQL.class.php');
// \JLoader::register('elFinderVolumeS3', REMOTEIMAGE_ADMIN . '/src/Elfinder/elFinderVolumeS3.class.php');
$params = \JComponentHelper::getParams('com_remoteimage');
$safemode = $params->get('Safemode', true);
$host = $params->get('Ftp_Host', '127.0.0.1');
$port = $params->get('Ftp_Port', 21);
$user = $params->get('Ftp_User');
$pass = $params->get('Ftp_Password');
$active = $params->get('Ftp_Active', 'passive');
$url = $params->get('Ftp_Url');
$root = $params->get('Ftp_Root', '/');
$local_root = $params->get('Local_Root', 'images');
//Patch
$image_resize_enabled = $params->get('Image_Resize_Enabled', true);
$image_max_width = $params->get('Image_Max_Width', 1024);
$image_max_height = $params->get('Image_Max_Height', 1024);
$image_jpeg_quality = $params->get('Image_JPEG_Quality', 95);
// End patch
$roots = array();
if ($params->get('Connection_Local', 1)) {
$roots[] = array('driver' => 'LocalFileSystem', 'path' => JPATH_ROOT . '/' . trim($local_root, '/'), 'URL' => \JURI::root() . trim($local_root, '/'), 'accessControl' => array(__CLASS__, 'access'), 'uploadDeny' => array('text/x-php'), 'icon' => \JURI::root() . 'administrator/components/com_remoteimage/asset/js/elfinder/img/volume_icon_local.png', 'tmbPath' => JPATH_ROOT . '/cache/elfinderThumbs', 'tmbURL' => \JURI::root() . '/cache/elfinderThumbs', 'tmbPathMode' => 0755, 'tmp' => JPATH_ROOT . '/cache/elfinderTemps');
}
if ($params->get('Connection_Ftp', 0)) {
$roots[] = array('driver' => 'FTP', 'alias' => $host, 'host' => $host, 'user' => $user, 'pass' => $pass, 'port' => $port, 'mode' => $active, 'path' => $root, 'timeout' => 10, 'owner' => true, 'tmbPath' => JPATH_ROOT . '/cache/elfinderThumbs', 'tmbURL' => \JURI::root() . '/cache/elfinderThumbs', 'tmp' => JPATH_ROOT . '/cache/elfinderTemps', 'tmbPathMode' => 0755, 'dirMode' => 0755, 'fileMode' => 0644, 'URL' => $url, 'checkSubfolders' => false, 'uploadDeny' => array('text/x-php'), 'icon' => \JURI::root() . 'administrator/components/com_remoteimage/asset/js/elfinder/img/volume_icon_ftp.png');
}
// Safe Mode
if ($safemode) {
foreach ($roots as &$root) {
$root['disabled'] = array('archive', 'extract', 'rename', 'mkfile');
}
}
//Patch
$lResizePluginOption = array();
$lResizePluginOption['enable'] = $image_resize_enabled;
if ($image_max_width > 0) {
$lResizePluginOption['maxWidth'] = $image_max_width;
}
if ($image_max_height > 0) {
$lResizePluginOption['maxHeight'] = $image_max_height;
}
if ($image_jpeg_quality > 0) {
$lResizePluginOption['quality'] = $image_jpeg_quality;
}
$opts = array('plugin' => array('AutoResize' => $lResizePluginOption), 'bind' => array('upload.presave' => array('Plugin.AutoResize.onUpLoadPreSave')), 'roots' => $roots);
// Run elFinder
$connector = new \elFinderConnector(new \elFinder($opts));
$connector->run();
exit;
}
示例10: connector
public function connector()
{
$mainframe = JFactory::getApplication();
$user = JFactory::getUser();
$path = SigProHelper::getPath('site');
$url = SigProHelper::getHTTPPath($path);
JPath::check($path);
include_once JPATH_COMPONENT_ADMINISTRATOR . '/js/elfinder/php/elFinderConnector.class.php';
include_once JPATH_COMPONENT_ADMINISTRATOR . '/js/elfinder/php/elFinder.class.php';
include_once JPATH_COMPONENT_ADMINISTRATOR . '/js/elfinder/php/elFinderVolumeDriver.class.php';
include_once JPATH_COMPONENT_ADMINISTRATOR . '/js/elfinder/php/elFinderVolumeLocalFileSystem.class.php';
function access($attr, $path, $data, $volume)
{
$mainframe = JFactory::getApplication();
$user = JFactory::getUser();
// Hide files and folders starting with .
if (strpos(basename($path), '.') === 0 && $attr == 'hidden') {
return true;
}
// Read only access for front-end. Full access for administration section.
switch ($attr) {
case 'read':
return true;
break;
case 'write':
if ($mainframe->isSite()) {
return false;
} else {
return version_compare(JVERSION, '1.6.0', 'ge') ? $user->authorise('core.create', 'com_sigpro') && $user->authorise('core.edit', 'com_sigpro') && $user->authorise('core.delete', 'com_sigpro') : true;
}
break;
case 'locked':
if ($mainframe->isSite()) {
return true;
} else {
return version_compare(JVERSION, '1.6.0', 'ge') ? !($user->authorise('core.create', 'com_sigpro') && $user->authorise('core.edit', 'com_sigpro') && $user->authorise('core.delete', 'com_sigpro')) : false;
}
break;
case 'hidden':
return false;
break;
}
}
if ($mainframe->isAdmin()) {
if (version_compare(JVERSION, '1.6.0', 'ge')) {
$write = $user->authorise('core.create', 'com_sigpro') && $user->authorise('core.edit', 'com_sigpro') && $user->authorise('core.delete', 'com_sigpro');
} else {
$write = true;
}
$permissions = array('read' => true, 'write' => $write);
} else {
$permissions = array('read' => true, 'write' => false);
}
$options = array('roots' => array(array('driver' => 'LocalFileSystem', 'path' => $path, 'URL' => $url, 'accessControl' => 'access', 'defaults' => $permissions)));
$connector = new elFinderConnector(new elFinder($options));
$connector->run();
}
示例11: run
public function run()
{
require_once dirname(__FILE__) . '/php/elFinderConnector.class.php';
require_once dirname(__FILE__) . '/php/elFinder.class.php';
require_once dirname(__FILE__) . '/php/elFinderVolumeDriver.class.php';
require_once dirname(__FILE__) . '/php/elFinderVolumeLocalFileSystem.class.php';
$connector = new elFinderConnector(new elFinder($this->settings));
$connector->run();
}
示例12: connectorAction
/**
* @return \Zend\View\Model\ViewModel
*/
public function connectorAction()
{
$view = new ViewModel();
$this->getConfig();
$opts = array('roots' => array($this->Config['QuRoots']));
$connector = new \elFinderConnector(new \elFinder($opts));
$connector->run();
$view->setTerminal(true);
return $view;
}
示例13: connector
function connector()
{
include_once APPPATH . 'third_party/finder/elFinderConnector.class.php';
include_once APPPATH . 'third_party/finder/elFinder.class.php';
include_once APPPATH . 'third_party/finder/elFinderVolumeDriver.class.php';
include_once APPPATH . 'third_party/finder/elFinderVolumeLocalFileSystem.class.php';
$opts = array('debug' => true, 'uploadMaxSize' => "5M", 'uploadTotalSize' => "5000000000", 'uploadFileSize' => "5M", 'uploadAllow' => array('image'), 'roots' => array(array('uploadMaxSize' => "5M", 'uploadTotalSize' => "5M", 'uploadFileSize' => "5M", 'driver' => 'LocalFileSystem', 'path' => APPPATH . '../files/', 'URL' => '/files/', 'accessControl' => 'access', 'defaults' => array('read' => true, 'write' => true, 'rm' => true), 'perms' => array('/^test_dir\\/.*/' => array('read' => true, 'write' => true, 'rm' => true)))));
// run elFinder
$connector = new elFinderConnector(new elFinder($opts));
$connector->run();
}
示例14: connector
public function connector()
{
$folder_path = Config::get($this->package . '::folder_path');
$roots = Config::get($this->package . '::roots');
if (!$roots) {
$roots = array(array('driver' => 'LocalFileSystem', 'path' => public_path() . DIRECTORY_SEPARATOR . $folder_path, 'URL' => asset($folder_path), 'accessControl' => Config::get($this->package . '::access')));
}
$opts = array('roots' => $roots);
$connector = new \elFinderConnector(new \elFinder($opts));
$connector->run();
}
示例15: elfRunConnector
public function elfRunConnector($options)
{
$elFinderPath = Yii::getPathOfAlias('application.vendors.elfinder2.php');
require_once $elFinderPath . DIRECTORY_SEPARATOR . 'elFinderConnector.class.php';
require_once $elFinderPath . DIRECTORY_SEPARATOR . 'elFinder.class.php';
require_once $elFinderPath . DIRECTORY_SEPARATOR . 'elFinderVolumeDriver.class.php';
require_once $elFinderPath . DIRECTORY_SEPARATOR . 'elFinderVolumeLocalFileSystem.class.php';
// Defining default connector options
$connector = new elFinderConnector(new elFinder($options));
$connector->run();
}