- md5
- b2c28a55c7e6b4f4b685e65deeeba937
- sha1
- 66e7a60de59c03609aaa84cb76516ec3af984e73
- sha256
- 59985f387cb5af02da65ead3b6d85178d6b919c7d5262d9d6013aa83bd58eeb0
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
<?php
/**
* @package Joomla.Plugin
* @subpackage FileSystem.Local
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Component\Media\Administrator\Event\MediaProviderEvent;
use Joomla\Component\Media\Administrator\Provider\ProviderInterface;
/**
* FileSystem Local plugin.
*
* The plugin to deal with the local filesystem in Media Manager.
*
* @since __DEPLOY_VERSION__
*/
class PlgFileSystemLocal extends CMSPlugin implements ProviderInterface
{
/**
* Affects constructor behavior. If true, language files will be loaded automatically.
*
* @var boolean
* @since __DEPLOY_VERSION__
*/
protected $autoloadLanguage = true;
/**
* Setup Providers for Local Adapter
*
* @param MediaProviderEvent $event Event for ProviderManager
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
public function onSetupProviders(MediaProviderEvent $event)
{
$event->getProviderManager()->registerProvider($this);
}
/**
* Returns the ID of the provider
*
* @return string
*
* @since __DEPLOY_VERSION__
*/
public function getID()
{
return $this->_name;
}
/**
* Returns the display name of the provider
*
* @return string
*
* @since __DEPLOY_VERSION__
*/
public function getDisplayName()
{
return $this->params->get('display_name');
}
/**
* Returns and array of adapters
*
* @return \Joomla\Component\Media\Administrator\Adapter\AdapterInterface[]
*
* @since __DEPLOY_VERSION__
*/
public function getAdapters()
{
$adapters = [];
$directories = $this->params->get('directories', '[{"directory":{"directory": "images"}}]');
// Do a check if default settings are not saved by user
// If not initialize them manually
if (is_string($directories))
{
$directories = json_decode($directories);
list($directories) = $directories;
}
foreach ($directories as $directoryEntity)
{
if ($directoryEntity->directory)
{
$directoryPath = JPATH_ROOT . '/' . $directoryEntity->directory;
$directoryPath = rtrim($directoryPath) . '/';
$adapters[] = new \Joomla\Plugin\Filesystem\Local\Adapter\LocalAdapter($directoryPath, $directoryEntity->directory);
}
}
return $adapters;
}
}
No other release has this exact content. See every version of this file.