[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Dispatcher/ -> ApiDispatcher.php (source)

   1  <?php
   2  
   3  /**
   4   * Joomla! Content Management System
   5   *
   6   * @copyright  (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
   7   * @license    GNU General Public License version 2 or later; see LICENSE
   8   */
   9  
  10  namespace Joomla\CMS\Dispatcher;
  11  
  12  // phpcs:disable PSR1.Files.SideEffects
  13  \defined('_JEXEC') or die;
  14  // phpcs:enable PSR1.Files.SideEffects
  15  
  16  /**
  17   * API Implementation for our dispatcher. It loads a component's administrator language files, and calls the API
  18   * Controller so that components that haven't implemented web services can add their own handling.
  19   *
  20   * @since  4.0.0
  21   */
  22  final class ApiDispatcher extends ComponentDispatcher
  23  {
  24      /**
  25       * Load the component's administrator language
  26       *
  27       * @since   4.0.0
  28       *
  29       * @return  void
  30       */
  31      protected function loadLanguage()
  32      {
  33          // Load common and local language files.
  34          $this->app->getLanguage()->load($this->option, JPATH_BASE) ||
  35          $this->app->getLanguage()->load($this->option, JPATH_ADMINISTRATOR) ||
  36          $this->app->getLanguage()->load($this->option, JPATH_COMPONENT_ADMINISTRATOR);
  37      }
  38  
  39      /**
  40       * Dispatch a controller task. API Overrides to ensure there is no redirects.
  41       *
  42       * @return  void
  43       *
  44       * @since   4.0.0
  45       */
  46      public function dispatch()
  47      {
  48          $task = $this->input->getCmd('task', 'display');
  49  
  50          // Build controller config data
  51          $config['option'] = $this->option;
  52  
  53          // Set name of controller if it is passed in the request
  54          if ($this->input->exists('controller')) {
  55              $config['name'] = strtolower($this->input->get('controller'));
  56          }
  57  
  58          $controller = $this->input->get('controller');
  59          $controller = $this->getController($controller, ucfirst($this->app->getName()), $config);
  60  
  61          $controller->execute($task);
  62      }
  63  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer