CoreFiles by mySites.guru
LanguagesController.php67 lines, 1,827 bytes, from Joomla_4.3.0-alpha3-Alpha-Full_Package.zip
Raw History Compare with 4.3.0-alpha2
md5
f6dcb0ef452b750ca395e955378b7ffc
sha1
129739720d1cd3d923e947cc92b7b5cc1e69d9cb
sha256
eeeabdb3be6bd4f49de4a479597384f31d99d8020f763d00c504b7bbd1033d61
<?php

/**
 * @package     Joomla.Administrator
 * @subpackage  com_languages
 *
 * @copyright   (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Component\Languages\Administrator\Controller;

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

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
 * Languages controller Class.
 *
 * @since  1.6
 */
class LanguagesController 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 = 'Language', $prefix = 'Administrator', $config = ['ignore_request' => true])
    {
        return parent::getModel($name, $prefix, $config);
    }

    /**
     * Method to get the number of published languages for quickicons
     *
     * @return  string  The JSON-encoded amount of published languages
     *
     * @since   4.3.0
     */
    public function getQuickiconContent()
    {
        $model = $this->getModel('languages');

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

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

        $result = [];

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

        echo new JsonResponse($result);
    }
}

No other release has this exact content. See every version of this file.