@@ -58,8 +58,8 @@ |
||
58 | 58 | |
59 | 59 | /** |
60 | 60 | * Lingo\Element constructor. |
61 | - * @param $term |
|
62 | - * @param $definition |
|
61 | + * @param string $term |
|
62 | + * @param string $definition |
|
63 | 63 | */ |
64 | 64 | public function __construct( &$term, &$definition = null ) { |
65 | 65 |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | const ELEMENT_LINK = 3; |
48 | 48 | const ELEMENT_STYLE = 4; |
49 | 49 | |
50 | - const ELEMENT_FIELDCOUNT = 5; // number of fields stored for each element; (last field's index) + 1 |
|
50 | + const ELEMENT_FIELDCOUNT = 5; // number of fields stored for each element; (last field's index) + 1 |
|
51 | 51 | |
52 | 52 | const LINK_TEMPLATE_ID = 'LingoLink'; |
53 | 53 | |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | * @param $definition |
75 | 75 | */ |
76 | 76 | public function addDefinition( &$definition ) { |
77 | - $this->mDefinitions[] = array_pad( $definition, self::ELEMENT_FIELDCOUNT, null ); |
|
77 | + $this->mDefinitions[ ] = array_pad( $definition, self::ELEMENT_FIELDCOUNT, null ); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
81 | 81 | * @param StashingDOMDocument $doc |
82 | 82 | * @return DOMNode|DOMText |
83 | 83 | */ |
84 | - public function getFullDefinition( StashingDOMDocument &$doc ) { |
|
84 | + public function getFullDefinition( StashingDOMDocument & $doc ) { |
|
85 | 85 | |
86 | 86 | global $wgexLingoDisplayOnce; |
87 | 87 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | /** |
99 | 99 | * @param StashingDOMDocument $doc |
100 | 100 | */ |
101 | - private function buildFullDefinition( StashingDOMDocument &$doc ) { |
|
101 | + private function buildFullDefinition( StashingDOMDocument & $doc ) { |
|
102 | 102 | |
103 | 103 | // only create if not yet created |
104 | 104 | if ( $this->mFullDefinition === null || $this->mFullDefinition->ownerDocument !== $doc ) { |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @return DOMElement |
126 | 126 | * @throws \MWException |
127 | 127 | */ |
128 | - protected function getFullDefinitionAsLink( StashingDOMDocument &$doc ) { |
|
128 | + protected function getFullDefinitionAsLink( StashingDOMDocument & $doc ) { |
|
129 | 129 | |
130 | 130 | // create Title object for target page |
131 | 131 | $target = Title::newFromText( $this->mDefinitions[ 0 ][ self::ELEMENT_LINK ] ); |
@@ -166,19 +166,19 @@ discard block |
||
166 | 166 | $classes = array(); |
167 | 167 | |
168 | 168 | if ( $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ] !== null ) { |
169 | - $classes[] = $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ]; |
|
169 | + $classes[ ] = $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ]; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | if ( !$target->isKnown() ) { |
173 | - $classes[] = 'new'; |
|
173 | + $classes[ ] = 'new'; |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | if ( $target->isExternal() ) { |
177 | - $classes[] = 'extiw'; |
|
177 | + $classes[ ] = 'extiw'; |
|
178 | 178 | } |
179 | 179 | |
180 | - if ( count($classes) > 0 ) { |
|
181 | - $link->setAttribute( 'class', join(' ', $classes ) ); |
|
180 | + if ( count( $classes ) > 0 ) { |
|
181 | + $link->setAttribute( 'class', join( ' ', $classes ) ); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | return $link; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * @return DOMElement |
209 | 209 | * @throws \MWException |
210 | 210 | */ |
211 | - protected function getFullDefinitionAsTooltip( StashingDOMDocument &$doc ) { |
|
211 | + protected function getFullDefinitionAsTooltip( StashingDOMDocument & $doc ) { |
|
212 | 212 | |
213 | 213 | // Wrap term and definition in <span> tags |
214 | 214 | $span = $doc->createElement( 'span' ); |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * @param StashingDOMDocument $doc |
254 | 254 | * @return DOMNode |
255 | 255 | */ |
256 | - private function getLinkTemplate( StashingDOMDocument &$doc ) { |
|
256 | + private function getLinkTemplate( StashingDOMDocument & $doc ) { |
|
257 | 257 | |
258 | 258 | $mLinkTemplate = $doc->stashGet( self::LINK_TEMPLATE_ID ); |
259 | 259 | |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | if ( $mLinkTemplate === null ) { |
262 | 262 | |
263 | 263 | $mLinkTemplate = $doc->createElement( 'a' ); |
264 | - $mLinkTemplate->setAttribute( 'class', 'mw-lingo-tooltip-link'); |
|
264 | + $mLinkTemplate->setAttribute( 'class', 'mw-lingo-tooltip-link' ); |
|
265 | 265 | |
266 | 266 | $doc->stashSet( $mLinkTemplate, self::LINK_TEMPLATE_ID ); |
267 | 267 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public static function initExtension() { |
45 | 45 | |
46 | - $GLOBALS[ 'wgExtensionFunctions' ][] = function () { |
|
46 | + $GLOBALS[ 'wgExtensionFunctions' ][ ] = function() { |
|
47 | 47 | |
48 | 48 | $parser = LingoParser::getInstance(); |
49 | 49 | |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | |
54 | 54 | \Hooks::register( 'ParserAfterParse', array( $parser, 'parse' ) ); |
55 | 55 | |
56 | - \Hooks::register( 'ParserFirstCallInit', function ( \Parser $parser ) { |
|
56 | + \Hooks::register( 'ParserFirstCallInit', function( \Parser $parser ) { |
|
57 | 57 | |
58 | - $parser->setHook( 'noglossary', function ( $input, array $args, \Parser $parser, \PPFrame $frame ) { |
|
58 | + $parser->setHook( 'noglossary', function( $input, array $args, \Parser $parser, \PPFrame $frame ) { |
|
59 | 59 | $output = $parser->recursiveTagParse( $input, $frame ); |
60 | 60 | return '<span class="noglossary">' . $output . '</span>'; |
61 | 61 | } ); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | return true; |
64 | 64 | } ); |
65 | 65 | |
66 | - \Hooks::register( 'SpecialPageBeforeExecute', function ( \SpecialPage $specialPage, $subPage ) { |
|
66 | + \Hooks::register( 'SpecialPageBeforeExecute', function( \SpecialPage $specialPage, $subPage ) { |
|
67 | 67 | |
68 | 68 | if ( $specialPage instanceof \SpecialVersion ) { |
69 | 69 | foreach ( $GLOBALS[ 'wgExtensionCredits' ][ 'parserhook' ] as $index => $description ) { |
@@ -83,6 +83,6 @@ discard block |
||
83 | 83 | * @param array $doubleUnderscoreIDs |
84 | 84 | */ |
85 | 85 | public static function onGetDoubleUnderscoreIDs( array &$doubleUnderscoreIDs ) { |
86 | - $doubleUnderscoreIDs[] = 'noglossary'; |
|
86 | + $doubleUnderscoreIDs[ ] = 'noglossary'; |
|
87 | 87 | } |
88 | 88 | } |