This repository has been archived by the owner on Nov 26, 2017. It is now read-only.
/
packagemanifest.php
142 lines (122 loc) · 2.88 KB
/
packagemanifest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?php
/**
* @package Joomla.Platform
* @subpackage Installer
*
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
jimport('joomla.filesystem.file');
jimport('joomla.installer.extension');
/**
* Joomla! Package Manifest File
*
* @package Joomla.Platform
* @subpackage Installer
* @since 11.1
*/
class JPackageManifest extends JObject
{
/**
* @var string name Name of the package
*/
public $name = '';
/**
* @var string packagename Unique name of the package
*/
public $packagename = '';
/**
* @var string url Website for the package
*/
public $url = '';
/**
* @var string description Description for the package
*/
public $description = '';
/**
* @var string packager Packager of the package
*/
public $packager = '';
/**
* @var string packagerurl Packager's URL of the package
*/
public $packagerurl = '';
/**
* @var string scriptfile Scriptfile for the package
*/
public $scriptfile = '';
/**
* @var string update Update site for the package
*/
public $update = '';
/**
* @var string version Version of the package
*/
public $version = '';
/**
* @var array filelist List of files in this package
*/
public $filelist = array();
/**
* @var string manifest_file Path to the manifest file
*/
public $manifest_file = '';
/**
* Constructor
*
* @param string $xmlpath Path to XML manifest file.
*
* @since
*/
public function __construct($xmlpath = '')
{
if (strlen($xmlpath))
{
$this->loadManifestFromXML($xmlpath);
}
}
/**
* Load a manifest from an XML file
*
* @param string $xmlfile Path to XML manifest file
*
* @return boolean Result of load
*
* @since 11.1
*/
public function loadManifestFromXML($xmlfile)
{
$this->manifest_file = JFile::stripExt(basename($xmlfile));
$xml = JFactory::getXML($xmlfile);
if (!$xml)
{
$this->_errors[] = JText::sprintf('JLIB_INSTALLER_ERROR_LOAD_XML', $xmlfile);
return false;
}
else
{
$this->name = (string) $xml->name;
$this->packagename = (string) $xml->packagename;
$this->update = (string) $xml->update;
$this->authorurl = (string) $xml->authorUrl;
$this->author = (string) $xml->author;
$this->authoremail = (string) $xml->authorEmail;
$this->description = (string) $xml->description;
$this->packager = (string) $xml->packager;
$this->packagerurl = (string) $xml->packagerurl;
$this->scriptfile = (string) $xml->scriptfile;
$this->version = (string) $xml->version;
if (isset($xml->files->file) && count($xml->files->file))
{
foreach ($xml->files->file as $file)
{
// NOTE: JExtension doesn't expect a string.
// DO NOT CAST $file
$this->filelist[] = new JExtension($file);
}
}
return true;
}
}
}