|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* (c) Kitodo. Key to digital objects e.V. <[email protected]> |
|
5
|
|
|
* |
|
6
|
|
|
* This file is part of the Kitodo and TYPO3 projects. |
|
7
|
|
|
* |
|
8
|
|
|
* @license GNU General Public License version 3 or later. |
|
9
|
|
|
* For the full copyright and license information, please read the |
|
10
|
|
|
* LICENSE.txt file that was distributed with this source code. |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace Kitodo\Dlf\Common\Document; |
|
14
|
|
|
|
|
15
|
|
|
use Kitodo\Dlf\Format\Item; |
|
|
|
|
|
|
16
|
|
|
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; |
|
17
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Model3D class for the 'dlf' extension. |
|
21
|
|
|
* |
|
22
|
|
|
* @author Beatrycze Volk <[email protected]> |
|
23
|
|
|
* @package TYPO3 |
|
24
|
|
|
* @subpackage dlf |
|
25
|
|
|
* @access public |
|
26
|
|
|
*/ |
|
27
|
|
|
final class Model3D extends Document |
|
28
|
|
|
{ |
|
29
|
|
|
/** |
|
30
|
|
|
* The extension key |
|
31
|
|
|
* |
|
32
|
|
|
* @var string |
|
33
|
|
|
* @static |
|
34
|
|
|
* @access public |
|
35
|
|
|
*/ |
|
36
|
|
|
public static $extKey = 'dlf'; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* This holds the XML file's ITEM part as \SimpleXMLElement object |
|
40
|
|
|
* |
|
41
|
|
|
* @var \SimpleXMLElement |
|
42
|
|
|
* @access protected |
|
43
|
|
|
*/ |
|
44
|
|
|
protected $item; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* {@inheritDoc} |
|
48
|
|
|
* @see Document::getDownloadLocation($id) |
|
49
|
|
|
*/ |
|
50
|
|
|
public function getDownloadLocation($id) |
|
51
|
|
|
{ |
|
52
|
|
|
// Nothing to do here, at the moment |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* {@inheritDoc} |
|
57
|
|
|
* @see Document::getFileLocation($id) |
|
58
|
|
|
*/ |
|
59
|
|
|
public function getFileLocation($id) |
|
60
|
|
|
{ |
|
61
|
|
|
// Nothing to do here, at the moment |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* {@inheritDoc} |
|
66
|
|
|
* @see Document::getFileMimeType($id) |
|
67
|
|
|
*/ |
|
68
|
|
|
public function getFileMimeType($id) |
|
69
|
|
|
{ |
|
70
|
|
|
// Nothing to do here, at the moment |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* {@inheritDoc} |
|
75
|
|
|
* @see Document::getFileLocation($id) |
|
76
|
|
|
*/ |
|
77
|
|
|
public function getLogicalStructure($id, $recursive = false) |
|
78
|
|
|
{ |
|
79
|
|
|
// Nothing to do here, at the moment |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* {@inheritDoc} |
|
84
|
|
|
* @see Document::getMetadata($id, $cPid = 0) |
|
85
|
|
|
*/ |
|
86
|
|
|
public function getMetadata($id, $cPid = 0) |
|
87
|
|
|
{ |
|
88
|
|
|
// Get metadata from parsed metadata array if available. |
|
89
|
|
|
if ( |
|
90
|
|
|
!empty($this->metadataArray[$id]) |
|
91
|
|
|
&& $this->metadataArray[0] == $cPid |
|
92
|
|
|
) { |
|
93
|
|
|
return $this->metadataArray[$id]; |
|
94
|
|
|
} |
|
95
|
|
|
// Initialize metadata array with empty values. |
|
96
|
|
|
$metadata = [ |
|
97
|
|
|
'title' => [], |
|
98
|
|
|
'description' => [], |
|
99
|
|
|
'author' => [], |
|
100
|
|
|
'preview_image' => [], |
|
101
|
|
|
'upload' => [], |
|
102
|
|
|
'document_format' => ['ITEM'] |
|
103
|
|
|
]; |
|
104
|
|
|
|
|
105
|
|
|
$item = GeneralUtility::makeInstance(Item::class); |
|
106
|
|
|
$item->extractMetadata($this->xml, $metadata); |
|
107
|
|
|
|
|
108
|
|
|
return $metadata; |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* {@inheritDoc} |
|
113
|
|
|
* @see Document::establishRecordId($pid) |
|
114
|
|
|
*/ |
|
115
|
|
|
protected function establishRecordId($pid) |
|
116
|
|
|
{ |
|
117
|
|
|
// Nothing to do here, at the moment |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* {@inheritDoc} |
|
122
|
|
|
* @see Document::getDocument() |
|
123
|
|
|
*/ |
|
124
|
|
|
protected function getDocument() |
|
125
|
|
|
{ |
|
126
|
|
|
return $this->item; |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
/** |
|
130
|
|
|
* {@inheritDoc} |
|
131
|
|
|
* @see Document::init() |
|
132
|
|
|
*/ |
|
133
|
|
|
protected function init() |
|
134
|
|
|
{ |
|
135
|
|
|
// Get ITEM node from XML file. |
|
136
|
|
|
$item = $this->xml->xpath('/response/item[@key="0"]'); |
|
137
|
|
|
if (!empty($item)) { |
|
138
|
|
|
$this->item = $item; |
|
|
|
|
|
|
139
|
|
|
} else { |
|
140
|
|
|
$this->logger->error('No ITEM part found in document with UID ' . $this->uid); |
|
|
|
|
|
|
141
|
|
|
} |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
/** |
|
145
|
|
|
* {@inheritDoc} |
|
146
|
|
|
* @see Document::loadLocation($location) |
|
147
|
|
|
*/ |
|
148
|
|
|
protected function loadLocation($location) |
|
149
|
|
|
{ |
|
150
|
|
|
$xml = $this->loadXMLLocation($location); |
|
151
|
|
|
// Set some basic properties. |
|
152
|
|
|
if ($xml !== false) { |
|
153
|
|
|
$this->xml = $xml; |
|
|
|
|
|
|
154
|
|
|
return true; |
|
155
|
|
|
} |
|
156
|
|
|
return false; |
|
157
|
|
|
} |
|
158
|
|
|
|
|
159
|
|
|
/** |
|
160
|
|
|
* {@inheritDoc} |
|
161
|
|
|
* @see Document::getParentDocumentUidForSaving($pid, $core, $owner) |
|
162
|
|
|
*/ |
|
163
|
|
|
protected function getParentDocumentUidForSaving($pid, $core, $owner) |
|
164
|
|
|
{ |
|
165
|
|
|
// Nothing to do here, at the moment |
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
/** |
|
169
|
|
|
* {@inheritDoc} |
|
170
|
|
|
* @see Document::prepareMetadataArray($cPid) |
|
171
|
|
|
*/ |
|
172
|
|
|
protected function prepareMetadataArray($cPid) |
|
173
|
|
|
{ |
|
174
|
|
|
// Nothing to do here, at the moment |
|
175
|
|
|
} |
|
176
|
|
|
|
|
177
|
|
|
/** |
|
178
|
|
|
* {@inheritDoc} |
|
179
|
|
|
* @see Document::setPreloadedDocument($preloadedDocument) |
|
180
|
|
|
*/ |
|
181
|
|
|
protected function setPreloadedDocument($preloadedDocument) |
|
182
|
|
|
{ |
|
183
|
|
|
// Nothing to do here, at the moment |
|
184
|
|
|
} |
|
185
|
|
|
|
|
186
|
|
|
/** |
|
187
|
|
|
* {@inheritDoc} |
|
188
|
|
|
* @see Document::_getPhysicalStructure() |
|
189
|
|
|
*/ |
|
190
|
|
|
protected function _getPhysicalStructure() |
|
191
|
|
|
{ |
|
192
|
|
|
// Nothing to do here, at the moment |
|
193
|
|
|
} |
|
194
|
|
|
|
|
195
|
|
|
/** |
|
196
|
|
|
* {@inheritDoc} |
|
197
|
|
|
* @see Document::_getSmLinks() |
|
198
|
|
|
*/ |
|
199
|
|
|
protected function _getSmLinks() |
|
200
|
|
|
{ |
|
201
|
|
|
// Nothing to do here, at the moment |
|
202
|
|
|
} |
|
203
|
|
|
|
|
204
|
|
|
/** |
|
205
|
|
|
* {@inheritDoc} |
|
206
|
|
|
* @see Document::_getThumbnail($forceReload = false) |
|
207
|
|
|
*/ |
|
208
|
|
|
protected function _getThumbnail($forceReload = false) |
|
209
|
|
|
{ |
|
210
|
|
|
// Nothing to do here, at the moment |
|
211
|
|
|
} |
|
212
|
|
|
|
|
213
|
|
|
/** |
|
214
|
|
|
* {@inheritDoc} |
|
215
|
|
|
* @see Document::_getToplevelId() |
|
216
|
|
|
*/ |
|
217
|
|
|
protected function _getToplevelId() |
|
218
|
|
|
{ |
|
219
|
|
|
// Nothing to do here, at the moment |
|
220
|
|
|
} |
|
221
|
|
|
} |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths