<?php
 class elFinderPlugin {
 protected $opts = array();
 protected function getCurrentOpts($volume) {
 $name = substr(get_class($this), 14);
 $opts = $this->opts;
 if (is_object($volume)) {
 $volOpts = $volume->getOptionsPlugin($name);
 if (is_array($volOpts)) {
 $opts = array_merge($opts, $volOpts);
 }
 }
 return $opts;
 }
 protected function iaEnabled($opts, $elfinder = null) {
 if (!$opts['enable']) {
 return false;
 }
 if ($elfinder && !empty($opts['disableWithContentSaveId'])) {
 $session = $elfinder->getSession();
 $urlContentSaveIds = $session->get('urlContentSaveIds', array());
 if (!empty(elFinder::$currentArgs['contentSaveId']) && ($contentSaveId = elFinder::$currentArgs['contentSaveId'])) {
 if (!empty($urlContentSaveIds[$contentSaveId])) {
 $elfinder->removeUrlContentSaveId($contentSaveId);
 return false;
 }
 }
 }
 if (isset($opts['onDropWith']) && !is_null($opts['onDropWith'])) {
 if (isset($_REQUEST['dropWith']) && $_REQUEST['dropWith']) {
 $onDropWith = $opts['onDropWith'];
 $action = (int)$_REQUEST['dropWith'];
 if (!is_array($onDropWith)) {
 $onDropWith = array($onDropWith);
 }
 foreach ($onDropWith as $key) {
 $key = (int)$key;
 if (($action & $key) === $key) {
 return true;
 }
 }
 }
 return false;
 }
 if (isset($opts['offDropWith']) && !is_null($opts['offDropWith']) && isset($_REQUEST['dropWith'])) {
 $offDropWith = $opts['offDropWith'];
 $action = (int)$_REQUEST['dropWith'];
 if (!is_array($offDropWith)) {
 $offDropWith = array($offDropWith);
 }
 $res = true;
 foreach ($offDropWith as $key) {
 $key = (int)$key;
 if ($key === 0) {
 if ($action === 0) {
 $res = false;
 break;
 }
 }
 else {
 if (($action & $key) === $key) {
 $res = false;
 break;
 }
 }
 }
 if (!$res) {
 return false;
 }
 }
 return true;
 }
 }
 