[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Installer/Manifest/ -> PackageManifest.php (source)

   1  <?php
   2  
   3  /**
   4   * Joomla! Content Management System
   5   *
   6   * @copyright  (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
   7   * @license    GNU General Public License version 2 or later; see LICENSE.txt
   8   */
   9  
  10  namespace Joomla\CMS\Installer\Manifest;
  11  
  12  use Joomla\CMS\Installer\InstallerExtension;
  13  use Joomla\CMS\Installer\Manifest;
  14  
  15  // phpcs:disable PSR1.Files.SideEffects
  16  \defined('JPATH_PLATFORM') or die;
  17  // phpcs:enable PSR1.Files.SideEffects
  18  
  19  /**
  20   * Joomla! Package Manifest File
  21   *
  22   * @since  3.1
  23   */
  24  class PackageManifest extends Manifest
  25  {
  26      /**
  27       * Unique name of the package
  28       *
  29       * @var    string
  30       * @since  3.1
  31       */
  32      public $packagename = '';
  33  
  34      /**
  35       * Website for the package
  36       *
  37       * @var    string
  38       * @since  3.1
  39       */
  40      public $url = '';
  41  
  42      /**
  43       * Scriptfile for the package
  44       *
  45       * @var    string
  46       * @since  3.1
  47       */
  48      public $scriptfile = '';
  49  
  50      /**
  51       * Flag if the package blocks individual child extensions from being uninstalled
  52       *
  53       * @var    boolean
  54       * @since  3.7.0
  55       */
  56      public $blockChildUninstall = false;
  57  
  58      /**
  59       * Apply manifest data from a \SimpleXMLElement to the object.
  60       *
  61       * @param   \SimpleXMLElement  $xml  Data to load
  62       *
  63       * @return  void
  64       *
  65       * @since   3.1
  66       */
  67      protected function loadManifestFromData(\SimpleXMLElement $xml)
  68      {
  69          $this->name        = (string) $xml->name;
  70          $this->packagename = (string) $xml->packagename;
  71          $this->update      = (string) $xml->update;
  72          $this->authorurl   = (string) $xml->authorUrl;
  73          $this->author      = (string) $xml->author;
  74          $this->authoremail = (string) $xml->authorEmail;
  75          $this->description = (string) $xml->description;
  76          $this->packager    = (string) $xml->packager;
  77          $this->packagerurl = (string) $xml->packagerurl;
  78          $this->scriptfile  = (string) $xml->scriptfile;
  79          $this->version     = (string) $xml->version;
  80  
  81          if (isset($xml->blockChildUninstall)) {
  82              $value = (string) $xml->blockChildUninstall;
  83  
  84              if ($value === '1' || $value === 'true') {
  85                  $this->blockChildUninstall = true;
  86              }
  87          }
  88  
  89          if (isset($xml->files->file) && \count($xml->files->file)) {
  90              foreach ($xml->files->file as $file) {
  91                  // NOTE: JInstallerExtension doesn't expect a string.
  92                  // DO NOT CAST $file
  93                  $this->filelist[] = new InstallerExtension($file);
  94              }
  95          }
  96  
  97          // Handle cases where package contains folders
  98          if (isset($xml->files->folder) && \count($xml->files->folder)) {
  99              foreach ($xml->files->folder as $folder) {
 100                  // NOTE: JInstallerExtension doesn't expect a string.
 101                  // DO NOT CAST $folder
 102                  $this->filelist[] = new InstallerExtension($folder);
 103              }
 104          }
 105      }
 106  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer