@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @param ResponseParser $responseParser |
30 | 30 | */ |
31 | - public function __construct( ResponseParser $responseParser ) { |
|
31 | + public function __construct(ResponseParser $responseParser) { |
|
32 | 32 | $this->responseParser = $responseParser; |
33 | 33 | } |
34 | 34 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param boolean $isReadOnly |
39 | 39 | */ |
40 | - public function isReadOnly( $isReadOnly ) { |
|
40 | + public function isReadOnly($isReadOnly) { |
|
41 | 41 | $this->isReadOnly = (bool)$isReadOnly; |
42 | 42 | } |
43 | 43 | |
@@ -46,13 +46,13 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return string |
48 | 48 | */ |
49 | - public function getRawResponse( $id ) { |
|
49 | + public function getRawResponse($id) { |
|
50 | 50 | |
51 | - if ( $id === '' ) { |
|
51 | + if ($id === '') { |
|
52 | 52 | return ''; |
53 | 53 | } |
54 | 54 | |
55 | - return $this->responseParser->getRawResponse( $id ); |
|
55 | + return $this->responseParser->getRawResponse($id); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return string |
62 | 62 | */ |
63 | - public function renderTextFor( $id ) { |
|
63 | + public function renderTextFor($id) { |
|
64 | 64 | |
65 | 65 | $html = ''; |
66 | 66 | |
67 | - $this->responseParser->doFilterResponseFor( $id ); |
|
67 | + $this->responseParser->doFilterResponseFor($id); |
|
68 | 68 | |
69 | 69 | $html .= Html::rawElement( |
70 | 70 | 'div', |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | '' |
75 | 75 | ); |
76 | 76 | |
77 | - if ( $this->responseParser->getMessages() !== [] ) { |
|
77 | + if ($this->responseParser->getMessages() !== []) { |
|
78 | 78 | return ''; |
79 | 79 | } |
80 | 80 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | // Only display the create button for when the DB can be actually |
84 | 84 | // accessed |
85 | - if ( $this->isReadOnly === false ) { |
|
85 | + if ($this->isReadOnly === false) { |
|
86 | 86 | $create = Html::element( |
87 | 87 | 'a', |
88 | 88 | [ |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | 'data-content-selector' => '#scite-record-content', |
92 | 92 | 'data-title' => $this->responseParser->getFilteredRecord()->getTitleForPageCreation() |
93 | 93 | ], |
94 | - wfMessage( 'sci-metadata-search-action-create' )->text() |
|
94 | + wfMessage('sci-metadata-search-action-create')->text() |
|
95 | 95 | ); |
96 | 96 | } |
97 | 97 | |
@@ -107,12 +107,12 @@ discard block |
||
107 | 107 | 'class' => 'scite-highlight scite-action-button', |
108 | 108 | 'data-content-selector' => '#scite-record-content' |
109 | 109 | ], |
110 | - wfMessage( 'sci-metadata-search-action-highlight' )->text() |
|
110 | + wfMessage('sci-metadata-search-action-highlight')->text() |
|
111 | 111 | ) . ' ' . $create |
112 | 112 | ); |
113 | 113 | |
114 | 114 | // To display the #scite on the generated page |
115 | - $this->responseParser->getFilteredRecord()->set( '@show', 'true' ); |
|
115 | + $this->responseParser->getFilteredRecord()->set('@show', 'true'); |
|
116 | 116 | |
117 | 117 | $html .= Html::rawElement( |
118 | 118 | 'div', |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @return array |
29 | 29 | */ |
30 | - public function newSciteParserFunctionDefinition( NamespaceExaminer $namespaceExaminer, Options $options ) { |
|
30 | + public function newSciteParserFunctionDefinition(NamespaceExaminer $namespaceExaminer, Options $options) { |
|
31 | 31 | |
32 | - $sciteParserFunctionDefinition = function( $parser ) use( $namespaceExaminer, $options ) { |
|
32 | + $sciteParserFunctionDefinition = function($parser) use($namespaceExaminer, $options) { |
|
33 | 33 | |
34 | 34 | $parserData = ApplicationFactory::getInstance()->newParserData( |
35 | 35 | $parser->getTitle(), |
@@ -52,20 +52,20 @@ discard block |
||
52 | 52 | $namespaceExaminer, |
53 | 53 | $citationTextTemplateRenderer, |
54 | 54 | $mediaWikiNsContentMapper, |
55 | - new BibtexProcessor( new BibtexParser(), new BibtexAuthorListParser() ) |
|
55 | + new BibtexProcessor(new BibtexParser(), new BibtexAuthorListParser()) |
|
56 | 56 | ); |
57 | 57 | |
58 | 58 | $sciteParserFunction->setStrictParserValidationState( |
59 | - $options->get( 'enabledStrictParserValidation' ) |
|
59 | + $options->get('enabledStrictParserValidation') |
|
60 | 60 | ); |
61 | 61 | |
62 | 62 | return $sciteParserFunction->doProcess( |
63 | - ParameterProcessorFactory::newFromArray( func_get_args() ), |
|
63 | + ParameterProcessorFactory::newFromArray(func_get_args()), |
|
64 | 64 | new PreTextFormatter() |
65 | 65 | ); |
66 | 66 | }; |
67 | 67 | |
68 | - return [ 'scite', $sciteParserFunctionDefinition, 0 ]; |
|
68 | + return ['scite', $sciteParserFunctionDefinition, 0]; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -77,21 +77,21 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function newReferenceListParserFunctionDefinition() { |
79 | 79 | |
80 | - $referenceListParserFunctionDefinition = function( $parser ) { |
|
80 | + $referenceListParserFunctionDefinition = function($parser) { |
|
81 | 81 | |
82 | 82 | $parserData = ApplicationFactory::getInstance()->newParserData( |
83 | 83 | $parser->getTitle(), |
84 | 84 | $parser->getOutput() |
85 | 85 | ); |
86 | 86 | |
87 | - $referenceListParserFunction = new ReferenceListParserFunction( $parserData ); |
|
87 | + $referenceListParserFunction = new ReferenceListParserFunction($parserData); |
|
88 | 88 | |
89 | 89 | return $referenceListParserFunction->doProcess( |
90 | - ParameterProcessorFactory::newFromArray( func_get_args() ) |
|
90 | + ParameterProcessorFactory::newFromArray(func_get_args()) |
|
91 | 91 | ); |
92 | 92 | }; |
93 | 93 | |
94 | - return [ 'referencelist', $referenceListParserFunctionDefinition, 0 ]; |
|
94 | + return ['referencelist', $referenceListParserFunctionDefinition, 0]; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @param string $cachePrefix |
28 | 28 | */ |
29 | - public function setCachePrefix( $cachePrefix ) { |
|
29 | + public function setCachePrefix($cachePrefix) { |
|
30 | 30 | $this->cachePrefix = $cachePrefix; |
31 | 31 | } |
32 | 32 | |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @return string |
39 | 39 | */ |
40 | - public function getCacheKeyForCitationReference( $hash ) { |
|
41 | - return $this->cachePrefix . ':sci:ref:' . md5( $hash . self::VERSION ); |
|
40 | + public function getCacheKeyForCitationReference($hash) { |
|
41 | + return $this->cachePrefix . ':sci:ref:' . md5($hash . self::VERSION); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return string |
50 | 50 | */ |
51 | - public function getCacheKeyForReferenceList( $hash ) { |
|
52 | - return $this->cachePrefix . ':sci:reflist:' . md5( $hash . self::VERSION ); |
|
51 | + public function getCacheKeyForReferenceList($hash) { |
|
52 | + return $this->cachePrefix . ':sci:reflist:' . md5($hash . self::VERSION); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @param MediaWikiNsContentReader $mediaWikiNsContentReader |
41 | 41 | */ |
42 | - public function __construct( MediaWikiNsContentReader $mediaWikiNsContentReader ) { |
|
42 | + public function __construct(MediaWikiNsContentReader $mediaWikiNsContentReader) { |
|
43 | 43 | $this->mediaWikiNsContentReader = $mediaWikiNsContentReader; |
44 | 44 | } |
45 | 45 | |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @return string |
61 | 61 | */ |
62 | - public function findPropertyForId( $id ) { |
|
62 | + public function findPropertyForId($id) { |
|
63 | 63 | |
64 | - $id = strtolower( trim( $id ) ); |
|
64 | + $id = strtolower(trim($id)); |
|
65 | 65 | |
66 | - if ( self::$identifierToPropertyMap === [] ) { |
|
66 | + if (self::$identifierToPropertyMap === []) { |
|
67 | 67 | |
68 | 68 | // Fixed by definition due to usage of |
69 | 69 | // pre-defined properties |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | 'reference' => SCI_PROP_CITE_KEY, |
78 | 78 | 'citation text' => SCI_PROP_CITE_TEXT, |
79 | 79 | 'sortkey' => '_SKEY' |
80 | - ] + $this->parseContentFor( "sci-property-definition" ); |
|
80 | + ] + $this->parseContentFor("sci-property-definition"); |
|
81 | 81 | } |
82 | 82 | |
83 | - return isset( self::$identifierToPropertyMap[$id] ) ? self::$identifierToPropertyMap[$id] : null; |
|
83 | + return isset(self::$identifierToPropertyMap[$id]) ? self::$identifierToPropertyMap[$id] : null; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -90,48 +90,48 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @return string |
92 | 92 | */ |
93 | - public function findTemplateForType( $type ) { |
|
93 | + public function findTemplateForType($type) { |
|
94 | 94 | |
95 | - $type = strtolower( trim( $type ) ); |
|
95 | + $type = strtolower(trim($type)); |
|
96 | 96 | |
97 | - if ( self::$typeToTemplateMap === [] ) { |
|
98 | - self::$typeToTemplateMap = $this->parseContentFor( "sci-template-definition" ); |
|
97 | + if (self::$typeToTemplateMap === []) { |
|
98 | + self::$typeToTemplateMap = $this->parseContentFor("sci-template-definition"); |
|
99 | 99 | } |
100 | 100 | |
101 | - return isset( self::$typeToTemplateMap[$type] ) ? self::$typeToTemplateMap[$type] : null; |
|
101 | + return isset(self::$typeToTemplateMap[$type]) ? self::$typeToTemplateMap[$type] : null; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
105 | 105 | * @param string $name |
106 | 106 | */ |
107 | - private function parseContentFor( $name ) { |
|
107 | + private function parseContentFor($name) { |
|
108 | 108 | |
109 | - if ( self::$skipMessageCache ) { |
|
109 | + if (self::$skipMessageCache) { |
|
110 | 110 | $this->mediaWikiNsContentReader->skipMessageCache(); |
111 | 111 | } |
112 | 112 | |
113 | - $contents = (string)$this->mediaWikiNsContentReader->read( $name ); |
|
113 | + $contents = (string)$this->mediaWikiNsContentReader->read($name); |
|
114 | 114 | |
115 | - if ( $contents === '' ) { |
|
115 | + if ($contents === '') { |
|
116 | 116 | return []; |
117 | 117 | } |
118 | 118 | |
119 | - $contentMap = array_map( 'trim', preg_split( "([\n][\s]?)", $contents ) ); |
|
119 | + $contentMap = array_map('trim', preg_split("([\n][\s]?)", $contents)); |
|
120 | 120 | $list = []; |
121 | 121 | |
122 | 122 | // Check whether the first line is infact an explanation |
123 | - if ( strpos( $contentMap[0], '|' ) === false ) { |
|
124 | - array_shift( $contentMap ); |
|
123 | + if (strpos($contentMap[0], '|') === false) { |
|
124 | + array_shift($contentMap); |
|
125 | 125 | } |
126 | 126 | |
127 | - foreach ( $contentMap as $map ) { |
|
127 | + foreach ($contentMap as $map) { |
|
128 | 128 | |
129 | - if ( strpos( $map, '|' ) === false ) { |
|
129 | + if (strpos($map, '|') === false) { |
|
130 | 130 | continue; |
131 | 131 | } |
132 | 132 | |
133 | - list( $id, $value ) = explode( '|', $map, 2 ); |
|
134 | - $list[str_replace( '_', ' ', strtolower( trim( $id ) ) )] = $value; |
|
133 | + list($id, $value) = explode('|', $map, 2); |
|
134 | + $list[str_replace('_', ' ', strtolower(trim($id)))] = $value; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | return $list; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param Store $store |
42 | 42 | * @param ReferenceBacklinksLookup $referenceBacklinksLookup |
43 | 43 | */ |
44 | - public function __construct( Store $store, ReferenceBacklinksLookup $referenceBacklinksLookup ) { |
|
44 | + public function __construct(Store $store, ReferenceBacklinksLookup $referenceBacklinksLookup) { |
|
45 | 45 | $this->store = $store; |
46 | 46 | $this->referenceBacklinksLookup = $referenceBacklinksLookup; |
47 | 47 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @param boolean $enabledUpdateJobState |
53 | 53 | */ |
54 | - public function setEnabledUpdateJobState( $enabledUpdateJobState ) { |
|
54 | + public function setEnabledUpdateJobState($enabledUpdateJobState) { |
|
55 | 55 | $this->enabledUpdateJobState = $enabledUpdateJobState; |
56 | 56 | } |
57 | 57 | |
@@ -63,21 +63,21 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @return boolean |
65 | 65 | */ |
66 | - public function dispatchUpdateJobFor( DIWikiPage $subject, CompositePropertyTableDiffIterator $compositePropertyTableDiffIterator ) { |
|
66 | + public function dispatchUpdateJobFor(DIWikiPage $subject, CompositePropertyTableDiffIterator $compositePropertyTableDiffIterator) { |
|
67 | 67 | |
68 | - if ( !$this->enabledUpdateJobState ) { |
|
68 | + if (!$this->enabledUpdateJobState) { |
|
69 | 69 | return false; |
70 | 70 | } |
71 | 71 | |
72 | 72 | $tableName = $this->store->getPropertyTableInfoFetcher()->findTableIdForProperty( |
73 | - new DIProperty( PropertyRegistry::SCI_CITE_TEXT ) |
|
73 | + new DIProperty(PropertyRegistry::SCI_CITE_TEXT) |
|
74 | 74 | ); |
75 | 75 | |
76 | 76 | $subjectIdList = $this->getSubjectListFrom( |
77 | - $compositePropertyTableDiffIterator->getOrderedDiffByTable( $tableName ) |
|
77 | + $compositePropertyTableDiffIterator->getOrderedDiffByTable($tableName) |
|
78 | 78 | ); |
79 | 79 | |
80 | - if ( ( $jobList = $this->getDispatchableTargetList( $subjectIdList ) ) === [] ) { |
|
80 | + if (($jobList = $this->getDispatchableTargetList($subjectIdList)) === []) { |
|
81 | 81 | return false; |
82 | 82 | } |
83 | 83 | |
@@ -93,30 +93,30 @@ discard block |
||
93 | 93 | return true; |
94 | 94 | } |
95 | 95 | |
96 | - private function getSubjectListFrom( array $orderedDiff ) { |
|
96 | + private function getSubjectListFrom(array $orderedDiff) { |
|
97 | 97 | |
98 | 98 | $subjectIdList = []; |
99 | 99 | |
100 | 100 | // Find out whether a cite text object was altered |
101 | - foreach ( $orderedDiff as $key => $value ) { |
|
101 | + foreach ($orderedDiff as $key => $value) { |
|
102 | 102 | |
103 | - if ( strpos( $key, 'sci_cite_text' ) === false ) { |
|
103 | + if (strpos($key, 'sci_cite_text') === false) { |
|
104 | 104 | continue; |
105 | 105 | } |
106 | 106 | |
107 | - if ( !isset( $value['delete'] ) ) { |
|
107 | + if (!isset($value['delete'])) { |
|
108 | 108 | $value['delete'] = []; |
109 | 109 | } |
110 | 110 | |
111 | - foreach ( $value['delete'] as $delete ) { |
|
111 | + foreach ($value['delete'] as $delete) { |
|
112 | 112 | $subjectIdList[] = $delete['s_id']; |
113 | 113 | } |
114 | 114 | |
115 | - if ( !isset( $value['insert'] ) ) { |
|
115 | + if (!isset($value['insert'])) { |
|
116 | 116 | $value['insert'] = []; |
117 | 117 | } |
118 | 118 | |
119 | - foreach ( $value['insert'] as $insert ) { |
|
119 | + foreach ($value['insert'] as $insert) { |
|
120 | 120 | $subjectIdList[] = $insert['s_id']; |
121 | 121 | } |
122 | 122 | } |
@@ -124,25 +124,25 @@ discard block |
||
124 | 124 | return $subjectIdList; |
125 | 125 | } |
126 | 126 | |
127 | - private function getDispatchableTargetList( array $subjectIdList ) { |
|
127 | + private function getDispatchableTargetList(array $subjectIdList) { |
|
128 | 128 | |
129 | - if ( $subjectIdList === [] ) { |
|
129 | + if ($subjectIdList === []) { |
|
130 | 130 | return []; |
131 | 131 | } |
132 | 132 | |
133 | - $hashList = $this->store->getObjectIds()->getDataItemPoolHashListFor( $subjectIdList ); |
|
133 | + $hashList = $this->store->getObjectIds()->getDataItemPoolHashListFor($subjectIdList); |
|
134 | 134 | $referenceBacklinks = []; |
135 | 135 | |
136 | - foreach ( $hashList as $hash ) { |
|
136 | + foreach ($hashList as $hash) { |
|
137 | 137 | $referenceBacklinks += $this->referenceBacklinksLookup->findReferenceBacklinksFor( |
138 | - $this->referenceBacklinksLookup->tryToFindCitationKeyFor( DIWikiPage::doUnserialize( $hash ) ) |
|
138 | + $this->referenceBacklinksLookup->tryToFindCitationKeyFor(DIWikiPage::doUnserialize($hash)) |
|
139 | 139 | ); |
140 | 140 | } |
141 | 141 | |
142 | 142 | $targetBatch = []; |
143 | 143 | |
144 | - foreach ( $referenceBacklinks as $referenceBacklink ) { |
|
145 | - $targetBatch[HashBuilder::getHashIdForDiWikiPage( $referenceBacklink )] = true; |
|
144 | + foreach ($referenceBacklinks as $referenceBacklink) { |
|
145 | + $targetBatch[HashBuilder::getHashIdForDiWikiPage($referenceBacklink)] = true; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | return $targetBatch; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param MediaWikiNsContentMapper $mediaWikiNsContentMapper |
75 | 75 | * @param BibtexProcessor $bibtexProcessor |
76 | 76 | */ |
77 | - public function __construct( ParserData $parserData, NamespaceExaminer $namespaceExaminer, CitationTextTemplateRenderer $citationTextTemplateRenderer, MediaWikiNsContentMapper $mediaWikiNsContentMapper, BibtexProcessor $bibtexProcessor ) { |
|
77 | + public function __construct(ParserData $parserData, NamespaceExaminer $namespaceExaminer, CitationTextTemplateRenderer $citationTextTemplateRenderer, MediaWikiNsContentMapper $mediaWikiNsContentMapper, BibtexProcessor $bibtexProcessor) { |
|
78 | 78 | $this->parserData = $parserData; |
79 | 79 | $this->namespaceExaminer = $namespaceExaminer; |
80 | 80 | $this->citationTextTemplateRenderer = $citationTextTemplateRenderer; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @param boolean $strictParserValidationState |
90 | 90 | */ |
91 | - public function setStrictParserValidationState ( $strictParserValidationState ) { |
|
91 | + public function setStrictParserValidationState($strictParserValidationState) { |
|
92 | 92 | $this->strictParserValidationState = (bool)$strictParserValidationState; |
93 | 93 | } |
94 | 94 | |
@@ -143,28 +143,28 @@ discard block |
||
143 | 143 | * |
144 | 144 | * @param ParserParameterProcessor $parserParameterProcessor |
145 | 145 | */ |
146 | - public function doProcess( ParserParameterProcessor $parserParameterProcessor, PreTextFormatter $preTextFormatter = null ) { |
|
146 | + public function doProcess(ParserParameterProcessor $parserParameterProcessor, PreTextFormatter $preTextFormatter = null) { |
|
147 | 147 | |
148 | - if ( !$this->namespaceExaminer->isSemanticEnabled( $this->parserData->getTitle()->getNamespace() ) ) { |
|
149 | - return $this->createErrorMessageFor( 'sci-scite-parser-not-enabled-namespace' ); |
|
148 | + if (!$this->namespaceExaminer->isSemanticEnabled($this->parserData->getTitle()->getNamespace())) { |
|
149 | + return $this->createErrorMessageFor('sci-scite-parser-not-enabled-namespace'); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | // Hopefully the bibtex processor will add all required parameters and values |
153 | - if ( $parserParameterProcessor->hasParameter( 'bibtex' ) ) { |
|
154 | - $this->bibtexProcessor->doProcess( $parserParameterProcessor ); |
|
153 | + if ($parserParameterProcessor->hasParameter('bibtex')) { |
|
154 | + $this->bibtexProcessor->doProcess($parserParameterProcessor); |
|
155 | 155 | } |
156 | 156 | |
157 | - $reference = str_replace( '_', ' ', (string)$parserParameterProcessor->getFirstParameter() ); |
|
157 | + $reference = str_replace('_', ' ', (string)$parserParameterProcessor->getFirstParameter()); |
|
158 | 158 | $type = ''; |
159 | 159 | |
160 | 160 | // Explicit reference precedes |
161 | - if ( $parserParameterProcessor->hasParameter( 'reference' ) ) { |
|
162 | - $reference = $parserParameterProcessor->getParameterValuesFor( 'reference' ); |
|
163 | - $reference = end( $reference ); |
|
161 | + if ($parserParameterProcessor->hasParameter('reference')) { |
|
162 | + $reference = $parserParameterProcessor->getParameterValuesFor('reference'); |
|
163 | + $reference = end($reference); |
|
164 | 164 | } |
165 | 165 | |
166 | - if ( $reference === '' ) { |
|
167 | - return $this->createErrorMessageFor( 'sci-scite-parser-no-reference' ); |
|
166 | + if ($reference === '') { |
|
167 | + return $this->createErrorMessageFor('sci-scite-parser-no-reference'); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | // Fixed identifier |
@@ -173,10 +173,10 @@ discard block |
||
173 | 173 | $reference |
174 | 174 | ); |
175 | 175 | |
176 | - if ( $parserParameterProcessor->hasParameter( 'type' ) ) { |
|
177 | - $type = $parserParameterProcessor->getParameterValuesFor( 'type' ); |
|
178 | - sort( $type ); |
|
179 | - $type = end( $type ); |
|
176 | + if ($parserParameterProcessor->hasParameter('type')) { |
|
177 | + $type = $parserParameterProcessor->getParameterValuesFor('type'); |
|
178 | + sort($type); |
|
179 | + $type = end($type); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | $returnText = $this->tryToMatchCitationTextByPrecept( |
@@ -197,125 +197,125 @@ discard block |
||
197 | 197 | // placed next to each other, have the first occurrence to mark its |
198 | 198 | // existence explicitly by outputting an empty paragraph and so avoid a |
199 | 199 | // <br> element. |
200 | - if ( $returnText === '' && $this->parserData->getOutput()->getExtensionData( 'sci-parserfunction' ) === null ) { |
|
201 | - $this->parserData->getOutput()->setExtensionData( 'sci-parserfunction', true ); |
|
200 | + if ($returnText === '' && $this->parserData->getOutput()->getExtensionData('sci-parserfunction') === null) { |
|
201 | + $this->parserData->getOutput()->setExtensionData('sci-parserfunction', true); |
|
202 | 202 | $returnText = '<p></p>'; |
203 | 203 | } |
204 | 204 | |
205 | - if ( $parserParameterProcessor->hasParameter( '@show' ) && $preTextFormatter !== null ) { |
|
206 | - $returnText = $preTextFormatter->getFormattedSciteFuncFrom( $parserParameterProcessor->getRaw() ) . $returnText; |
|
205 | + if ($parserParameterProcessor->hasParameter('@show') && $preTextFormatter !== null) { |
|
206 | + $returnText = $preTextFormatter->getFormattedSciteFuncFrom($parserParameterProcessor->getRaw()) . $returnText; |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | return $returnText; //array( '', 'noparse' => true, 'isHTML' => true ); |
210 | 210 | } |
211 | 211 | |
212 | - private function tryToMatchCitationTextByPrecept( ParserParameterProcessor $parserParameterProcessor, $reference, $type = '' ) { |
|
212 | + private function tryToMatchCitationTextByPrecept(ParserParameterProcessor $parserParameterProcessor, $reference, $type = '') { |
|
213 | 213 | |
214 | 214 | $template = ''; |
215 | 215 | |
216 | - if ( $this->strictParserValidationState && $type === '' ) { |
|
216 | + if ($this->strictParserValidationState && $type === '') { |
|
217 | 217 | |
218 | 218 | $parserParameterProcessor->addParameter( |
219 | 219 | DIProperty::TYPE_ERROR, |
220 | 220 | PropertyRegistry::SCI_CITE |
221 | 221 | ); |
222 | 222 | |
223 | - return $this->createErrorMessageFor( 'sci-scite-parser-no-type', $reference ); |
|
223 | + return $this->createErrorMessageFor('sci-scite-parser-no-type', $reference); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | // An injected text trumps a template |
227 | - if ( $parserParameterProcessor->hasParameter( 'citation text' ) ) { |
|
227 | + if ($parserParameterProcessor->hasParameter('citation text')) { |
|
228 | 228 | return ''; |
229 | 229 | } |
230 | 230 | |
231 | 231 | // An explicit template precedes the assignment found for the type |
232 | - if ( $parserParameterProcessor->hasParameter( 'template' ) ) { |
|
233 | - $template = $parserParameterProcessor->getParameterValuesFor( 'template' ); |
|
234 | - $template = trim( end( $template ) ); |
|
235 | - } elseif ( $this->mediaWikiNsContentMapper->findTemplateForType( $type ) !== null ) { |
|
236 | - $template = $this->mediaWikiNsContentMapper->findTemplateForType( $type ); |
|
232 | + if ($parserParameterProcessor->hasParameter('template')) { |
|
233 | + $template = $parserParameterProcessor->getParameterValuesFor('template'); |
|
234 | + $template = trim(end($template)); |
|
235 | + } elseif ($this->mediaWikiNsContentMapper->findTemplateForType($type) !== null) { |
|
236 | + $template = $this->mediaWikiNsContentMapper->findTemplateForType($type); |
|
237 | 237 | } |
238 | 238 | |
239 | - if ( $template !== '' ) { |
|
240 | - $this->citationTextTemplateRenderer->packFieldsForTemplate( $template ); |
|
239 | + if ($template !== '') { |
|
240 | + $this->citationTextTemplateRenderer->packFieldsForTemplate($template); |
|
241 | 241 | |
242 | 242 | // Fixed identifier |
243 | 243 | $parserParameterProcessor->addParameter( |
244 | 244 | 'citation text', |
245 | - $this->citationTextTemplateRenderer->renderFor( $parserParameterProcessor->toArray() ) |
|
245 | + $this->citationTextTemplateRenderer->renderFor($parserParameterProcessor->toArray()) |
|
246 | 246 | ); |
247 | - } elseif ( $this->strictParserValidationState ) { |
|
247 | + } elseif ($this->strictParserValidationState) { |
|
248 | 248 | |
249 | 249 | $parserParameterProcessor->addParameter( |
250 | 250 | DIProperty::TYPE_ERROR, |
251 | 251 | PropertyRegistry::SCI_CITE_TEXT |
252 | 252 | ); |
253 | 253 | |
254 | - return $this->createErrorMessageFor( 'sci-scite-parser-no-citation-text', $reference, $type ); |
|
254 | + return $this->createErrorMessageFor('sci-scite-parser-no-citation-text', $reference, $type); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | return ''; |
258 | 258 | } |
259 | 259 | |
260 | - private function addPropertyValuesFor( ParserParameterProcessor $parserParameterProcessor, $reference ) { |
|
260 | + private function addPropertyValuesFor(ParserParameterProcessor $parserParameterProcessor, $reference) { |
|
261 | 261 | |
262 | - $subobject = new Subobject( $this->parserData->getTitle() ); |
|
263 | - $subobject->setEmptyContainerForId( '_SCITE' . md5( $reference ) ); |
|
262 | + $subobject = new Subobject($this->parserData->getTitle()); |
|
263 | + $subobject->setEmptyContainerForId('_SCITE' . md5($reference)); |
|
264 | 264 | |
265 | 265 | $subject = $this->parserData->getSemanticData()->getSubject(); |
266 | 266 | |
267 | - foreach ( $parserParameterProcessor->toArray() as $key => $values ) { |
|
267 | + foreach ($parserParameterProcessor->toArray() as $key => $values) { |
|
268 | 268 | |
269 | - if ( $key === DIProperty::TYPE_ERROR ) { |
|
269 | + if ($key === DIProperty::TYPE_ERROR) { |
|
270 | 270 | |
271 | - $value = new DIProperty( end( $values ) ); |
|
271 | + $value = new DIProperty(end($values)); |
|
272 | 272 | |
273 | 273 | $subobject->getSemanticData()->addPropertyObjectValue( |
274 | - new DIProperty( DIProperty::TYPE_ERROR ), |
|
274 | + new DIProperty(DIProperty::TYPE_ERROR), |
|
275 | 275 | $value->getDiWikiPage() |
276 | 276 | ); |
277 | 277 | |
278 | 278 | continue; |
279 | 279 | } |
280 | 280 | |
281 | - $property = $this->mediaWikiNsContentMapper->findPropertyForId( $key ); |
|
281 | + $property = $this->mediaWikiNsContentMapper->findPropertyForId($key); |
|
282 | 282 | |
283 | 283 | // No mapping, no annotation |
284 | - if ( $property === null ) { |
|
284 | + if ($property === null) { |
|
285 | 285 | continue; |
286 | 286 | } |
287 | 287 | |
288 | - foreach ( $values as $value ) { |
|
288 | + foreach ($values as $value) { |
|
289 | 289 | |
290 | 290 | $dataValue = $this->dataValueFactory->newPropertyValue( |
291 | 291 | $property, |
292 | - trim( $value ), |
|
292 | + trim($value), |
|
293 | 293 | false, |
294 | 294 | $subject |
295 | 295 | ); |
296 | 296 | |
297 | - $subobject->addDataValue( $dataValue ); |
|
297 | + $subobject->addDataValue($dataValue); |
|
298 | 298 | } |
299 | 299 | } |
300 | 300 | |
301 | - if ( $subobject->getSemanticData()->isEmpty() ) { |
|
301 | + if ($subobject->getSemanticData()->isEmpty()) { |
|
302 | 302 | return; |
303 | 303 | } |
304 | 304 | |
305 | 305 | $this->parserData->getSemanticData()->addPropertyObjectValue( |
306 | - new DIProperty( PropertyRegistry::SCI_CITE ), |
|
306 | + new DIProperty(PropertyRegistry::SCI_CITE), |
|
307 | 307 | $subobject->getContainer() |
308 | 308 | ); |
309 | 309 | |
310 | - $this->parserData->getSubject()->setContextReference( 'scitep:' . uniqid() ); |
|
310 | + $this->parserData->getSubject()->setContextReference('scitep:' . uniqid()); |
|
311 | 311 | $this->parserData->pushSemanticDataToParserOutput(); |
312 | 312 | } |
313 | 313 | |
314 | - private function createErrorMessageFor( $messageKey, $arg1 = '', $arg2 = '' ) { |
|
314 | + private function createErrorMessageFor($messageKey, $arg1 = '', $arg2 = '') { |
|
315 | 315 | return \Html::rawElement( |
316 | 316 | 'div', |
317 | - [ 'class' => 'smw-callout smw-callout-error' ], |
|
318 | - wfMessage( $messageKey, $arg1, $arg2 )->inContentLanguage()->text() |
|
317 | + ['class' => 'smw-callout smw-callout-error'], |
|
318 | + wfMessage($messageKey, $arg1, $arg2)->inContentLanguage()->text() |
|
319 | 319 | ); |
320 | 320 | } |
321 | 321 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param Cache $cache |
41 | 41 | * @param Options $options |
42 | 42 | */ |
43 | - public function __construct( Store $store, Cache $cache, Options $options ) { |
|
43 | + public function __construct(Store $store, Cache $cache, Options $options) { |
|
44 | 44 | $this->options = $options; |
45 | 45 | |
46 | 46 | $this->addCallbackHandlers( |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | * @param string $key |
59 | 59 | * @param mixed $value |
60 | 60 | */ |
61 | - public function setOption( $key, $value ) { |
|
62 | - $this->options->set( $key, $value ); |
|
61 | + public function setOption($key, $value) { |
|
62 | + $this->options->set($key, $value); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @return boolean |
71 | 71 | */ |
72 | - public function isRegistered( $name ) { |
|
73 | - return Hooks::isRegistered( $name ); |
|
72 | + public function isRegistered($name) { |
|
73 | + return Hooks::isRegistered($name); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -78,17 +78,17 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function clear() { |
80 | 80 | |
81 | - if ( !defined( 'MW_PHPUNIT_TEST' ) ) { |
|
81 | + if (!defined('MW_PHPUNIT_TEST')) { |
|
82 | 82 | return; |
83 | 83 | } |
84 | 84 | |
85 | - foreach ( $this->handlers as $name => $callback ) { |
|
85 | + foreach ($this->handlers as $name => $callback) { |
|
86 | 86 | if ( |
87 | - !class_exists( '\MediaWiki\MediaWikiServices' ) || |
|
88 | - !method_exists( \MediaWiki\MediaWikiServices::getInstance(), 'getHookContainer' ) ) { |
|
89 | - \Hooks::clear( $name ); |
|
87 | + !class_exists('\MediaWiki\MediaWikiServices') || |
|
88 | + !method_exists(\MediaWiki\MediaWikiServices::getInstance(), 'getHookContainer') ) { |
|
89 | + \Hooks::clear($name); |
|
90 | 90 | } else { |
91 | - \MediaWiki\MediaWikiServices::getInstance()->getHookContainer()->clear( $name ); |
|
91 | + \MediaWiki\MediaWikiServices::getInstance()->getHookContainer()->clear($name); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | } |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @return Callable|false |
102 | 102 | */ |
103 | - public function getHandlerFor( $name ) { |
|
104 | - return isset( $this->handlers[$name] ) ? $this->handlers[$name] : false; |
|
103 | + public function getHandlerFor($name) { |
|
104 | + return isset($this->handlers[$name]) ? $this->handlers[$name] : false; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | // return; |
114 | 114 | //} |
115 | 115 | |
116 | - foreach ( $this->handlers as $name => $callback ) { |
|
116 | + foreach ($this->handlers as $name => $callback) { |
|
117 | 117 | if ( |
118 | - !class_exists( '\MediaWiki\MediaWikiServices' ) || |
|
119 | - !method_exists( \MediaWiki\MediaWikiServices::getInstance(), 'getHookContainer' ) ) { |
|
120 | - \Hooks::register( $name, $callback ); |
|
118 | + !class_exists('\MediaWiki\MediaWikiServices') || |
|
119 | + !method_exists(\MediaWiki\MediaWikiServices::getInstance(), 'getHookContainer') ) { |
|
120 | + \Hooks::register($name, $callback); |
|
121 | 121 | } else { |
122 | - \MediaWiki\MediaWikiServices::getInstance()->getHookContainer()->register( $name, $callback ); |
|
122 | + \MediaWiki\MediaWikiServices::getInstance()->getHookContainer()->register($name, $callback); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | } |
@@ -129,16 +129,16 @@ discard block |
||
129 | 129 | * |
130 | 130 | * @param array &$config |
131 | 131 | */ |
132 | - public static function onBeforeConfigCompletion( &$config ) { |
|
132 | + public static function onBeforeConfigCompletion(&$config) { |
|
133 | 133 | |
134 | - if ( !isset( $config['smwgFulltextSearchPropertyExemptionList'] ) ) { |
|
134 | + if (!isset($config['smwgFulltextSearchPropertyExemptionList'])) { |
|
135 | 135 | return; |
136 | 136 | } |
137 | 137 | |
138 | 138 | // Exclude those properties from indexing |
139 | 139 | $config['smwgFulltextSearchPropertyExemptionList'] = array_merge( |
140 | 140 | $config['smwgFulltextSearchPropertyExemptionList'], |
141 | - [ PropertyRegistry::SCI_CITE ] |
|
141 | + [PropertyRegistry::SCI_CITE] |
|
142 | 142 | ); |
143 | 143 | } |
144 | 144 | |
@@ -147,14 +147,14 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public static function initExtension() { |
149 | 149 | |
150 | - $GLOBALS['wgHooks']['SMW::Config::BeforeCompletion'][] = function( &$config ) { |
|
150 | + $GLOBALS['wgHooks']['SMW::Config::BeforeCompletion'][] = function(&$config) { |
|
151 | 151 | |
152 | 152 | $exemptionlist = [ |
153 | 153 | PropertyRegistry::SCI_CITE |
154 | 154 | ]; |
155 | 155 | |
156 | 156 | // Exclude listed properties from indexing |
157 | - if ( isset( $config['smwgFulltextSearchPropertyExemptionList'] ) ) { |
|
157 | + if (isset($config['smwgFulltextSearchPropertyExemptionList'])) { |
|
158 | 158 | $config['smwgFulltextSearchPropertyExemptionList'] = array_merge( |
159 | 159 | $config['smwgFulltextSearchPropertyExemptionList'], |
160 | 160 | $exemptionlist |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | // selected object would trigger an automatic change without the necessary |
166 | 166 | // human intervention and can therefore produce unwanted query updates |
167 | 167 | |
168 | - if ( isset( $config['smwgQueryDependencyPropertyExemptionList'] ) ) { |
|
168 | + if (isset($config['smwgQueryDependencyPropertyExemptionList'])) { |
|
169 | 169 | $config['smwgQueryDependencyPropertyExemptionList'] = array_merge( |
170 | 170 | $config['smwgQueryDependencyPropertyExemptionList'], |
171 | 171 | $exemptionlist |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | '_sci_olid' |
195 | 195 | ]; |
196 | 196 | |
197 | - foreach ( $types as $type ) { |
|
197 | + foreach ($types as $type) { |
|
198 | 198 | $dataTypeRegistry->registerDatatype( |
199 | 199 | $type, |
200 | 200 | '\SCI\DataValues\ResourceIdentifierStringValue', |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | }; |
208 | 208 | |
209 | 209 | // SMW 3.1+ |
210 | - if ( method_exists( $dataTypeRegistry, 'registerCallable' ) ) { |
|
211 | - $dataTypeRegistry->registerCallable( '_sci_ref', 'sci.citationreferencepositionjournal', $callback ); |
|
210 | + if (method_exists($dataTypeRegistry, 'registerCallable')) { |
|
211 | + $dataTypeRegistry->registerCallable('_sci_ref', 'sci.citationreferencepositionjournal', $callback); |
|
212 | 212 | } else { |
213 | 213 | $dataTypeRegistry->registerExtraneousFunction( |
214 | 214 | '\SCI\CitationReferencePositionJournal', |
@@ -219,40 +219,40 @@ discard block |
||
219 | 219 | return true; |
220 | 220 | } |
221 | 221 | |
222 | - private function addCallbackHandlers( $store, $cache, $options ) { |
|
222 | + private function addCallbackHandlers($store, $cache, $options) { |
|
223 | 223 | |
224 | 224 | $propertyRegistry = new PropertyRegistry(); |
225 | 225 | $namespaceExaminer = ApplicationFactory::getInstance()->getNamespaceExaminer(); |
226 | 226 | |
227 | 227 | $cacheKeyProvider = new CacheKeyProvider(); |
228 | - $cacheKeyProvider->setCachePrefix( $options->get( 'cachePrefix' ) ); |
|
228 | + $cacheKeyProvider->setCachePrefix($options->get('cachePrefix')); |
|
229 | 229 | |
230 | 230 | $this->citationReferencePositionJournal = new CitationReferencePositionJournal( |
231 | 231 | $cache, |
232 | 232 | $cacheKeyProvider |
233 | 233 | ); |
234 | 234 | |
235 | - $referenceBacklinksLookup = new ReferenceBacklinksLookup( $store ); |
|
235 | + $referenceBacklinksLookup = new ReferenceBacklinksLookup($store); |
|
236 | 236 | |
237 | 237 | /** |
238 | 238 | * @see https://www.semantic-mediawiki.org/wiki/Hooks/SMW::Property::initProperties |
239 | 239 | */ |
240 | - $this->handlers['SMW::Property::initProperties'] = function ( $corePropertyRegistry ) use ( $propertyRegistry ) { |
|
241 | - return $propertyRegistry->registerTo( $corePropertyRegistry ); |
|
240 | + $this->handlers['SMW::Property::initProperties'] = function($corePropertyRegistry) use ($propertyRegistry) { |
|
241 | + return $propertyRegistry->registerTo($corePropertyRegistry); |
|
242 | 242 | }; |
243 | 243 | |
244 | 244 | /** |
245 | 245 | * @see https://www.semantic-mediawiki.org/wiki/Hooks/SMW::DataType::initTypes |
246 | 246 | */ |
247 | - $this->handlers['SMW::DataType::initTypes'] = [ $this, 'onDataTypeInit' ]; |
|
247 | + $this->handlers['SMW::DataType::initTypes'] = [$this, 'onDataTypeInit']; |
|
248 | 248 | |
249 | 249 | /** |
250 | 250 | * @see https://www.semantic-mediawiki.org/wiki/Hooks/SMW::Browse::AfterIncomingPropertiesLookupComplete |
251 | 251 | */ |
252 | - $this->handlers['SMW::Browse::AfterIncomingPropertiesLookupComplete'] = function ( $store, $semanticData, $requestOptions ) use ( $referenceBacklinksLookup ) { |
|
252 | + $this->handlers['SMW::Browse::AfterIncomingPropertiesLookupComplete'] = function($store, $semanticData, $requestOptions) use ($referenceBacklinksLookup) { |
|
253 | 253 | |
254 | - $referenceBacklinksLookup->setRequestOptions( $requestOptions ); |
|
255 | - $referenceBacklinksLookup->setStore( $store ); |
|
254 | + $referenceBacklinksLookup->setRequestOptions($requestOptions); |
|
255 | + $referenceBacklinksLookup->setStore($store); |
|
256 | 256 | |
257 | 257 | $referenceBacklinksLookup->addReferenceBacklinksTo( |
258 | 258 | $semanticData |
@@ -261,22 +261,22 @@ discard block |
||
261 | 261 | return true; |
262 | 262 | }; |
263 | 263 | |
264 | - $this->handlers['SMW::Browse::BeforeIncomingPropertyValuesFurtherLinkCreate'] = function ( $property, $subject, &$html ) use ( $referenceBacklinksLookup ) { |
|
265 | - return $referenceBacklinksLookup->getSpecialPropertySearchFurtherLink( $property, $subject, $html ); |
|
264 | + $this->handlers['SMW::Browse::BeforeIncomingPropertyValuesFurtherLinkCreate'] = function($property, $subject, &$html) use ($referenceBacklinksLookup) { |
|
265 | + return $referenceBacklinksLookup->getSpecialPropertySearchFurtherLink($property, $subject, $html); |
|
266 | 266 | }; |
267 | 267 | |
268 | 268 | /** |
269 | 269 | * @see https://www.semantic-mediawiki.org/wiki/Hooks/SMW::Parser::BeforeMagicWordsFinder |
270 | 270 | */ |
271 | - $this->handlers['SMW::Parser::BeforeMagicWordsFinder'] = function( array &$magicWords ) { |
|
272 | - $magicWords = array_merge( $magicWords, [ 'SCI_NOREFERENCELIST' ] ); |
|
271 | + $this->handlers['SMW::Parser::BeforeMagicWordsFinder'] = function(array &$magicWords) { |
|
272 | + $magicWords = array_merge($magicWords, ['SCI_NOREFERENCELIST']); |
|
273 | 273 | return true; |
274 | 274 | }; |
275 | 275 | |
276 | 276 | /** |
277 | 277 | * @see https://www.semantic-mediawiki.org/wiki/Hooks/SMW::SQLStore::AddCustomFixedPropertyTables |
278 | 278 | */ |
279 | - $this->handlers['SMW::SQLStore::AddCustomFixedPropertyTables'] = function( array &$customFixedProperties ) use( $propertyRegistry ) { |
|
279 | + $this->handlers['SMW::SQLStore::AddCustomFixedPropertyTables'] = function(array &$customFixedProperties) use($propertyRegistry) { |
|
280 | 280 | |
281 | 281 | $properties = [ |
282 | 282 | $propertyRegistry::SCI_CITE_KEY, |
@@ -291,8 +291,8 @@ discard block |
||
291 | 291 | $propertyRegistry::SCI_OLID |
292 | 292 | ]; |
293 | 293 | |
294 | - foreach ( $properties as $property ) { |
|
295 | - $customFixedProperties[$property] = str_replace( '__', '_', $property ); |
|
294 | + foreach ($properties as $property) { |
|
295 | + $customFixedProperties[$property] = str_replace('__', '_', $property); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | return true; |
@@ -301,13 +301,13 @@ discard block |
||
301 | 301 | /** |
302 | 302 | * @see https://www.mediawiki.org/wiki/Manual:Hooks/BeforePageDisplay |
303 | 303 | */ |
304 | - $this->handlers['BeforePageDisplay'] = function ( &$outputPage, &$skin ) use( $namespaceExaminer ) { |
|
304 | + $this->handlers['BeforePageDisplay'] = function(&$outputPage, &$skin) use($namespaceExaminer) { |
|
305 | 305 | |
306 | - if ( !$namespaceExaminer->isSemanticEnabled( $outputPage->getTitle()->getNamespace() ) ) { |
|
306 | + if (!$namespaceExaminer->isSemanticEnabled($outputPage->getTitle()->getNamespace())) { |
|
307 | 307 | return true; |
308 | 308 | } |
309 | 309 | |
310 | - $outputPage->addModuleStyles( 'ext.scite.styles' ); |
|
310 | + $outputPage->addModuleStyles('ext.scite.styles'); |
|
311 | 311 | |
312 | 312 | $outputPage->addModules( |
313 | 313 | [ |
@@ -325,15 +325,15 @@ discard block |
||
325 | 325 | * |
326 | 326 | * @see https://www.mediawiki.org/wiki/Manual:Hooks/OutputPageParserOutput |
327 | 327 | */ |
328 | - $this->handlers['OutputPageParserOutput'] = function( &$outputPage, $parserOutput ) { |
|
329 | - $outputPage->smwmagicwords = $parserOutput->getExtensionData( 'smwmagicwords' ); |
|
328 | + $this->handlers['OutputPageParserOutput'] = function(&$outputPage, $parserOutput) { |
|
329 | + $outputPage->smwmagicwords = $parserOutput->getExtensionData('smwmagicwords'); |
|
330 | 330 | return true; |
331 | 331 | }; |
332 | 332 | |
333 | 333 | /** |
334 | 334 | * @see https://www.mediawiki.org/wiki/Manual:Hooks/OutputPageBeforeHTML |
335 | 335 | */ |
336 | - $this->handlers['OutputPageBeforeHTML'] = function( &$outputPage, &$text ) use ( $store, $namespaceExaminer, $cache, $cacheKeyProvider, $options ) { |
|
336 | + $this->handlers['OutputPageBeforeHTML'] = function(&$outputPage, &$text) use ($store, $namespaceExaminer, $cache, $cacheKeyProvider, $options) { |
|
337 | 337 | |
338 | 338 | $referenceListFactory = new ReferenceListFactory( |
339 | 339 | $store, |
@@ -342,13 +342,13 @@ discard block |
||
342 | 342 | ); |
343 | 343 | |
344 | 344 | $cachedReferenceListOutputRenderer = $referenceListFactory->newCachedReferenceListOutputRenderer( |
345 | - new MediaWikiContextInteractor( $outputPage->getContext() ), |
|
345 | + new MediaWikiContextInteractor($outputPage->getContext()), |
|
346 | 346 | $cache, |
347 | 347 | $cacheKeyProvider, |
348 | 348 | $options |
349 | 349 | ); |
350 | 350 | |
351 | - $cachedReferenceListOutputRenderer->addReferenceListToText( $text ); |
|
351 | + $cachedReferenceListOutputRenderer->addReferenceListToText($text); |
|
352 | 352 | |
353 | 353 | return true; |
354 | 354 | }; |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | /** |
357 | 357 | * @see https://www.semantic-mediawiki.org/wiki/Hooks#SMWStore::updateDataBefore |
358 | 358 | */ |
359 | - $this->handlers['SMWStore::updateDataBefore'] = function ( $store, $semanticData ) use ( $cache, $cacheKeyProvider ) { |
|
359 | + $this->handlers['SMWStore::updateDataBefore'] = function($store, $semanticData) use ($cache, $cacheKeyProvider) { |
|
360 | 360 | |
361 | 361 | $hash = $semanticData->getSubject()->getHash(); |
362 | 362 | |
@@ -364,14 +364,14 @@ discard block |
||
364 | 364 | // more because as long as a CiteRef exists, CitationReferencePositionJournal |
365 | 365 | // is able recompute and update the entries but with no CiteRef left |
366 | 366 | // the last entry will remain and needs to be purged at this point |
367 | - if ( !$this->citationReferencePositionJournal->hasCitationReference( $semanticData ) ) { |
|
367 | + if (!$this->citationReferencePositionJournal->hasCitationReference($semanticData)) { |
|
368 | 368 | $cache->delete( |
369 | - $cacheKeyProvider->getCacheKeyForCitationReference( $hash ) |
|
369 | + $cacheKeyProvider->getCacheKeyForCitationReference($hash) |
|
370 | 370 | ); |
371 | 371 | } |
372 | 372 | |
373 | 373 | $cache->delete( |
374 | - $cacheKeyProvider->getCacheKeyForReferenceList( $hash ) |
|
374 | + $cacheKeyProvider->getCacheKeyForReferenceList($hash) |
|
375 | 375 | ); |
376 | 376 | |
377 | 377 | return true; |
@@ -380,16 +380,16 @@ discard block |
||
380 | 380 | /** |
381 | 381 | * @see https://www.semantic-mediawiki.org/wiki/Hooks#SMW::SQLStore::AfterDeleteSubjectComplete |
382 | 382 | */ |
383 | - $this->handlers['SMW::SQLStore::AfterDeleteSubjectComplete'] = function ( $store, $title ) use ( $cache, $cacheKeyProvider ) { |
|
383 | + $this->handlers['SMW::SQLStore::AfterDeleteSubjectComplete'] = function($store, $title) use ($cache, $cacheKeyProvider) { |
|
384 | 384 | |
385 | - $hash = DIWikiPage::newFromTitle( $title )->getHash(); |
|
385 | + $hash = DIWikiPage::newFromTitle($title)->getHash(); |
|
386 | 386 | |
387 | 387 | $cache->delete( |
388 | - $cacheKeyProvider->getCacheKeyForCitationReference( $hash ) |
|
388 | + $cacheKeyProvider->getCacheKeyForCitationReference($hash) |
|
389 | 389 | ); |
390 | 390 | |
391 | 391 | $cache->delete( |
392 | - $cacheKeyProvider->getCacheKeyForReferenceList( $hash ) |
|
392 | + $cacheKeyProvider->getCacheKeyForReferenceList($hash) |
|
393 | 393 | ); |
394 | 394 | |
395 | 395 | return true; |
@@ -398,9 +398,9 @@ discard block |
||
398 | 398 | /** |
399 | 399 | * @see https://www.semantic-mediawiki.org/wiki/Hooks#SMW::SQLStore::AfterDataUpdateComplete |
400 | 400 | */ |
401 | - $this->handlers['SMW::SQLStore::AfterDataUpdateComplete'] = function ( $store, $semanticData, $compositePropertyTableDiffIterator ) use ( $referenceBacklinksLookup, $options ) { |
|
401 | + $this->handlers['SMW::SQLStore::AfterDataUpdateComplete'] = function($store, $semanticData, $compositePropertyTableDiffIterator) use ($referenceBacklinksLookup, $options) { |
|
402 | 402 | |
403 | - $referenceBacklinksLookup->setStore( $store ); |
|
403 | + $referenceBacklinksLookup->setStore($store); |
|
404 | 404 | |
405 | 405 | $citationTextChangeUpdateJobDispatcher = new CitationTextChangeUpdateJobDispatcher( |
406 | 406 | $store, |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | ); |
409 | 409 | |
410 | 410 | $citationTextChangeUpdateJobDispatcher->setEnabledUpdateJobState( |
411 | - $options->get( 'enabledCitationTextChangeUpdateJob' ) |
|
411 | + $options->get('enabledCitationTextChangeUpdateJob') |
|
412 | 412 | ); |
413 | 413 | |
414 | 414 | $citationTextChangeUpdateJobDispatcher->dispatchUpdateJobFor( |
@@ -422,12 +422,12 @@ discard block |
||
422 | 422 | /** |
423 | 423 | * @see https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderGetConfigVars |
424 | 424 | */ |
425 | - $this->handlers['ResourceLoaderGetConfigVars'] = function ( &$vars ) use ( $options ) { |
|
425 | + $this->handlers['ResourceLoaderGetConfigVars'] = function(&$vars) use ($options) { |
|
426 | 426 | |
427 | 427 | $vars['ext.scite.config'] = [ |
428 | - 'showTooltipForCitationReference' => $options->get( 'showTooltipForCitationReference' ), |
|
429 | - 'tooltipRequestCacheTTL' => $options->get( 'tooltipRequestCacheTTL' ), |
|
430 | - 'cachePrefix' => $options->get( 'cachePrefix' ) |
|
428 | + 'showTooltipForCitationReference' => $options->get('showTooltipForCitationReference'), |
|
429 | + 'tooltipRequestCacheTTL' => $options->get('tooltipRequestCacheTTL'), |
|
430 | + 'cachePrefix' => $options->get('cachePrefix') |
|
431 | 431 | ]; |
432 | 432 | |
433 | 433 | return true; |
@@ -436,20 +436,20 @@ discard block |
||
436 | 436 | /** |
437 | 437 | * @see https://www.mediawiki.org/wiki/Manual:Hooks/ParserFirstCallInit |
438 | 438 | */ |
439 | - $this->handlers['ParserFirstCallInit'] = function ( &$parser ) use ( $namespaceExaminer, $options ) { |
|
439 | + $this->handlers['ParserFirstCallInit'] = function(&$parser) use ($namespaceExaminer, $options) { |
|
440 | 440 | |
441 | 441 | $parserFunctionFactory = new ParserFunctionFactory(); |
442 | 442 | |
443 | - list( $name, $definition, $flag ) = $parserFunctionFactory->newSciteParserFunctionDefinition( |
|
443 | + list($name, $definition, $flag) = $parserFunctionFactory->newSciteParserFunctionDefinition( |
|
444 | 444 | $namespaceExaminer, |
445 | 445 | $options |
446 | 446 | ); |
447 | 447 | |
448 | - $parser->setFunctionHook( $name, $definition, $flag ); |
|
448 | + $parser->setFunctionHook($name, $definition, $flag); |
|
449 | 449 | |
450 | - list( $name, $definition, $flag ) = $parserFunctionFactory->newReferenceListParserFunctionDefinition(); |
|
450 | + list($name, $definition, $flag) = $parserFunctionFactory->newReferenceListParserFunctionDefinition(); |
|
451 | 451 | |
452 | - $parser->setFunctionHook( $name, $definition, $flag ); |
|
452 | + $parser->setFunctionHook($name, $definition, $flag); |
|
453 | 453 | |
454 | 454 | return true; |
455 | 455 | }; |
@@ -11,10 +11,10 @@ |
||
11 | 11 | |
12 | 12 | /** English (English) */ |
13 | 13 | $specialPageAliases['en'] = [ |
14 | - 'FindCitableMetadata' => [ 'FindCitableMetadata', 'FindMetadataById' ] |
|
14 | + 'FindCitableMetadata' => ['FindCitableMetadata', 'FindMetadataById'] |
|
15 | 15 | ]; |
16 | 16 | |
17 | 17 | /** German (Deutsch) */ |
18 | 18 | $specialPageAliases['de'] = [ |
19 | - 'FindCitableMetadata' => [ 'Metadatensuche_nach_Identifizierungskennung' ] |
|
19 | + 'FindCitableMetadata' => ['Metadatensuche_nach_Identifizierungskennung'] |
|
20 | 20 | ]; |
@@ -9,15 +9,15 @@ |
||
9 | 9 | * English (English) |
10 | 10 | */ |
11 | 11 | $magicWords['en'] = [ |
12 | - 'scite' => [ 0, 'scite' ], |
|
13 | - 'referencelist' => [ 0, 'referencelist' ], |
|
14 | - 'SCI_NOREFERENCELIST' => [ 0, '__NOREFERENCELIST__' ] |
|
12 | + 'scite' => [0, 'scite'], |
|
13 | + 'referencelist' => [0, 'referencelist'], |
|
14 | + 'SCI_NOREFERENCELIST' => [0, '__NOREFERENCELIST__'] |
|
15 | 15 | ]; |
16 | 16 | |
17 | 17 | /** |
18 | 18 | * German (Deutsch) |
19 | 19 | */ |
20 | 20 | $magicWords['de'] = [ |
21 | - 'referencelist' => [ 0, 'referenzierungen' ], |
|
22 | - 'SCI_NOREFERENCELIST' => [ 0, '__KEINE_REFERENZIERUNGEN__', '__KEINEREFERENZIERUNGEN__' ] |
|
21 | + 'referencelist' => [0, 'referenzierungen'], |
|
22 | + 'SCI_NOREFERENCELIST' => [0, '__KEINE_REFERENZIERUNGEN__', '__KEINEREFERENZIERUNGEN__'] |
|
23 | 23 | ]; |