1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SCI; |
4
|
|
|
|
5
|
|
|
use SMW\PropertyRegistry as CorePropertyRegistry; |
|
|
|
|
6
|
|
|
|
7
|
|
|
// Globally defined predefined property labels |
8
|
|
|
define( 'SCI_PROP_CITE_KEY', 'Citation key' ); |
9
|
|
|
define( 'SCI_PROP_CITE_REFERENCE', 'Citation reference' ); |
10
|
|
|
define( 'SCI_PROP_CITE_TEXT', 'Citation text' ); |
11
|
|
|
define( 'SCI_PROP_CITE', 'Citation resource' ); |
12
|
|
|
define( 'SCI_PROP_DOI', 'DOI' ); |
13
|
|
|
define( 'SCI_PROP_PMCID', 'PMCID' ); |
14
|
|
|
define( 'SCI_PROP_PMID', 'PMID' ); |
15
|
|
|
define( 'SCI_PROP_OCLC', 'OCLC' ); |
16
|
|
|
define( 'SCI_PROP_VIAF', 'VIAF' ); |
17
|
|
|
define( 'SCI_PROP_OLID', 'OLID' ); |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @license GNU GPL v2+ |
21
|
|
|
* @since 1.0 |
22
|
|
|
* |
23
|
|
|
* @author mwjames |
24
|
|
|
*/ |
25
|
|
|
class PropertyRegistry { |
26
|
|
|
|
27
|
|
|
const SCI_CITE_KEY = '__sci_cite_key'; |
28
|
|
|
const SCI_CITE_REFERENCE = '__sci_cite_reference'; |
29
|
|
|
const SCI_CITE_TEXT = '__sci_cite_text'; |
30
|
|
|
const SCI_CITE = '__sci_cite'; |
31
|
|
|
const SCI_DOI = '__sci_doi'; |
32
|
|
|
const SCI_PMCID = '__sci_pmcid'; |
33
|
|
|
const SCI_PMID = '__sci_pmid'; |
34
|
|
|
const SCI_OCLC = '__sci_oclc'; |
35
|
|
|
const SCI_VIAF = '__sci_viaf'; |
36
|
|
|
const SCI_OLID = '__sci_olid'; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @since 1.0 |
40
|
|
|
* |
41
|
|
|
* @param CorePropertyRegistry $corePropertyRegistry |
42
|
|
|
* |
43
|
|
|
* @return boolean |
44
|
|
|
*/ |
45
|
20 |
|
public function registerTo( CorePropertyRegistry $corePropertyRegistry ) { |
46
|
|
|
|
47
|
|
|
$propertyDefinitions = [ |
48
|
|
|
|
49
|
20 |
|
self::SCI_OLID => [ |
50
|
20 |
|
'label' => SCI_PROP_OLID, |
51
|
20 |
|
'type' => '_sci_olid', |
52
|
20 |
|
'alias' => [ wfMessage( 'sci-property-alias-olid' )->text(), 'olid', 'Olid' ], |
|
|
|
|
53
|
|
|
'visibility' => true, |
54
|
|
|
'annotableByUser' => true |
55
|
|
|
], |
56
|
|
|
|
57
|
20 |
|
self::SCI_VIAF => [ |
58
|
20 |
|
'label' => SCI_PROP_VIAF, |
59
|
20 |
|
'type' => '_sci_viaf', |
60
|
20 |
|
'alias' => [ wfMessage( 'sci-property-alias-viaf' )->text(), 'viaf', 'Viaf' ], |
61
|
|
|
'visibility' => true, |
62
|
|
|
'annotableByUser' => true |
63
|
|
|
], |
64
|
|
|
|
65
|
20 |
|
self::SCI_OCLC => [ |
66
|
20 |
|
'label' => SCI_PROP_OCLC, |
67
|
20 |
|
'type' => '_sci_oclc', |
68
|
20 |
|
'alias' => [ wfMessage( 'sci-property-alias-oclc' )->text(), 'oclc', 'Oclc' ], |
69
|
|
|
'visibility' => true, |
70
|
|
|
'annotableByUser' => true |
71
|
|
|
], |
72
|
|
|
|
73
|
20 |
|
self::SCI_DOI => [ |
74
|
20 |
|
'label' => SCI_PROP_DOI, |
75
|
20 |
|
'type' => '_sci_doi', |
76
|
20 |
|
'alias' => [ wfMessage( 'sci-property-alias-doi' )->text(), 'Doi', 'doi' ], |
77
|
|
|
'visibility' => true, |
78
|
|
|
'annotableByUser' => true |
79
|
|
|
], |
80
|
|
|
|
81
|
20 |
|
self::SCI_PMCID => [ |
82
|
20 |
|
'label' => SCI_PROP_PMCID, |
83
|
20 |
|
'type' => '_sci_pmcid', |
84
|
20 |
|
'alias' => [ wfMessage( 'sci-property-alias-pmcid' )->text(), 'Pmcid', 'pmcid' ], |
85
|
|
|
'visibility' => true, |
86
|
|
|
'annotableByUser' => true |
87
|
|
|
], |
88
|
|
|
|
89
|
20 |
|
self::SCI_PMID => [ |
90
|
20 |
|
'label' => SCI_PROP_PMID, |
91
|
20 |
|
'type' => '_sci_pmid', |
92
|
20 |
|
'alias' => [ wfMessage( 'sci-property-alias-pmid' )->text(), 'Pmid', 'pmid' ], |
93
|
|
|
'visibility' => true, |
94
|
|
|
'annotableByUser' => true |
95
|
|
|
], |
96
|
|
|
|
97
|
20 |
|
self::SCI_CITE_KEY => [ |
98
|
20 |
|
'label' => SCI_PROP_CITE_KEY, |
99
|
20 |
|
'type' => '_txt', |
100
|
20 |
|
'alias' => [ wfMessage( 'sci-property-alias-citation-key' )->text() ], |
101
|
|
|
'visibility' => true, |
102
|
|
|
'annotableByUser' => true |
103
|
|
|
], |
104
|
|
|
|
105
|
|
|
// Allow CiteRef to be an alias as it saves typing |
106
|
|
|
// [[CiteRef:: ... ]] instead of [[Citation reference:: ... ]] |
107
|
20 |
|
self::SCI_CITE_REFERENCE => [ |
108
|
20 |
|
'label' => SCI_PROP_CITE_REFERENCE, |
109
|
20 |
|
'type' => '_sci_ref', |
110
|
20 |
|
'alias' => [ wfMessage( 'sci-property-alias-citation-reference' )->text(), 'CiteRef' ], |
111
|
|
|
'visibility' => true, |
112
|
|
|
'annotableByUser' => true |
113
|
|
|
], |
114
|
|
|
|
115
|
20 |
|
self::SCI_CITE_TEXT => [ |
116
|
20 |
|
'label' => SCI_PROP_CITE_TEXT, |
117
|
20 |
|
'type' => '_txt', |
118
|
20 |
|
'alias' => [ wfMessage( 'sci-property-alias-citation-text' )->text() ], |
119
|
|
|
'visibility' => true, |
120
|
|
|
'annotableByUser' => true |
121
|
|
|
], |
122
|
|
|
|
123
|
20 |
|
self::SCI_CITE => [ |
124
|
20 |
|
'label' => SCI_PROP_CITE, |
125
|
20 |
|
'type' => '__sob', |
126
|
20 |
|
'alias' => [ wfMessage( 'sci-property-alias-citation-resource' )->text() ], |
127
|
|
|
'visibility' => true, |
128
|
|
|
'annotableByUser' => false |
129
|
|
|
] |
130
|
|
|
]; |
131
|
|
|
|
132
|
20 |
|
foreach ( $propertyDefinitions as $propertyId => $definition ) { |
133
|
20 |
|
$this->addPropertyDefinitionFor( $corePropertyRegistry, $propertyId, $definition ); |
134
|
|
|
} |
135
|
|
|
|
136
|
20 |
|
return true; |
137
|
|
|
} |
138
|
|
|
|
139
|
20 |
|
private function addPropertyDefinitionFor( $corePropertyRegistry, $propertyId, $definition ) { |
140
|
|
|
|
141
|
20 |
|
$corePropertyRegistry->registerProperty( |
142
|
20 |
|
$propertyId, |
143
|
20 |
|
$definition['type'], |
144
|
20 |
|
$definition['label'], |
145
|
20 |
|
$definition['visibility'], |
146
|
20 |
|
$definition['annotableByUser'] |
147
|
|
|
); |
148
|
|
|
|
149
|
20 |
|
foreach ( $definition['alias'] as $alias ) { |
150
|
20 |
|
$corePropertyRegistry->registerPropertyAlias( |
151
|
20 |
|
$propertyId, |
152
|
20 |
|
$alias |
153
|
|
|
); |
154
|
|
|
} |
155
|
20 |
|
} |
156
|
|
|
|
157
|
|
|
} |
158
|
|
|
|
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