[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Plugin 5 * @subpackage FileSystem.Local 6 * 7 * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 10 * @phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace 11 */ 12 13 use Joomla\CMS\Language\Text; 14 use Joomla\CMS\Plugin\CMSPlugin; 15 use Joomla\Component\Media\Administrator\Event\MediaProviderEvent; 16 use Joomla\Component\Media\Administrator\Provider\ProviderInterface; 17 18 // phpcs:disable PSR1.Files.SideEffects 19 \defined('_JEXEC') or die; 20 // phpcs:enable PSR1.Files.SideEffects 21 22 /** 23 * FileSystem Local plugin. 24 * 25 * The plugin to deal with the local filesystem in Media Manager. 26 * 27 * @since 4.0.0 28 */ 29 class PlgFileSystemLocal extends CMSPlugin implements ProviderInterface 30 { 31 /** 32 * Affects constructor behavior. If true, language files will be loaded automatically. 33 * 34 * @var boolean 35 * @since 4.0.0 36 */ 37 protected $autoloadLanguage = true; 38 39 /** 40 * Setup Providers for Local Adapter 41 * 42 * @param MediaProviderEvent $event Event for ProviderManager 43 * 44 * @return void 45 * 46 * @since 4.0.0 47 */ 48 public function onSetupProviders(MediaProviderEvent $event) 49 { 50 $event->getProviderManager()->registerProvider($this); 51 } 52 53 /** 54 * Returns the ID of the provider 55 * 56 * @return string 57 * 58 * @since 4.0.0 59 */ 60 public function getID() 61 { 62 return $this->_name; 63 } 64 65 /** 66 * Returns the display name of the provider 67 * 68 * @return string 69 * 70 * @since 4.0.0 71 */ 72 public function getDisplayName() 73 { 74 return Text::_('PLG_FILESYSTEM_LOCAL_DEFAULT_NAME'); 75 } 76 77 /** 78 * Returns and array of adapters 79 * 80 * @return \Joomla\Component\Media\Administrator\Adapter\AdapterInterface[] 81 * 82 * @since 4.0.0 83 */ 84 public function getAdapters() 85 { 86 $adapters = []; 87 $directories = $this->params->get('directories', '[{"directory": "images"}]'); 88 89 // Do a check if default settings are not saved by user 90 // If not initialize them manually 91 if (is_string($directories)) { 92 $directories = json_decode($directories); 93 } 94 95 foreach ($directories as $directoryEntity) { 96 if ($directoryEntity->directory) { 97 $directoryPath = JPATH_ROOT . '/' . $directoryEntity->directory; 98 $directoryPath = rtrim($directoryPath) . '/'; 99 100 $adapter = new \Joomla\Plugin\Filesystem\Local\Adapter\LocalAdapter( 101 $directoryPath, 102 $directoryEntity->directory 103 ); 104 105 $adapters[$adapter->getAdapterName()] = $adapter; 106 } 107 } 108 109 return $adapters; 110 } 111 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |