|
1
|
|
|
<?php |
|
2
|
|
|
namespace EWW\Dpf\Domain\Model; |
|
3
|
|
|
|
|
4
|
|
|
/* |
|
5
|
|
|
* This file is part of the TYPO3 CMS project. |
|
6
|
|
|
* |
|
7
|
|
|
* It is free software; you can redistribute it and/or modify it under |
|
8
|
|
|
* the terms of the GNU General Public License, either version 2 |
|
9
|
|
|
* of the License, or any later version. |
|
10
|
|
|
* |
|
11
|
|
|
* For the full copyright and license information, please read the |
|
12
|
|
|
* LICENSE.txt file that was distributed with this source code. |
|
13
|
|
|
* |
|
14
|
|
|
* The TYPO3 project - inspiring people to share! |
|
15
|
|
|
*/ |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* BibTexMetadata |
|
19
|
|
|
*/ |
|
20
|
|
|
class BibTexMetadata extends ExternalMetadata |
|
21
|
|
|
{ |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* @return string |
|
25
|
|
|
* @throws \Exception |
|
26
|
|
|
*/ |
|
27
|
|
|
public function getTitle(): string |
|
28
|
|
|
{ |
|
29
|
|
|
$node = $this->getDataXpath()->query('/response/title'); |
|
30
|
|
|
|
|
31
|
|
|
if ($node->length == 1) { |
|
32
|
|
|
return $node->item(0)->nodeValue; |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
return ''; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @return array |
|
40
|
|
|
*/ |
|
41
|
|
|
public function getPersons(): array |
|
42
|
|
|
{ |
|
43
|
|
|
$xpath = $this->getDataXpath(); |
|
44
|
|
|
|
|
45
|
|
|
$personList = []; |
|
46
|
|
|
|
|
47
|
|
|
$nodes = $xpath->query('/response/author'); |
|
48
|
|
|
|
|
49
|
|
|
foreach ($nodes as $person) { |
|
50
|
|
|
|
|
51
|
|
|
$name = ['family' => '', 'given' => '']; |
|
52
|
|
|
|
|
53
|
|
|
$family = $xpath->query('family', $person); |
|
54
|
|
|
if ($family->length > 0) { |
|
55
|
|
|
$name['family'] = $family->item(0)->nodeValue; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
$given = $xpath->query('given', $person); |
|
59
|
|
|
if ($given->length > 0) { |
|
60
|
|
|
$name['given'] = $given->item(0)->nodeValue; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
$personList[] = $name; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
return $personList; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* @return string |
|
71
|
|
|
*/ |
|
72
|
|
|
public function getYear(): string |
|
73
|
|
|
{ |
|
74
|
|
|
$xpath = $this->getDataXpath(); |
|
75
|
|
|
|
|
76
|
|
|
$node = $xpath->query('/response/year'); |
|
77
|
|
|
|
|
78
|
|
|
if ($node->length == 1) { |
|
79
|
|
|
return $node->item(0)->nodeValue; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
return ''; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* @return string |
|
87
|
|
|
* @throws \Exception |
|
88
|
|
|
*/ |
|
89
|
|
|
public function getPublicationType(): string |
|
90
|
|
|
{ |
|
91
|
|
|
$node = $this->getDataXpath()->query('/response/_type'); |
|
92
|
|
|
|
|
93
|
|
|
if ($node->length == 1) { |
|
94
|
|
|
return $node->item(0)->nodeValue; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
return ''; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
} |
|
101
|
|
|
|