Rev 1086 | Rev 1130 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1086 | Rev 1116 | ||
---|---|---|---|
Line 52... | Line 52... | ||
52 | // Only language plugins |
52 | // Only language plugins |
53 | private $languageCode = ''; |
53 | private $languageCode = ''; |
54 | private $languageFlag = ''; |
54 | private $languageFlag = ''; |
55 | private $languageMessages = ''; |
55 | private $languageMessages = ''; |
56 | 56 | ||
- | 57 | /** |
|
- | 58 | * @return string |
|
- | 59 | */ |
|
57 | public function getTypeClass(): string { |
60 | public function getTypeClass(): string { |
58 | return $this->type; |
61 | return $this->type; |
59 | } |
62 | } |
60 | 63 | ||
- | 64 | /** |
|
- | 65 | * @return string |
|
- | 66 | */ |
|
61 | public function getName(): string { |
67 | public function getName(): string { |
62 | return $this->name; |
68 | return $this->name; |
63 | } |
69 | } |
64 | 70 | ||
- | 71 | /** |
|
- | 72 | * @return string |
|
- | 73 | */ |
|
65 | public function getAuthor(): string { |
74 | public function getAuthor(): string { |
66 | return $this->author; |
75 | return $this->author; |
67 | } |
76 | } |
68 | 77 | ||
- | 78 | /** |
|
- | 79 | * @return string |
|
- | 80 | */ |
|
69 | public function getLicense(): string { |
81 | public function getLicense(): string { |
70 | return $this->license; |
82 | return $this->license; |
71 | } |
83 | } |
72 | 84 | ||
- | 85 | /** |
|
- | 86 | * @return string |
|
- | 87 | */ |
|
73 | public function getVersion(): string { |
88 | public function getVersion(): string { |
74 | if (str_starts_with($this->oid,'1.3.6.1.4.1.37476.2.5.2.4.') && ($this->version == '')) { |
89 | if (str_starts_with($this->oid,'1.3.6.1.4.1.37476.2.5.2.4.') && ($this->version == '')) { |
75 | $sysver = OIDplus::getVersion(); |
90 | $sysver = OIDplus::getVersion(); |
76 | if ($sysver == '') { |
91 | if ($sysver == '') { |
77 | //return _L('Part of OIDplus'); |
92 | //return _L('Part of OIDplus'); |
Line 83... | Line 98... | ||
83 | } else { |
98 | } else { |
84 | return $this->version; |
99 | return $this->version; |
85 | } |
100 | } |
86 | } |
101 | } |
87 | 102 | ||
- | 103 | /** |
|
- | 104 | * @return string |
|
- | 105 | */ |
|
88 | public function getHtmlDescription(): string { |
106 | public function getHtmlDescription(): string { |
89 | return $this->htmlDescription; |
107 | return $this->htmlDescription; |
90 | } |
108 | } |
91 | 109 | ||
- | 110 | /** |
|
- | 111 | * @return string |
|
- | 112 | */ |
|
92 | public function getOid(): string { |
113 | public function getOid(): string { |
93 | return $this->oid; |
114 | return $this->oid; |
94 | } |
115 | } |
95 | 116 | ||
- | 117 | /** |
|
- | 118 | * @return string |
|
- | 119 | */ |
|
96 | public function getPhpMainClass(): string { |
120 | public function getPhpMainClass(): string { |
97 | return $this->phpMainClass; |
121 | return $this->phpMainClass; |
98 | } |
122 | } |
99 | 123 | ||
100 | /** |
124 | /** |
101 | * @return array<string> |
125 | * @return string[] |
102 | */ |
126 | */ |
103 | public function getCSSFiles(): array { |
127 | public function getCSSFiles(): array { |
104 | return $this->cssFiles; |
128 | return $this->cssFiles; |
105 | } |
129 | } |
106 | 130 | ||
107 | /** |
131 | /** |
108 | * @return array<string> |
132 | * @return string[] |
109 | */ |
133 | */ |
110 | public function getJSFiles(): array { |
134 | public function getJSFiles(): array { |
111 | return $this->jsFiles; |
135 | return $this->jsFiles; |
112 | } |
136 | } |
113 | 137 | ||
114 | /** |
138 | /** |
115 | * @return array<string> |
139 | * @return string[] |
116 | */ |
140 | */ |
117 | public function getCSSFilesSetup(): array { |
141 | public function getCSSFilesSetup(): array { |
118 | return $this->cssFilesSetup; |
142 | return $this->cssFilesSetup; |
119 | } |
143 | } |
120 | 144 | ||
121 | /** |
145 | /** |
122 | * @return array<string> |
146 | * @return string[] |
123 | */ |
147 | */ |
124 | public function getJSFilesSetup(): array { |
148 | public function getJSFilesSetup(): array { |
125 | return $this->jsFilesSetup; |
149 | return $this->jsFilesSetup; |
126 | } |
150 | } |
127 | 151 | ||
- | 152 | /** |
|
- | 153 | * @return string |
|
- | 154 | */ |
|
128 | public function getManifestFile(): string { |
155 | public function getManifestFile(): string { |
129 | return $this->manifestFile; |
156 | return $this->manifestFile; |
130 | } |
157 | } |
131 | 158 | ||
- | 159 | /** |
|
- | 160 | * @return \SimpleXMLElement |
|
- | 161 | */ |
|
132 | public function getRawXml(): \SimpleXMLElement { |
162 | public function getRawXml(): \SimpleXMLElement { |
133 | return $this->rawXML; |
163 | return $this->rawXML; |
134 | } |
164 | } |
135 | 165 | ||
- | 166 | /** |
|
- | 167 | * @return string |
|
- | 168 | */ |
|
136 | public function getLanguageCode(): string { |
169 | public function getLanguageCode(): string { |
137 | return $this->languageCode; |
170 | return $this->languageCode; |
138 | } |
171 | } |
139 | 172 | ||
- | 173 | /** |
|
- | 174 | * @return string |
|
- | 175 | */ |
|
140 | public function getLanguageFlag(): string { |
176 | public function getLanguageFlag(): string { |
141 | return $this->languageFlag; |
177 | return $this->languageFlag; |
142 | } |
178 | } |
143 | 179 | ||
- | 180 | /** |
|
- | 181 | * @return string |
|
- | 182 | */ |
|
144 | public function getLanguageMessages(): string { |
183 | public function getLanguageMessages(): string { |
145 | return $this->languageMessages; |
184 | return $this->languageMessages; |
146 | } |
185 | } |
147 | 186 | ||
148 | /** |
187 | /** |
149 | * Lists all files referenced by the manifest files |
188 | * Lists all files referenced by the manifest files |
150 | * Not included are other files like menu images or other PHP classes |
189 | * Not included are other files like menu images or other PHP classes |
151 | * @return array<string> |
190 | * @return string[] |
- | 191 | * @throws \ReflectionException |
|
152 | */ |
192 | */ |
153 | public function getManifestLinkedFiles(): array { |
193 | public function getManifestLinkedFiles(): array { |
154 | $files = array_merge( |
194 | $files = array_merge( |
155 | $this->getJSFiles(), |
195 | $this->getJSFiles(), |
156 | $this->getCSSFiles(), |
196 | $this->getCSSFiles(), |
Line 161... | Line 201... | ||
161 | $files[] = (new \ReflectionClass($this->getPhpMainClass()))->getFileName(); |
201 | $files[] = (new \ReflectionClass($this->getPhpMainClass()))->getFileName(); |
162 | sort($files); |
202 | sort($files); |
163 | return $files; |
203 | return $files; |
164 | } |
204 | } |
165 | 205 | ||
- | 206 | /** |
|
- | 207 | * @param string $filename |
|
- | 208 | * @return bool |
|
- | 209 | */ |
|
166 | public function loadManifest($filename) { |
210 | public function loadManifest(string $filename) { |
167 | if (!file_exists($filename)) return false; |
211 | if (!file_exists($filename)) return false; |
168 | $xmldata = @simplexml_load_file($filename); |
212 | $xmldata = @simplexml_load_file($filename); |
169 | if ($xmldata === false) return false; |
213 | if ($xmldata === false) return false; // TODO: rather throw an Exception and let the method return void only |
170 | 214 | ||
171 | $this->manifestFile = $filename; |
215 | $this->manifestFile = $filename; |
172 | $this->rawXML = $xmldata; |
216 | $this->rawXML = $xmldata; |
173 | 217 | ||
174 | // The following attributes are available for every plugin |
218 | // The following attributes are available for every plugin |
Line 193... | Line 237... | ||
193 | $file = dirname($filename).DIRECTORY_SEPARATOR.$css_file; |
237 | $file = dirname($filename).DIRECTORY_SEPARATOR.$css_file; |
194 | //if (!file_exists($file)) continue; |
238 | //if (!file_exists($file)) continue; |
195 | $this->cssFiles[] = $file; |
239 | $this->cssFiles[] = $file; |
196 | } |
240 | } |
197 | 241 | ||
198 | // The following functionalities are only available for page plugins |
242 | // The following functionalities are only available for page plugins, captcha plugins, and object type plugins |
199 | // XML Schema urn:oid:1.3.6.1.4.1.37476.2.5.2.5.2.1 |
243 | // XML Schema urn:oid:1.3.6.1.4.1.37476.2.5.2.5.2.1 |
- | 244 | // XML Schema urn:oid:1.3.6.1.4.1.37476.2.5.2.5.10.1 |
|
- | 245 | // XML Schema urn:oid:1.3.6.1.4.1.37476.2.5.2.5.12.1 |
|
200 | foreach ((array)$xmldata->js->file as $js_file) { |
246 | foreach ((array)$xmldata->js->file as $js_file) { |
201 | $file = dirname($filename).DIRECTORY_SEPARATOR.$js_file; |
247 | $file = dirname($filename).DIRECTORY_SEPARATOR.$js_file; |
202 | //if (!file_exists($file)) continue; |
248 | //if (!file_exists($file)) continue; |
203 | $this->jsFiles[] = $file; |
249 | $this->jsFiles[] = $file; |
204 | } |
250 | } |