| @@ -48,14 +48,14 @@ discard block | ||
| 48 | 48 | const ELEMENT_LINK = 3; | 
| 49 | 49 | const ELEMENT_STYLE = 4; | 
| 50 | 50 | |
| 51 | - const ELEMENT_FIELDCOUNT = 5; // number of fields stored for each element; (last field's index) + 1 | |
| 51 | + const ELEMENT_FIELDCOUNT = 5; // number of fields stored for each element; (last field's index) + 1 | |
| 52 | 52 | |
| 53 | 53 | const LINK_TEMPLATE_ID = 'LingoLink'; | 
| 54 | 54 | |
| 55 | 55 | private $formattedTerm = null; | 
| 56 | 56 | private $formattedDefinitions = null; | 
| 57 | 57 | |
| 58 | - private $mDefinitions = []; | |
| 58 | + private $mDefinitions = [ ]; | |
| 59 | 59 | private $mTerm = null; | 
| 60 | 60 | |
| 61 | 61 | private $hasBeenDisplayed = false; | 
| @@ -79,7 +79,7 @@ discard block | ||
| 79 | 79 | * @param array $definition | 
| 80 | 80 | */ | 
| 81 | 81 |  	public function addDefinition( &$definition ) { | 
| 82 | - $this->mDefinitions[] = array_pad( $definition, self::ELEMENT_FIELDCOUNT, null ); | |
| 82 | + $this->mDefinitions[ ] = array_pad( $definition, self::ELEMENT_FIELDCOUNT, null ); | |
| 83 | 83 | } | 
| 84 | 84 | |
| 85 | 85 | /** | 
| @@ -185,18 +185,18 @@ discard block | ||
| 185 | 185 | // part here. | 
| 186 | 186 | |
| 187 | 187 | // set style | 
| 188 | - $classes = []; | |
| 188 | + $classes = [ ]; | |
| 189 | 189 | |
| 190 | 190 |  		if ( $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ] !== null ) { | 
| 191 | - $classes[] = $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ]; | |
| 191 | + $classes[ ] = $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ]; | |
| 192 | 192 | } | 
| 193 | 193 | |
| 194 | 194 |  		if ( !$target->isKnown() ) { | 
| 195 | - $classes[] = 'new'; | |
| 195 | + $classes[ ] = 'new'; | |
| 196 | 196 | } | 
| 197 | 197 | |
| 198 | 198 |  		if ( $target->isExternal() ) { | 
| 199 | - $classes[] = 'extiw'; | |
| 199 | + $classes[ ] = 'extiw'; | |
| 200 | 200 | } | 
| 201 | 201 | |
| 202 | 202 |  		if ( count( $classes ) > 0 ) { | 
| @@ -243,16 +243,16 @@ discard block | ||
| 243 | 243 |  	protected function buildFormattedDefinitions() { | 
| 244 | 244 | |
| 245 | 245 | // Wrap definition in a <div> tag | 
| 246 | - $divDefinitions = []; | |
| 247 | - $divDefinitions[] = '<div class="mw-lingo-tooltip ' . $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ] . '" id="' . $this->getId() . '" >'; | |
| 246 | + $divDefinitions = [ ]; | |
| 247 | + $divDefinitions[ ] = '<div class="mw-lingo-tooltip ' . $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ] . '" id="' . $this->getId() . '" >'; | |
| 248 | 248 | |
| 249 | 249 |  		foreach ( $this->mDefinitions as $definition ) { | 
| 250 | 250 | |
| 251 | - $divDefinitions[] = '<div class="mw-lingo-definition">'; | |
| 251 | + $divDefinitions[ ] = '<div class="mw-lingo-definition">'; | |
| 252 | 252 | |
| 253 | - $divDefinitions[] = '<div class="mw-lingo-definition-text ' . $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ] . "\">\n"; | |
| 254 | - $divDefinitions[] = $definition[ self::ELEMENT_DEFINITION ]; | |
| 255 | - $divDefinitions[] = "\n" . '</div>'; | |
| 253 | + $divDefinitions[ ] = '<div class="mw-lingo-definition-text ' . $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ] . "\">\n"; | |
| 254 | + $divDefinitions[ ] = $definition[ self::ELEMENT_DEFINITION ]; | |
| 255 | + $divDefinitions[ ] = "\n" . '</div>'; | |
| 256 | 256 | |
| 257 | 257 |  			if ( $definition[ self::ELEMENT_LINK ] ) { | 
| 258 | 258 | |
| @@ -263,14 +263,14 @@ discard block | ||
| 263 | 263 | } | 
| 264 | 264 | |
| 265 | 265 |  				if ( $url !== null ) { | 
| 266 | - $divDefinitions[] = '<div class="mw-lingo-definition-link">[' . $url . ' <nowiki/>]</div>'; | |
| 266 | + $divDefinitions[ ] = '<div class="mw-lingo-definition-link">[' . $url . ' <nowiki/>]</div>'; | |
| 267 | 267 | } | 
| 268 | 268 | } | 
| 269 | 269 | |
| 270 | - $divDefinitions[] = '</div>'; | |
| 270 | + $divDefinitions[ ] = '</div>'; | |
| 271 | 271 | } | 
| 272 | 272 | |
| 273 | - $divDefinitions[] = "\n" . '</div>'; | |
| 273 | + $divDefinitions[ ] = "\n" . '</div>'; | |
| 274 | 274 | |
| 275 | 275 | $this->formattedDefinitions = join( $divDefinitions ); | 
| 276 | 276 | } | 
| @@ -160,7 +160,7 @@ discard block | ||
| 160 | 160 |  				} else { | 
| 161 | 161 | |
| 162 | 162 | wfDebug( "Cache miss: Lingo tree not found in cache.\n" ); | 
| 163 | - $this->mLingoTree =& $this->buildLingo(); | |
| 163 | + $this->mLingoTree = & $this->buildLingo(); | |
| 164 | 164 | wfDebug( "Cached lingo tree.\n" ); | 
| 165 | 165 | } | 
| 166 | 166 | |
| @@ -171,7 +171,7 @@ discard block | ||
| 171 | 171 | |
| 172 | 172 |  			} else { | 
| 173 | 173 | wfDebug( "Caching of lingo tree disabled.\n" ); | 
| 174 | - $this->mLingoTree =& $this->buildLingo(); | |
| 174 | + $this->mLingoTree = & $this->buildLingo(); | |
| 175 | 175 | } | 
| 176 | 176 | |
| 177 | 177 | } | 
| @@ -236,7 +236,7 @@ discard block | ||
| 236 | 236 | // Iterate all HTML text matches | 
| 237 | 237 | $numberOfTextElements = $textElements->length; | 
| 238 | 238 | |
| 239 | - $definitions = []; | |
| 239 | + $definitions = [ ]; | |
| 240 | 240 | |
| 241 | 241 |  		for ( $textElementIndex = 0; $textElementIndex < $numberOfTextElements; $textElementIndex++ ) { | 
| 242 | 242 | $textElement = $textElements->item( $textElementIndex ); | 
| @@ -245,7 +245,7 @@ discard block | ||
| 245 | 245 | continue; | 
| 246 | 246 | } | 
| 247 | 247 | |
| 248 | - $matches = []; | |
| 248 | + $matches = [ ]; | |
| 249 | 249 | preg_match_all( | 
| 250 | 250 | $this->regex, | 
| 251 | 251 | $textElement->nodeValue, | 
| @@ -257,7 +257,7 @@ discard block | ||
| 257 | 257 | continue; | 
| 258 | 258 | } | 
| 259 | 259 | |
| 260 | - $wordDescriptors = &$matches[ 0 ]; // See __construct() for definition of "word" | |
| 260 | + $wordDescriptors = &$matches[ 0 ]; // See __construct() for definition of "word" | |
| 261 | 261 | $numberOfWordDescriptors = count( $wordDescriptors ); | 
| 262 | 262 | |
| 263 | 263 | $parentNode = &$textElement->parentNode; | 
| @@ -275,12 +275,12 @@ discard block | ||
| 275 | 275 | |
| 276 | 276 |  					if ( $skippedWords > 0 ) { // skipped some text, insert it as is | 
| 277 | 277 | |
| 278 | - $start = $wordDescriptors[$wordDescriptorIndex][self::WORD_OFFSET]; | |
| 279 | - $length = $wordDescriptors[$wordDescriptorIndex + $skippedWords][self::WORD_OFFSET] - $start; | |
| 278 | + $start = $wordDescriptors[ $wordDescriptorIndex ][ self::WORD_OFFSET ]; | |
| 279 | + $length = $wordDescriptors[ $wordDescriptorIndex + $skippedWords ][ self::WORD_OFFSET ] - $start; | |
| 280 | 280 | |
| 281 | 281 | $parentNode->insertBefore( | 
| 282 | 282 | $doc->createTextNode( | 
| 283 | - substr( $textElement->nodeValue, $start, $length) | |
| 283 | + substr( $textElement->nodeValue, $start, $length ) | |
| 284 | 284 | ), | 
| 285 | 285 | $textElement | 
| 286 | 286 | ); | 
| @@ -301,11 +301,11 @@ discard block | ||
| 301 | 301 | // Only change element if found term before | 
| 302 | 302 |  					if ( $changedElem === true ) { | 
| 303 | 303 | |
| 304 | - $start = $wordDescriptors[$wordDescriptorIndex][self::WORD_OFFSET]; | |
| 304 | + $start = $wordDescriptors[ $wordDescriptorIndex ][ self::WORD_OFFSET ]; | |
| 305 | 305 | |
| 306 | 306 | $parentNode->insertBefore( | 
| 307 | 307 | $doc->createTextNode( | 
| 308 | - substr( $textElement->nodeValue, $start) | |
| 308 | + substr( $textElement->nodeValue, $start ) | |
| 309 | 309 | ), | 
| 310 | 310 | $textElement | 
| 311 | 311 | ); | 
| @@ -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,14 +53,14 @@ discard block | ||
| 53 | 53 | |
| 54 | 54 | \Hooks::register( 'ContentAlterParserOutput', [ $parser, 'parse' ] ); | 
| 55 | 55 | |
| 56 | -			\Hooks::register('GetDoubleUnderscoreIDs', function ( array &$doubleUnderscoreIDs ) { | |
| 57 | - $doubleUnderscoreIDs[] = 'noglossary'; | |
| 56 | +			\Hooks::register( 'GetDoubleUnderscoreIDs', function( array &$doubleUnderscoreIDs ) { | |
| 57 | + $doubleUnderscoreIDs[ ] = 'noglossary'; | |
| 58 | 58 | return true; | 
| 59 | 59 | } ); | 
| 60 | 60 | |
| 61 | -			\Hooks::register( 'ParserFirstCallInit', function ( \Parser $parser ) { | |
| 61 | +			\Hooks::register( 'ParserFirstCallInit', function( \Parser $parser ) { | |
| 62 | 62 | |
| 63 | -				$parser->setHook( 'noglossary', function ( $input, array $args, \Parser $parser, \PPFrame $frame ) { | |
| 63 | +				$parser->setHook( 'noglossary', function( $input, array $args, \Parser $parser, \PPFrame $frame ) { | |
| 64 | 64 | $output = $parser->recursiveTagParse( $input, $frame ); | 
| 65 | 65 | return '<span class="noglossary">' . $output . '</span>'; | 
| 66 | 66 | } ); | 
| @@ -68,7 +68,7 @@ discard block | ||
| 68 | 68 | return true; | 
| 69 | 69 | } ); | 
| 70 | 70 | |
| 71 | -			\Hooks::register( 'SpecialPageBeforeExecute', function ( \SpecialPage $specialPage, $subPage ) { | |
| 71 | +			\Hooks::register( 'SpecialPageBeforeExecute', function( \SpecialPage $specialPage, $subPage ) { | |
| 72 | 72 | |
| 73 | 73 |  				if ( $specialPage instanceof \SpecialVersion ) { | 
| 74 | 74 |  					foreach ( $GLOBALS[ 'wgExtensionCredits' ][ 'parserhook' ] as $index => $description ) { |