Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@matdave
Created June 18, 2021 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matdave/6167ae9d4860139f00837162172c862d to your computer and use it in GitHub Desktop.
Save matdave/6167ae9d4860139f00837162172c862d to your computer and use it in GitHub Desktop.
MODX Fred elFinder Configure Plugins
<?php
/** elFinder Plugin Options **/
switch ($modx->event->name) {
case 'FredOnElfinderRoots':
$params = $modx->getOption('params', $scriptProperties);
if (empty($params)) return false;
// Enable Sanitizer
$params->bind['upload.pre mkdir.pre mkfile.pre rename.pre archive.pre ls.pre'][] = 'Plugin.Sanitizer.cmdPreprocess';
$params->bind['paste.copyfrom upload.presave'][] = 'Plugin.Sanitizer.onUpLoadPreSave';
$params->plugin['Sanitizer'] = [
'enable' => true,
'targets' => array('\\','/',':','*','?','"','<','>','|','#',' '),
'replace' => '-',
'callBack' => null
];
// Enable Normalizer
$params->bind['upload.pre mkdir.pre mkfile.pre rename.pre archive.pre ls.pre'][] = 'Plugin.Normalizer.cmdPreprocess';
$params->bind['paste.copyfrom upload.presave'][] = 'Plugin.Normalizer.onUpLoadPreSave';
$params->plugin['Normalizer'] = [
'enable' => true,
'nfc' => true,
'nfkc' => true,
'umlauts' => true,
'lowercase' => true,
'convmap' => array()
];
// Enable Auto Rotate
$params->bind['upload.presave'][] = 'Plugin.AutoRotate.onUpLoadPreSave';
$params->plugin['AutoRotate'] = [
'enable' => true,
'quality' => 95,
'offDropWith' => null,
'onDropWith' => null
];
// Enable Auto Resize
$params->bind['upload.presave'][] = 'Plugin.AutoResize.onUpLoadPreSave';
$params->plugin['AutoResize'] = [
'enable' => true,
'maxWidth' => 1024,
'maxHeight' => 1024,
'quality' => 95,
'preserveExif' => false,
'forceEffect' => false,
'targetType' => IMG_GIF|IMG_JPG|IMG_PNG|IMG_WBMP,
'offDropWith' => null,
'onDropWith' => null
];
break;
}
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment