Feature #435
add minimal events (callbacks) for connector
| Status: | Closed | Start date: | 11.02.2011 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 100% |
|
| Category: | Connector | |||
| Target version: | 1.2 |
Description
Related issues
| related to elFinder - Feature #141: Вызов событий после отработки собятия в elFinder | Closed | 22.06.2010 |
Associated revisions
closes #435 - add callbacks for elFinder commands
History
Updated by Alexey Sukhotin over 1 year ago
Here is example of rename callback.
--- elFinder.class.php.orig 2010-03-22 05:05:08.000000000 +0300
+++ elFinder.class.php 2011-02-11 01:10:07.000000000 +0300
@@ -596,9 +618,11 @@
} elseif (!$this->_isUploadAllow($_FILES['upload']['name'][$i], $_FILES['upload']['tmp_name'][$i])) {
$this->_errorData($_FILES['upload']['name'][$i], 'Not allowed file type');
} else {
- $file = $dir.DIRECTORY_SEPARATOR.$_FILES['upload']['name'][$i];
+ $fname = $_FILES['upload']['name'][$i];
+ $this->_fnamereplace($fname);
+ $file = $dir.DIRECTORY_SEPARATOR.$fname;
if (!@move_uploaded_file($_FILES['upload']['tmp_name'][$i], $file)) {
- $this->_errorData($_FILES['upload']['name'][$i], 'Unable to save uploaded file');
+ $this->_errorData($fname, 'Unable to save uploaded file');
} else {
@chmod($file, $this->_options['fileMode']);
$this->_result['select'][] = $this->_hash($file);
@@ -1855,6 +1879,10 @@
return (double)$time[1] + (double)$time[0];
}
+ public function _fnamereplace(&$filename) {
+
+ }
+
}
Using callback:
class elFinderDrupal extends elFinder {
public function _fnamereplace(&$filename) {
$filename = preg_replace('/atv/','bike--', $filename);
}
};
So atv1.jpg will be renamed to bike--1.jpg.
Note: only filename passing to callback, so better pass full path to allow moving to another directory, log to database, etc.
Updated by Dmitry Levashov over 1 year ago
- Status changed from New to Closed
- % Done changed from 0 to 100
Applied in changeset 10e0685ee9f75958d198f432e2880786d25d602f.
Updated by Troex Nevelin 11 months ago
- Target version changed from 1.x to 1.2