@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * LingoParser constructor. |
53 | 53 | * @param LingoMessageLog|null $messages |
54 | 54 | */ |
55 | - public function __construct( LingoMessageLog &$messages = null ) { |
|
55 | + public function __construct( LingoMessageLog&$messages = null ) { |
|
56 | 56 | global $wgexLingoBackend; |
57 | 57 | |
58 | 58 | $this->mLingoBackend = new $wgexLingoBackend( $messages ); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @param Parser $parser |
63 | 63 | * @return string |
64 | 64 | */ |
65 | - private static function uniqPrefix( Parser &$parser ) { |
|
65 | + private static function uniqPrefix( Parser&$parser ) { |
|
66 | 66 | if ( defined( "Parser::MARKER_PREFIX" ) ) { |
67 | 67 | return Parser::MARKER_PREFIX; |
68 | 68 | } else { |
@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | * @param string $text |
77 | 77 | * @return Boolean |
78 | 78 | */ |
79 | - public static function parse( Parser &$parser, &$text ) { |
|
79 | + public static function parse( Parser&$parser, &$text ) { |
|
80 | 80 | |
81 | 81 | if ( !self::$parserSingleton ) { |
82 | 82 | self::$parserSingleton = new LingoParser(); |
83 | 83 | |
84 | 84 | // The RegEx to split a chunk of text into words |
85 | 85 | // Words are: placeholders for stripped items, sequences of letters and numbers, single characters that are neither letter nor number |
86 | - self::$regex = '/' . preg_quote( self::uniqPrefix( $parser ), '/' ) . '.*?' . preg_quote( Parser::MARKER_SUFFIX, '/' ) . '|[\p{L}\p{N}]+|[^\p{L}\p{N}]/u'; |
|
86 | + self::$regex = '/'.preg_quote( self::uniqPrefix( $parser ), '/' ).'.*?'.preg_quote( Parser::MARKER_SUFFIX, '/' ).'|[\p{L}\p{N}]+|[^\p{L}\p{N}]/u'; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | self::$parserSingleton->realParse( $parser, $text ); |
@@ -142,13 +142,13 @@ discard block |
||
142 | 142 | } else { |
143 | 143 | |
144 | 144 | wfDebug( "Cache miss: Lingo tree not found in cache.\n" ); |
145 | - $this->mLingoTree =& $this->buildLingo(); |
|
145 | + $this->mLingoTree = & $this->buildLingo(); |
|
146 | 146 | $cache->set( $cachekey, $this->mLingoTree ); |
147 | 147 | wfDebug( "Cached lingo tree.\n" ); |
148 | 148 | } |
149 | 149 | } else { |
150 | 150 | wfDebug( "Caching of lingo tree disabled.\n" ); |
151 | - $this->mLingoTree =& $this->buildLingo(); |
|
151 | + $this->mLingoTree = & $this->buildLingo(); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | wfSuppressWarnings(); |
205 | 205 | |
206 | 206 | $doc = new DOMDocument( '1.0', 'utf-8' ); |
207 | - $doc->loadHTML( '<html><head><meta http-equiv="content-type" content="charset=utf-8"/></head><body>' . $text . '</body></html>' ); |
|
207 | + $doc->loadHTML( '<html><head><meta http-equiv="content-type" content="charset=utf-8"/></head><body>'.$text.'</body></html>' ); |
|
208 | 208 | |
209 | 209 | wfRestoreWarnings(); |
210 | 210 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | self::$regex, |
231 | 231 | $el->nodeValue, |
232 | 232 | $matches, |
233 | - PREG_OFFSET_CAPTURE | PREG_PATTERN_ORDER |
|
233 | + PREG_OFFSET_CAPTURE|PREG_PATTERN_ORDER |
|
234 | 234 | ); |
235 | 235 | |
236 | 236 | if ( count( $matches ) == 0 || count( $matches[ 0 ] ) == 0 ) { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public static function noglossaryTagRenderer( $input, array $args, Parser $parser, PPFrame $frame ) { |
88 | 88 | $output = $parser->recursiveTagParse( $input, $frame ); |
89 | - return '<span class="noglossary">' . $output . '</span>'; |
|
89 | + return '<span class="noglossary">'.$output.'</span>'; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * - extension description shown on Special:Version |
96 | 96 | */ |
97 | 97 | public static function initExtension() { |
98 | - MagicWord::$mDoubleUnderscoreIDs[] = 'noglossary'; |
|
98 | + MagicWord::$mDoubleUnderscoreIDs[ ] = 'noglossary'; |
|
99 | 99 | |
100 | 100 | foreach ( $GLOBALS[ 'wgExtensionCredits' ][ 'parserhook' ] as $index => $description ) { |
101 | 101 | if ( $GLOBALS[ 'wgExtensionCredits' ][ 'parserhook' ][ $index ][ 'name' ] === 'Lingo' ) { |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param int $severity |
49 | 49 | */ |
50 | 50 | public function addMessage( $message, $severity = self::MESSAGE_NOTICE ) { |
51 | - $this->mMessages[] = array( $message, $severity ); |
|
51 | + $this->mMessages[ ] = array( $message, $severity ); |
|
52 | 52 | |
53 | 53 | // log errors and warnings in debug log |
54 | 54 | if ( $severity == self::MESSAGE_WARNING || |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @param $message |
63 | 63 | */ |
64 | 64 | public function addError( $message ) { |
65 | - $this->mMessages[] = array( $message, self::MESSAGE_ERROR ); |
|
65 | + $this->mMessages[ ] = array( $message, self::MESSAGE_ERROR ); |
|
66 | 66 | wfDebug( "Error: $message\n" ); |
67 | 67 | } |
68 | 68 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param $message |
71 | 71 | */ |
72 | 72 | public function addWarning( $message ) { |
73 | - $this->mMessages[] = array( $message, self::MESSAGE_WARNING ); |
|
73 | + $this->mMessages[ ] = array( $message, self::MESSAGE_WARNING ); |
|
74 | 74 | wfDebug( "Warning: $message\n" ); |
75 | 75 | } |
76 | 76 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param $message |
79 | 79 | */ |
80 | 80 | public function addNotice( $message ) { |
81 | - $this->mMessages[] = array( $message, self::MESSAGE_NOTICE ); |
|
81 | + $this->mMessages[ ] = array( $message, self::MESSAGE_NOTICE ); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | foreach ( $this->mMessages as $message ) { |
95 | 95 | if ( $message[ 1 ] <= $severity ) { |
96 | - $ret .= '* ' . $message[ 0 ] . "\n"; |
|
96 | + $ret .= '* '.$message[ 0 ]."\n"; |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | $ret = Html::rawElement( 'div', array( 'class' => 'messages' ), |
112 | - $header . "\n" . |
|
112 | + $header."\n". |
|
113 | 113 | $ret |
114 | 114 | ); |
115 | 115 |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * LingoBasicBackend constructor. |
40 | 40 | * @param LingoMessageLog|null $messages |
41 | 41 | */ |
42 | - public function __construct( LingoMessageLog &$messages = null ) { |
|
42 | + public function __construct( LingoMessageLog&$messages = null ) { |
|
43 | 43 | |
44 | 44 | global $wgexLingoPage, $wgRequest; |
45 | 45 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $term = null; |
118 | 118 | } |
119 | 119 | |
120 | - $definitions[] = trim( $chunks[ 1 ] ); |
|
120 | + $definitions[ ] = trim( $chunks[ 1 ] ); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | // found a new term? |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | |
128 | 128 | if ( $term !== null ) { |
129 | 129 | foreach ( $definitions as $definition ) { |
130 | - $ret[] = array( |
|
130 | + $ret[ ] = array( |
|
131 | 131 | LingoElement::ELEMENT_TERM => $term, |
132 | 132 | LingoElement::ELEMENT_DEFINITION => $definition, |
133 | 133 | LingoElement::ELEMENT_LINK => null, |
@@ -39,7 +39,7 @@ |
||
39 | 39 | * LingoBackend constructor. |
40 | 40 | * @param LingoMessageLog|null $messages |
41 | 41 | */ |
42 | - public function __construct( LingoMessageLog &$messages = null ) { |
|
42 | + public function __construct( LingoMessageLog&$messages = null ) { |
|
43 | 43 | |
44 | 44 | if ( !$messages ) { |
45 | 45 | $this->mMessageLog = new LingoMessageLog(); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | const ELEMENT_LINK = 3; |
41 | 41 | const ELEMENT_STYLE = 4; |
42 | 42 | |
43 | - const ELEMENT_FIELDCOUNT = 5; // number of fields stored for each element; (last field's index) + 1 |
|
43 | + const ELEMENT_FIELDCOUNT = 5; // number of fields stored for each element; (last field's index) + 1 |
|
44 | 44 | |
45 | 45 | private $mFullDefinition = null; |
46 | 46 | private $mDefinitions = array(); |
@@ -67,14 +67,14 @@ discard block |
||
67 | 67 | * @param $definition |
68 | 68 | */ |
69 | 69 | public function addDefinition( &$definition ) { |
70 | - $this->mDefinitions[] = array_pad( $definition, self::ELEMENT_FIELDCOUNT, null ); |
|
70 | + $this->mDefinitions[ ] = array_pad( $definition, self::ELEMENT_FIELDCOUNT, null ); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
74 | 74 | * @param DOMDocument $doc |
75 | 75 | * @return DOMNode|DOMText |
76 | 76 | */ |
77 | - public function getFullDefinition( DOMDocument &$doc ) { |
|
77 | + public function getFullDefinition( DOMDocument&$doc ) { |
|
78 | 78 | |
79 | 79 | global $wgexLingoDisplayOnce; |
80 | 80 | |
@@ -160,13 +160,13 @@ discard block |
||
160 | 160 | * @param DOMDocument $doc |
161 | 161 | * @return DOMNode |
162 | 162 | */ |
163 | - private function getLinkTemplate( DOMDocument &$doc ) { |
|
163 | + private function getLinkTemplate( DOMDocument&$doc ) { |
|
164 | 164 | // create template if it does not yet exist |
165 | 165 | if ( !self::$mLinkTemplate || ( self::$mLinkTemplate->ownerDocument !== $doc ) ) { |
166 | 166 | global $wgScriptPath; |
167 | 167 | |
168 | 168 | $linkimage = $doc->createElement( 'img' ); |
169 | - $linkimage->setAttribute( 'src', $wgScriptPath . '/extensions/Lingo/styles/linkicon.png' ); |
|
169 | + $linkimage->setAttribute( 'src', $wgScriptPath.'/extensions/Lingo/styles/linkicon.png' ); |
|
170 | 170 | |
171 | 171 | self::$mLinkTemplate = $doc->createElement( 'a' ); |
172 | 172 | self::$mLinkTemplate->appendChild( $linkimage ); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @return DOMElement |
182 | 182 | * @throws MWException |
183 | 183 | */ |
184 | - protected function getFullDefinitionAsLink( DOMDocument &$doc ) { |
|
184 | + protected function getFullDefinitionAsLink( DOMDocument&$doc ) { |
|
185 | 185 | |
186 | 186 | // create Title object for target page |
187 | 187 | $target = Title::newFromText( $this->mDefinitions[ 0 ][ self::ELEMENT_LINK ] ); |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | * @return string |
204 | 204 | * @throws MWException |
205 | 205 | */ |
206 | - protected function getFullDefinitionAsTooltip( DOMDocument &$doc ) { |
|
206 | + protected function getFullDefinitionAsTooltip( DOMDocument&$doc ) { |
|
207 | 207 | |
208 | 208 | // Wrap term and definition in <span> tags |
209 | 209 | $span = $doc->createElement( 'span' ); |
210 | - $span->setAttribute( 'class', 'mw-lingo-tooltip ' . $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ] ); |
|
210 | + $span->setAttribute( 'class', 'mw-lingo-tooltip '.$this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ] ); |
|
211 | 211 | |
212 | 212 | // Wrap term in <span> tag, hidden |
213 | 213 | wfSuppressWarnings(); |
@@ -218,12 +218,12 @@ discard block |
||
218 | 218 | |
219 | 219 | // Wrap definition in a <span> tag |
220 | 220 | $spanDefinition = $doc->createElement( 'span' ); |
221 | - $spanDefinition->setAttribute( 'class', 'mw-lingo-tooltip-tip ' . $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ] ); |
|
221 | + $spanDefinition->setAttribute( 'class', 'mw-lingo-tooltip-tip '.$this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ] ); |
|
222 | 222 | |
223 | 223 | foreach ( $this->mDefinitions as $definition ) { |
224 | 224 | wfSuppressWarnings(); |
225 | 225 | $element = $doc->createElement( 'span', htmlentities( $definition[ self::ELEMENT_DEFINITION ], ENT_COMPAT, 'UTF-8' ) ); |
226 | - $element->setAttribute( 'class', 'mw-lingo-tooltip-definition ' . $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ] ); |
|
226 | + $element->setAttribute( 'class', 'mw-lingo-tooltip-definition '.$this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ] ); |
|
227 | 227 | wfRestoreWarnings(); |
228 | 228 | if ( $definition[ self::ELEMENT_LINK ] ) { |
229 | 229 | $linkedTitle = Title::newFromText( $definition[ self::ELEMENT_LINK ] ); |