/** * Return the full user directory path. Create if required * * @param string The base path * @access public * @return Full path to folder */ function getRootDir() { static $root; if (!isset($root)) { $root = parent::getRootDir(); $wf = WFEditorPlugin::getInstance(); // Restricted Joomla! folders $restricted = explode(',', $wf->getParam('editor.filesystem.joomla.restrict_dir', 'administrator,cache,components,includes,language,libraries,logs,media,modules,plugins,templates,xmlrpc')); $allowroot = $wf->getParam('editor.filesystem.joomla.allow_root', 0); // Revert to default if empty if (empty($root) && !$allowroot) { $root = 'images'; } // Force default if directory is a joomla directory $parts = explode('/', $root); if (in_array(strtolower($parts[0]), $restricted) && !$allowroot) { $root = 'images'; } if (!empty($root)) { // Create the folder $full = WFUtility::makePath(JPATH_SITE, $root); if (!JFolder::exists($full)) { $this->folderCreate($full); } // Fallback $root = JFolder::exists($full) ? $root : 'images'; } } return $root; }
public function getFileSystem() { static $filesystem; if (!is_object($filesystem)) { $wf = WFEditorPlugin::getInstance(); $config = array('dir' => $this->get('dir'), 'upload_conflict' => $wf->getParam('editor.upload_conflict', 'overwrite'), 'filetypes' => $this->getFileTypes('array')); $filesystem = WFFileSystem::getInstance($this->get('filesystem'), $config); } return $filesystem; }