Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option onDropWith for plugin function iaEnabled #2442

Merged
merged 2 commits into from
Mar 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 20 additions & 1 deletion php/elFinderPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,26 @@ protected function iaEnabled($opts) {
return false;
}

if (isset($opts['onDropWith']) && !is_null($opts['onDropWith'])) {
// plugin disabled by default, enabled only if given key is pressed
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'])) {
// plugin enabled by default, disabled only if given key is pressed
$offDropWith = $opts['offDropWith'];
$action = (int)$_REQUEST['dropWith'];
if (! is_array($offDropWith)) {
Expand Down Expand Up @@ -72,4 +91,4 @@ protected function iaEnabled($opts) {

return true;
}
}
}
10 changes: 8 additions & 2 deletions php/plugins/AutoResize/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
* 'preserveExif' => false, // Preserve EXIF data (Imagick only)
* 'forceEffect' => false, // For change quality or make progressive JPEG of small images
* 'targetType' => IMG_GIF|IMG_JPG|IMG_PNG|IMG_WBMP, // Target image formats ( bit-field )
* 'offDropWith' => null // To disable it if it is dropped with pressing the meta key
* 'offDropWith' => null, // Enabled by default. To disable it if it is dropped with pressing the meta key
* // Alt: 8, Ctrl: 4, Meta: 2, Shift: 1 - sum of each value
* // In case of using any key, specify it as an array
* 'onDropWith' => null // Disabled by default. To enable it if it is dropped with pressing the meta key
* // Alt: 8, Ctrl: 4, Meta: 2, Shift: 1 - sum of each value
* // In case of using any key, specify it as an array
* )
Expand All @@ -41,7 +44,10 @@
* 'preserveExif' => false, // Preserve EXIF data (Imagick only)
* 'forceEffect' => false, // For change quality or make progressive JPEG of small images
* 'targetType' => IMG_GIF|IMG_JPG|IMG_PNG|IMG_WBMP, // Target image formats ( bit-field )
* 'offDropWith' => null // To disable it if it is dropped with pressing the meta key
* 'offDropWith' => null, // Enabled by default. To disable it if it is dropped with pressing the meta key
* // Alt: 8, Ctrl: 4, Meta: 2, Shift: 1 - sum of each value
* // In case of using any key, specify it as an array
* 'onDropWith' => null // Disabled by default. To enable it if it is dropped with pressing the meta key
* // Alt: 8, Ctrl: 4, Meta: 2, Shift: 1 - sum of each value
* // In case of using any key, specify it as an array
* )
Expand Down
10 changes: 8 additions & 2 deletions php/plugins/AutoRotate/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
* 'AutoRotate' => array(
* 'enable' => true, // For control by volume driver
* 'quality' => 95, // JPEG image save quality
* 'offDropWith' => null // To disable it if it is dropped with pressing the meta key
* 'offDropWith' => null, // Enabled by default. To disable it if it is dropped with pressing the meta key
* // Alt: 8, Ctrl: 4, Meta: 2, Shift: 1 - sum of each value
* // In case of using any key, specify it as an array
* 'onDropWith' => null // Disabled by default. To enable it if it is dropped with pressing the meta key
* // Alt: 8, Ctrl: 4, Meta: 2, Shift: 1 - sum of each value
* // In case of using any key, specify it as an array
* )
Expand All @@ -31,7 +34,10 @@
* 'AutoRotate' => array(
* 'enable' => true, // For control by volume driver
* 'quality' => 95, // JPEG image save quality
* 'offDropWith' => null // To disable it if it is dropped with pressing the meta key
* 'offDropWith' => null, // Enabled by default. To disable it if it is dropped with pressing the meta key
* // Alt: 8, Ctrl: 4, Meta: 2, Shift: 1 - sum of each value
* // In case of using any key, specify it as an array
* 'onDropWith' => null // Disabled by default. To enable it if it is dropped with pressing the meta key
* // Alt: 8, Ctrl: 4, Meta: 2, Shift: 1 - sum of each value
* // In case of using any key, specify it as an array
* )
Expand Down
10 changes: 8 additions & 2 deletions php/plugins/Watermark/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
* 'targetType' => IMG_GIF|IMG_JPG|IMG_PNG|IMG_WBMP, // Target image formats ( bit-field )
* 'targetMinPixel' => 200, // Target image minimum pixel size
* 'interlace' => IMG_GIF|IMG_JPG, // Set interlacebit image formats ( bit-field )
* 'offDropWith' => null // To disable it if it is dropped with pressing the meta key
* 'offDropWith' => null, // Enabled by default. To disable it if it is dropped with pressing the meta key
* // Alt: 8, Ctrl: 4, Meta: 2, Shift: 1 - sum of each value
* // In case of using any key, specify it as an array
* 'onDropWith' => null // Disabled by default. To enable it if it is dropped with pressing the meta key
* // Alt: 8, Ctrl: 4, Meta: 2, Shift: 1 - sum of each value
* // In case of using any key, specify it as an array
* )
Expand All @@ -45,7 +48,10 @@
* 'targetType' => IMG_GIF|IMG_JPG|IMG_PNG|IMG_WBMP, // Target image formats ( bit-field )
* 'targetMinPixel' => 200, // Target image minimum pixel size
* 'interlace' => IMG_GIF|IMG_JPG, // Set interlacebit image formats ( bit-field )
* 'offDropWith' => null // To disable it if it is dropped with pressing the meta key
* 'offDropWith' => null, // Enabled by default. To disable it if it is dropped with pressing the meta key
* // Alt: 8, Ctrl: 4, Meta: 2, Shift: 1 - sum of each value
* // In case of using any key, specify it as an array
* 'onDropWith' => null // Disabled by default. To enable it if it is dropped with pressing the meta key
* // Alt: 8, Ctrl: 4, Meta: 2, Shift: 1 - sum of each value
* // In case of using any key, specify it as an array
* )
Expand Down