[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_plugins/src/Controller/ -> PluginsController.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_plugins
   6   *
   7   * @copyright   (C) 2009 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\Plugins\Administrator\Controller;
  12  
  13  use Joomla\CMS\Language\Text;
  14  use Joomla\CMS\MVC\Controller\AdminController;
  15  use Joomla\CMS\Response\JsonResponse;
  16  
  17  // phpcs:disable PSR1.Files.SideEffects
  18  \defined('_JEXEC') or die;
  19  // phpcs:enable PSR1.Files.SideEffects
  20  
  21  /**
  22   * Plugins list controller class.
  23   *
  24   * @since  1.6
  25   */
  26  class PluginsController extends AdminController
  27  {
  28      /**
  29       * Method to get a model object, loading it if required.
  30       *
  31       * @param   string  $name    The model name. Optional.
  32       * @param   string  $prefix  The class prefix. Optional.
  33       * @param   array   $config  Configuration array for model. Optional.
  34       *
  35       * @return  object  The model.
  36       *
  37       * @since   1.6
  38       */
  39      public function getModel($name = 'Plugin', $prefix = 'Administrator', $config = array('ignore_request' => true))
  40      {
  41          return parent::getModel($name, $prefix, $config);
  42      }
  43  
  44      /**
  45       * Method to get the number of activated plugins
  46       *
  47       * @return  void
  48       *
  49       * @since   4.0.0
  50       */
  51      public function getQuickiconContent()
  52      {
  53          $model = $this->getModel('Plugins');
  54  
  55          $model->setState('filter.enabled', 1);
  56  
  57          $amount = (int) $model->getTotal();
  58  
  59          $result = [];
  60  
  61          $result['amount'] = $amount;
  62          $result['sronly'] = Text::plural('COM_PLUGINS_N_QUICKICON_SRONLY', $amount);
  63          $result['name'] = Text::plural('COM_PLUGINS_N_QUICKICON', $amount);
  64  
  65          echo new JsonResponse($result);
  66      }
  67  }


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