public function actionConnector() { $this->layout = false; Yii::import('elfinder.vendors.*'); require_once 'elFinder.class.php'; $opts = array('root' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'upload' . DIRECTORY_SEPARATOR, 'URL' => Yii::app()->baseUrl . '/upload/', 'rootAlias' => 'Home'); $fm = new elFinder($opts); $fm->run(); }
public function connector() { $this->show->Title = 'Менеджер файлов'; include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'elFinder.class.php'; // $log = new elFinderLogger(); $opts = array('root' => DOC_ROOT . 'var/custom', 'URL' => BASE_PATH . 'var/custom/', 'rootAlias' => $this->show->Title); $fm = new elFinder($opts); $fm->run(); }
<?php error_reporting(0); // Set E_ALL for debuging if (function_exists('date_default_timezone_set')) { date_default_timezone_set('Europe/Moscow'); } include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'elFinder.class.php'; /** * Simple example how to use logger with elFinder **/ class elFinderLogger implements elFinderILogger { public function log($cmd, $ok, $context, $err = '', $errorData = array()) { if (false != ($fp = fopen('./log.txt', 'a'))) { if ($ok) { $str = "cmd: {$cmd}; OK; context: " . str_replace("\n", '', var_export($context, true)) . "; \n"; } else { $str = "cmd: {$cmd}; FAILED; context: " . str_replace("\n", '', var_export($context, true)) . "; error: {$err}; errorData: " . str_replace("\n", '', var_export($errorData, true)) . "\n"; } fwrite($fp, $str); fclose($fp); } } } $opts = array('root' => '../../files', 'URL' => 'http://localhost/mws/plugins/elfinder/files/', 'rootAlias' => 'Home'); $fm = new elFinder($opts); $fm->run();
public function run() { require_once dirname(__FILE__) . '/php/elFinder.class.php'; $fm = new \elFinder($this->settings); $fm->run(); }
public function run() { $this->options = array_merge($this->options, array('root' => Yii::getPathOfAlias('webroot.data'), 'URL' => Yii::app()->baseUrl . '/data/', 'rootAlias' => 'Home')); $fm = new elFinder($this->options); $fm->run(); }
/** * Файловый менеджер * * @return void */ public function filesAction() { /** * При Ajax и POST - запросах инициализируем PHP-коннектор */ if ($this->_request->isXmlHttpRequest() || $this->_request->isPost()) { error_reporting(0); /** * Основные опции */ $opts = array('root' => DOCUMENT_PATH . '/uploads/files/', 'URL' => '/uploads/files/', 'tmbDir' => '.tmb', 'tmbCrop' => false, 'tmbCleanProb' => 50); /** * Инициализация elFinder */ require_once 'Phorm/Plugin/Elfinder/elFinder.class.php'; $connector = new elFinder($opts); $connector->run(); /** * При GET-запросах инициализируем JS-библиотеку */ } else { /** * Подключаем файлы стилей и скриптов */ $this->_boot->jquery->addJavascriptFile($this->view->BaseUrl() . '/ui/elfinder/js/elfinder.min.js'); $this->_boot->jquery->addJavascriptFile($this->view->BaseUrl() . '/ui/elfinder/js/i18n/elfinder.ru.js'); $this->_boot->jquery->addStylesheet($this->view->BaseUrl() . '/ui/elfinder/css/elfinder.css'); /** * Основные опции */ $opts = array('lang' => 'ru', 'url' => $this->view->siteUrl() . '/control/browser/files/', 'places' => $this->_translate->_(''), 'cssClass' => 'ui-widget-content ui-corner-all', 'closeOnEditorCallback' => false); $opts = ZendX_JQuery::encodeJson($opts); /** * Опции для вставки в различные редакторы */ $editorCallback = ''; if (isset($this->_params['for']) && isset($this->_params['selector'])) { switch ($this->_params['for']) { case 'markitup': $js = 'function(url){ return phorm_ui_selectFileForMarkitup("' . $this->view->escape($this->_params['selector']) . '",url); }'; $opts = substr($opts, 0, -1) . ',editorCallback: ' . $js . '}'; break; case 'tinymce': $this->_boot->jquery->addJavascriptFile($this->view->BaseUrl() . '/ui/tinymce/tiny_mce_popup.js'); $js = 'function(url){ return phorm_ui_selectFileForTinyMCE("' . $this->view->escape($this->_params['selector']) . '",url); }'; $opts = substr($opts, 0, -1) . ',editorCallback: ' . $js . '}'; break; } } /** * Инициализация JS elFinder */ $elementid = 'filemanager'; $this->_boot->jquery->addOnload('$("#' . $elementid . '").elfinder(' . $opts . ').ready(function(){ phorm_ui_correctElfinder(this); })'); $this->view->assign('FileManager', '<div id="' . $elementid . '"></div>'); } }