[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Installer/ -> Manifest.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;
  11  
  12  use Joomla\CMS\Language\Text;
  13  
  14  // phpcs:disable PSR1.Files.SideEffects
  15  \defined('JPATH_PLATFORM') or die;
  16  // phpcs:enable PSR1.Files.SideEffects
  17  
  18  /**
  19   * Joomla! Package Manifest File
  20   *
  21   * @since  3.1
  22   */
  23  abstract class Manifest
  24  {
  25      /**
  26       * Path to the manifest file
  27       *
  28       * @var    string
  29       * @since  3.1
  30       */
  31      public $manifest_file = '';
  32  
  33      /**
  34       * Name of the extension
  35       *
  36       * @var    string
  37       * @since  3.1
  38       */
  39      public $name = '';
  40  
  41      /**
  42       * Version of the extension
  43       *
  44       * @var    string
  45       * @since  3.1
  46       */
  47      public $version = '';
  48  
  49      /**
  50       * Description of the extension
  51       *
  52       * @var    string
  53       * @since  3.1
  54       */
  55      public $description = '';
  56  
  57      /**
  58       * Packager of the extension
  59       *
  60       * @var    string
  61       * @since  3.1
  62       */
  63      public $packager = '';
  64  
  65      /**
  66       * Packager's URL of the extension
  67       *
  68       * @var    string
  69       * @since  3.1
  70       */
  71      public $packagerurl = '';
  72  
  73      /**
  74       * Update site for the extension
  75       *
  76       * @var    string
  77       * @since  3.1
  78       */
  79      public $update = '';
  80  
  81      /**
  82       * List of files in the extension
  83       *
  84       * @var    array
  85       * @since  3.1
  86       */
  87      public $filelist = array();
  88  
  89      /**
  90       * Constructor
  91       *
  92       * @param   string  $xmlpath  Path to XML manifest file.
  93       *
  94       * @since   3.1
  95       */
  96      public function __construct($xmlpath = '')
  97      {
  98          if ($xmlpath !== '') {
  99              $this->loadManifestFromXml($xmlpath);
 100          }
 101      }
 102  
 103      /**
 104       * Load a manifest from a file
 105       *
 106       * @param   string  $xmlfile  Path to file to load
 107       *
 108       * @return  boolean
 109       *
 110       * @since   3.1
 111       */
 112      public function loadManifestFromXml($xmlfile)
 113      {
 114          $this->manifest_file = basename($xmlfile, '.xml');
 115  
 116          $xml = simplexml_load_file($xmlfile);
 117  
 118          if (!$xml) {
 119              $this->_errors[] = Text::sprintf('JLIB_INSTALLER_ERROR_LOAD_XML', $xmlfile);
 120  
 121              return false;
 122          } else {
 123              $this->loadManifestFromData($xml);
 124  
 125              return true;
 126          }
 127      }
 128  
 129      /**
 130       * Apply manifest data from a \SimpleXMLElement to the object.
 131       *
 132       * @param   \SimpleXMLElement  $xml  Data to load
 133       *
 134       * @return  void
 135       *
 136       * @since   3.1
 137       */
 138      abstract protected function loadManifestFromData(\SimpleXMLElement $xml);
 139  }


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