Subversion Repositories oidplus

Rev

Rev 327 | Rev 359 | 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();
355 daniel-mar 32
        private $rawXML = null;
307 daniel-mar 33
 
308 daniel-mar 34
        public function getTypeClass(): string {
35
                return $this->type;
36
        }
37
 
307 daniel-mar 38
        public function getName(): string {
39
                return $this->name;
40
        }
41
 
42
        public function getAuthor(): string {
43
                return $this->author;
44
        }
45
 
46
        public function getVersion(): string {
47
                return $this->version;
48
        }
49
 
50
        public function getHtmlDescription(): string {
51
                return $this->htmlDescription;
52
        }
53
 
308 daniel-mar 54
        public function getOid(): string {
55
                return $this->oid;
56
        }
57
 
307 daniel-mar 58
        public function getPhpMainClass(): string {
59
                return $this->phpMainClass;
60
        }
61
 
62
        public function getCSSFiles(): array {
63
                return $this->cssFiles;
64
        }
65
 
66
        public function getJSFiles(): array {
67
                return $this->jsFiles;
68
        }
69
 
355 daniel-mar 70
        public function getRawXml(): object {
71
                return $this->rawXML;
72
        }
73
 
307 daniel-mar 74
        public function loadManifest($filename) {
308 daniel-mar 75
                if (!file_exists($filename)) return false;
76
                $xmldata = @simplexml_load_file($filename);
77
                if ($xmldata === false) return false;
307 daniel-mar 78
 
308 daniel-mar 79
                $this->type = (string)$xmldata->type;
307 daniel-mar 80
 
308 daniel-mar 81
                $this->name = (string)$xmldata->info->name;
82
                $this->author = (string)$xmldata->info->author;
83
                $this->version = (string)$xmldata->info->version;
84
                $this->htmlDescription = (string)$xmldata->info->descriptionHTML;
85
                $this->oid = (string)$xmldata->info->oid;
307 daniel-mar 86
 
308 daniel-mar 87
                $this->phpMainClass = (string)$xmldata->php->mainclass;
307 daniel-mar 88
 
308 daniel-mar 89
                foreach ((array)$xmldata->css->file as $css_file) {
327 daniel-mar 90
                        $file = dirname($filename).'/'.$css_file;
91
                        if (!file_exists($file)) continue;
92
                        $this->cssFiles[] = $file;
307 daniel-mar 93
                }
308 daniel-mar 94
                foreach ((array)$xmldata->js->file as $js_file) {
327 daniel-mar 95
                        $file = dirname($filename).'/'.$js_file;
96
                        if (!file_exists($file)) continue;
97
                        $this->jsFiles[] = $file;
308 daniel-mar 98
                }
307 daniel-mar 99
 
355 daniel-mar 100
                $this->rawXML = $xmldata;
101
 
307 daniel-mar 102
                return true;
103
        }
104
 
105
}