@@ -52,12 +52,12 @@ |
||
52 | 52 | $(document).ready(function() { |
53 | 53 | AudioPlayer = new dlfAudioPlayer({ |
54 | 54 | audio: { |
55 | - mimeType: "' . $this->audio['mimetype'] . '", |
|
56 | - title: "' . $this->audio['label'] . '", |
|
57 | - url: "' . $this->audio['url'] . '" |
|
55 | + mimeType: "' . $this->audio['mimetype'].'", |
|
56 | + title: "' . $this->audio['label'].'", |
|
57 | + url: "' . $this->audio['url'].'" |
|
58 | 58 | }, |
59 | 59 | parentElId: "tx-dlf-audio", |
60 | - swfPath: "' . PathUtility::stripPathSitePrefix(ExtensionManagementUtility::extPath('dlf')) . 'Resources/Public/JavaScript/jPlayer/jquery.jplayer.swf" |
|
60 | + swfPath: "' . PathUtility::stripPathSitePrefix(ExtensionManagementUtility::extPath('dlf')).'Resources/Public/JavaScript/jPlayer/jquery.jplayer.swf" |
|
61 | 61 | }); |
62 | 62 | }); |
63 | 63 | '; |
@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | * @subpackage dlf |
26 | 26 | * @access public |
27 | 27 | */ |
28 | -class AudioplayerController extends AbstractController |
|
29 | -{ |
|
28 | +class AudioplayerController extends AbstractController { |
|
30 | 29 | /** |
31 | 30 | * Holds the current audio file's URL, MIME type and optional label |
32 | 31 | * |
@@ -42,8 +41,7 @@ discard block |
||
42 | 41 | * |
43 | 42 | * @return void |
44 | 43 | */ |
45 | - protected function addPlayerJS() |
|
46 | - { |
|
44 | + protected function addPlayerJS() { |
|
47 | 45 | // Inline CSS. |
48 | 46 | $inlineCSS = '#tx-dlf-audio { width: 100px; height: 100px; }'; |
49 | 47 | |
@@ -72,8 +70,7 @@ discard block |
||
72 | 70 | * |
73 | 71 | * @return void |
74 | 72 | */ |
75 | - public function mainAction() |
|
76 | - { |
|
73 | + public function mainAction() { |
|
77 | 74 | // Load current document. |
78 | 75 | $this->loadDocument($this->requestData); |
79 | 76 | if ($this->isDocMissingOrEmpty()) { |
@@ -16,67 +16,67 @@ |
||
16 | 16 | // Plugin "audioplayer". |
17 | 17 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_audioplayer'] = 'layout,select_key,pages,recursive'; |
18 | 18 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_audioplayer'] = 'pi_flexform'; |
19 | -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_audioplayer', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/AudioPlayer.xml'); |
|
19 | +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_audioplayer', 'FILE:EXT:'.'dlf/Configuration/FlexForms/AudioPlayer.xml'); |
|
20 | 20 | // Plugin "basket". |
21 | 21 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_basket'] = 'layout,select_key,pages,recursive'; |
22 | 22 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_basket'] = 'pi_flexform'; |
23 | -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_basket', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/Basket.xml'); |
|
23 | +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_basket', 'FILE:EXT:'.'dlf/Configuration/FlexForms/Basket.xml'); |
|
24 | 24 | // Plugin "calendar". |
25 | 25 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_calendar'] = 'layout,select_key,pages,recursive'; |
26 | 26 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_calendar'] = 'pi_flexform'; |
27 | -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_calendar', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/Calendar.xml'); |
|
27 | +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_calendar', 'FILE:EXT:'.'dlf/Configuration/FlexForms/Calendar.xml'); |
|
28 | 28 | // Plugin "collection". |
29 | 29 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_collection'] = 'layout,select_key,pages,recursive'; |
30 | 30 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_collection'] = 'pi_flexform'; |
31 | -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_collection', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/Collection.xml'); |
|
31 | +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_collection', 'FILE:EXT:'.'dlf/Configuration/FlexForms/Collection.xml'); |
|
32 | 32 | // Plugin "feeds". |
33 | 33 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_feeds'] = 'layout,select_key,pages,recursive'; |
34 | 34 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_feeds'] = 'pi_flexform'; |
35 | -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_feeds', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/Feeds.xml'); |
|
35 | +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_feeds', 'FILE:EXT:'.'dlf/Configuration/FlexForms/Feeds.xml'); |
|
36 | 36 | // Plugin "listview". |
37 | 37 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_listview'] = 'layout,select_key,pages,recursive'; |
38 | 38 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_listview'] = 'pi_flexform'; |
39 | -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_listview', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/ListView.xml'); |
|
39 | +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_listview', 'FILE:EXT:'.'dlf/Configuration/FlexForms/ListView.xml'); |
|
40 | 40 | // Plugin "metadata". |
41 | 41 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_metadata'] = 'layout,select_key,pages,recursive'; |
42 | 42 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_metadata'] = 'pi_flexform'; |
43 | -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_metadata', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/Metadata.xml'); |
|
43 | +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_metadata', 'FILE:EXT:'.'dlf/Configuration/FlexForms/Metadata.xml'); |
|
44 | 44 | // Plugin "navigation". |
45 | 45 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_navigation'] = 'layout,select_key,pages,recursive'; |
46 | 46 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_navigation'] = 'pi_flexform'; |
47 | -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_navigation', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/Navigation.xml'); |
|
47 | +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_navigation', 'FILE:EXT:'.'dlf/Configuration/FlexForms/Navigation.xml'); |
|
48 | 48 | // Plugin "oaipmh". |
49 | 49 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_oaipmh'] = 'layout,select_key,pages,recursive'; |
50 | 50 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_oaipmh'] = 'pi_flexform'; |
51 | -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_oaipmh', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/OaiPmh.xml'); |
|
51 | +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_oaipmh', 'FILE:EXT:'.'dlf/Configuration/FlexForms/OaiPmh.xml'); |
|
52 | 52 | // Plugin "pagegrid". |
53 | 53 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_pagegrid'] = 'layout,select_key,pages,recursive'; |
54 | 54 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_pagegrid'] = 'pi_flexform'; |
55 | -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_pagegrid', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/PageGrid.xml'); |
|
55 | +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_pagegrid', 'FILE:EXT:'.'dlf/Configuration/FlexForms/PageGrid.xml'); |
|
56 | 56 | // Plugin "pageview". |
57 | 57 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_pageview'] = 'layout,select_key,pages,recursive'; |
58 | 58 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_pageview'] = 'pi_flexform'; |
59 | -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_pageview', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/PageView.xml'); |
|
59 | +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_pageview', 'FILE:EXT:'.'dlf/Configuration/FlexForms/PageView.xml'); |
|
60 | 60 | // Plugin "search". |
61 | 61 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_search'] = 'layout,select_key,pages,recursive'; |
62 | 62 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_search'] = 'pi_flexform'; |
63 | -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_search', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/Search.xml'); |
|
63 | +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_search', 'FILE:EXT:'.'dlf/Configuration/FlexForms/Search.xml'); |
|
64 | 64 | // Plugin "statistics". |
65 | 65 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_statistics'] = 'layout,select_key,pages,recursive'; |
66 | 66 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_statistics'] = 'pi_flexform'; |
67 | -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_statistics', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/Statistics.xml'); |
|
67 | +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_statistics', 'FILE:EXT:'.'dlf/Configuration/FlexForms/Statistics.xml'); |
|
68 | 68 | // Plugin "tableofcontents". |
69 | 69 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_tableofcontents'] = 'layout,select_key,pages,recursive'; |
70 | 70 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_tableofcontents'] = 'pi_flexform'; |
71 | -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_tableofcontents', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/TableOfContents.xml'); |
|
71 | +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_tableofcontents', 'FILE:EXT:'.'dlf/Configuration/FlexForms/TableOfContents.xml'); |
|
72 | 72 | // Plugin "toolbox". |
73 | 73 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_toolbox'] = 'layout,select_key,pages,recursive'; |
74 | 74 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_toolbox'] = 'pi_flexform'; |
75 | -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_toolbox', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/Toolbox.xml'); |
|
75 | +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_toolbox', 'FILE:EXT:'.'dlf/Configuration/FlexForms/Toolbox.xml'); |
|
76 | 76 | // Plugin "view3d". |
77 | 77 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_view3d'] = 'layout,select_key,pages,recursive'; |
78 | 78 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_view3d'] = 'pi_flexform'; |
79 | -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_view3d', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/View3D.xml'); |
|
79 | +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_view3d', 'FILE:EXT:'.'dlf/Configuration/FlexForms/View3D.xml'); |
|
80 | 80 | |
81 | 81 | \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( |
82 | 82 | 'Kitodo.Dlf', |
@@ -46,8 +46,7 @@ |
||
46 | 46 | * |
47 | 47 | * @return void |
48 | 48 | */ |
49 | - public function extractMetadata(\SimpleXMLElement $xml, array &$metadata) |
|
50 | - { |
|
49 | + public function extractMetadata(\SimpleXMLElement $xml, array &$metadata) { |
|
51 | 50 | $this->xml = $xml; |
52 | 51 | $this->metadata = $metadata; |
53 | 52 |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | if (!empty($name)) { |
100 | 100 | $this->metadata['author'][$i] = [ |
101 | 101 | 'name' => $name, |
102 | - 'url' => 'https://orcid.org/' . $orcidId |
|
102 | + 'url' => 'https://orcid.org/'.$orcidId |
|
103 | 103 | ]; |
104 | 104 | } else { |
105 | 105 | //fallback into display form |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | } |
147 | 147 | // Append "valueURI" to name using Unicode unit separator. |
148 | 148 | if (isset($authors[$i]['valueURI'])) { |
149 | - $this->metadata['author'][$i] .= chr(31) . (string) $authors[$i]['valueURI']; |
|
149 | + $this->metadata['author'][$i] .= chr(31).(string) $authors[$i]['valueURI']; |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | if (!empty($name)) { |
188 | 188 | $this->metadata['holder'][$i] = [ |
189 | 189 | 'name' => $name, |
190 | - 'url' => 'http://viaf.org/viaf/' . $viafId |
|
190 | + 'url' => 'http://viaf.org/viaf/'.$viafId |
|
191 | 191 | ]; |
192 | 192 | } else { |
193 | 193 | //fallback into display form |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $this->getHolderFromXmlDisplayForm($holders, $i); |
200 | 200 | // Append "valueURI" to name using Unicode unit separator. |
201 | 201 | if (isset($holders[$i]['valueURI'])) { |
202 | - $this->metadata['holder'][$i] .= chr(31) . (string) $holders[$i]['valueURI']; |
|
202 | + $this->metadata['holder'][$i] .= chr(31).(string) $holders[$i]['valueURI']; |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 |
@@ -129,7 +129,7 @@ |
||
129 | 129 | $this->raw->registerXPathNamespace('personal-details', 'http://www.orcid.org/ns/personal-details'); |
130 | 130 | $givenNames = $this->raw->xpath('./personal-details:name/personal-details:given-names'); |
131 | 131 | $familyName = $this->raw->xpath('./personal-details:name/personal-details:family-name'); |
132 | - return (string) $givenNames[0] . ' ' . (string) $familyName[0]; |
|
132 | + return (string) $givenNames[0].' '.(string) $familyName[0]; |
|
133 | 133 | } else { |
134 | 134 | $this->logger->warning('No name found for given ORCID'); |
135 | 135 | return false; |
@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | * @subpackage dlf |
26 | 26 | * @access public |
27 | 27 | **/ |
28 | -class Profile |
|
29 | -{ |
|
28 | +class Profile { |
|
30 | 29 | /** |
31 | 30 | * This holds the logger |
32 | 31 | * |
@@ -57,8 +56,7 @@ discard block |
||
57 | 56 | * |
58 | 57 | * @return void |
59 | 58 | **/ |
60 | - public function __construct($orcid) |
|
61 | - { |
|
59 | + public function __construct($orcid) { |
|
62 | 60 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
63 | 61 | $this->client = new Client($orcid, GeneralUtility::makeInstance(RequestFactory::class)); |
64 | 62 | } |
@@ -68,8 +66,7 @@ discard block |
||
68 | 66 | * |
69 | 67 | * @return array|false |
70 | 68 | **/ |
71 | - public function getData() |
|
72 | - { |
|
69 | + public function getData() { |
|
73 | 70 | $this->getRaw('person'); |
74 | 71 | if (!empty($this->raw)) { |
75 | 72 | $data = []; |
@@ -88,8 +85,7 @@ discard block |
||
88 | 85 | * |
89 | 86 | * @return string|false |
90 | 87 | **/ |
91 | - public function getAddress() |
|
92 | - { |
|
88 | + public function getAddress() { |
|
93 | 89 | $this->getRaw('address'); |
94 | 90 | if (!empty($this->raw)) { |
95 | 91 | $this->raw->registerXPathNamespace('address', 'http://www.orcid.org/ns/address'); |
@@ -105,8 +101,7 @@ discard block |
||
105 | 101 | * |
106 | 102 | * @return string|false |
107 | 103 | **/ |
108 | - public function getEmail() |
|
109 | - { |
|
104 | + public function getEmail() { |
|
110 | 105 | $this->getRaw('email'); |
111 | 106 | if (!empty($this->raw)) { |
112 | 107 | $this->raw->registerXPathNamespace('email', 'http://www.orcid.org/ns/email'); |
@@ -122,8 +117,7 @@ discard block |
||
122 | 117 | * |
123 | 118 | * @return string|false |
124 | 119 | **/ |
125 | - public function getFullName() |
|
126 | - { |
|
120 | + public function getFullName() { |
|
127 | 121 | $this->getRaw('personal-details'); |
128 | 122 | if (!empty($this->raw)) { |
129 | 123 | $this->raw->registerXPathNamespace('personal-details', 'http://www.orcid.org/ns/personal-details'); |
@@ -143,8 +137,7 @@ discard block |
||
143 | 137 | * |
144 | 138 | * @return void |
145 | 139 | **/ |
146 | - protected function getRaw($endpoint) |
|
147 | - { |
|
140 | + protected function getRaw($endpoint) { |
|
148 | 141 | $this->client->setEndpoint($endpoint); |
149 | 142 | $data = $this->client->getData(); |
150 | 143 | if (!isset($this->raw) && $data != false) { |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @var \SimpleXmlElement|false |
50 | 50 | **/ |
51 | - private $raw = null; |
|
51 | + private $raw = NULL; |
|
52 | 52 | |
53 | 53 | /** |
54 | 54 | * Constructs client instance |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | return $data; |
80 | 80 | } else { |
81 | 81 | $this->logger->warning('No data found for given ORCID'); |
82 | - return false; |
|
82 | + return FALSE; |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | return (string) $this->raw->xpath('./address:address/address:country')[0]; |
97 | 97 | } else { |
98 | 98 | $this->logger->warning('No address found for given ORCID'); |
99 | - return false; |
|
99 | + return FALSE; |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | return (string) $this->raw->xpath('./email:email/email:email')[0]; |
114 | 114 | } else { |
115 | 115 | $this->logger->warning('No email found for given ORCID'); |
116 | - return false; |
|
116 | + return FALSE; |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | return (string) $givenNames[0] . ' ' . (string) $familyName[0]; |
133 | 133 | } else { |
134 | 134 | $this->logger->warning('No name found for given ORCID'); |
135 | - return false; |
|
135 | + return FALSE; |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | { |
148 | 148 | $this->client->setEndpoint($endpoint); |
149 | 149 | $data = $this->client->getData(); |
150 | - if (!isset($this->raw) && $data != false) { |
|
150 | + if (!isset($this->raw) && $data != FALSE) { |
|
151 | 151 | $this->raw = Helper::getXmlFileAsString($data); |
152 | 152 | } |
153 | 153 | } |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @var string |
62 | 62 | **/ |
63 | - private $orcid = null; |
|
63 | + private $orcid = NULL; |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * The request object |
67 | 67 | * |
68 | 68 | * @var RequestFactoryInterface |
69 | 69 | **/ |
70 | - private $requestFactory = null; |
|
70 | + private $requestFactory = NULL; |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * Constructs a new instance |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $response = $this->requestFactory->request($url); |
103 | 103 | } catch (\Exception $e) { |
104 | 104 | $this->logger->warning('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.'); |
105 | - return false; |
|
105 | + return FALSE; |
|
106 | 106 | } |
107 | 107 | return $response->getBody()->getContents(); |
108 | 108 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | try { |
106 | 106 | $response = $this->requestFactory->request($url); |
107 | 107 | } catch (\Exception $e) { |
108 | - $this->logger->warning('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.'); |
|
108 | + $this->logger->warning('Could not fetch data from URL "'.$url.'". Error: '.$e->getMessage().'.'); |
|
109 | 109 | return false; |
110 | 110 | } |
111 | 111 | return $response->getBody()->getContents(); |
@@ -118,10 +118,10 @@ discard block |
||
118 | 118 | **/ |
119 | 119 | private function getApiEndpoint() |
120 | 120 | { |
121 | - $url = 'https://' . $this->level . '.' . self::HOSTNAME; |
|
122 | - $url .= '/v' . self::VERSION . '/'; |
|
121 | + $url = 'https://'.$this->level.'.'.self::HOSTNAME; |
|
122 | + $url .= '/v'.self::VERSION.'/'; |
|
123 | 123 | $url .= $this->orcid; |
124 | - $url .= '/' . $this->endpoint; |
|
124 | + $url .= '/'.$this->endpoint; |
|
125 | 125 | return $url; |
126 | 126 | } |
127 | 127 | } |
@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | * @subpackage dlf |
26 | 26 | * @access public |
27 | 27 | **/ |
28 | -class Client |
|
29 | -{ |
|
28 | +class Client { |
|
30 | 29 | /** |
31 | 30 | * constants for API endpoint |
32 | 31 | **/ |
@@ -76,8 +75,7 @@ discard block |
||
76 | 75 | * @param RequestFactory $requestFactory a request object to inject |
77 | 76 | * @return void |
78 | 77 | **/ |
79 | - public function __construct($orcid, RequestFactory $requestFactory) |
|
80 | - { |
|
78 | + public function __construct($orcid, RequestFactory $requestFactory) { |
|
81 | 79 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
82 | 80 | $this->orcid = $orcid; |
83 | 81 | $this->requestFactory = $requestFactory; |
@@ -99,8 +97,7 @@ discard block |
||
99 | 97 | * |
100 | 98 | * @return object|bool |
101 | 99 | **/ |
102 | - public function getData() |
|
103 | - { |
|
100 | + public function getData() { |
|
104 | 101 | $url = $this->getApiEndpoint(); |
105 | 102 | try { |
106 | 103 | $response = $this->requestFactory->request($url); |
@@ -116,8 +113,7 @@ discard block |
||
116 | 113 | * |
117 | 114 | * @return string |
118 | 115 | **/ |
119 | - private function getApiEndpoint() |
|
120 | - { |
|
116 | + private function getApiEndpoint() { |
|
121 | 117 | $url = 'https://' . $this->level . '.' . self::HOSTNAME; |
122 | 118 | $url .= '/v' . self::VERSION . '/'; |
123 | 119 | $url .= $this->orcid; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @var bool |
67 | 67 | * @access protected |
68 | 68 | */ |
69 | - protected static $fieldsLoaded = false; |
|
69 | + protected static $fieldsLoaded = FALSE; |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * List of already processed documents |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | public static function add(Document $document) |
97 | 97 | { |
98 | 98 | if (in_array($document->getUid(), self::$processedDocs)) { |
99 | - return true; |
|
99 | + return TRUE; |
|
100 | 100 | } elseif (self::solrConnect($document->getSolrcore(), $document->getPid())) { |
101 | - $success = true; |
|
101 | + $success = TRUE; |
|
102 | 102 | Helper::getLanguageService()->includeLLFile('EXT:dlf/Resources/Private/Language/locallang_be.xlf'); |
103 | 103 | // Handle multi-volume documents. |
104 | 104 | if ($parentId = $document->getPartof()) { |
@@ -110,13 +110,13 @@ discard block |
||
110 | 110 | $parent = $documentRepository->findByUid($parentId); |
111 | 111 | if ($parent) { |
112 | 112 | // get XML document of parent |
113 | - $doc = Doc::getInstance($parent->getLocation(), ['storagePid' => $parent->getPid()], true); |
|
114 | - if ($doc !== null) { |
|
113 | + $doc = Doc::getInstance($parent->getLocation(), ['storagePid' => $parent->getPid()], TRUE); |
|
114 | + if ($doc !== NULL) { |
|
115 | 115 | $parent->setDoc($doc); |
116 | 116 | $success = self::add($parent); |
117 | 117 | } else { |
118 | 118 | Helper::log('Could not load parent document with UID ' . $document->getDoc()->parentId, LOG_SEVERITY_ERROR); |
119 | - return false; |
|
119 | + return FALSE; |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | sprintf(Helper::getLanguageService()->getLL('flash.documentIndexed'), $document->getTitle(), $document->getUid()), |
158 | 158 | Helper::getLanguageService()->getLL('flash.done'), |
159 | 159 | FlashMessage::OK, |
160 | - true, |
|
160 | + TRUE, |
|
161 | 161 | 'core.template.flashMessages' |
162 | 162 | ); |
163 | 163 | } else { |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | sprintf(Helper::getLanguageService()->getLL('flash.documentNotIndexed'), $document->getTitle(), $document->getUid()), |
166 | 166 | Helper::getLanguageService()->getLL('flash.error'), |
167 | 167 | FlashMessage::ERROR, |
168 | - true, |
|
168 | + TRUE, |
|
169 | 169 | 'core.template.flashMessages' |
170 | 170 | ); |
171 | 171 | } |
@@ -177,12 +177,12 @@ discard block |
||
177 | 177 | Helper::getLanguageService()->getLL('flash.solrException') . ' ' . htmlspecialchars($e->getMessage()), |
178 | 178 | Helper::getLanguageService()->getLL('flash.error'), |
179 | 179 | FlashMessage::ERROR, |
180 | - true, |
|
180 | + TRUE, |
|
181 | 181 | 'core.template.flashMessages' |
182 | 182 | ); |
183 | 183 | } |
184 | 184 | Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
185 | - return false; |
|
185 | + return FALSE; |
|
186 | 186 | } |
187 | 187 | } else { |
188 | 188 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
@@ -190,12 +190,12 @@ discard block |
||
190 | 190 | Helper::getLanguageService()->getLL('flash.solrNoConnection'), |
191 | 191 | Helper::getLanguageService()->getLL('flash.warning'), |
192 | 192 | FlashMessage::WARNING, |
193 | - true, |
|
193 | + TRUE, |
|
194 | 194 | 'core.template.flashMessages' |
195 | 195 | ); |
196 | 196 | } |
197 | 197 | Helper::log('Could not connect to Apache Solr server', LOG_SEVERITY_ERROR); |
198 | - return false; |
|
198 | + return FALSE; |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
@@ -290,10 +290,10 @@ discard block |
||
290 | 290 | if ($indexing['index_boost'] > 0.0) { |
291 | 291 | self::$fields['fieldboost'][$indexing['index_name']] = floatval($indexing['index_boost']); |
292 | 292 | } else { |
293 | - self::$fields['fieldboost'][$indexing['index_name']] = false; |
|
293 | + self::$fields['fieldboost'][$indexing['index_name']] = FALSE; |
|
294 | 294 | } |
295 | 295 | } |
296 | - self::$fieldsLoaded = true; |
|
296 | + self::$fieldsLoaded = TRUE; |
|
297 | 297 | } |
298 | 298 | } |
299 | 299 | |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | */ |
310 | 310 | protected static function processLogical(Document $document, array $logicalUnit) |
311 | 311 | { |
312 | - $success = true; |
|
312 | + $success = TRUE; |
|
313 | 313 | $doc = $document->getDoc(); |
314 | 314 | $doc->cPid = $document->getPid(); |
315 | 315 | // Get metadata for logical unit. |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | $solrDoc->setField('thumbnail', $doc->getFileLocation($logicalUnit['thumbnailId'])); |
334 | 334 | } |
335 | 335 | // There can be only one toplevel unit per UID, independently of backend configuration |
336 | - $solrDoc->setField('toplevel', $logicalUnit['id'] == $doc->toplevelId ? true : false); |
|
336 | + $solrDoc->setField('toplevel', $logicalUnit['id'] == $doc->toplevelId ? TRUE : FALSE); |
|
337 | 337 | $solrDoc->setField('title', $metadata['title'][0], self::$fields['fieldboost']['title']); |
338 | 338 | $solrDoc->setField('volume', $metadata['volume'][0], self::$fields['fieldboost']['volume']); |
339 | 339 | // verify date formatting |
@@ -406,12 +406,12 @@ discard block |
||
406 | 406 | Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($e->getMessage()), |
407 | 407 | Helper::getLanguageService()->getLL('flash.error'), |
408 | 408 | FlashMessage::ERROR, |
409 | - true, |
|
409 | + TRUE, |
|
410 | 410 | 'core.template.flashMessages' |
411 | 411 | ); |
412 | 412 | } |
413 | 413 | Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
414 | - return false; |
|
414 | + return FALSE; |
|
415 | 415 | } |
416 | 416 | } |
417 | 417 | // Check for child elements... |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | break; |
458 | 458 | } |
459 | 459 | } |
460 | - $solrDoc->setField('toplevel', false); |
|
460 | + $solrDoc->setField('toplevel', FALSE); |
|
461 | 461 | $solrDoc->setField('type', $physicalUnit['type'], self::$fields['fieldboost']['type']); |
462 | 462 | $solrDoc->setField('collection', $doc->metadataArray[$doc->toplevelId]['collection']); |
463 | 463 | |
@@ -497,15 +497,15 @@ discard block |
||
497 | 497 | Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($e->getMessage()), |
498 | 498 | Helper::getLanguageService()->getLL('flash.error'), |
499 | 499 | FlashMessage::ERROR, |
500 | - true, |
|
500 | + TRUE, |
|
501 | 501 | 'core.template.flashMessages' |
502 | 502 | ); |
503 | 503 | } |
504 | 504 | Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
505 | - return false; |
|
505 | + return FALSE; |
|
506 | 506 | } |
507 | 507 | } |
508 | - return true; |
|
508 | + return TRUE; |
|
509 | 509 | } |
510 | 510 | |
511 | 511 | /** |
@@ -531,10 +531,10 @@ discard block |
||
531 | 531 | self::loadIndexConf($pid); |
532 | 532 | } |
533 | 533 | } else { |
534 | - return false; |
|
534 | + return FALSE; |
|
535 | 535 | } |
536 | 536 | } |
537 | - return true; |
|
537 | + return TRUE; |
|
538 | 538 | } |
539 | 539 | |
540 | 540 | /** |
@@ -32,8 +32,7 @@ discard block |
||
32 | 32 | * @subpackage dlf |
33 | 33 | * @access public |
34 | 34 | */ |
35 | -class Indexer |
|
36 | -{ |
|
35 | +class Indexer { |
|
37 | 36 | /** |
38 | 37 | * The extension key |
39 | 38 | * |
@@ -93,8 +92,7 @@ discard block |
||
93 | 92 | * |
94 | 93 | * @return bool true on success or false on failure |
95 | 94 | */ |
96 | - public static function add(Document $document) |
|
97 | - { |
|
95 | + public static function add(Document $document) { |
|
98 | 96 | if (in_array($document->getUid(), self::$processedDocs)) { |
99 | 97 | return true; |
100 | 98 | } elseif (self::solrConnect($document->getSolrcore(), $document->getPid())) { |
@@ -209,8 +207,7 @@ discard block |
||
209 | 207 | * |
210 | 208 | * @return string The field's dynamic index name |
211 | 209 | */ |
212 | - public static function getIndexFieldName($index_name, $pid = 0) |
|
213 | - { |
|
210 | + public static function getIndexFieldName($index_name, $pid = 0) { |
|
214 | 211 | // Sanitize input. |
215 | 212 | $pid = max(intval($pid), 0); |
216 | 213 | if (!$pid) { |
@@ -236,8 +233,7 @@ discard block |
||
236 | 233 | * |
237 | 234 | * @return void |
238 | 235 | */ |
239 | - protected static function loadIndexConf($pid) |
|
240 | - { |
|
236 | + protected static function loadIndexConf($pid) { |
|
241 | 237 | if (!self::$fieldsLoaded) { |
242 | 238 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
243 | 239 | ->getQueryBuilderForTable('tx_dlf_metadata'); |
@@ -307,8 +303,7 @@ discard block |
||
307 | 303 | * |
308 | 304 | * @return bool true on success or false on failure |
309 | 305 | */ |
310 | - protected static function processLogical(Document $document, array $logicalUnit) |
|
311 | - { |
|
306 | + protected static function processLogical(Document $document, array $logicalUnit) { |
|
312 | 307 | $success = true; |
313 | 308 | $doc = $document->getDoc(); |
314 | 309 | $doc->cPid = $document->getPid(); |
@@ -346,7 +341,7 @@ discard block |
||
346 | 341 | ) { |
347 | 342 | $solrDoc->setField('date', $metadata['date'][0]); |
348 | 343 | // change date YYYYMMDD to YYYY-MM-DD |
349 | - } elseif (preg_match("/^[\d]{8}$/", $metadata['date'][0])){ |
|
344 | + } elseif (preg_match("/^[\d]{8}$/", $metadata['date'][0])) { |
|
350 | 345 | $solrDoc->setField('date', date("Y-m-d", strtotime($metadata['date'][0]))); |
351 | 346 | // convert any datetime to proper ISO extended datetime format and timezone for SOLR |
352 | 347 | } else { |
@@ -439,8 +434,7 @@ discard block |
||
439 | 434 | * |
440 | 435 | * @return bool true on success or false on failure |
441 | 436 | */ |
442 | - protected static function processPhysical(Document $document, $page, array $physicalUnit) |
|
443 | - { |
|
437 | + protected static function processPhysical(Document $document, $page, array $physicalUnit) { |
|
444 | 438 | $doc = $document->getDoc(); |
445 | 439 | $doc->cPid = $document->getPid(); |
446 | 440 | if ($doc->hasFulltext && $fullText = $doc->getFullText($physicalUnit['id'])) { |
@@ -518,8 +512,7 @@ discard block |
||
518 | 512 | * |
519 | 513 | * @return bool true on success or false on failure |
520 | 514 | */ |
521 | - protected static function solrConnect($core, $pid = 0) |
|
522 | - { |
|
515 | + protected static function solrConnect($core, $pid = 0) { |
|
523 | 516 | // Get Solr instance. |
524 | 517 | if (!self::$solr) { |
525 | 518 | // Connect to Solr server. |
@@ -588,8 +581,7 @@ discard block |
||
588 | 581 | * |
589 | 582 | * @access private |
590 | 583 | */ |
591 | - private function __construct() |
|
592 | - { |
|
584 | + private function __construct() { |
|
593 | 585 | // This is a static class, thus no instances should be created. |
594 | 586 | } |
595 | 587 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $parent->setDoc($doc); |
116 | 116 | $success = self::add($parent); |
117 | 117 | } else { |
118 | - Helper::log('Could not load parent document with UID ' . $document->getDoc()->parentId, LOG_SEVERITY_ERROR); |
|
118 | + Helper::log('Could not load parent document with UID '.$document->getDoc()->parentId, LOG_SEVERITY_ERROR); |
|
119 | 119 | return false; |
120 | 120 | } |
121 | 121 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | self::$processedDocs[] = $document->getUid(); |
126 | 126 | // Delete old Solr documents. |
127 | 127 | $updateQuery = self::$solr->service->createUpdate(); |
128 | - $updateQuery->addDeleteQuery('uid:' . $document->getUid()); |
|
128 | + $updateQuery->addDeleteQuery('uid:'.$document->getUid()); |
|
129 | 129 | self::$solr->service->update($updateQuery); |
130 | 130 | |
131 | 131 | // Index every logical unit as separate Solr document. |
@@ -174,14 +174,14 @@ discard block |
||
174 | 174 | } catch (\Exception $e) { |
175 | 175 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
176 | 176 | Helper::addMessage( |
177 | - Helper::getLanguageService()->getLL('flash.solrException') . ' ' . htmlspecialchars($e->getMessage()), |
|
177 | + Helper::getLanguageService()->getLL('flash.solrException').' '.htmlspecialchars($e->getMessage()), |
|
178 | 178 | Helper::getLanguageService()->getLL('flash.error'), |
179 | 179 | FlashMessage::ERROR, |
180 | 180 | true, |
181 | 181 | 'core.template.flashMessages' |
182 | 182 | ); |
183 | 183 | } |
184 | - Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
|
184 | + Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR); |
|
185 | 185 | return false; |
186 | 186 | } |
187 | 187 | } else { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | // Sanitize input. |
215 | 215 | $pid = max(intval($pid), 0); |
216 | 216 | if (!$pid) { |
217 | - Helper::log('Invalid PID ' . $pid . ' for metadata configuration', LOG_SEVERITY_ERROR); |
|
217 | + Helper::log('Invalid PID '.$pid.' for metadata configuration', LOG_SEVERITY_ERROR); |
|
218 | 218 | return ''; |
219 | 219 | } |
220 | 220 | // Load metadata configuration. |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | $suffix = (in_array($index_name, self::$fields['tokenized']) ? 't' : 'u'); |
224 | 224 | $suffix .= (in_array($index_name, self::$fields['stored']) ? 's' : 'u'); |
225 | 225 | $suffix .= (in_array($index_name, self::$fields['indexed']) ? 'i' : 'u'); |
226 | - $index_name .= '_' . $suffix; |
|
226 | + $index_name .= '_'.$suffix; |
|
227 | 227 | return $index_name; |
228 | 228 | } |
229 | 229 | |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | $solrDoc->setField('title', $metadata['title'][0], self::$fields['fieldboost']['title']); |
338 | 338 | $solrDoc->setField('volume', $metadata['volume'][0], self::$fields['fieldboost']['volume']); |
339 | 339 | // verify date formatting |
340 | - if(strtotime($metadata['date'][0])) { |
|
340 | + if (strtotime($metadata['date'][0])) { |
|
341 | 341 | // do not alter dates YYYY or YYYY-MM or YYYY-MM-DD |
342 | 342 | if ( |
343 | 343 | preg_match("/^[\d]{4}$/", $metadata['date'][0]) |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | ) { |
347 | 347 | $solrDoc->setField('date', $metadata['date'][0]); |
348 | 348 | // change date YYYYMMDD to YYYY-MM-DD |
349 | - } elseif (preg_match("/^[\d]{8}$/", $metadata['date'][0])){ |
|
349 | + } elseif (preg_match("/^[\d]{8}$/", $metadata['date'][0])) { |
|
350 | 350 | $solrDoc->setField('date', date("Y-m-d", strtotime($metadata['date'][0]))); |
351 | 351 | // convert any datetime to proper ISO extended datetime format and timezone for SOLR |
352 | 352 | } else { |
@@ -374,11 +374,11 @@ discard block |
||
374 | 374 | $solrDoc->setField(self::getIndexFieldName($index_name, $document->getPid()), $data, self::$fields['fieldboost'][$index_name]); |
375 | 375 | if (in_array($index_name, self::$fields['sortables'])) { |
376 | 376 | // Add sortable fields to index. |
377 | - $solrDoc->setField($index_name . '_sorting', $metadata[$index_name . '_sorting'][0]); |
|
377 | + $solrDoc->setField($index_name.'_sorting', $metadata[$index_name.'_sorting'][0]); |
|
378 | 378 | } |
379 | 379 | if (in_array($index_name, self::$fields['facets'])) { |
380 | 380 | // Add facets to index. |
381 | - $solrDoc->setField($index_name . '_faceting', $data); |
|
381 | + $solrDoc->setField($index_name.'_faceting', $data); |
|
382 | 382 | } |
383 | 383 | if (in_array($index_name, self::$fields['autocomplete'])) { |
384 | 384 | $autocomplete = array_merge($autocomplete, $data); |
@@ -403,14 +403,14 @@ discard block |
||
403 | 403 | } catch (\Exception $e) { |
404 | 404 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
405 | 405 | Helper::addMessage( |
406 | - Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($e->getMessage()), |
|
406 | + Helper::getLanguageService()->getLL('flash.solrException').'<br />'.htmlspecialchars($e->getMessage()), |
|
407 | 407 | Helper::getLanguageService()->getLL('flash.error'), |
408 | 408 | FlashMessage::ERROR, |
409 | 409 | true, |
410 | 410 | 'core.template.flashMessages' |
411 | 411 | ); |
412 | 412 | } |
413 | - Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
|
413 | + Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR); |
|
414 | 414 | return false; |
415 | 415 | } |
416 | 416 | } |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | $data = self::removeAppendsFromAuthor($data); |
477 | 477 | } |
478 | 478 | // Add facets to index. |
479 | - $solrDoc->setField($index_name . '_faceting', $data); |
|
479 | + $solrDoc->setField($index_name.'_faceting', $data); |
|
480 | 480 | } |
481 | 481 | } |
482 | 482 | // Add sorting information to physical sub-elements if applicable. |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | !empty($data) |
485 | 485 | && substr($index_name, -8) == '_sorting' |
486 | 486 | ) { |
487 | - $solrDoc->setField($index_name , $doc->metadataArray[$doc->toplevelId][$index_name]); |
|
487 | + $solrDoc->setField($index_name, $doc->metadataArray[$doc->toplevelId][$index_name]); |
|
488 | 488 | } |
489 | 489 | } |
490 | 490 | } |
@@ -501,14 +501,14 @@ discard block |
||
501 | 501 | } catch (\Exception $e) { |
502 | 502 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
503 | 503 | Helper::addMessage( |
504 | - Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($e->getMessage()), |
|
504 | + Helper::getLanguageService()->getLL('flash.solrException').'<br />'.htmlspecialchars($e->getMessage()), |
|
505 | 505 | Helper::getLanguageService()->getLL('flash.error'), |
506 | 506 | FlashMessage::ERROR, |
507 | 507 | true, |
508 | 508 | 'core.template.flashMessages' |
509 | 509 | ); |
510 | 510 | } |
511 | - Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
|
511 | + Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR); |
|
512 | 512 | return false; |
513 | 513 | } |
514 | 514 | } |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | private static function getSolrDocument($updateQuery, $document, $unit, $fullText = '') { |
560 | 560 | $solrDoc = $updateQuery->createDocument(); |
561 | 561 | // Create unique identifier from document's UID and unit's XML ID. |
562 | - $solrDoc->setField('id', $document->getUid() . $unit['id']); |
|
562 | + $solrDoc->setField('id', $document->getUid().$unit['id']); |
|
563 | 563 | $solrDoc->setField('uid', $document->getUid()); |
564 | 564 | $solrDoc->setField('pid', $document->getPid()); |
565 | 565 | $solrDoc->setField('partof', $document->getPartof()); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | public function __construct($viaf, RequestFactory $requestFactory) |
67 | 67 | { |
68 | 68 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
69 | - $this->viafUrl = 'http://viaf.org/viaf/' . $viaf; |
|
69 | + $this->viafUrl = 'http://viaf.org/viaf/'.$viaf; |
|
70 | 70 | $this->requestFactory = $requestFactory; |
71 | 71 | } |
72 | 72 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | try { |
93 | 93 | $response = $this->requestFactory->request($url); |
94 | 94 | } catch (\Exception $e) { |
95 | - $this->logger->warning('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.'); |
|
95 | + $this->logger->warning('Could not fetch data from URL "'.$url.'". Error: '.$e->getMessage().'.'); |
|
96 | 96 | return false; |
97 | 97 | } |
98 | 98 | return $response->getBody()->getContents(); |
@@ -105,6 +105,6 @@ discard block |
||
105 | 105 | **/ |
106 | 106 | protected function getApiEndpoint() |
107 | 107 | { |
108 | - return $this->viafUrl . '/' . $this->endpoint; |
|
108 | + return $this->viafUrl.'/'.$this->endpoint; |
|
109 | 109 | } |
110 | 110 | } |
@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | * @subpackage dlf |
26 | 26 | * @access public |
27 | 27 | **/ |
28 | -class Client |
|
29 | -{ |
|
28 | +class Client { |
|
30 | 29 | /** |
31 | 30 | * This holds the logger |
32 | 31 | * |
@@ -63,8 +62,7 @@ discard block |
||
63 | 62 | * @param RequestFactory $requestFactory a request object to inject |
64 | 63 | * @return void |
65 | 64 | **/ |
66 | - public function __construct($viaf, RequestFactory $requestFactory) |
|
67 | - { |
|
65 | + public function __construct($viaf, RequestFactory $requestFactory) { |
|
68 | 66 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
69 | 67 | $this->viafUrl = 'http://viaf.org/viaf/' . $viaf; |
70 | 68 | $this->requestFactory = $requestFactory; |
@@ -86,8 +84,7 @@ discard block |
||
86 | 84 | * |
87 | 85 | * @return object|bool |
88 | 86 | **/ |
89 | - public function getData() |
|
90 | - { |
|
87 | + public function getData() { |
|
91 | 88 | $url = $this->getApiEndpoint(); |
92 | 89 | try { |
93 | 90 | $response = $this->requestFactory->request($url); |
@@ -103,8 +100,7 @@ discard block |
||
103 | 100 | * |
104 | 101 | * @return string |
105 | 102 | **/ |
106 | - protected function getApiEndpoint() |
|
107 | - { |
|
103 | + protected function getApiEndpoint() { |
|
108 | 104 | return $this->viafUrl . '/' . $this->endpoint; |
109 | 105 | } |
110 | 106 | } |
@@ -47,14 +47,14 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @var string |
49 | 49 | **/ |
50 | - private $viafUrl = null; |
|
50 | + private $viafUrl = NULL; |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * The request object |
54 | 54 | * |
55 | 55 | * @var RequestFactoryInterface |
56 | 56 | **/ |
57 | - private $requestFactory = null; |
|
57 | + private $requestFactory = NULL; |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * Constructs a new instance |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $response = $this->requestFactory->request($url); |
94 | 94 | } catch (\Exception $e) { |
95 | 95 | $this->logger->warning('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.'); |
96 | - return false; |
|
96 | + return FALSE; |
|
97 | 97 | } |
98 | 98 | return $response->getBody()->getContents(); |
99 | 99 | } |
@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | * @subpackage dlf |
26 | 26 | * @access public |
27 | 27 | **/ |
28 | -class Profile |
|
29 | -{ |
|
28 | +class Profile { |
|
30 | 29 | /** |
31 | 30 | * This holds the logger |
32 | 31 | * |
@@ -57,8 +56,7 @@ discard block |
||
57 | 56 | * |
58 | 57 | * @return void |
59 | 58 | **/ |
60 | - public function __construct($viaf) |
|
61 | - { |
|
59 | + public function __construct($viaf) { |
|
62 | 60 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
63 | 61 | $this->client = new Client($viaf, GeneralUtility::makeInstance(RequestFactory::class)); |
64 | 62 | } |
@@ -68,8 +66,7 @@ discard block |
||
68 | 66 | * |
69 | 67 | * @return array|false |
70 | 68 | **/ |
71 | - public function getData() |
|
72 | - { |
|
69 | + public function getData() { |
|
73 | 70 | $this->getRaw(); |
74 | 71 | if (!empty($this->raw)) { |
75 | 72 | $data = []; |
@@ -87,8 +84,7 @@ discard block |
||
87 | 84 | * |
88 | 85 | * @return string|false |
89 | 86 | **/ |
90 | - public function getAddress() |
|
91 | - { |
|
87 | + public function getAddress() { |
|
92 | 88 | $this->getRaw(); |
93 | 89 | if (!empty($this->raw->asXML())) { |
94 | 90 | return (string) $this->raw->xpath('./ns1:nationalityOfEntity/ns1:data/ns1:text')[0]; |
@@ -103,8 +99,7 @@ discard block |
||
103 | 99 | * |
104 | 100 | * @return string|false |
105 | 101 | **/ |
106 | - public function getFullName() |
|
107 | - { |
|
102 | + public function getFullName() { |
|
108 | 103 | $this->getRaw(); |
109 | 104 | if (!empty($this->raw->asXML())) { |
110 | 105 | $rawName = $this->raw->xpath('./ns1:mainHeadings/ns1:data/ns1:text'); |
@@ -122,8 +117,7 @@ discard block |
||
122 | 117 | * |
123 | 118 | * @return void |
124 | 119 | **/ |
125 | - protected function getRaw() |
|
126 | - { |
|
120 | + protected function getRaw() { |
|
127 | 121 | $data = $this->client->getData(); |
128 | 122 | if (!isset($this->raw) && $data != false) { |
129 | 123 | $this->raw = Helper::getXmlFileAsString($data); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @var \SimpleXmlElement|false |
50 | 50 | **/ |
51 | - private $raw = null; |
|
51 | + private $raw = NULL; |
|
52 | 52 | |
53 | 53 | /** |
54 | 54 | * Constructs client instance |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | return $data; |
79 | 79 | } else { |
80 | 80 | $this->logger->warning('No data found for given VIAF URL'); |
81 | - return false; |
|
81 | + return FALSE; |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | return (string) $this->raw->xpath('./ns1:nationalityOfEntity/ns1:data/ns1:text')[0]; |
95 | 95 | } else { |
96 | 96 | $this->logger->warning('No address found for given VIAF URL'); |
97 | - return false; |
|
97 | + return FALSE; |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | return $name; |
114 | 114 | } else { |
115 | 115 | $this->logger->warning('No name found for given VIAF URL'); |
116 | - return false; |
|
116 | + return FALSE; |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | protected function getRaw() |
126 | 126 | { |
127 | 127 | $data = $this->client->getData(); |
128 | - if (!isset($this->raw) && $data != false) { |
|
128 | + if (!isset($this->raw) && $data != FALSE) { |
|
129 | 129 | $this->raw = Helper::getXmlFileAsString($data); |
130 | 130 | $this->raw->registerXPathNamespace('ns1', 'http://viaf.org/viaf/terms#'); |
131 | 131 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | array_unshift($metadata, $data); |
113 | 113 | } |
114 | 114 | if (empty($metadata)) { |
115 | - $this->logger->warning('No metadata found for document with UID ' . $this->document->getUid()); |
|
115 | + $this->logger->warning('No metadata found for document with UID '.$this->document->getUid()); |
|
116 | 116 | return ''; |
117 | 117 | } |
118 | 118 | ksort($metadata); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | if (empty(implode('', $value)) && $this->settings['getTitle'] && $this->document->getPartof()) { |
216 | 216 | $superiorTitle = Doc::getTitle($this->document->getPartof(), true); |
217 | 217 | if (!empty($superiorTitle)) { |
218 | - $metadata[$i][$name] = ['[' . $superiorTitle . ']']; |
|
218 | + $metadata[$i][$name] = ['['.$superiorTitle.']']; |
|
219 | 219 | } |
220 | 220 | } |
221 | 221 | if (!empty($value)) { |
@@ -29,8 +29,7 @@ discard block |
||
29 | 29 | * @subpackage dlf |
30 | 30 | * @access public |
31 | 31 | */ |
32 | -class MetadataController extends AbstractController |
|
33 | -{ |
|
32 | +class MetadataController extends AbstractController { |
|
34 | 33 | /** |
35 | 34 | * @var CollectionRepository |
36 | 35 | */ |
@@ -39,8 +38,7 @@ discard block |
||
39 | 38 | /** |
40 | 39 | * @param CollectionRepository $collectionRepository |
41 | 40 | */ |
42 | - public function injectCollectionRepository(CollectionRepository $collectionRepository) |
|
43 | - { |
|
41 | + public function injectCollectionRepository(CollectionRepository $collectionRepository) { |
|
44 | 42 | $this->collectionRepository = $collectionRepository; |
45 | 43 | } |
46 | 44 | |
@@ -52,8 +50,7 @@ discard block |
||
52 | 50 | /** |
53 | 51 | * @param MetadataRepository $metadataRepository |
54 | 52 | */ |
55 | - public function injectMetadataRepository(MetadataRepository $metadataRepository) |
|
56 | - { |
|
53 | + public function injectMetadataRepository(MetadataRepository $metadataRepository) { |
|
57 | 54 | $this->metadataRepository = $metadataRepository; |
58 | 55 | } |
59 | 56 | |
@@ -65,16 +62,14 @@ discard block |
||
65 | 62 | /** |
66 | 63 | * @param StructureRepository $structureRepository |
67 | 64 | */ |
68 | - public function injectStructureRepository(StructureRepository $structureRepository) |
|
69 | - { |
|
65 | + public function injectStructureRepository(StructureRepository $structureRepository) { |
|
70 | 66 | $this->structureRepository = $structureRepository; |
71 | 67 | } |
72 | 68 | |
73 | 69 | /** |
74 | 70 | * @return string|void |
75 | 71 | */ |
76 | - public function mainAction() |
|
77 | - { |
|
72 | + public function mainAction() { |
|
78 | 73 | $this->cObj = $this->configurationManager->getContentObject(); |
79 | 74 | |
80 | 75 | // Load current document. |
@@ -130,8 +125,7 @@ discard block |
||
130 | 125 | * |
131 | 126 | * @return string The metadata array ready for output |
132 | 127 | */ |
133 | - protected function printMetadata(array $metadata, $useOriginalIiifManifestMetadata = false) |
|
134 | - { |
|
128 | + protected function printMetadata(array $metadata, $useOriginalIiifManifestMetadata = false) { |
|
135 | 129 | if ($useOriginalIiifManifestMetadata) { |
136 | 130 | $iiifData = []; |
137 | 131 | foreach ($metadata as $row) { |
@@ -269,8 +263,7 @@ discard block |
||
269 | 263 | } |
270 | 264 | |
271 | 265 | if (is_array($metadata[$i][$name])) { |
272 | - $metadata[$i][$name] = array_values(array_filter($metadata[$i][$name], function($metadataValue) |
|
273 | - { |
|
266 | + $metadata[$i][$name] = array_values(array_filter($metadata[$i][$name], function($metadataValue) { |
|
274 | 267 | return !empty($metadataValue); |
275 | 268 | })); |
276 | 269 | } |
@@ -294,8 +287,7 @@ discard block |
||
294 | 287 | * |
295 | 288 | * @return array metadata |
296 | 289 | */ |
297 | - private function getMetadata() |
|
298 | - { |
|
290 | + private function getMetadata() { |
|
299 | 291 | $metadata = []; |
300 | 292 | if ($this->settings['rootline'] < 2) { |
301 | 293 | // Get current structure's @ID. |
@@ -333,8 +325,7 @@ discard block |
||
333 | 325 | * |
334 | 326 | * @return array metadata |
335 | 327 | */ |
336 | - private function getMetadataForIds($id, $metadata) |
|
337 | - { |
|
328 | + private function getMetadataForIds($id, $metadata) { |
|
338 | 329 | $useOriginalIiifManifestMetadata = $this->settings['originalIiifMetadata'] == 1 && $this->document->getDoc() instanceof IiifManifest; |
339 | 330 | foreach ($id as $sid) { |
340 | 331 | if ($useOriginalIiifManifestMetadata) { |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @return string The metadata array ready for output |
129 | 129 | */ |
130 | - protected function printMetadata(array $metadata, $useOriginalIiifManifestMetadata = false) |
|
130 | + protected function printMetadata(array $metadata, $useOriginalIiifManifestMetadata = FALSE) |
|
131 | 131 | { |
132 | 132 | if ($useOriginalIiifManifestMetadata) { |
133 | 133 | $iiifData = []; |
@@ -145,14 +145,14 @@ discard block |
||
145 | 145 | $iiifData[$key] = [ |
146 | 146 | 'label' => $key, |
147 | 147 | 'value' => $group, |
148 | - 'buildUrl' => true, |
|
148 | + 'buildUrl' => TRUE, |
|
149 | 149 | ]; |
150 | 150 | } else { |
151 | 151 | // Data output |
152 | 152 | $iiifData[$key] = [ |
153 | 153 | 'label' => $key, |
154 | 154 | 'value' => $group, |
155 | - 'buildUrl' => false, |
|
155 | + 'buildUrl' => FALSE, |
|
156 | 156 | ]; |
157 | 157 | } |
158 | 158 | } else { |
@@ -169,18 +169,18 @@ discard block |
||
169 | 169 | $iiifData[$key]['data'][] = [ |
170 | 170 | 'label' => $nolabel ? '' : $label, |
171 | 171 | 'value' => $value, |
172 | - 'buildUrl' => true, |
|
172 | + 'buildUrl' => TRUE, |
|
173 | 173 | ]; |
174 | 174 | } else { |
175 | 175 | $iiifData[$key]['data'][] = [ |
176 | 176 | 'label' => $label, |
177 | 177 | 'value' => $value, |
178 | - 'buildUrl' => false, |
|
178 | + 'buildUrl' => FALSE, |
|
179 | 179 | ]; |
180 | 180 | } |
181 | 181 | } |
182 | 182 | } |
183 | - $this->view->assign('useIiif', true); |
|
183 | + $this->view->assign('useIiif', TRUE); |
|
184 | 184 | $this->view->assign('iiifData', $iiifData); |
185 | 185 | } |
186 | 186 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | if ($name == 'title') { |
211 | 211 | // Get title of parent document if needed. |
212 | 212 | if (empty(implode('', $value)) && $this->settings['getTitle'] && $this->document->getPartof()) { |
213 | - $superiorTitle = Doc::getTitle($this->document->getPartof(), true); |
|
213 | + $superiorTitle = Doc::getTitle($this->document->getPartof(), TRUE); |
|
214 | 214 | if (!empty($superiorTitle)) { |
215 | 215 | $metadata[$i][$name] = ['[' . $superiorTitle . ']']; |
216 | 216 | } |