[ 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_installer 6 * 7 * @copyright (C) 2008 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\Installer\Administrator\View\Update; 12 13 use Joomla\CMS\Application\CMSApplication; 14 use Joomla\CMS\Factory; 15 use Joomla\CMS\Language\Text; 16 use Joomla\CMS\Object\CMSObject; 17 use Joomla\CMS\Toolbar\ToolbarHelper; 18 use Joomla\Component\Installer\Administrator\Helper\InstallerHelper as CmsInstallerHelper; 19 use Joomla\Component\Installer\Administrator\View\Installer\HtmlView as InstallerViewDefault; 20 21 // phpcs:disable PSR1.Files.SideEffects 22 \defined('_JEXEC') or die; 23 // phpcs:enable PSR1.Files.SideEffects 24 25 /** 26 * Extension Manager Update View 27 * 28 * @since 1.6 29 */ 30 class HtmlView extends InstallerViewDefault 31 { 32 /** 33 * List of update items. 34 * 35 * @var array 36 */ 37 protected $items; 38 39 /** 40 * List pagination. 41 * 42 * @var \Joomla\CMS\Pagination\Pagination 43 */ 44 protected $pagination; 45 46 /** 47 * How many updates require but are missing Download Keys 48 * 49 * @var integer 50 * @since 4.0.0 51 */ 52 protected $missingDownloadKeys = 0; 53 54 /** 55 * @var boolean 56 * @since 4.0.0 57 */ 58 private $isEmptyState = false; 59 60 /** 61 * Display the view. 62 * 63 * @param string $tpl Template 64 * 65 * @return void 66 * 67 * @since 1.6 68 */ 69 public function display($tpl = null) 70 { 71 // Get data from the model. 72 $this->items = $this->get('Items'); 73 $this->pagination = $this->get('Pagination'); 74 $this->filterForm = $this->get('FilterForm'); 75 $this->activeFilters = $this->get('ActiveFilters'); 76 77 $paths = new \stdClass(); 78 $paths->first = ''; 79 80 $this->paths = &$paths; 81 82 if (count($this->items) === 0 && $this->isEmptyState = $this->get('IsEmptyState')) { 83 $this->setLayout('emptystate'); 84 } else { 85 Factory::getApplication()->enqueueMessage(Text::_('COM_INSTALLER_MSG_WARNINGS_UPDATE_NOTICE'), 'warning'); 86 } 87 88 // Find if there are any updates which require but are missing a Download Key 89 if (!class_exists('Joomla\Component\Installer\Administrator\Helper\InstallerHelper')) { 90 require_once JPATH_COMPONENT_ADMINISTRATOR . '/Helper/InstallerHelper.php'; 91 } 92 93 $mappingCallback = function ($item) { 94 $dlkeyInfo = CmsInstallerHelper::getDownloadKey(new CMSObject($item)); 95 $item->isMissingDownloadKey = $dlkeyInfo['supported'] && !$dlkeyInfo['valid']; 96 97 if ($item->isMissingDownloadKey) { 98 $this->missingDownloadKeys++; 99 } 100 101 return $item; 102 }; 103 $this->items = array_map($mappingCallback, $this->items); 104 105 if ($this->missingDownloadKeys) { 106 $url = 'index.php?option=com_installer&view=updatesites&filter[supported]=-1'; 107 $msg = Text::plural('COM_INSTALLER_UPDATE_MISSING_DOWNLOADKEY_LABEL_N', $this->missingDownloadKeys, $url); 108 Factory::getApplication()->enqueueMessage($msg, CMSApplication::MSG_WARNING); 109 } 110 111 parent::display($tpl); 112 } 113 114 /** 115 * Add the page title and toolbar. 116 * 117 * @return void 118 * 119 * @since 1.6 120 */ 121 protected function addToolbar() 122 { 123 if (false === $this->isEmptyState) { 124 ToolbarHelper::custom('update.update', 'upload', '', 'COM_INSTALLER_TOOLBAR_UPDATE', true); 125 } 126 127 ToolbarHelper::custom('update.find', 'refresh', '', 'COM_INSTALLER_TOOLBAR_FIND_UPDATES', false); 128 ToolbarHelper::divider(); 129 130 parent::addToolbar(); 131 ToolbarHelper::help('Extensions:_Update'); 132 } 133 }
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 |