[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Administrator 5 * @subpackage com_tags 6 * 7 * @copyright (C) 2013 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\Tags\Administrator\Controller; 12 13 use Joomla\CMS\Language\Text; 14 use Joomla\CMS\MVC\Controller\AdminController; 15 use Joomla\CMS\Response\JsonResponse; 16 use Joomla\CMS\Router\Route; 17 18 // phpcs:disable PSR1.Files.SideEffects 19 \defined('_JEXEC') or die; 20 // phpcs:enable PSR1.Files.SideEffects 21 22 /** 23 * The Tags List Controller 24 * 25 * @since 3.1 26 */ 27 class TagsController extends AdminController 28 { 29 /** 30 * Proxy for getModel 31 * 32 * @param string $name The model name. Optional. 33 * @param string $prefix The class prefix. Optional. 34 * @param array $config An optional associative array of configuration settings. 35 * 36 * @return \Joomla\CMS\MVC\Model\BaseDatabaseModel The model. 37 * 38 * @since 3.1 39 */ 40 public function getModel($name = 'Tag', $prefix = 'Administrator', $config = array('ignore_request' => true)) 41 { 42 return parent::getModel($name, $prefix, $config); 43 } 44 45 /** 46 * Rebuild the nested set tree. 47 * 48 * @return boolean False on failure or error, true on success. 49 * 50 * @since 3.1 51 */ 52 public function rebuild() 53 { 54 $this->checkToken(); 55 56 $this->setRedirect(Route::_('index.php?option=com_tags&view=tags', false)); 57 58 /** @var \Joomla\Component\Tags\Administrator\Model\TagModel $model */ 59 $model = $this->getModel(); 60 61 if ($model->rebuild()) { 62 // Rebuild succeeded. 63 $this->setMessage(Text::_('COM_TAGS_REBUILD_SUCCESS')); 64 65 return true; 66 } else { 67 // Rebuild failed. 68 $this->setMessage(Text::_('COM_TAGS_REBUILD_FAILURE')); 69 70 return false; 71 } 72 } 73 74 /** 75 * Method to get the JSON-encoded amount of published tags for quickicons 76 * 77 * @return void 78 * 79 * @since 4.1.0 80 */ 81 public function getQuickiconContent() 82 { 83 $model = $this->getModel('tags'); 84 85 $model->setState('filter.published', 1); 86 87 $amount = (int) $model->getTotal(); 88 89 $result = []; 90 91 $result['amount'] = $amount; 92 $result['sronly'] = Text::plural('COM_TAGS_N_QUICKICON_SRONLY', $amount); 93 $result['name'] = Text::plural('COM_TAGS_N_QUICKICON', $amount); 94 95 echo new JsonResponse($result); 96 } 97 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |