PluginProbe ʕ •ᴥ•ʔ
File Manager Pro – Filester / 1.8
File Manager Pro – Filester v1.8
2.1.1 trunk 1.6.1 1.7.6 1.8 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 2.0 2.0.1 2.0.2 2.1.0
filester / includes / File_manager / lib / php / elFinderPlugin.php
filester / includes / File_manager / lib / php Last commit date
.tmp 2 years ago editors 2 years ago libs 2 years ago plugins 2 years ago resources 2 years ago MySQLStorage.sql 2 years ago autoload.php 2 years ago elFinder.class.php 2 years ago elFinderConnector.class.php 2 years ago elFinderFlysystemGoogleDriveNetmount.php 2 years ago elFinderPlugin.php 2 years ago elFinderSession.php 2 years ago elFinderSessionInterface.php 2 years ago elFinderVolumeBox.class.php 2 years ago elFinderVolumeDriver.class.php 2 years ago elFinderVolumeDropbox.class.php 2 years ago elFinderVolumeDropbox2.class.php 2 years ago elFinderVolumeFTP.class.php 2 years ago elFinderVolumeGoogleDrive.class.php 2 years ago elFinderVolumeGroup.class.php 2 years ago elFinderVolumeLocalFileSystem.class.php 2 years ago elFinderVolumeMySQL.class.php 2 years ago elFinderVolumeOneDrive.class.php 2 years ago elFinderVolumeSFTPphpseclib.class.php 2 years ago elFinderVolumeTrash.class.php 2 years ago elFinderVolumeTrashMySQL.class.php 2 years ago index.php 2 years ago mime.types 2 years ago
elFinderPlugin.php
114 lines
1 <?php
2
3 /**
4 * elFinder Plugin Abstract
5 *
6 * @package elfinder
7 * @author Naoki Sawada
8 * @license New BSD
9 */
10 class elFinderPlugin
11 {
12
13 /**
14 * This plugin's options
15 *
16 * @var array
17 */
18 protected $opts = array();
19
20 /**
21 * Get current volume's options
22 *
23 * @param object $volume
24 *
25 * @return array options
26 */
27 protected function getCurrentOpts($volume)
28 {
29 $name = substr(get_class($this), 14); // remove "elFinderPlugin"
30 $opts = $this->opts;
31 if (is_object($volume)) {
32 $volOpts = $volume->getOptionsPlugin($name);
33 if (is_array($volOpts)) {
34 $opts = array_merge($opts, $volOpts);
35 }
36 }
37 return $opts;
38 }
39
40 /**
41 * Is enabled with options
42 *
43 * @param array $opts
44 * @param elFinder $elfinder
45 *
46 * @return boolean
47 */
48 protected function iaEnabled($opts, $elfinder = null)
49 {
50 if (!$opts['enable']) {
51 return false;
52 }
53
54 // check post var 'contentSaveId' to disable this plugin
55 if ($elfinder && !empty($opts['disableWithContentSaveId'])) {
56 $session = $elfinder->getSession();
57 $urlContentSaveIds = $session->get('urlContentSaveIds', array());
58 if (!empty(elFinder::$currentArgs['contentSaveId']) && ($contentSaveId = elFinder::$currentArgs['contentSaveId'])) {
59 if (!empty($urlContentSaveIds[$contentSaveId])) {
60 $elfinder->removeUrlContentSaveId($contentSaveId);
61 return false;
62 }
63 }
64 }
65
66 if (isset($opts['onDropWith']) && !is_null($opts['onDropWith'])) {
67 // plugin disabled by default, enabled only if given key is pressed
68 if (isset($_REQUEST['dropWith']) && $_REQUEST['dropWith']) {
69 $onDropWith = $opts['onDropWith'];
70 $action = (int)$_REQUEST['dropWith'];
71 if (!is_array($onDropWith)) {
72 $onDropWith = array($onDropWith);
73 }
74 foreach ($onDropWith as $key) {
75 $key = (int)$key;
76 if (($action & $key) === $key) {
77 return true;
78 }
79 }
80 }
81 return false;
82 }
83
84 if (isset($opts['offDropWith']) && !is_null($opts['offDropWith']) && isset($_REQUEST['dropWith'])) {
85 // plugin enabled by default, disabled only if given key is pressed
86 $offDropWith = $opts['offDropWith'];
87 $action = (int)$_REQUEST['dropWith'];
88 if (!is_array($offDropWith)) {
89 $offDropWith = array($offDropWith);
90 }
91 $res = true;
92 foreach ($offDropWith as $key) {
93 $key = (int)$key;
94 if ($key === 0) {
95 if ($action === 0) {
96 $res = false;
97 break;
98 }
99 } else {
100 if (($action & $key) === $key) {
101 $res = false;
102 break;
103 }
104 }
105 }
106 if (!$res) {
107 return false;
108 }
109 }
110
111 return true;
112 }
113 }
114