diff --git a/elements/radicalmultifieldtreecatalog.php b/elements/radicalmultifieldtreecatalog.php deleted file mode 100644 index c2bcd0a..0000000 --- a/elements/radicalmultifieldtreecatalog.php +++ /dev/null @@ -1,297 +0,0 @@ - - -*/ - - -JFormHelper::loadFieldClass('list'); - -class FormFieldRadicalmultifieldtreecatalog extends JFormField -{ - - public $type = 'radicalmultifieldtreecatalog'; - - protected $uid; - - protected function showdir - ( - $dir, - $folderOnly = false, - $showRoot = false, - $level = 0, // do not use!!! - $ef = '' // do not use!!! - ) - { - $html = ''; - if ((int)$level == 0) - { - $dir = realpath($dir); - $ef = ($showRoot ? realpath($dir . DIRECTORY_SEPARATOR . '..') . DIRECTORY_SEPARATOR : $dir . DIRECTORY_SEPARATOR); - } - - if (!file_exists($dir)) { - return ''; - } - - if ($showRoot && (int)$level == 0) - { - $html = ''; - } - else - { - $list = scandir($dir); - if (is_array($list)) - { - $list = array_diff($list, ['.', '..']); - if ($list) - { - $folders = []; - $files = []; - - foreach ($list as $name) - { - if (is_dir($dir . DIRECTORY_SEPARATOR . $name)) { - $folders[] = $name; - } - else - { - $files[] = $name; - } - } - - if (!($folderOnly && !$folders) || !(!$folders || !$files)) - { - $html .= ''; - } - - sort($folders); - sort($files); - - foreach ($folders as $name) - { - $fpath = $dir . DIRECTORY_SEPARATOR . $name; - $subdir = $this->showdir($fpath, $folderOnly, $showRoot, $level + 1, $ef); - $fpath = str_replace($ef, '', $fpath); - $fpath = preg_replace("/^.*?\//isu", 'root/', $fpath); - $html .= '
  • ' . ($subdir ? '' : '') . '' . $name . '' . $subdir . '
  • '; - } - - if (!$folderOnly) - { - foreach ($files as $name) - { - $fpath = $dir . DIRECTORY_SEPARATOR . $name; - $fpath = str_replace($ef, '', $fpath); - $ext = substr(strrchr($name, '.'), 1); - $html .= '
  • ' . $name . '
  • '; - } - } - - if (!($folderOnly && !$folders) || !(!$folders || !$files)) - { - $html .= ''; - } - - unset($folders, $files, $fpath, $ext); - } - } - } - - return $html; - } - - - /** - * @param bool $only_directories - * - * @return string - */ - public function getInput($only_directories = false) - { - - HTMLHelper::_('script', 'media/plg_fields_radicalmultifield/libs/vex/dist/js/vex.combined.min.js', [ - 'version' => filemtime ( __FILE__ ), - 'relative' => false, - ]); - - HTMLHelper::_('stylesheet', 'media/plg_fields_radicalmultifield/libs/vex/dist/css/vex.css', [ - 'version' => filemtime ( __FILE__ ), - 'relative' => false - ]); - - HTMLHelper::_('stylesheet', 'media/plg_fields_radicalmultifield/libs/vex/dist/css/vex-theme-plain.css', [ - 'version' => filemtime ( __FILE__ ), - 'relative' => false - ]); - - // Add some JS language strings to translate - Text::script('PLG_RADICAL_MULTI_FIELD_BUTTON_BACK'); - Text::script('PLG_RADICAL_MULTI_FIELD_BUTTON_UP'); - Text::script('PLG_RADICAL_MULTI_FIELD_BUTTON_GRID'); - Text::script('PLG_RADICAL_MULTI_FIELD_BUTTON_LIST'); - Text::script('PLG_RADICAL_MULTI_FIELD_BUTTON_SELECTALL'); - - // Add the root url as JS var - Factory::getDocument()->addScriptDeclaration("let siteUrl = '".JUri::root()."';"); - - $app = Factory::getApplication(); - - // get attributes - $importfield = $this->getAttribute('importfield'); - $exs = $this->getAttribute('exs'); - $namefield = $this->getAttribute('namefield'); - $namefile = $this->getAttribute('namefile'); - $maxsize = $this->getAttribute('maxsize'); - $folder = $this->getAttribute('folder'); - $folder = $folder ? $folder : 'images'; - $administrator = $app->isAdmin() ? 'true' : 'false'; - - if(substr_count($folder, '{user_id}')) - { - $user = Factory::getUser(); - } - else - { - $user = new stdClass(); - $user->id = 0; - } - - if(substr_count($folder, '{item_id}')) - { - $item_id = Factory::getApplication()->input->get('id', '0'); - } - else - { - $item_id = '0'; - } - - - $folder = str_replace([ - '{user_id}', - '{item_id}', - '{year}', - '{month}', - '{day}', - '{hours}', - '{minutes}', - '{second}', - '{unix}', - ], [ - $user->id, - $item_id, - date('Y'), - date('m'), - date('d'), - date('h'), - date('i'), - date('s'), - date('U'), - ], $folder); - - $folders = explode(DIRECTORY_SEPARATOR, $folder); - $currentTmp = ''; - - foreach ($folders as $tmpFolder) - { - $currentTmp .= DIRECTORY_SEPARATOR . $tmpFolder; - if(!file_exists(JPATH_ROOT . $currentTmp)) - { - Folder::create(JPATH_ROOT . $currentTmp); - } - } - - $folderOnly = $this->getAttribute('folderonly'); - $folderOnly = ($folderOnly && (strtolower($folderOnly) === 'true' || strtolower($folderOnly) === 'folderonly') ? true : false); - - $showRoot = $this->getAttribute('showroot'); - $showRoot = ($showRoot && (strtolower($showRoot) === 'true' || strtolower($showRoot) === 'showroot') ? true : false); - - // get uniq id - $this->uid = uniqid('avfl'); - - if(!$only_directories) - { - // include jq && css - HTMLHelper::_('jquery.framework', false, null, false); - - HTMLHelper::_('stylesheet', 'plg_fields_radicalmultifield/core/tree.css', [ - 'version' => filemtime ( __FILE__ ), - 'relative' => true - ]); - - HTMLHelper::_('script', 'plg_fields_radicalmultifield/core/import.js', [ - 'version' => filemtime ( __FILE__ ), - 'relative' => true - ]); - - - $html = "
    - uid . "\" role=\"button\" class=\"btn button-open-modal\" data-administrator=\"" . $administrator . "\" data-exs=\"" . $exs . "\" data-namefile=\"" . $namefile . "\" data-namefield=\"" . $namefield . "\" data-maxsize=\"" . $maxsize . "\" data-importfield=\"" . $importfield . "\" data-importfieldpath=\"" . $folder . "\" data-toggle=\"modal\">" . Text::_('PLG_RADICAL_MULTI_FIELD_FIELD_IMPORT_MODAL_BUTTON_OPEN') . " - - - -
    uid . "\" class=\"modal modal-small modal-import-file hide fade\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"impot-modal-" . $this->uid . "\" aria-hidden=\"true\"> -
    - -

    uid . "\">". Text::_('PLG_RADICAL_MULTI_FIELD_FIELD_IMPORT_MODAL_TITLE') . "

    -
    -
    "; - - $html .= '
    '; - - // input - $html .= '
    '; - $html .= '
    required ? 'required' : '') . '/>
    '; - - // modal - $html .= '
    '; - $html .= '
    '; - $html .= $this->showdir(JPATH_ROOT . DIRECTORY_SEPARATOR . $folder, $folderOnly, $showRoot); - $html .= '
    '; - $html .= '
    '; - $html .= '
    '; - - JLoader::register('FormFieldRadicalmultifieldupload', JPATH_ROOT . '/plugins/fields/radicalmultifield/elements/radicalmultifieldupload.php'); - $upload = new FormFieldRadicalmultifieldupload; - $upload->setup(new SimpleXMLElement(""), ''); - - $html .= '
    ' . $upload->getInput() . '
    '; - - $html .= "
    -
    - - -
    -
    -
    "; - } - else - { - $html = $this->showdir(JPATH_ROOT . DIRECTORY_SEPARATOR . $folder, $folderOnly, $showRoot); - } - - return $html; - } - -} diff --git a/elements/radicalmultifieldupload.php b/elements/radicalmultifieldupload.php deleted file mode 100644 index 4f3ccc0..0000000 --- a/elements/radicalmultifieldupload.php +++ /dev/null @@ -1,35 +0,0 @@ - filemtime ( __FILE__ ), - 'relative' => true - ]); - - $layout = new FileLayout('upload', JPATH_ROOT . '/plugins/fields/radicalmultifield/elements/tmpl'); - return $layout->render(); - } - -} diff --git a/radicalmultifield.xml b/radicalmultifield.xml index f523c0e..53d9449 100644 --- a/radicalmultifield.xml +++ b/radicalmultifield.xml @@ -20,9 +20,7 @@ - - https://hika.su/update/free/plg_radicalmultifield_3x.xml - + https://hika.su/update/free/plg_radicalmultifield_3x.xml