@@ -42,28 +42,28 @@ discard block |
||
42 | 42 | * @since 2.0.2 |
43 | 43 | */ |
44 | 44 | public static function initExtension() { |
45 | - $GLOBALS[ 'wgExtensionFunctions' ][] = function () { |
|
45 | + $GLOBALS[ 'wgExtensionFunctions' ][ ] = function() { |
|
46 | 46 | $parser = LingoParser::getInstance(); |
47 | 47 | |
48 | 48 | $backend = new $GLOBALS[ 'wgexLingoBackend' ](); |
49 | 49 | |
50 | 50 | $parser->setBackend( $backend ); |
51 | 51 | |
52 | - \Hooks::register( 'ContentAlterParserOutput', function () use ( $parser ){ |
|
52 | + \Hooks::register( 'ContentAlterParserOutput', function() use ( $parser ){ |
|
53 | 53 | $parser->parse( MediaWikiServices::getInstance()->getParser() ); |
54 | 54 | } ); |
55 | 55 | |
56 | - \Hooks::register( 'ApiMakeParserOptions', function ( \ParserOptions $popts, \Title $title, array $params ) use ( $parser ){ |
|
56 | + \Hooks::register( 'ApiMakeParserOptions', function( \ParserOptions $popts, \Title $title, array $params ) use ( $parser ){ |
|
57 | 57 | $parser->setApiParams( $params ); |
58 | 58 | } ); |
59 | 59 | |
60 | - \Hooks::register( 'GetDoubleUnderscoreIDs', function ( array &$doubleUnderscoreIDs ) { |
|
61 | - $doubleUnderscoreIDs[] = 'noglossary'; |
|
60 | + \Hooks::register( 'GetDoubleUnderscoreIDs', function( array &$doubleUnderscoreIDs ) { |
|
61 | + $doubleUnderscoreIDs[ ] = 'noglossary'; |
|
62 | 62 | return true; |
63 | 63 | } ); |
64 | 64 | |
65 | - \Hooks::register( 'ParserFirstCallInit', function ( \Parser $parser ) { |
|
66 | - $parser->setHook( 'noglossary', function ( $input, array $args, \Parser $parser, \PPFrame $frame ) { |
|
65 | + \Hooks::register( 'ParserFirstCallInit', function( \Parser $parser ) { |
|
66 | + $parser->setHook( 'noglossary', function( $input, array $args, \Parser $parser, \PPFrame $frame ) { |
|
67 | 67 | $output = $parser->recursiveTagParse( $input, $frame ); |
68 | 68 | return '<span class="noglossary">' . $output . '</span>'; |
69 | 69 | } ); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | return true; |
72 | 72 | } ); |
73 | 73 | |
74 | - \Hooks::register( 'SpecialPageBeforeExecute', function ( \SpecialPage $specialPage, $subPage ) { |
|
74 | + \Hooks::register( 'SpecialPageBeforeExecute', function( \SpecialPage $specialPage, $subPage ) { |
|
75 | 75 | if ( $specialPage instanceof \SpecialVersion ) { |
76 | 76 | foreach ( $GLOBALS[ 'wgExtensionCredits' ][ 'parserhook' ] as $index => $description ) { |
77 | 77 | if ( $GLOBALS[ 'wgExtensionCredits' ][ 'parserhook' ][ $index ][ 'name' ] === 'Lingo' ) { |
@@ -47,14 +47,14 @@ 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 | |
54 | 54 | private $formattedTerm = null; |
55 | 55 | private $formattedDefinitions = null; |
56 | 56 | |
57 | - private $mDefinitions = []; |
|
57 | + private $mDefinitions = [ ]; |
|
58 | 58 | private $mTerm = null; |
59 | 59 | |
60 | 60 | private $hasBeenDisplayed = false; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param array &$definition |
75 | 75 | */ |
76 | 76 | public function addDefinition( &$definition ) { |
77 | - $this->mDefinitions[] = $definition + array_fill( 0, self::ELEMENT_FIELDCOUNT, null ); |
|
77 | + $this->mDefinitions[ ] = $definition + array_fill( 0, self::ELEMENT_FIELDCOUNT, null ); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $descriptor = $this->getDescriptorFromLinkTarget( $linkTarget ); |
130 | 130 | |
131 | 131 | if ( $descriptor === null ) { |
132 | - $this->mDefinitions = []; |
|
132 | + $this->mDefinitions = [ ]; |
|
133 | 133 | $this->addErrorMessageForInvalidLink( $linkTarget ); |
134 | 134 | return $this->buildFormattedTermAsTooltip( $doc ); |
135 | 135 | } |
@@ -177,20 +177,20 @@ discard block |
||
177 | 177 | // set style |
178 | 178 | $classes = [ 'mw-lingo-term' ]; |
179 | 179 | |
180 | - $classes[] = $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ]; |
|
180 | + $classes[ ] = $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ]; |
|
181 | 181 | |
182 | 182 | if ( array_key_exists( 'title', $descriptor ) && $descriptor[ 'title' ] instanceof Title ) { |
183 | 183 | |
184 | - if ( !$descriptor['title']->isKnown() ) { |
|
185 | - $classes[] = 'new'; |
|
184 | + if ( !$descriptor[ 'title' ]->isKnown() ) { |
|
185 | + $classes[ ] = 'new'; |
|
186 | 186 | } |
187 | 187 | |
188 | - if ( $descriptor['title']->isExternal() ) { |
|
189 | - $classes[] = 'extiw'; |
|
188 | + if ( $descriptor[ 'title' ]->isExternal() ) { |
|
189 | + $classes[ ] = 'extiw'; |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | } else { |
193 | - $classes[] = 'ext'; |
|
193 | + $classes[ ] = 'ext'; |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | return array_filter( $classes ); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | class MessageLog { |
44 | 44 | |
45 | - private $mMessages = []; |
|
45 | + private $mMessages = [ ]; |
|
46 | 46 | private $mParser = null; |
47 | 47 | |
48 | 48 | const MESSAGE_ERROR = 1; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param int $severity |
55 | 55 | */ |
56 | 56 | public function addMessage( $message, $severity = self::MESSAGE_NOTICE ) { |
57 | - $this->mMessages[] = [ $message, $severity ]; |
|
57 | + $this->mMessages[ ] = [ $message, $severity ]; |
|
58 | 58 | |
59 | 59 | // log errors and warnings in debug log |
60 | 60 | if ( $severity == self::MESSAGE_WARNING || |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param string $message |
69 | 69 | */ |
70 | 70 | public function addError( $message ) { |
71 | - $this->mMessages[] = [ $message, self::MESSAGE_ERROR ]; |
|
71 | + $this->mMessages[ ] = [ $message, self::MESSAGE_ERROR ]; |
|
72 | 72 | wfDebug( "Error: $message\n" ); |
73 | 73 | } |
74 | 74 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param string $message |
77 | 77 | */ |
78 | 78 | public function addWarning( $message ) { |
79 | - $this->mMessages[] = [ $message, self::MESSAGE_WARNING ]; |
|
79 | + $this->mMessages[ ] = [ $message, self::MESSAGE_WARNING ]; |
|
80 | 80 | wfDebug( "Warning: $message\n" ); |
81 | 81 | } |
82 | 82 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @param string $message |
85 | 85 | */ |
86 | 86 | public function addNotice( $message ) { |
87 | - $this->mMessages[] = [ $message, self::MESSAGE_NOTICE ]; |
|
87 | + $this->mMessages[ ] = [ $message, self::MESSAGE_NOTICE ]; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |