0

我已将 elfinder v2.1 与 TinyMce4 集成。它工作得很好,只是图像 elfinder 提供给 tinymce 的路径不正确。

最简单的解决方案是使用绝对路径。我发现了一些资源可以使用以前版本的 tinymce (elfinder + tinymce3) 但不是第 4 版。我尝试更改 connector.php 中的一些变量但没有任何成功。这是实际的代码:

<?php

error_reporting(0); // Set E_ALL for debuging

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       // if file/folder begins with '.' (dot)
        ? !($attr == 'read' || $attr == 'write')    // set read+write to false, other (locked+hidden) set to true
        :  null;                                    // else elFinder decide it itself
}

$opts = array(
    // 'debug' => true,
    'roots' => array(
        array(
            'driver'        => 'LocalFileSystem',   // driver for accessing file system (REQUIRED)
            'path'          => '../files/',         // path to files (REQUIRED)
            'URL'           => dirname($_SERVER['PHP_SELF']) . '/../files/', // URL to files (REQUIRED)
            'accessControl' => 'access'             // disable and hide dot starting files (OPTIONAL)
        )
    )
);

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

任何人都知道如何从 elfinder 检索绝对网址?

谢谢

4

1 回答 1

0

我通过修改 connector.php 文件并添加别名选项找到了解决方案

见:https ://github.com/Studio-42/elFinder/wiki/Connector-configuration-options

因此,在函数访问中,转到 $opt 并修改 URL 和别名,如下所示:

$opts = array(
    // 'debug' => true,
    'roots' => array(
        array(
            'driver'        => 'LocalFileSystem',   // driver for accessing file system (REQUIRED)
            'path'          => '../files/',         // path to files (REQUIRED)
            'URL'           => 'absolutepath/to/elfinder/files/', // URL to files (REQUIRED)
            'alias'         => 'absolutepath/to/elfinder/files/',
            'accessControl' => 'access'             // disable and hide dot starting files (OPTIONAL)
        )
    )
);

希望它可以提供帮助。

于 2015-01-13T15:08:40.267 回答