【问题标题】:elfinder (a Javascript file manager plugin) bind action not fire in connector.phpelfinder(一个 Javascript 文件管理器插件)绑定操作未在 connector.php 中触发
【发布时间】:2016-05-23 05:39:53
【问题描述】:
function log() {
    $data = array(
        'folder_id' => 1,
        'user_id' => 1
    );

    $this->Folder_model->share($data);
}
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
}

function album() {
    $opts = array(
        'bind' => array(
            'upload.presave' => array(
                'Plugin.AutoResize.onUpLoadPreSave'
            )
        ),
        'roots' => array(
            array(
                'driver' => 'LocalFileSystem',
                'alias' => 'Home',
                'path' => 'uploads/album/' . $this->user_id . '/',
                'URL' => site_url('uploads/album/' . $this->user_id),
                'uploadDeny' => array('all'),
                'uploadAllow' => array('image/jpeg', 'image/gif', 'image/png', 'image/bmp'),
                'uploadOrder' => array('deny', 'allow'),
                'accessControl' => array($this, 'access'),
                'plugin' => array(
                    'AutoResize' => array(
                        'enable' => true,
                        'maxWidth' => 2100,
                        'maxHeight' => 1500,
                        'quality' => 100
                    )
                ),
                'bind' => array(
                    'mkdir mkfile rename duplicate upload rm paste' => array($this, 'log')
                )
            )
        )
    );

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

上面是连接器的类,其中album是前端Jquery中使用的连接器路径。

问题是,既然访问控制可以使用array($this, 'access')触发函数,那么bind中array($this, 'log')的语法应该是正确的吧?

但是,我检查了每个动作都不能触发绑定功能,有什么办法调试吗?非常感谢

【问题讨论】:

    标签: javascript php jquery bind elfinder


    【解决方案1】:

    您不能在根选项中使用bind。

    function album() {
        $opts = array(
            'bind' => array(
                'upload.presave' => array(
                    'Plugin.AutoResize.onUpLoadPreSave'
                ),
                'mkdir mkfile rename duplicate upload rm paste' => array(
                    array($this, 'log')
                )
            ),
            'roots' => array(
                array(
                    'driver' => 'LocalFileSystem',
                    'alias' => 'Home',
                    'path' => 'uploads/album/' . $this->user_id . '/',
                    'URL' => site_url('uploads/album/' . $this->user_id),
                    'uploadDeny' => array('all'),
                    'uploadAllow' => array('image/jpeg', 'image/gif', 'image/png', 'image/bmp'),
                    'uploadOrder' => array('deny', 'allow'),
                    'accessControl' => array($this, 'access'),
                    'plugin' => array(
                        'AutoResize' => array(
                            'enable' => true,
                            'maxWidth' => 2100,
                            'maxHeight' => 1500,
                            'quality' => 100
                        )
                    )
                )
            )
        );
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-04
      • 1970-01-01
      • 1970-01-01
      • 2015-09-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多