CoreFiles by mySites.guru
PluginsController.php64 lines, 1,592 bytes, from Joomla_4.0.0-alpha11-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha10
md5
0f5021244dcf698ede3c0c43128d7a5c
sha1
e355da337fec3cd0931ee2040f619046e8abb29a
sha256
e99a5e53983dcd8bd752a9265f10427caee654801f3149ef0572649e520c7a0a
<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_plugins
 *
 * @copyright   Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Component\Plugins\Administrator\Controller;

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\CMS\Response\JsonResponse;

/**
 * Plugins list controller class.
 *
 * @since  1.6
 */
class PluginsController extends AdminController
{
	/**
	 * Method to get a model object, loading it if required.
	 *
	 * @param   string  $name    The model name. Optional.
	 * @param   string  $prefix  The class prefix. Optional.
	 * @param   array   $config  Configuration array for model. Optional.
	 *
	 * @return  object  The model.
	 *
	 * @since   1.6
	 */
	public function getModel($name = 'Plugin', $prefix = 'Administrator', $config = array('ignore_request' => true))
	{
		return parent::getModel($name, $prefix, $config);
	}

	/**
	 * Method to get the number of activated plugins
	 *
	 * @return  string  The JSON-encoded amount of items
	 *
	 * @since   4.0
	 */
	public function getQuickiconContent()
	{
		$model = $this->getModel('Plugins');

		$model->setState('filter.enabled', 1);

		$amount = (int) $model->getTotal();

		$result = [];

		$result['amount'] = $amount;
		$result['sronly'] = Text::plural('COM_PLUGINS_N_QUICKICON_SRONLY', $amount);
		$result['name'] = Text::plural('COM_PLUGINS_N_QUICKICON', $amount);

		echo new JsonResponse($result);
	}
}

The same content is in 2 releases, Joomla 4.0.0-alpha11 to 4.0.0-alpha12. See them all, or every version of this file.