[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Site 5 * @subpackage com_media 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 11 namespace Joomla\Component\Media\Site\Dispatcher; 12 13 use Joomla\CMS\Access\Exception\NotAllowed; 14 use Joomla\CMS\Dispatcher\ComponentDispatcher; 15 use Joomla\CMS\MVC\Controller\BaseController; 16 17 // phpcs:disable PSR1.Files.SideEffects 18 \defined('_JEXEC') or die; 19 // phpcs:enable PSR1.Files.SideEffects 20 21 /** 22 * ComponentDispatcher class for com_media 23 * 24 * @since 4.0.0 25 */ 26 class Dispatcher extends ComponentDispatcher 27 { 28 /** 29 * Load the language 30 * 31 * @since 4.0.0 32 * 33 * @return void 34 */ 35 protected function loadLanguage() 36 { 37 // Load the administrator languages needed for the media manager 38 $this->app->getLanguage()->load('', JPATH_ADMINISTRATOR); 39 $this->app->getLanguage()->load($this->option, JPATH_ADMINISTRATOR); 40 41 parent::loadLanguage(); 42 } 43 44 /** 45 * Method to check component access permission 46 * 47 * @since 4.0.0 48 * 49 * @return void 50 */ 51 protected function checkAccess() 52 { 53 $user = $this->app->getIdentity(); 54 55 // Access check 56 if ( 57 !$user->authorise('core.manage', 'com_media') 58 && !$user->authorise('core.create', 'com_media') 59 ) { 60 throw new NotAllowed($this->app->getLanguage()->_('JERROR_ALERTNOAUTHOR'), 403); 61 } 62 } 63 64 /** 65 * Get a controller from the component 66 * 67 * @param string $name Controller name 68 * @param string $client Optional client (like Administrator, Site etc.) 69 * @param array $config Optional controller config 70 * 71 * @return BaseController 72 * 73 * @since 4.0.0 74 */ 75 public function getController(string $name, string $client = '', array $config = array()): BaseController 76 { 77 $config['base_path'] = JPATH_ADMINISTRATOR . '/components/com_media'; 78 79 // Force to load the admin controller 80 return parent::getController($name, 'Administrator', $config); 81 } 82 }
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 |