2015-01-13 4 views
0

Я интегрировал elfinder v2.1 с TinyMce4. Он отлично работает, за исключением того, что путь к изображению elfinder придает tinymce неправильный.Tinymce 4 Elfinder полный путь к картинке

Самое простое решение - использовать абсолютный путь. Я нашел некоторые ресурсы, чтобы сделать это с предыдущей версией 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(); 
?> 

Любой знает, как получить абсолютный URL из elfinder?

Благодаря

ответ

0

Я нашел решение, изменив файл connector.php и добавив опцию псевдонима

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

Таким образом, в отношении доступа к функции, идти до $ неавтоматического и изменять 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) 
     ) 
    ) 
); 

Надеюсь, это поможет.

Смежные вопросы