CoreFiles by mySites.guru
NewsfeedsController.php67 lines, 1,832 bytes, from Joomla_4.3.0-alpha3-Alpha-Full_Package.zip
Raw History Compare with 4.3.0-alpha2
md5
889824fdd78e14a07c65b0faeec76d4b
sha1
5bf1e9002025e67adab671d11f2c3ab44bf135af
sha256
a847515f48669fbf7e6d0d54ad616c442b2ceb83e68b1369dc69791f05147ac0
<?php

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

namespace Joomla\Component\Newsfeeds\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

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

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

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

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

        $result = [];

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

        echo new JsonResponse($result);
    }
}

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