@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function next() { |
| 74 | 74 | static $term = null; |
| 75 | - static $definitions = []; |
|
| 76 | - static $ret = []; |
|
| 75 | + static $definitions = [ ]; |
|
| 76 | + static $ret = [ ]; |
|
| 77 | 77 | |
| 78 | 78 | $this->collectDictionaryLines(); |
| 79 | 79 | |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | // wipe the data if it's a totally new term definition |
| 111 | 111 | if ( !empty( $term ) && count( $definitions ) > 0 ) { |
| 112 | - $definitions = []; |
|
| 112 | + $definitions = [ ]; |
|
| 113 | 113 | $term = null; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - $definitions[] = trim( $chunks[ 1 ] ); |
|
| 116 | + $definitions[ ] = trim( $chunks[ 1 ] ); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | // found a new term? |
@@ -130,10 +130,10 @@ discard block |
||
| 130 | 130 | * @return array |
| 131 | 131 | */ |
| 132 | 132 | protected function queueDefinitions( $definitions, $term ) { |
| 133 | - $ret = []; |
|
| 133 | + $ret = [ ]; |
|
| 134 | 134 | |
| 135 | 135 | foreach ( $definitions as $definition ) { |
| 136 | - $ret[] = [ |
|
| 136 | + $ret[ ] = [ |
|
| 137 | 137 | Element::ELEMENT_TERM => $term, |
| 138 | 138 | Element::ELEMENT_DEFINITION => $definition, |
| 139 | 139 | Element::ELEMENT_LINK => null, |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | } else { |
| 155 | 155 | |
| 156 | 156 | wfDebug( "Cache miss: Lingo tree not found in cache.\n" ); |
| 157 | - $this->mLingoTree =& $this->buildLingo(); |
|
| 157 | + $this->mLingoTree = & $this->buildLingo(); |
|
| 158 | 158 | wfDebug( "Cached lingo tree.\n" ); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | } else { |
| 167 | 167 | wfDebug( "Caching of lingo tree disabled.\n" ); |
| 168 | - $this->mLingoTree =& $this->buildLingo(); |
|
| 168 | + $this->mLingoTree = & $this->buildLingo(); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | } |
@@ -201,10 +201,10 @@ discard block |
||
| 201 | 201 | // Parse text identical to options used in includes/api/ApiParse.php |
| 202 | 202 | $params = $this->mApiParams; |
| 203 | 203 | $text = is_null( $params ) ? $parser->getOutput()->getText() : $parser->getOutput()->getText( [ |
| 204 | - 'allowTOC' => !$params['disabletoc'], |
|
| 205 | - 'enableSectionEditLinks' => !$params['disableeditsection'], |
|
| 206 | - 'wrapperDivClass' => $params['wrapoutputclass'], |
|
| 207 | - 'deduplicateStyles' => !$params['disablestylededuplication'], |
|
| 204 | + 'allowTOC' => !$params[ 'disabletoc' ], |
|
| 205 | + 'enableSectionEditLinks' => !$params[ 'disableeditsection' ], |
|
| 206 | + 'wrapperDivClass' => $params[ 'wrapoutputclass' ], |
|
| 207 | + 'deduplicateStyles' => !$params[ 'disablestylededuplication' ], |
|
| 208 | 208 | ] ); |
| 209 | 209 | |
| 210 | 210 | if ( $text === null || $text === '' ) { |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | // Iterate all HTML text matches |
| 236 | 236 | $numberOfTextElements = $textElements->length; |
| 237 | 237 | |
| 238 | - $definitions = []; |
|
| 238 | + $definitions = [ ]; |
|
| 239 | 239 | |
| 240 | 240 | for ( $textElementIndex = 0; $textElementIndex < $numberOfTextElements; $textElementIndex++ ) { |
| 241 | 241 | $textElement = $textElements->item( $textElementIndex ); |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | continue; |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - $matches = []; |
|
| 247 | + $matches = [ ]; |
|
| 248 | 248 | preg_match_all( |
| 249 | 249 | $this->regex, |
| 250 | 250 | $textElement->nodeValue, |
@@ -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 | /** |