[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Plugin 5 * @subpackage Extension.Joomla 6 * 7 * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 10 * @phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace 11 */ 12 13 use Joomla\CMS\Installer\Installer; 14 use Joomla\CMS\Plugin\CMSPlugin; 15 use Joomla\Event\DispatcherInterface; 16 17 // phpcs:disable PSR1.Files.SideEffects 18 \defined('_JEXEC') or die; 19 // phpcs:enable PSR1.Files.SideEffects 20 21 /** 22 * Joomla! namespace map creator / updater. 23 * 24 * @since 4.0.0 25 */ 26 class PlgExtensionNamespacemap extends CMSPlugin 27 { 28 /** 29 * The namespace map file creator 30 * 31 * @var JNamespacePsr4Map 32 */ 33 private $fileCreator = null; 34 35 /** 36 * Constructor 37 * 38 * @param DispatcherInterface &$subject The object to observe 39 * @param array $config An optional associative array of configuration settings. 40 * Recognized key values include 'name', 'group', 'params', 'language' 41 * (this list is not meant to be comprehensive). 42 * 43 * @since 4.0.0 44 */ 45 public function __construct(&$subject, $config = array()) 46 { 47 $this->fileCreator = new JNamespacePsr4Map(); 48 49 parent::__construct($subject, $config); 50 } 51 52 /** 53 * Update / Create map on extension install 54 * 55 * @param Installer $installer Installer instance 56 * @param integer $eid Extension id 57 * 58 * @return void 59 * 60 * @since 4.0.0 61 */ 62 public function onExtensionAfterInstall($installer, $eid) 63 { 64 // Check that we have a valid extension 65 if ($eid) { 66 // Update / Create new map 67 $this->fileCreator->create(); 68 } 69 } 70 71 /** 72 * Update / Create map on extension uninstall 73 * 74 * @param Installer $installer Installer instance 75 * @param integer $eid Extension id 76 * @param boolean $removed Installation result 77 * 78 * @return void 79 * 80 * @since 4.0.0 81 */ 82 public function onExtensionAfterUninstall($installer, $eid, $removed) 83 { 84 // Check that we have a valid extension and that it has been removed 85 if ($eid && $removed) { 86 // Update / Create new map 87 $this->fileCreator->create(); 88 } 89 } 90 91 /** 92 * Update map on extension update 93 * 94 * @param Installer $installer Installer instance 95 * @param integer $eid Extension id 96 * 97 * @return void 98 * 99 * @since 4.0.0 100 */ 101 public function onExtensionAfterUpdate($installer, $eid) 102 { 103 // Check that we have a valid extension 104 if ($eid) { 105 // Update / Create new map 106 $this->fileCreator->create(); 107 } 108 } 109 }
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 |