Rev 307 | Rev 327 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
307 | daniel-mar | 1 | <?php |
2 | |||
3 | /* |
||
4 | * OIDplus 2.0 |
||
5 | * Copyright 2019 Daniel Marschall, ViaThinkSoft |
||
6 | * |
||
7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
||
8 | * you may not use this file except in compliance with the License. |
||
9 | * You may obtain a copy of the License at |
||
10 | * |
||
11 | * http://www.apache.org/licenses/LICENSE-2.0 |
||
12 | * |
||
13 | * Unless required by applicable law or agreed to in writing, software |
||
14 | * distributed under the License is distributed on an "AS IS" BASIS, |
||
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||
16 | * See the License for the specific language governing permissions and |
||
17 | * limitations under the License. |
||
18 | */ |
||
19 | |||
20 | class OIDplusPluginManifest { |
||
21 | |||
308 | daniel-mar | 22 | private $name = ''; |
23 | private $author = ''; |
||
24 | private $version = ''; |
||
25 | private $htmlDescription = ''; |
||
26 | private $oid = ''; |
||
307 | daniel-mar | 27 | |
308 | daniel-mar | 28 | private $type = ''; |
29 | private $phpMainClass = ''; |
||
307 | daniel-mar | 30 | private $cssFiles = array(); |
31 | private $jsFiles = array(); |
||
32 | |||
308 | daniel-mar | 33 | public function getTypeClass(): string { |
34 | return $this->type; |
||
35 | } |
||
36 | |||
307 | daniel-mar | 37 | public function getName(): string { |
38 | return $this->name; |
||
39 | } |
||
40 | |||
41 | public function getAuthor(): string { |
||
42 | return $this->author; |
||
43 | } |
||
44 | |||
45 | public function getVersion(): string { |
||
46 | return $this->version; |
||
47 | } |
||
48 | |||
49 | public function getHtmlDescription(): string { |
||
50 | return $this->htmlDescription; |
||
51 | } |
||
52 | |||
308 | daniel-mar | 53 | public function getOid(): string { |
54 | return $this->oid; |
||
55 | } |
||
56 | |||
307 | daniel-mar | 57 | public function getPhpMainClass(): string { |
58 | return $this->phpMainClass; |
||
59 | } |
||
60 | |||
61 | public function getCSSFiles(): array { |
||
62 | return $this->cssFiles; |
||
63 | } |
||
64 | |||
65 | public function getJSFiles(): array { |
||
66 | return $this->jsFiles; |
||
67 | } |
||
68 | |||
69 | public function loadManifest($filename) { |
||
308 | daniel-mar | 70 | if (!file_exists($filename)) return false; |
71 | $xmldata = @simplexml_load_file($filename); |
||
72 | if ($xmldata === false) return false; |
||
307 | daniel-mar | 73 | |
308 | daniel-mar | 74 | $this->type = (string)$xmldata->type; |
307 | daniel-mar | 75 | |
308 | daniel-mar | 76 | $this->name = (string)$xmldata->info->name; |
77 | $this->author = (string)$xmldata->info->author; |
||
78 | $this->version = (string)$xmldata->info->version; |
||
79 | $this->htmlDescription = (string)$xmldata->info->descriptionHTML; |
||
80 | $this->oid = (string)$xmldata->info->oid; |
||
307 | daniel-mar | 81 | |
308 | daniel-mar | 82 | $this->phpMainClass = (string)$xmldata->php->mainclass; |
307 | daniel-mar | 83 | |
308 | daniel-mar | 84 | foreach ((array)$xmldata->css->file as $css_file) { |
85 | $this->cssFiles[] = dirname($filename).'/'.$css_file; |
||
307 | daniel-mar | 86 | } |
308 | daniel-mar | 87 | foreach ((array)$xmldata->js->file as $js_file) { |
88 | $this->jsFiles[] = dirname($filename).'/'.$js_file; |
||
89 | } |
||
307 | daniel-mar | 90 | |
91 | return true; |
||
92 | } |
||
93 | |||
94 | } |