Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -27,11 +27,11 @@ |
28 | 28 | class MediaWiki_I18N { |
29 | 29 | var $_context = array(); |
30 | 30 | |
31 | | - function set($varName, $value) { |
| 31 | + function set( $varName, $value ) { |
32 | 32 | $this->_context[$varName] = $value; |
33 | 33 | } |
34 | 34 | |
35 | | - function translate($value) { |
| 35 | + function translate( $value ) { |
36 | 36 | wfProfileIn( __METHOD__ ); |
37 | 37 | |
38 | 38 | // Hack for i18n:attributes in PHPTAL 1.0.0 dev version as of 2004-10-23 |
— | — | @@ -40,12 +40,12 @@ |
41 | 41 | $value = wfMsg( $value ); |
42 | 42 | // interpolate variables |
43 | 43 | $m = array(); |
44 | | - while (preg_match('/\$([0-9]*?)/sm', $value, $m)) { |
45 | | - list($src, $var) = $m; |
| 44 | + while( preg_match( '/\$([0-9]*?)/sm', $value, $m ) ) { |
| 45 | + list( $src, $var ) = $m; |
46 | 46 | wfSuppressWarnings(); |
47 | 47 | $varValue = $this->_context[$var]; |
48 | 48 | wfRestoreWarnings(); |
49 | | - $value = str_replace($src, $varValue, $value); |
| 49 | + $value = str_replace( $src, $varValue, $value ); |
50 | 50 | } |
51 | 51 | wfProfileOut( __METHOD__ ); |
52 | 52 | return $value; |
— | — | @@ -124,7 +124,7 @@ |
125 | 125 | * @return object |
126 | 126 | * @private |
127 | 127 | */ |
128 | | - function setupTemplate( $classname, $repository=false, $cache_dir=false ) { |
| 128 | + function setupTemplate( $classname, $repository = false, $cache_dir = false ) { |
129 | 129 | return new $classname(); |
130 | 130 | } |
131 | 131 | |
— | — | @@ -150,23 +150,23 @@ |
151 | 151 | $diff = $wgRequest->getVal( 'diff' ); |
152 | 152 | $action = $wgRequest->getVal( 'action', 'view' ); |
153 | 153 | |
154 | | - wfProfileIn( __METHOD__."-init" ); |
| 154 | + wfProfileIn( __METHOD__ . '-init' ); |
155 | 155 | $this->initPage( $out ); |
156 | 156 | |
157 | 157 | $this->setMembers(); |
158 | 158 | $tpl = $this->setupTemplate( $this->template, 'skins' ); |
159 | 159 | |
160 | 160 | #if ( $wgUseDatabaseMessages ) { // uncomment this to fall back to GetText |
161 | | - $tpl->setTranslator(new MediaWiki_I18N()); |
| 161 | + $tpl->setTranslator( new MediaWiki_I18N() ); |
162 | 162 | #} |
163 | | - wfProfileOut( __METHOD__."-init" ); |
| 163 | + wfProfileOut( __METHOD__ . '-init' ); |
164 | 164 | |
165 | | - wfProfileIn( __METHOD__."-stuff" ); |
166 | | - $this->thispage = $this->mTitle->getPrefixedDbKey(); |
| 165 | + wfProfileIn( __METHOD__ . '-stuff' ); |
| 166 | + $this->thispage = $this->mTitle->getPrefixedDBkey(); |
167 | 167 | $this->thisurl = $this->mTitle->getPrefixedURL(); |
168 | 168 | $this->loggedin = $wgUser->isLoggedIn(); |
169 | | - $this->iscontent = ($this->mTitle->getNamespace() != NS_SPECIAL ); |
170 | | - $this->iseditable = ($this->iscontent and !($action == 'edit' or $action == 'submit')); |
| 169 | + $this->iscontent = ( $this->mTitle->getNamespace() != NS_SPECIAL ); |
| 170 | + $this->iseditable = ( $this->iscontent and !( $action == 'edit' or $action == 'submit' ) ); |
171 | 171 | $this->username = $wgUser->getName(); |
172 | 172 | |
173 | 173 | if ( $wgUser->isLoggedIn() || $this->showIPinHeader() ) { |
— | — | @@ -181,18 +181,18 @@ |
182 | 182 | $this->setupUserCss( $out ); |
183 | 183 | $this->setupUserJs( $out->isUserJsAllowed() ); |
184 | 184 | $this->titletxt = $this->mTitle->getPrefixedText(); |
185 | | - wfProfileOut( __METHOD__."-stuff" ); |
| 185 | + wfProfileOut( __METHOD__ . '-stuff' ); |
186 | 186 | |
187 | | - wfProfileIn( __METHOD__."-stuff2" ); |
| 187 | + wfProfileIn( __METHOD__ . '-stuff2' ); |
188 | 188 | $tpl->set( 'title', $out->getPageTitle() ); |
189 | 189 | $tpl->set( 'pagetitle', $out->getHTMLTitle() ); |
190 | 190 | $tpl->set( 'displaytitle', $out->mPageLinkTitle ); |
191 | 191 | $tpl->set( 'pageclass', $this->getPageClasses( $this->mTitle ) ); |
192 | | - $tpl->set( 'skinnameclass', ( "skin-" . Sanitizer::escapeClass( $this->getSkinName ( ) ) ) ); |
| 192 | + $tpl->set( 'skinnameclass', ( 'skin-' . Sanitizer::escapeClass( $this->getSkinName() ) ) ); |
193 | 193 | |
194 | 194 | $nsname = isset( $wgCanonicalNamespaceNames[ $this->mTitle->getNamespace() ] ) ? |
195 | | - $wgCanonicalNamespaceNames[ $this->mTitle->getNamespace() ] : |
196 | | - $this->mTitle->getNsText(); |
| 195 | + $wgCanonicalNamespaceNames[ $this->mTitle->getNamespace() ] : |
| 196 | + $this->mTitle->getNsText(); |
197 | 197 | |
198 | 198 | $tpl->set( 'nscanonical', $nsname ); |
199 | 199 | $tpl->set( 'nsnumber', $this->mTitle->getNamespace() ); |
— | — | @@ -203,33 +203,34 @@ |
204 | 204 | |
205 | 205 | $tpl->set( 'isarticle', $out->isArticle() ); |
206 | 206 | |
207 | | - $tpl->setRef( "thispage", $this->thispage ); |
| 207 | + $tpl->setRef( 'thispage', $this->thispage ); |
208 | 208 | $subpagestr = $this->subPageSubtitle(); |
209 | 209 | $tpl->set( |
210 | | - 'subtitle', !empty($subpagestr)? |
211 | | - '<span class="subpages">'.$subpagestr.'</span>'.$out->getSubtitle(): |
| 210 | + 'subtitle', !empty( $subpagestr ) ? |
| 211 | + '<span class="subpages">'.$subpagestr.'</span>'.$out->getSubtitle() : |
212 | 212 | $out->getSubtitle() |
213 | 213 | ); |
214 | 214 | $undelete = $this->getUndeleteLink(); |
215 | 215 | $tpl->set( |
216 | | - "undelete", !empty($undelete)? |
217 | | - '<span class="subpages">'.$undelete.'</span>': |
| 216 | + 'undelete', !empty( $undelete ) ? |
| 217 | + '<span class="subpages">'.$undelete.'</span>' : |
218 | 218 | '' |
219 | 219 | ); |
220 | 220 | |
221 | | - $tpl->set( 'catlinks', $this->getCategories()); |
| 221 | + $tpl->set( 'catlinks', $this->getCategories() ); |
222 | 222 | if( $out->isSyndicated() ) { |
223 | 223 | $feeds = array(); |
224 | 224 | foreach( $out->getSyndicationLinks() as $format => $link ) { |
225 | 225 | $feeds[$format] = array( |
226 | 226 | 'text' => wfMsg( "feed-$format" ), |
227 | | - 'href' => $link ); |
| 227 | + 'href' => $link |
| 228 | + ); |
228 | 229 | } |
229 | 230 | $tpl->setRef( 'feeds', $feeds ); |
230 | 231 | } else { |
231 | 232 | $tpl->set( 'feeds', false ); |
232 | 233 | } |
233 | | - if ($wgUseTrackbacks && $out->isArticleRelated()) { |
| 234 | + if( $wgUseTrackbacks && $out->isArticleRelated() ) { |
234 | 235 | $tpl->set( 'trackbackhtml', $wgTitle->trackbackRDF() ); |
235 | 236 | } else { |
236 | 237 | $tpl->set( 'trackbackhtml', null ); |
— | — | @@ -250,7 +251,7 @@ |
251 | 252 | $tpl->set( 'printable', $wgRequest->getBool( 'printable' ) ); |
252 | 253 | $tpl->set( 'handheld', $wgRequest->getBool( 'handheld' ) ); |
253 | 254 | $tpl->setRef( 'loggedin', $this->loggedin ); |
254 | | - $tpl->set('notspecialpage', $this->mTitle->getNamespace() != NS_SPECIAL); |
| 255 | + $tpl->set( 'notspecialpage', $this->mTitle->getNamespace() != NS_SPECIAL ); |
255 | 256 | /* XXX currently unused, might get useful later |
256 | 257 | $tpl->set( "editable", ($this->mTitle->getNamespace() != NS_SPECIAL ) ); |
257 | 258 | $tpl->set( "exists", $this->mTitle->getArticleID() != 0 ); |
— | — | @@ -259,38 +260,38 @@ |
260 | 261 | $tpl->set( "helppage", wfMsg('helppage')); |
261 | 262 | */ |
262 | 263 | $tpl->set( 'searchaction', $this->escapeSearchLink() ); |
263 | | - $tpl->set( 'searchtitle', SpecialPage::getTitleFor('search')->getPrefixedDBKey() ); |
| 264 | + $tpl->set( 'searchtitle', SpecialPage::getTitleFor( 'Search' )->getPrefixedDBKey() ); |
264 | 265 | $tpl->set( 'search', trim( $wgRequest->getVal( 'search' ) ) ); |
265 | 266 | $tpl->setRef( 'stylepath', $wgStylePath ); |
266 | 267 | $tpl->setRef( 'articlepath', $wgArticlePath ); |
267 | 268 | $tpl->setRef( 'scriptpath', $wgScriptPath ); |
268 | 269 | $tpl->setRef( 'serverurl', $wgServer ); |
269 | 270 | $tpl->setRef( 'logopath', $wgLogo ); |
270 | | - $tpl->setRef( "lang", $wgContLanguageCode ); |
271 | | - $tpl->set( 'dir', $wgContLang->isRTL() ? "rtl" : "ltr" ); |
| 271 | + $tpl->setRef( 'lang', $wgContLanguageCode ); |
| 272 | + $tpl->set( 'dir', $wgContLang->isRTL() ? 'rtl' : 'ltr' ); |
272 | 273 | $tpl->set( 'rtl', $wgContLang->isRTL() ); |
273 | 274 | $tpl->set( 'langname', $wgContLang->getLanguageName( $wgContLanguageCode ) ); |
274 | 275 | $tpl->set( 'showjumplinks', $wgUser->getOption( 'showjumplinks' ) ); |
275 | 276 | $tpl->set( 'username', $wgUser->isAnon() ? NULL : $this->username ); |
276 | | - $tpl->setRef( 'userpage', $this->userpage); |
277 | | - $tpl->setRef( 'userpageurl', $this->userpageUrlDetails['href']); |
| 277 | + $tpl->setRef( 'userpage', $this->userpage ); |
| 278 | + $tpl->setRef( 'userpageurl', $this->userpageUrlDetails['href'] ); |
278 | 279 | $tpl->set( 'userlang', $wgLang->getCode() ); |
279 | 280 | $tpl->set( 'pagecss', $this->setupPageCss() ); |
280 | | - $tpl->setRef( 'usercss', $this->usercss); |
281 | | - $tpl->setRef( 'userjs', $this->userjs); |
282 | | - $tpl->setRef( 'userjsprev', $this->userjsprev); |
| 281 | + $tpl->setRef( 'usercss', $this->usercss ); |
| 282 | + $tpl->setRef( 'userjs', $this->userjs ); |
| 283 | + $tpl->setRef( 'userjsprev', $this->userjsprev ); |
283 | 284 | if( $wgUseSiteJs ) { |
284 | 285 | $jsCache = $this->loggedin ? '&smaxage=0' : ''; |
285 | 286 | $tpl->set( 'jsvarurl', |
286 | | - self::makeUrl('-', |
| 287 | + self::makeUrl( '-', |
287 | 288 | "action=raw$jsCache&gen=js&useskin=" . |
288 | 289 | urlencode( $this->getSkinName() ) ) ); |
289 | 290 | } else { |
290 | | - $tpl->set('jsvarurl', false); |
| 291 | + $tpl->set( 'jsvarurl', false ); |
291 | 292 | } |
292 | 293 | $newtalks = $wgUser->getNewMessageLinks(); |
293 | 294 | |
294 | | - if (count($newtalks) == 1 && $newtalks[0]["wiki"] === wfWikiID() ) { |
| 295 | + if( count( $newtalks ) == 1 && $newtalks[0]['wiki'] === wfWikiID() ) { |
295 | 296 | $usertitle = $this->mUser->getUserPage(); |
296 | 297 | $usertalktitle = $usertitle->getTalkPage(); |
297 | 298 | if( !$usertalktitle->equals( $this->mTitle ) ) { |
— | — | @@ -307,63 +308,63 @@ |
308 | 309 | ) |
309 | 310 | ); |
310 | 311 | # Disable Cache |
311 | | - $out->setSquidMaxage(0); |
| 312 | + $out->setSquidMaxage( 0 ); |
312 | 313 | } |
313 | | - } else if (count($newtalks)) { |
314 | | - $sep = str_replace("_", " ", wfMsgHtml("newtalkseparator")); |
| 314 | + } else if( count( $newtalks ) ) { |
| 315 | + $sep = str_replace( '_', ' ', wfMsgHtml( 'newtalkseparator' ) ); |
315 | 316 | $msgs = array(); |
316 | | - foreach ($newtalks as $newtalk) { |
317 | | - $msgs[] = Xml::element("a", |
318 | | - array('href' => $newtalk["link"]), $newtalk["wiki"]); |
| 317 | + foreach( $newtalks as $newtalk ) { |
| 318 | + $msgs[] = Xml::element('a', |
| 319 | + array( 'href' => $newtalk['link'] ), $newtalk['wiki'] ); |
319 | 320 | } |
320 | | - $parts = implode($sep, $msgs); |
321 | | - $ntl = wfMsgHtml('youhavenewmessagesmulti', $parts); |
322 | | - $out->setSquidMaxage(0); |
| 321 | + $parts = implode( $sep, $msgs ); |
| 322 | + $ntl = wfMsgHtml( 'youhavenewmessagesmulti', $parts ); |
| 323 | + $out->setSquidMaxage( 0 ); |
323 | 324 | } else { |
324 | 325 | $ntl = ''; |
325 | 326 | } |
326 | | - wfProfileOut( __METHOD__."-stuff2" ); |
| 327 | + wfProfileOut( __METHOD__ . '-stuff2' ); |
327 | 328 | |
328 | | - wfProfileIn( __METHOD__."-stuff3" ); |
| 329 | + wfProfileIn( __METHOD__ . '-stuff3' ); |
329 | 330 | $tpl->setRef( 'newtalk', $ntl ); |
330 | 331 | $tpl->setRef( 'skin', $this ); |
331 | 332 | $tpl->set( 'logo', $this->logoText() ); |
332 | | - if ( $out->isArticle() and (!isset( $oldid ) or isset( $diff )) and |
333 | | - $wgArticle and 0 != $wgArticle->getID() ) |
334 | | - { |
| 333 | + if ( $out->isArticle() and ( !isset( $oldid ) or isset( $diff ) ) and |
| 334 | + $wgArticle and 0 != $wgArticle->getID() ){ |
335 | 335 | if ( !$wgDisableCounters ) { |
336 | 336 | $viewcount = $wgLang->formatNum( $wgArticle->getCount() ); |
337 | 337 | if ( $viewcount ) { |
338 | | - $tpl->set('viewcount', wfMsgExt( 'viewcount', array( 'parseinline' ), $viewcount ) ); |
| 338 | + $tpl->set( 'viewcount', wfMsgExt( 'viewcount', array( 'parseinline' ), $viewcount ) ); |
339 | 339 | } else { |
340 | | - $tpl->set('viewcount', false); |
| 340 | + $tpl->set( 'viewcount', false ); |
341 | 341 | } |
342 | 342 | } else { |
343 | | - $tpl->set('viewcount', false); |
| 343 | + $tpl->set( 'viewcount', false ); |
344 | 344 | } |
345 | 345 | |
346 | | - if ($wgPageShowWatchingUsers) { |
| 346 | + if( $wgPageShowWatchingUsers ) { |
347 | 347 | $dbr = wfGetDB( DB_SLAVE ); |
348 | 348 | $watchlist = $dbr->tableName( 'watchlist' ); |
349 | | - $sql = "SELECT COUNT(*) AS n FROM $watchlist |
350 | | - WHERE wl_title='" . $dbr->strencode($this->mTitle->getDBkey()) . |
351 | | - "' AND wl_namespace=" . $this->mTitle->getNamespace() ; |
352 | | - $res = $dbr->query( $sql, 'SkinTemplate::outputPage'); |
| 349 | + $res = $dbr->select( 'watchlist', |
| 350 | + array( 'COUNT(*) AS n' ), |
| 351 | + array( 'wl_title' => $dbr->strencode( $this->mTitle->getDBkey() ), 'wl_namespace' => $this->mTitle->getNamespace() ), |
| 352 | + __METHOD__ |
| 353 | + ); |
353 | 354 | $x = $dbr->fetchObject( $res ); |
354 | 355 | $numberofwatchingusers = $x->n; |
355 | | - if ($numberofwatchingusers > 0) { |
356 | | - $tpl->set('numberofwatchingusers', |
357 | | - wfMsgExt('number_of_watching_users_pageview', array('parseinline'), |
358 | | - $wgLang->formatNum($numberofwatchingusers)) |
| 356 | + if( $numberofwatchingusers > 0 ) { |
| 357 | + $tpl->set( 'numberofwatchingusers', |
| 358 | + wfMsgExt( 'number_of_watching_users_pageview', array( 'parseinline' ), |
| 359 | + $wgLang->formatNum( $numberofwatchingusers ) ) |
359 | 360 | ); |
360 | 361 | } else { |
361 | | - $tpl->set('numberofwatchingusers', false); |
| 362 | + $tpl->set( 'numberofwatchingusers', false ); |
362 | 363 | } |
363 | 364 | } else { |
364 | | - $tpl->set('numberofwatchingusers', false); |
| 365 | + $tpl->set( 'numberofwatchingusers', false ); |
365 | 366 | } |
366 | 367 | |
367 | | - $tpl->set('copyright',$this->getCopyright()); |
| 368 | + $tpl->set( 'copyright', $this->getCopyright() ); |
368 | 369 | |
369 | 370 | $this->credits = false; |
370 | 371 | |
— | — | @@ -376,21 +377,21 @@ |
377 | 378 | $tpl->setRef( 'credits', $this->credits ); |
378 | 379 | |
379 | 380 | } elseif ( isset( $oldid ) && !isset( $diff ) ) { |
380 | | - $tpl->set('copyright', $this->getCopyright()); |
381 | | - $tpl->set('viewcount', false); |
382 | | - $tpl->set('lastmod', false); |
383 | | - $tpl->set('credits', false); |
384 | | - $tpl->set('numberofwatchingusers', false); |
| 381 | + $tpl->set( 'copyright', $this->getCopyright() ); |
| 382 | + $tpl->set( 'viewcount', false ); |
| 383 | + $tpl->set( 'lastmod', false ); |
| 384 | + $tpl->set( 'credits', false ); |
| 385 | + $tpl->set( 'numberofwatchingusers', false ); |
385 | 386 | } else { |
386 | | - $tpl->set('copyright', false); |
387 | | - $tpl->set('viewcount', false); |
388 | | - $tpl->set('lastmod', false); |
389 | | - $tpl->set('credits', false); |
390 | | - $tpl->set('numberofwatchingusers', false); |
| 387 | + $tpl->set( 'copyright', false ); |
| 388 | + $tpl->set( 'viewcount', false ); |
| 389 | + $tpl->set( 'lastmod', false ); |
| 390 | + $tpl->set( 'credits', false ); |
| 391 | + $tpl->set( 'numberofwatchingusers', false ); |
391 | 392 | } |
392 | | - wfProfileOut( __METHOD__."-stuff3" ); |
| 393 | + wfProfileOut( __METHOD__ . '-stuff3' ); |
393 | 394 | |
394 | | - wfProfileIn( __METHOD__."-stuff4" ); |
| 395 | + wfProfileIn( __METHOD__ . '-stuff4' ); |
395 | 396 | $tpl->set( 'copyrightico', $this->getCopyrightIcon() ); |
396 | 397 | $tpl->set( 'poweredbyico', $this->getPoweredBy() ); |
397 | 398 | $tpl->set( 'disclaimer', $this->disclaimerLink() ); |
— | — | @@ -413,37 +414,37 @@ |
414 | 415 | foreach( $out->getLanguageLinks() as $l ) { |
415 | 416 | $tmp = explode( ':', $l, 2 ); |
416 | 417 | $class = 'interwiki-' . $tmp[0]; |
417 | | - unset($tmp); |
| 418 | + unset( $tmp ); |
418 | 419 | $nt = Title::newFromText( $l ); |
419 | 420 | if ( $nt ) { |
420 | 421 | $language_urls[] = array( |
421 | 422 | 'href' => $nt->getFullURL(), |
422 | | - 'text' => ($wgContLang->getLanguageName( $nt->getInterwiki()) != ''?$wgContLang->getLanguageName( $nt->getInterwiki()) : $l), |
| 423 | + 'text' => ( $wgContLang->getLanguageName( $nt->getInterwiki() ) != '' ? |
| 424 | + $wgContLang->getLanguageName( $nt->getInterwiki() ) : $l ), |
423 | 425 | 'class' => $class |
424 | 426 | ); |
425 | 427 | } |
426 | 428 | } |
427 | 429 | } |
428 | | - if(count($language_urls)) { |
429 | | - $tpl->setRef( 'language_urls', $language_urls); |
| 430 | + if( count( $language_urls ) ) { |
| 431 | + $tpl->setRef( 'language_urls', $language_urls ); |
430 | 432 | } else { |
431 | | - $tpl->set('language_urls', false); |
| 433 | + $tpl->set( 'language_urls', false ); |
432 | 434 | } |
433 | | - wfProfileOut( __METHOD__."-stuff4" ); |
| 435 | + wfProfileOut( __METHOD__ . '-stuff4' ); |
434 | 436 | |
435 | | - wfProfileIn( __METHOD__."-stuff5" ); |
| 437 | + wfProfileIn( __METHOD__ . '-stuff5' ); |
436 | 438 | # Personal toolbar |
437 | | - $tpl->set('personal_urls', $this->buildPersonalUrls()); |
| 439 | + $tpl->set( 'personal_urls', $this->buildPersonalUrls() ); |
438 | 440 | $content_actions = $this->buildContentActionUrls(); |
439 | | - $tpl->setRef('content_actions', $content_actions); |
| 441 | + $tpl->setRef( 'content_actions', $content_actions ); |
440 | 442 | |
441 | 443 | // XXX: attach this from javascript, same with section editing |
442 | | - if($this->iseditable && $wgUser->getOption("editondblclick") ) |
443 | | - { |
| 444 | + if( $this->iseditable && $wgUser->getOption( 'editondblclick' ) ){ |
444 | 445 | $encEditUrl = Xml::escapeJsString( $this->mTitle->getLocalUrl( $this->editUrlOptions() ) ); |
445 | | - $tpl->set('body_ondblclick', 'document.location = "' . $encEditUrl . '";'); |
| 446 | + $tpl->set( 'body_ondblclick', 'document.location = "' . $encEditUrl . '";' ); |
446 | 447 | } else { |
447 | | - $tpl->set('body_ondblclick', false); |
| 448 | + $tpl->set( 'body_ondblclick', false ); |
448 | 449 | } |
449 | 450 | $tpl->set( 'body_onload', false ); |
450 | 451 | $tpl->set( 'sidebar', $this->buildSidebar() ); |
— | — | @@ -456,13 +457,13 @@ |
457 | 458 | |
458 | 459 | // allow extensions adding stuff after the page content. |
459 | 460 | // See Skin::afterContentHook() for further documentation. |
460 | | - $tpl->set ('dataAfterContent', $this->afterContentHook()); |
461 | | - wfProfileOut( __METHOD__."-stuff5" ); |
| 461 | + $tpl->set( 'dataAfterContent', $this->afterContentHook() ); |
| 462 | + wfProfileOut( __METHOD__ . '-stuff5' ); |
462 | 463 | |
463 | 464 | // execute template |
464 | | - wfProfileIn( __METHOD__."-execute" ); |
| 465 | + wfProfileIn( __METHOD__ . '-execute' ); |
465 | 466 | $res = $tpl->execute(); |
466 | | - wfProfileOut( __METHOD__."-execute" ); |
| 467 | + wfProfileOut( __METHOD__ . '-execute' ); |
467 | 468 | |
468 | 469 | // result may be an error |
469 | 470 | $this->printOrError( $res ); |
— | — | @@ -494,18 +495,18 @@ |
495 | 496 | |
496 | 497 | /* set up the default links for the personal toolbar */ |
497 | 498 | $personal_urls = array(); |
498 | | - if ($this->loggedin) { |
| 499 | + if( $this->loggedin ) { |
499 | 500 | $personal_urls['userpage'] = array( |
500 | 501 | 'text' => $this->username, |
501 | 502 | 'href' => &$this->userpageUrlDetails['href'], |
502 | | - 'class' => $this->userpageUrlDetails['exists']?false:'new', |
| 503 | + 'class' => $this->userpageUrlDetails['exists'] ? false : 'new', |
503 | 504 | 'active' => ( $this->userpageUrlDetails['href'] == $pageurl ) |
504 | 505 | ); |
505 | | - $usertalkUrlDetails = $this->makeTalkUrlDetails($this->userpage); |
| 506 | + $usertalkUrlDetails = $this->makeTalkUrlDetails( $this->userpage ); |
506 | 507 | $personal_urls['mytalk'] = array( |
507 | | - 'text' => wfMsg('mytalk'), |
| 508 | + 'text' => wfMsg( 'mytalk' ), |
508 | 509 | 'href' => &$usertalkUrlDetails['href'], |
509 | | - 'class' => $usertalkUrlDetails['exists']?false:'new', |
| 510 | + 'class' => $usertalkUrlDetails['exists'] ? false : 'new', |
510 | 511 | 'active' => ( $usertalkUrlDetails['href'] == $pageurl ) |
511 | 512 | ); |
512 | 513 | $href = self::makeSpecialUrl( 'Preferences' ); |
— | — | @@ -560,15 +561,15 @@ |
561 | 562 | $personal_urls['anonuserpage'] = array( |
562 | 563 | 'text' => $this->username, |
563 | 564 | 'href' => $href, |
564 | | - 'class' => $this->userpageUrlDetails['exists']?false:'new', |
| 565 | + 'class' => $this->userpageUrlDetails['exists'] ? false : 'new', |
565 | 566 | 'active' => ( $pageurl == $href ) |
566 | 567 | ); |
567 | | - $usertalkUrlDetails = $this->makeTalkUrlDetails($this->userpage); |
| 568 | + $usertalkUrlDetails = $this->makeTalkUrlDetails( $this->userpage ); |
568 | 569 | $href = &$usertalkUrlDetails['href']; |
569 | 570 | $personal_urls['anontalk'] = array( |
570 | | - 'text' => wfMsg('anontalk'), |
| 571 | + 'text' => wfMsg( 'anontalk' ), |
571 | 572 | 'href' => $href, |
572 | | - 'class' => $usertalkUrlDetails['exists']?false:'new', |
| 573 | + 'class' => $usertalkUrlDetails['exists'] ? false : 'new', |
573 | 574 | 'active' => ( $pageurl == $href ) |
574 | 575 | ); |
575 | 576 | $personal_urls['anonlogin'] = array( |
— | — | @@ -577,7 +578,6 @@ |
578 | 579 | 'active' => $wgTitle->isSpecial( 'Userlogin' ) |
579 | 580 | ); |
580 | 581 | } else { |
581 | | - |
582 | 582 | $personal_urls['login'] = array( |
583 | 583 | 'text' => wfMsg( $loginlink ), |
584 | 584 | 'href' => self::makeSpecialUrl( 'Userlogin', 'returnto=' . $this->thisurl ), |
— | — | @@ -591,7 +591,7 @@ |
592 | 592 | return $personal_urls; |
593 | 593 | } |
594 | 594 | |
595 | | - function tabAction( $title, $message, $selected, $query='', $checkEdit=false ) { |
| 595 | + function tabAction( $title, $message, $selected, $query = '', $checkEdit = false ) { |
596 | 596 | $classes = array(); |
597 | 597 | if( $selected ) { |
598 | 598 | $classes[] = 'selected'; |
— | — | @@ -608,9 +608,9 @@ |
609 | 609 | } |
610 | 610 | |
611 | 611 | $result = array(); |
612 | | - if( !wfRunHooks('SkinTemplateTabAction', array(&$this, |
| 612 | + if( !wfRunHooks( 'SkinTemplateTabAction', array( &$this, |
613 | 613 | $title, $message, $selected, $checkEdit, |
614 | | - &$classes, &$query, &$text, &$result)) ) { |
| 614 | + &$classes, &$query, &$text, &$result ) ) ) { |
615 | 615 | return $result; |
616 | 616 | } |
617 | 617 | |
— | — | @@ -622,8 +622,8 @@ |
623 | 623 | |
624 | 624 | function makeTalkUrlDetails( $name, $urlaction = '' ) { |
625 | 625 | $title = Title::newFromText( $name ); |
626 | | - if( !is_object($title) ) { |
627 | | - throw new MWException( __METHOD__." given invalid pagename $name" ); |
| 626 | + if( !is_object( $title ) ) { |
| 627 | + throw new MWException( __METHOD__ . " given invalid pagename $name" ); |
628 | 628 | } |
629 | 629 | $title = $title->getTalkPage(); |
630 | 630 | self::checkTitle( $title, $name ); |
— | — | @@ -657,8 +657,8 @@ |
658 | 658 | $section = $wgRequest->getVal( 'section' ); |
659 | 659 | $content_actions = array(); |
660 | 660 | |
661 | | - $prevent_active_tabs = false ; |
662 | | - wfRunHooks( 'SkinTemplatePreventOtherActiveTabs', array( &$this , &$prevent_active_tabs ) ) ; |
| 661 | + $prevent_active_tabs = false; |
| 662 | + wfRunHooks( 'SkinTemplatePreventOtherActiveTabs', array( &$this, &$prevent_active_tabs ) ); |
663 | 663 | |
664 | 664 | if( $this->iscontent ) { |
665 | 665 | $subjpage = $this->mTitle->getSubjectPage(); |
— | — | @@ -669,21 +669,23 @@ |
670 | 670 | $subjpage, |
671 | 671 | $nskey, |
672 | 672 | !$this->mTitle->isTalkPage() && !$prevent_active_tabs, |
673 | | - '', true); |
| 673 | + '', true |
| 674 | + ); |
674 | 675 | |
675 | 676 | $content_actions['talk'] = $this->tabAction( |
676 | 677 | $talkpage, |
677 | 678 | 'talk', |
678 | 679 | $this->mTitle->isTalkPage() && !$prevent_active_tabs, |
679 | 680 | '', |
680 | | - true); |
| 681 | + true |
| 682 | + ); |
681 | 683 | |
682 | | - wfProfileIn( __METHOD__."-edit" ); |
| 684 | + wfProfileIn( __METHOD__ . '-edit' ); |
683 | 685 | if ( $this->mTitle->quickUserCan( 'edit' ) && ( $this->mTitle->exists() || $this->mTitle->quickUserCan( 'create' ) ) ) { |
684 | 686 | $istalk = $this->mTitle->isTalkPage(); |
685 | 687 | $istalkclass = $istalk?' istalk':''; |
686 | 688 | $content_actions['edit'] = array( |
687 | | - 'class' => ((($action == 'edit' or $action == 'submit') and $section != 'new') ? 'selected' : '').$istalkclass, |
| 689 | + 'class' => ( ( ( $action == 'edit' or $action == 'submit' ) and $section != 'new' ) ? 'selected' : '' ) . $istalkclass, |
688 | 690 | 'text' => $this->mTitle->exists() |
689 | 691 | ? wfMsg( 'edit' ) |
690 | 692 | : wfMsg( 'create' ), |
— | — | @@ -694,7 +696,7 @@ |
695 | 697 | if ( !$wgOut->forceHideNewSectionLink() ) { |
696 | 698 | $content_actions['addsection'] = array( |
697 | 699 | 'class' => $section == 'new' ? 'selected' : false, |
698 | | - 'text' => wfMsg('addsection'), |
| 700 | + 'text' => wfMsg( 'addsection' ), |
699 | 701 | 'href' => $this->mTitle->getLocalUrl( 'action=edit§ion=new' ) |
700 | 702 | ); |
701 | 703 | } |
— | — | @@ -702,26 +704,26 @@ |
703 | 705 | } elseif ( $this->mTitle->isKnown() ) { |
704 | 706 | $content_actions['viewsource'] = array( |
705 | 707 | 'class' => ($action == 'edit') ? 'selected' : false, |
706 | | - 'text' => wfMsg('viewsource'), |
| 708 | + 'text' => wfMsg( 'viewsource' ), |
707 | 709 | 'href' => $this->mTitle->getLocalUrl( $this->editUrlOptions() ) |
708 | 710 | ); |
709 | 711 | } |
710 | | - wfProfileOut( __METHOD__."-edit" ); |
| 712 | + wfProfileOut( __METHOD__ . '-edit' ); |
711 | 713 | |
712 | | - wfProfileIn( __METHOD__."-live" ); |
| 714 | + wfProfileIn( __METHOD__ . '-live' ); |
713 | 715 | if ( $this->mTitle->exists() ) { |
714 | 716 | |
715 | 717 | $content_actions['history'] = array( |
716 | 718 | 'class' => ($action == 'history') ? 'selected' : false, |
717 | | - 'text' => wfMsg('history_short'), |
| 719 | + 'text' => wfMsg( 'history_short' ), |
718 | 720 | 'href' => $this->mTitle->getLocalUrl( 'action=history' ), |
719 | 721 | 'rel' => 'archives', |
720 | 722 | ); |
721 | 723 | |
722 | | - if( $wgUser->isAllowed('delete') ) { |
| 724 | + if( $wgUser->isAllowed( 'delete' ) ) { |
723 | 725 | $content_actions['delete'] = array( |
724 | 726 | 'class' => ($action == 'delete') ? 'selected' : false, |
725 | | - 'text' => wfMsg('delete'), |
| 727 | + 'text' => wfMsg( 'delete' ), |
726 | 728 | 'href' => $this->mTitle->getLocalUrl( 'action=delete' ) |
727 | 729 | ); |
728 | 730 | } |
— | — | @@ -729,7 +731,7 @@ |
730 | 732 | $moveTitle = SpecialPage::getTitleFor( 'Movepage', $this->thispage ); |
731 | 733 | $content_actions['move'] = array( |
732 | 734 | 'class' => $this->mTitle->isSpecial( 'Movepage' ) ? 'selected' : false, |
733 | | - 'text' => wfMsg('move'), |
| 735 | + 'text' => wfMsg( 'move' ), |
734 | 736 | 'href' => $moveTitle->getLocalUrl() |
735 | 737 | ); |
736 | 738 | } |
— | — | @@ -738,14 +740,14 @@ |
739 | 741 | if( !$this->mTitle->isProtected() ){ |
740 | 742 | $content_actions['protect'] = array( |
741 | 743 | 'class' => ($action == 'protect') ? 'selected' : false, |
742 | | - 'text' => wfMsg('protect'), |
| 744 | + 'text' => wfMsg( 'protect' ), |
743 | 745 | 'href' => $this->mTitle->getLocalUrl( 'action=protect' ) |
744 | 746 | ); |
745 | 747 | |
746 | 748 | } else { |
747 | 749 | $content_actions['unprotect'] = array( |
748 | 750 | 'class' => ($action == 'unprotect') ? 'selected' : false, |
749 | | - 'text' => wfMsg('unprotect'), |
| 751 | + 'text' => wfMsg( 'unprotect' ), |
750 | 752 | 'href' => $this->mTitle->getLocalUrl( 'action=unprotect' ) |
751 | 753 | ); |
752 | 754 | } |
— | — | @@ -757,7 +759,7 @@ |
758 | 760 | $undelTitle = SpecialPage::getTitleFor( 'Undelete' ); |
759 | 761 | $content_actions['undelete'] = array( |
760 | 762 | 'class' => false, |
761 | | - 'text' => wfMsgExt( 'undelete_short', array( 'parsemag' ), $wgLang->formatNum($n) ), |
| 763 | + 'text' => wfMsgExt( 'undelete_short', array( 'parsemag' ), $wgLang->formatNum( $n ) ), |
762 | 764 | 'href' => $undelTitle->getLocalUrl( 'target=' . urlencode( $this->thispage ) ) |
763 | 765 | #'href' => self::makeSpecialUrl( "Undelete/$this->thispage" ) |
764 | 766 | ); |
— | — | @@ -768,40 +770,40 @@ |
769 | 771 | if( !$this->mTitle->getRestrictions( 'create' ) ) { |
770 | 772 | $content_actions['protect'] = array( |
771 | 773 | 'class' => ($action == 'protect') ? 'selected' : false, |
772 | | - 'text' => wfMsg('protect'), |
| 774 | + 'text' => wfMsg( 'protect' ), |
773 | 775 | 'href' => $this->mTitle->getLocalUrl( 'action=protect' ) |
774 | 776 | ); |
775 | 777 | |
776 | 778 | } else { |
777 | 779 | $content_actions['unprotect'] = array( |
778 | 780 | 'class' => ($action == 'unprotect') ? 'selected' : false, |
779 | | - 'text' => wfMsg('unprotect'), |
| 781 | + 'text' => wfMsg( 'unprotect' ), |
780 | 782 | 'href' => $this->mTitle->getLocalUrl( 'action=unprotect' ) |
781 | 783 | ); |
782 | 784 | } |
783 | 785 | } |
784 | 786 | } |
785 | 787 | |
786 | | - wfProfileOut( __METHOD__."-live" ); |
| 788 | + wfProfileOut( __METHOD__ . '-live' ); |
787 | 789 | |
788 | 790 | if( $this->loggedin ) { |
789 | 791 | if( !$this->mTitle->userIsWatching()) { |
790 | 792 | $content_actions['watch'] = array( |
791 | 793 | 'class' => ($action == 'watch' or $action == 'unwatch') ? 'selected' : false, |
792 | | - 'text' => wfMsg('watch'), |
| 794 | + 'text' => wfMsg( 'watch' ), |
793 | 795 | 'href' => $this->mTitle->getLocalUrl( 'action=watch' ) |
794 | 796 | ); |
795 | 797 | } else { |
796 | 798 | $content_actions['unwatch'] = array( |
797 | 799 | 'class' => ($action == 'unwatch' or $action == 'watch') ? 'selected' : false, |
798 | | - 'text' => wfMsg('unwatch'), |
| 800 | + 'text' => wfMsg( 'unwatch' ), |
799 | 801 | 'href' => $this->mTitle->getLocalUrl( 'action=unwatch' ) |
800 | 802 | ); |
801 | 803 | } |
802 | 804 | } |
803 | 805 | |
804 | 806 | |
805 | | - wfRunHooks( 'SkinTemplateTabs', array( &$this , &$content_actions ) ) ; |
| 807 | + wfRunHooks( 'SkinTemplateTabs', array( &$this, &$content_actions ) ); |
806 | 808 | } else { |
807 | 809 | /* show special page tab */ |
808 | 810 | |
— | — | @@ -826,10 +828,10 @@ |
827 | 829 | continue; |
828 | 830 | $selected = ( $code == $preferred )? 'selected' : false; |
829 | 831 | $content_actions['varlang-' . $vcount] = array( |
830 | | - 'class' => $selected, |
831 | | - 'text' => $varname, |
832 | | - 'href' => $this->mTitle->getLocalURL('',$code) |
833 | | - ); |
| 832 | + 'class' => $selected, |
| 833 | + 'text' => $varname, |
| 834 | + 'href' => $this->mTitle->getLocalURL( '', $code ) |
| 835 | + ); |
834 | 836 | $vcount ++; |
835 | 837 | } |
836 | 838 | } |
— | — | @@ -840,8 +842,6 @@ |
841 | 843 | return $content_actions; |
842 | 844 | } |
843 | 845 | |
844 | | - |
845 | | - |
846 | 846 | /** |
847 | 847 | * build array of common navigation links |
848 | 848 | * @return array |
— | — | @@ -858,13 +858,13 @@ |
859 | 859 | $nav_urls = array(); |
860 | 860 | $nav_urls['mainpage'] = array( 'href' => self::makeMainPageUrl() ); |
861 | 861 | if( $wgEnableUploads && $wgUser->isAllowed( 'upload' ) ) { |
862 | | - if ($wgUploadNavigationUrl) { |
| 862 | + if( $wgUploadNavigationUrl ) { |
863 | 863 | $nav_urls['upload'] = array( 'href' => $wgUploadNavigationUrl ); |
864 | 864 | } else { |
865 | 865 | $nav_urls['upload'] = array( 'href' => self::makeSpecialUrl( 'Upload' ) ); |
866 | 866 | } |
867 | 867 | } else { |
868 | | - if ($wgUploadNavigationUrl) |
| 868 | + if( $wgUploadNavigationUrl ) |
869 | 869 | $nav_urls['upload'] = array( 'href' => $wgUploadNavigationUrl ); |
870 | 870 | else |
871 | 871 | $nav_urls['upload'] = false; |
— | — | @@ -908,21 +908,21 @@ |
909 | 909 | } else { |
910 | 910 | $nav_urls['recentchangeslinked'] = false; |
911 | 911 | } |
912 | | - if ($wgUseTrackbacks) |
| 912 | + if( $wgUseTrackbacks ) |
913 | 913 | $nav_urls['trackbacklink'] = array( |
914 | 914 | 'href' => $wgTitle->trackbackURL() |
915 | 915 | ); |
916 | 916 | } |
917 | 917 | |
918 | 918 | if( $this->mTitle->getNamespace() == NS_USER || $this->mTitle->getNamespace() == NS_USER_TALK ) { |
919 | | - $id = User::idFromName($this->mTitle->getText()); |
920 | | - $ip = User::isIP($this->mTitle->getText()); |
| 919 | + $id = User::idFromName( $this->mTitle->getText() ); |
| 920 | + $ip = User::isIP( $this->mTitle->getText() ); |
921 | 921 | } else { |
922 | 922 | $id = 0; |
923 | 923 | $ip = false; |
924 | 924 | } |
925 | 925 | |
926 | | - if($id || $ip) { # both anons and non-anons have contribs list |
| 926 | + if( $id || $ip ) { # both anons and non-anons have contribs list |
927 | 927 | $nav_urls['contributions'] = array( |
928 | 928 | 'href' => self::makeSpecialUrlSubpage( 'Contributions', $this->mTitle->getText() ) |
929 | 929 | ); |
— | — | @@ -979,9 +979,9 @@ |
980 | 980 | if( $allowUserJs && $this->loggedin ) { |
981 | 981 | if( $this->mTitle->isJsSubpage() and $this->userCanPreview( $action ) ) { |
982 | 982 | # XXX: additional security check/prompt? |
983 | | - $this->userjsprev = '/*<![CDATA[*/ ' . $wgRequest->getText('wpTextbox1') . ' /*]]>*/'; |
| 983 | + $this->userjsprev = '/*<![CDATA[*/ ' . $wgRequest->getText( 'wpTextbox1' ) . ' /*]]>*/'; |
984 | 984 | } else { |
985 | | - $this->userjs = self::makeUrl($this->userpage.'/'.$this->skinname.'.js', 'action=raw&ctype='.$wgJsMimeType); |
| 985 | + $this->userjs = self::makeUrl( $this->userpage . '/' . $this->skinname . '.js', 'action=raw&ctype=' . $wgJsMimeType ); |
986 | 986 | } |
987 | 987 | } |
988 | 988 | wfProfileOut( __METHOD__ ); |
— | — | @@ -1009,42 +1009,45 @@ |
1010 | 1010 | */ |
1011 | 1011 | class QuickTemplate { |
1012 | 1012 | /** |
1013 | | - * @public |
| 1013 | + * Constructor |
1014 | 1014 | */ |
1015 | | - function QuickTemplate() { |
| 1015 | + public function QuickTemplate() { |
1016 | 1016 | $this->data = array(); |
1017 | 1017 | $this->translator = new MediaWiki_I18N(); |
1018 | 1018 | } |
1019 | 1019 | |
1020 | 1020 | /** |
1021 | | - * @public |
| 1021 | + * Sets the value $value to $name |
| 1022 | + * @param $name |
| 1023 | + * @param $value |
1022 | 1024 | */ |
1023 | | - function set( $name, $value ) { |
| 1025 | + public function set( $name, $value ) { |
1024 | 1026 | $this->data[$name] = $value; |
1025 | 1027 | } |
1026 | 1028 | |
1027 | 1029 | /** |
1028 | | - * @public |
| 1030 | + * @param $name |
| 1031 | + * @param $value |
1029 | 1032 | */ |
1030 | | - function setRef($name, &$value) { |
| 1033 | + public function setRef( $name, &$value ) { |
1031 | 1034 | $this->data[$name] =& $value; |
1032 | 1035 | } |
1033 | 1036 | |
1034 | 1037 | /** |
1035 | | - * @public |
| 1038 | + * @param $t |
1036 | 1039 | */ |
1037 | | - function setTranslator( &$t ) { |
| 1040 | + public function setTranslator( &$t ) { |
1038 | 1041 | $this->translator = &$t; |
1039 | 1042 | } |
1040 | 1043 | |
1041 | 1044 | /** |
1042 | | - * @public |
| 1045 | + * Main function, used by classes that subclass QuickTemplate |
| 1046 | + * to show the actual HTML output |
1043 | 1047 | */ |
1044 | | - function execute() { |
1045 | | - echo "Override this function."; |
| 1048 | + public function execute() { |
| 1049 | + echo 'Override this function.'; |
1046 | 1050 | } |
1047 | 1051 | |
1048 | | - |
1049 | 1052 | /** |
1050 | 1053 | * @private |
1051 | 1054 | */ |
— | — | @@ -1105,6 +1108,6 @@ |
1106 | 1109 | */ |
1107 | 1110 | function haveMsg( $str ) { |
1108 | 1111 | $msg = $this->translator->translate( $str ); |
1109 | | - return ($msg != '-') && ($msg != ''); # ???? |
| 1112 | + return ( $msg != '-' ) && ( $msg != '' ); # ???? |
1110 | 1113 | } |
1111 | | -} |
| 1114 | +} |
\ No newline at end of file |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -23,7 +23,7 @@ |
24 | 24 | protected $searchboxes = ''; |
25 | 25 | /**#@-*/ |
26 | 26 | protected $mRevisionId; // The revision ID we're looking at, null if not applicable. |
27 | | - protected $skinname = 'standard' ; |
| 27 | + protected $skinname = 'standard'; |
28 | 28 | |
29 | 29 | /** Constructor, call parent constructor */ |
30 | 30 | function Skin() { parent::__construct(); } |
— | — | @@ -46,10 +46,10 @@ |
47 | 47 | $skinDir = dir( $wgStyleDirectory ); |
48 | 48 | |
49 | 49 | # while code from www.php.net |
50 | | - while (false !== ($file = $skinDir->read())) { |
| 50 | + while( false !== ( $file = $skinDir->read() ) ) { |
51 | 51 | // Skip non-PHP files, hidden files, and '.dep' includes |
52 | 52 | $matches = array(); |
53 | | - if(preg_match('/^([^.]*)\.php$/',$file, $matches)) { |
| 53 | + if( preg_match( '/^([^.]*)\.php$/', $file, $matches ) ) { |
54 | 54 | $aSkin = $matches[1]; |
55 | 55 | $wgValidSkinNames[strtolower($aSkin)] = $aSkin; |
56 | 56 | } |
— | — | @@ -196,7 +196,7 @@ |
197 | 197 | 'title' => wfMsgForContent( 'opensearch-desc' ), |
198 | 198 | )); |
199 | 199 | |
200 | | - $this->addMetadataLinks($out); |
| 200 | + $this->addMetadataLinks( $out ); |
201 | 201 | |
202 | 202 | $this->mRevisionId = $out->mRevisionId; |
203 | 203 | |
— | — | @@ -237,13 +237,15 @@ |
238 | 238 | $out->addMetadataLink( array( |
239 | 239 | 'title' => 'Creative Commons', |
240 | 240 | 'type' => 'application/rdf+xml', |
241 | | - 'href' => $wgTitle->getLocalURL( 'action=creativecommons') ) ); |
| 241 | + 'href' => $wgTitle->getLocalURL( 'action=creativecommons' ) ) |
| 242 | + ); |
242 | 243 | } |
243 | 244 | if( $wgEnableDublinCoreRdf ) { |
244 | 245 | $out->addMetadataLink( array( |
245 | 246 | 'title' => 'Dublin Core', |
246 | 247 | 'type' => 'application/rdf+xml', |
247 | | - 'href' => $wgTitle->getLocalURL( 'action=dublincore' ) ) ); |
| 248 | + 'href' => $wgTitle->getLocalURL( 'action=dublincore' ) ) |
| 249 | + ); |
248 | 250 | } |
249 | 251 | } |
250 | 252 | $copyright = ''; |
— | — | @@ -259,7 +261,8 @@ |
260 | 262 | if( $copyright ) { |
261 | 263 | $out->addLink( array( |
262 | 264 | 'rel' => 'copyright', |
263 | | - 'href' => $copyright ) ); |
| 265 | + 'href' => $copyright ) |
| 266 | + ); |
264 | 267 | } |
265 | 268 | } |
266 | 269 | |
— | — | @@ -384,11 +387,11 @@ |
385 | 388 | 'wgDigitTransformTable' => $compactDigitTransTable, |
386 | 389 | ); |
387 | 390 | |
388 | | - if( $wgUseAjax && $wgEnableMWSuggest && !$wgUser->getOption( 'disablesuggest', false )){ |
| 391 | + if( $wgUseAjax && $wgEnableMWSuggest && !$wgUser->getOption( 'disablesuggest', false ) ){ |
389 | 392 | $vars['wgMWSuggestTemplate'] = SearchEngine::getMWSuggestTemplate(); |
390 | 393 | $vars['wgDBname'] = $wgDBname; |
391 | 394 | $vars['wgSearchNamespaces'] = SearchEngine::userNamespaces( $wgUser ); |
392 | | - $vars['wgMWSuggestMessages'] = array( wfMsg('search-mwsuggest-enabled'), wfMsg('search-mwsuggest-disabled')); |
| 395 | + $vars['wgMWSuggestMessages'] = array( wfMsg( 'search-mwsuggest-enabled' ), wfMsg( 'search-mwsuggest-disabled' ) ); |
393 | 396 | } |
394 | 397 | |
395 | 398 | foreach( $wgRestrictionTypes as $type ) |
— | — | @@ -409,7 +412,8 @@ |
410 | 413 | $vars['wgAjaxWatch'] = $msgs; |
411 | 414 | } |
412 | 415 | |
413 | | - wfRunHooks('MakeGlobalVariablesScript', array(&$vars)); |
| 416 | + // Allow extensions to add their custom variables to the global JS variables |
| 417 | + wfRunHooks( 'MakeGlobalVariablesScript', array( &$vars ) ); |
414 | 418 | |
415 | 419 | return self::makeVariablesScript( $vars ); |
416 | 420 | } |
— | — | @@ -421,10 +425,10 @@ |
422 | 426 | |
423 | 427 | $r = array( "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/wikibits.js?$wgStyleVersion\"></script>" ); |
424 | 428 | global $wgUseSiteJs; |
425 | | - if ($wgUseSiteJs) { |
| 429 | + if( $wgUseSiteJs ) { |
426 | 430 | $jsCache = $wgUser->isLoggedIn() ? '&smaxage=0' : ''; |
427 | 431 | $r[] = "<script type=\"$wgJsMimeType\" src=\"". |
428 | | - htmlspecialchars(self::makeUrl('-', |
| 432 | + htmlspecialchars( self::makeUrl( '-', |
429 | 433 | "action=raw$jsCache&gen=js&useskin=" . |
430 | 434 | urlencode( $this->getSkinName() ) ) ) . |
431 | 435 | "\"><!-- site js --></script>"; |
— | — | @@ -433,7 +437,7 @@ |
434 | 438 | $userpage = $wgUser->getUserPage(); |
435 | 439 | $userjs = htmlspecialchars( self::makeUrl( |
436 | 440 | $userpage->getPrefixedText().'/'.$this->getSkinName().'.js', |
437 | | - 'action=raw&ctype='.$wgJsMimeType)); |
| 441 | + 'action=raw&ctype='.$wgJsMimeType ) ); |
438 | 442 | $r[] = '<script type="'.$wgJsMimeType.'" src="'.$userjs."\"></script>"; |
439 | 443 | } |
440 | 444 | return $vars . "\t\t" . implode ( "\n\t\t", $r ); |
— | — | @@ -485,8 +489,8 @@ |
486 | 490 | $s .= "var skin = '" . Xml::escapeJsString( $this->getSkinName() ) . "';\n"; |
487 | 491 | $s .= "var stylepath = '" . Xml::escapeJsString( $wgStylePath ) . "';"; |
488 | 492 | $s .= "\n\n/* MediaWiki:Common.js */\n"; |
489 | | - $commonJs = wfMsgForContent('common.js'); |
490 | | - if ( !wfEmptyMsg ( 'common.js', $commonJs ) ) { |
| 493 | + $commonJs = wfMsgForContent( 'common.js' ); |
| 494 | + if ( !wfEmptyMsg( 'common.js', $commonJs ) ) { |
491 | 495 | $s .= $commonJs; |
492 | 496 | } |
493 | 497 | |
— | — | @@ -494,7 +498,7 @@ |
495 | 499 | // avoid inclusion of non defined user JavaScript (with custom skins only) |
496 | 500 | // by checking for default message content |
497 | 501 | $msgKey = ucfirst( $this->getSkinName() ).'.js'; |
498 | | - $userJS = wfMsgForContent($msgKey); |
| 502 | + $userJS = wfMsgForContent( $msgKey ); |
499 | 503 | if ( !wfEmptyMsg( $msgKey, $userJS ) ) { |
500 | 504 | $s .= $userJS; |
501 | 505 | } |
— | — | @@ -504,7 +508,7 @@ |
505 | 509 | } |
506 | 510 | |
507 | 511 | /** |
508 | | - * generate user stylesheet for action=raw&gen=css |
| 512 | + * Generate user stylesheet for action=raw&gen=css |
509 | 513 | */ |
510 | 514 | public function generateUserStylesheet() { |
511 | 515 | wfProfileIn( __METHOD__ ); |
— | — | @@ -520,7 +524,7 @@ |
521 | 525 | protected function reallyGenerateUserStylesheet(){ |
522 | 526 | global $wgUser; |
523 | 527 | $s = ''; |
524 | | - if (($undopt = $wgUser->getOption("underline")) < 2) { |
| 528 | + if( ( $undopt = $wgUser->getOption( 'underline' ) ) < 2 ) { |
525 | 529 | $underline = $undopt ? 'underline' : 'none'; |
526 | 530 | $s .= "a { text-decoration: $underline; }\n"; |
527 | 531 | } |
— | — | @@ -608,14 +612,14 @@ |
609 | 613 | |
610 | 614 | // Per-user custom style pages |
611 | 615 | if( $wgAllowUserCss && $wgUser->isLoggedIn() ) { |
612 | | - $action = $wgRequest->getVal('action'); |
| 616 | + $action = $wgRequest->getVal( 'action' ); |
613 | 617 | # If we're previewing the CSS page, use it |
614 | 618 | if( $this->mTitle->isCssSubpage() && $this->userCanPreview( $action ) ) { |
615 | | - $previewCss = $wgRequest->getText('wpTextbox1'); |
| 619 | + $previewCss = $wgRequest->getText( 'wpTextbox1' ); |
616 | 620 | // @FIXME: properly escape the cdata! |
617 | 621 | $this->usercss = "/*<![CDATA[*/\n" . $previewCss . "/*]]>*/"; |
618 | 622 | } else { |
619 | | - $out->addStyle( self::makeUrl($this->userpage . '/' . $this->getSkinName() .'.css', |
| 623 | + $out->addStyle( self::makeUrl( $this->userpage . '/' . $this->getSkinName() .'.css', |
620 | 624 | 'action=raw&ctype=text/css' ) ); |
621 | 625 | } |
622 | 626 | } |
— | — | @@ -643,30 +647,29 @@ |
644 | 648 | $a = array( 'bgcolor' => '#ffffec' ); |
645 | 649 | } |
646 | 650 | else $a = array( 'bgcolor' => '#FFFFFF' ); |
647 | | - if($wgOut->isArticle() && $wgUser->getOption('editondblclick') && |
| 651 | + if( $wgOut->isArticle() && $wgUser->getOption( 'editondblclick' ) && |
648 | 652 | $wgTitle->quickUserCan( 'edit' ) ) { |
649 | 653 | $s = $wgTitle->getFullURL( $this->editUrlOptions() ); |
650 | 654 | $s = 'document.location = "' .Xml::escapeJsString( $s ) .'";'; |
651 | | - $a += array ('ondblclick' => $s); |
652 | | - |
| 655 | + $a += array( 'ondblclick' => $s ); |
653 | 656 | } |
654 | 657 | $a['onload'] = $wgOut->getOnloadHandler(); |
655 | 658 | $a['class'] = |
656 | 659 | 'mediawiki' . |
657 | | - ' '.( $wgContLang->isRTL() ? "rtl" : "ltr" ). |
| 660 | + ' '.( $wgContLang->isRTL() ? 'rtl' : 'ltr' ). |
658 | 661 | ' '.$this->getPageClasses( $wgTitle ) . |
659 | | - ' skin-'. Sanitizer::escapeClass( $this->getSkinName( ) ); |
| 662 | + ' skin-'. Sanitizer::escapeClass( $this->getSkinName() ); |
660 | 663 | return $a; |
661 | 664 | } |
662 | 665 | |
663 | 666 | function getPageClasses( $title ) { |
664 | 667 | $numeric = 'ns-'.$title->getNamespace(); |
665 | 668 | if( $title->getNamespace() == NS_SPECIAL ) { |
666 | | - $type = "ns-special"; |
| 669 | + $type = 'ns-special'; |
667 | 670 | } elseif( $title->isTalkPage() ) { |
668 | | - $type = "ns-talk"; |
| 671 | + $type = 'ns-talk'; |
669 | 672 | } else { |
670 | | - $type = "ns-subject"; |
| 673 | + $type = 'ns-subject'; |
671 | 674 | } |
672 | 675 | $name = Sanitizer::escapeClass( 'page-'.$title->getPrefixedText() ); |
673 | 676 | return "$numeric $type $name"; |
— | — | @@ -690,8 +693,7 @@ |
691 | 694 | |
692 | 695 | function doBeforeContent() { |
693 | 696 | global $wgContLang; |
694 | | - $fname = 'Skin::doBeforeContent'; |
695 | | - wfProfileIn( $fname ); |
| 697 | + wfProfileIn( __METHOD__ ); |
696 | 698 | |
697 | 699 | $s = ''; |
698 | 700 | $qb = $this->qbSetting(); |
— | — | @@ -721,10 +723,10 @@ |
722 | 724 | $l = $wgContLang->isRTL() ? 'right' : 'left'; |
723 | 725 | $s .= "<td {$borderhack} align='$l' valign='top'>\n"; |
724 | 726 | |
725 | | - $s .= $this->topLinks() ; |
| 727 | + $s .= $this->topLinks(); |
726 | 728 | $s .= "<p class='subtitle'>" . $this->pageTitleLinks() . "</p>\n"; |
727 | 729 | |
728 | | - $r = $wgContLang->isRTL() ? "left" : "right"; |
| 730 | + $r = $wgContLang->isRTL() ? 'left' : 'right'; |
729 | 731 | $s .= "</td>\n<td {$borderhack} valign='top' align='$r' nowrap='nowrap'>"; |
730 | 732 | $s .= $this->nameAndLogin(); |
731 | 733 | $s .= "\n<br />" . $this->searchForm() . "</td>"; |
— | — | @@ -744,9 +746,9 @@ |
745 | 747 | $s .= "\n<div id='siteNotice'>$notice</div>\n"; |
746 | 748 | } |
747 | 749 | $s .= $this->pageTitle(); |
748 | | - $s .= $this->pageSubtitle() ; |
| 750 | + $s .= $this->pageSubtitle(); |
749 | 751 | $s .= $this->getCategories(); |
750 | | - wfProfileOut( $fname ); |
| 752 | + wfProfileOut( __METHOD__ ); |
751 | 753 | return $s; |
752 | 754 | } |
753 | 755 | |
— | — | @@ -770,11 +772,11 @@ |
771 | 773 | $s = ''; |
772 | 774 | $colon = wfMsgExt( 'colon-separator', 'escapenoentities' ); |
773 | 775 | if ( !empty( $allCats['normal'] ) ) { |
774 | | - $t = $embed . implode ( "{$pop} {$sep} {$embed}" , $allCats['normal'] ) . $pop; |
| 776 | + $t = $embed . implode( "{$pop} {$sep} {$embed}" , $allCats['normal'] ) . $pop; |
775 | 777 | |
776 | 778 | $msg = wfMsgExt( 'pagecategories', array( 'parsemag', 'escapenoentities' ), count( $allCats['normal'] ) ); |
777 | 779 | $s .= '<div id="mw-normal-catlinks">' . |
778 | | - $this->link( Title::newFromText( wfMsgForContent('pagecategorieslink') ), $msg ) |
| 780 | + $this->link( Title::newFromText( wfMsgForContent( 'pagecategorieslink' ) ), $msg ) |
779 | 781 | . $colon . $t . '</div>'; |
780 | 782 | } |
781 | 783 | |
— | — | @@ -802,35 +804,36 @@ |
803 | 805 | $parenttree = $wgTitle->getParentCategoryTree(); |
804 | 806 | # Skin object passed by reference cause it can not be |
805 | 807 | # accessed under the method subfunction drawCategoryBrowser |
806 | | - $tempout = explode("\n", Skin::drawCategoryBrowser($parenttree, $this) ); |
| 808 | + $tempout = explode( "\n", Skin::drawCategoryBrowser( $parenttree, $this ) ); |
807 | 809 | # Clean out bogus first entry and sort them |
808 | | - unset($tempout[0]); |
809 | | - asort($tempout); |
| 810 | + unset( $tempout[0] ); |
| 811 | + asort( $tempout ); |
810 | 812 | # Output one per line |
811 | | - $s .= implode("<br />\n", $tempout); |
| 813 | + $s .= implode( "<br />\n", $tempout ); |
812 | 814 | } |
813 | 815 | |
814 | 816 | return $s; |
815 | 817 | } |
816 | 818 | |
817 | | - /** Render the array as a serie of links. |
| 819 | + /** |
| 820 | + * Render the array as a serie of links. |
818 | 821 | * @param $tree Array: categories tree returned by Title::getParentCategoryTree |
819 | 822 | * @param &skin Object: skin passed by reference |
820 | 823 | * @return String separated by >, terminate with "\n" |
821 | 824 | */ |
822 | 825 | function drawCategoryBrowser( $tree, &$skin ){ |
823 | 826 | $return = ''; |
824 | | - foreach ($tree as $element => $parent) { |
825 | | - if (empty($parent)) { |
| 827 | + foreach( $tree as $element => $parent ) { |
| 828 | + if( empty( $parent ) ) { |
826 | 829 | # element start a new list |
827 | 830 | $return .= "\n"; |
828 | 831 | } else { |
829 | 832 | # grab the others elements |
830 | | - $return .= Skin::drawCategoryBrowser($parent, $skin) . ' > '; |
| 833 | + $return .= Skin::drawCategoryBrowser( $parent, $skin ) . ' > '; |
831 | 834 | } |
832 | 835 | # add our current element to the list |
833 | | - $eltitle = Title::newFromText($element); |
834 | | - $return .= $skin->link( $eltitle, $eltitle->getText() ) ; |
| 836 | + $eltitle = Title::newFromText( $element ); |
| 837 | + $return .= $skin->link( $eltitle, $eltitle->getText() ); |
835 | 838 | } |
836 | 839 | return $return; |
837 | 840 | } |
— | — | @@ -869,7 +872,7 @@ |
870 | 873 | * Returns an empty string by default, if not changed by any hook function. |
871 | 874 | */ |
872 | 875 | protected function afterContentHook() { |
873 | | - $data = ""; |
| 876 | + $data = ''; |
874 | 877 | |
875 | 878 | if( wfRunHooks( 'SkinAfterContent', array( &$data ) ) ){ |
876 | 879 | // adding just some spaces shouldn't toggle the output |
— | — | @@ -937,7 +940,7 @@ |
938 | 941 | } |
939 | 942 | |
940 | 943 | /** overloaded by derived classes */ |
941 | | - function doAfterContent() { return "</div></div>"; } |
| 944 | + function doAfterContent() { return '</div></div>'; } |
942 | 945 | |
943 | 946 | function pageTitleLinks() { |
944 | 947 | global $wgOut, $wgTitle, $wgUser, $wgRequest, $wgLang; |
— | — | @@ -980,8 +983,8 @@ |
981 | 984 | $dl = $this->makeKnownLinkObj( $wgUser->getTalkPage(), wfMsgHtml( 'newmessagesdifflink' ), 'diff=cur' ); |
982 | 985 | $s[] = '<strong>'. wfMsg( 'youhavenewmessages', $tl, $dl ) . '</strong>'; |
983 | 986 | # disable caching |
984 | | - $wgOut->setSquidMaxage(0); |
985 | | - $wgOut->enableClientCache(false); |
| 987 | + $wgOut->setSquidMaxage( 0 ); |
| 988 | + $wgOut->enableClientCache( false ); |
986 | 989 | } |
987 | 990 | } |
988 | 991 | |
— | — | @@ -995,9 +998,8 @@ |
996 | 999 | function getUndeleteLink() { |
997 | 1000 | global $wgUser, $wgTitle, $wgContLang, $wgLang, $action; |
998 | 1001 | if( $wgUser->isAllowed( 'deletedhistory' ) && |
999 | | - (($wgTitle->getArticleId() == 0) || ($action == "history")) && |
1000 | | - ($n = $wgTitle->isDeleted() ) ) |
1001 | | - { |
| 1002 | + ( ( $wgTitle->getArticleId() == 0 ) || ( $action == 'history' ) ) && |
| 1003 | + ( $n = $wgTitle->isDeleted() ) ){ |
1002 | 1004 | if ( $wgUser->isAllowed( 'undelete' ) ) { |
1003 | 1005 | $msg = 'thisisdeleted'; |
1004 | 1006 | } else { |
— | — | @@ -1042,34 +1044,34 @@ |
1043 | 1045 | $sub = wfMsgExt( 'tagline', 'parsemag' ) . $wgExtraSubtitle; |
1044 | 1046 | } |
1045 | 1047 | $subpages = $this->subPageSubtitle(); |
1046 | | - $sub .= !empty($subpages)?"</p><p class='subpages'>$subpages":''; |
| 1048 | + $sub .= !empty( $subpages ) ? "</p><p class='subpages'>$subpages" : ''; |
1047 | 1049 | $s = "<p class='subtitle'>{$sub}</p>\n"; |
1048 | 1050 | return $s; |
1049 | 1051 | } |
1050 | 1052 | |
1051 | 1053 | function subPageSubtitle() { |
1052 | 1054 | $subpages = ''; |
1053 | | - if(!wfRunHooks('SkinSubPageSubtitle', array(&$subpages))) |
| 1055 | + if( !wfRunHooks( 'SkinSubPageSubtitle', array( &$subpages ) ) ) |
1054 | 1056 | return $subpages; |
1055 | 1057 | |
1056 | 1058 | global $wgOut, $wgTitle; |
1057 | | - if($wgOut->isArticle() && MWNamespace::hasSubpages( $wgTitle->getNamespace() )) { |
1058 | | - $ptext=$wgTitle->getPrefixedText(); |
1059 | | - if(preg_match('/\//',$ptext)) { |
1060 | | - $links = explode('/',$ptext); |
| 1059 | + if( $wgOut->isArticle() && MWNamespace::hasSubpages( $wgTitle->getNamespace() ) ) { |
| 1060 | + $ptext = $wgTitle->getPrefixedText(); |
| 1061 | + if( preg_match( '/\//', $ptext ) ) { |
| 1062 | + $links = explode( '/', $ptext ); |
1061 | 1063 | array_pop( $links ); |
1062 | 1064 | $c = 0; |
1063 | 1065 | $growinglink = ''; |
1064 | 1066 | $display = ''; |
1065 | | - foreach($links as $link) { |
| 1067 | + foreach( $links as $link ) { |
1066 | 1068 | $growinglink .= $link; |
1067 | 1069 | $display .= $link; |
1068 | 1070 | $linkObj = Title::newFromText( $growinglink ); |
1069 | 1071 | if( is_object( $linkObj ) && $linkObj->exists() ){ |
1070 | 1072 | $getlink = $this->makeKnownLinkObj( $linkObj, htmlspecialchars( $display ) ); |
1071 | 1073 | $c++; |
1072 | | - if ($c>1) { |
1073 | | - $subpages .= wfMsgExt( 'pipe-separator' , 'escapenoentities' ); |
| 1074 | + if( $c > 1 ) { |
| 1075 | + $subpages .= wfMsgExt( 'pipe-separator', 'escapenoentities' ); |
1074 | 1076 | } else { |
1075 | 1077 | $subpages .= '< '; |
1076 | 1078 | } |
— | — | @@ -1167,19 +1169,19 @@ |
1168 | 1170 | $s = '<form id="searchform'.$this->searchboxes.'" name="search" class="inline" method="post" action="' |
1169 | 1171 | . $this->escapeSearchLink() . "\">\n" |
1170 | 1172 | . '<input type="text" id="searchInput'.$this->searchboxes.'" name="search" size="19" value="' |
1171 | | - . htmlspecialchars(substr($search,0,256)) . "\" />\n" |
1172 | | - . '<input type="submit" name="go" value="' . wfMsg ('searcharticle') . '" />'; |
1173 | | - |
1174 | | - if ($wgUseTwoButtonsSearchForm) |
1175 | | - $s .= ' <input type="submit" name="fulltext" value="' . wfMsg ('searchbutton') . "\" />\n"; |
| 1173 | + . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" />\n" |
| 1174 | + . '<input type="submit" name="go" value="' . wfMsg( 'searcharticle' ) . '" />'; |
| 1175 | + |
| 1176 | + if( $wgUseTwoButtonsSearchForm ) |
| 1177 | + $s .= ' <input type="submit" name="fulltext" value="' . wfMsg( 'searchbutton' ) . "\" />\n"; |
1176 | 1178 | else |
1177 | | - $s .= ' <a href="' . $this->escapeSearchLink() . '" rel="search">' . wfMsg ('powersearch-legend') . "</a>\n"; |
1178 | | - |
| 1179 | + $s .= ' <a href="' . $this->escapeSearchLink() . '" rel="search">' . wfMsg( 'powersearch-legend' ) . "</a>\n"; |
| 1180 | + |
1179 | 1181 | $s .= '</form>'; |
1180 | | - |
| 1182 | + |
1181 | 1183 | // Ensure unique id's for search boxes made after the first |
1182 | 1184 | $this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1; |
1183 | | - |
| 1185 | + |
1184 | 1186 | return $s; |
1185 | 1187 | } |
1186 | 1188 | |
— | — | @@ -1207,7 +1209,7 @@ |
1208 | 1210 | } |
1209 | 1211 | |
1210 | 1212 | // FIXME: Is using Language::pipeList impossible here? Do not quite understand the use of the newline |
1211 | | - return implode( $s, wfMsgExt( 'pipe-separator' , 'escapenoentities' ) . "\n" ); |
| 1213 | + return implode( $s, wfMsgExt( 'pipe-separator', 'escapenoentities' ) . "\n" ); |
1212 | 1214 | } |
1213 | 1215 | |
1214 | 1216 | /** |
— | — | @@ -1251,7 +1253,10 @@ |
1252 | 1254 | $varname = $wgContLang->getVariantname( $code ); |
1253 | 1255 | if( $varname == 'disable' ) |
1254 | 1256 | continue; |
1255 | | - $s = $wgLang->pipeList( array( $s, '<a href="' . $wgTitle->escapeLocalUrl( 'variant=' . $code ) . '">' . htmlspecialchars( $varname ) . '</a>' ) ); |
| 1257 | + $s = $wgLang->pipeList( array( |
| 1258 | + $s, |
| 1259 | + '<a href="' . $wgTitle->escapeLocalUrl( 'variant=' . $code ) . '">' . htmlspecialchars( $varname ) . '</a>' |
| 1260 | + ) ); |
1256 | 1261 | } |
1257 | 1262 | } |
1258 | 1263 | return $s; |
— | — | @@ -1259,7 +1264,7 @@ |
1260 | 1265 | |
1261 | 1266 | function bottomLinks() { |
1262 | 1267 | global $wgOut, $wgUser, $wgTitle, $wgUseTrackbacks; |
1263 | | - $sep = wfMsgExt( 'pipe-separator' , 'escapenoentities' ) . "\n"; |
| 1268 | + $sep = wfMsgExt( 'pipe-separator', 'escapenoentities' ) . "\n"; |
1264 | 1269 | |
1265 | 1270 | $s = ''; |
1266 | 1271 | if ( $wgOut->isArticleRelated() ) { |
— | — | @@ -1272,17 +1277,15 @@ |
1273 | 1278 | $element[] = $this->whatLinksHere(); |
1274 | 1279 | $element[] = $this->watchPageLinksLink(); |
1275 | 1280 | |
1276 | | - if ($wgUseTrackbacks) |
| 1281 | + if( $wgUseTrackbacks ) |
1277 | 1282 | $element[] = $this->trackbackLink(); |
1278 | 1283 | |
1279 | 1284 | if ( $wgTitle->getNamespace() == NS_USER |
1280 | | - || $wgTitle->getNamespace() == NS_USER_TALK ) |
| 1285 | + || $wgTitle->getNamespace() == NS_USER_TALK ){ |
| 1286 | + $id = User::idFromName( $wgTitle->getText() ); |
| 1287 | + $ip = User::isIP( $wgTitle->getText() ); |
1281 | 1288 | |
1282 | | - { |
1283 | | - $id=User::idFromName($wgTitle->getText()); |
1284 | | - $ip=User::isIP($wgTitle->getText()); |
1285 | | - |
1286 | | - if($id || $ip) { # both anons and non-anons have contri list |
| 1289 | + if( $id || $ip ) { # both anons and non-anons have contri list |
1287 | 1290 | $element[] = $this->userContribsLink(); |
1288 | 1291 | } |
1289 | 1292 | if( $this->showEmailUser( $id ) ) { |
— | — | @@ -1294,9 +1297,9 @@ |
1295 | 1298 | |
1296 | 1299 | if ( $wgTitle->getArticleId() ) { |
1297 | 1300 | $s .= "\n<br />"; |
1298 | | - if($wgUser->isAllowed('delete')) { $s .= $this->deleteThisPage(); } |
1299 | | - if($wgUser->isAllowed('protect')) { $s .= $sep . $this->protectThisPage(); } |
1300 | | - if($wgUser->isAllowed('move')) { $s .= $sep . $this->moveThisPage(); } |
| 1301 | + if( $wgUser->isAllowed( 'delete' ) ) { $s .= $this->deleteThisPage(); } |
| 1302 | + if( $wgUser->isAllowed( 'protect' ) ) { $s .= $sep . $this->protectThisPage(); } |
| 1303 | + if( $wgUser->isAllowed( 'move' ) ) { $s .= $sep . $this->moveThisPage(); } |
1301 | 1304 | } |
1302 | 1305 | $s .= "<br />\n" . $this->otherLanguages(); |
1303 | 1306 | } |
— | — | @@ -1331,15 +1334,15 @@ |
1332 | 1335 | |
1333 | 1336 | if( $wgPageShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' ) ) { |
1334 | 1337 | $dbr = wfGetDB( DB_SLAVE ); |
1335 | | - $watchlist = $dbr->tableName( 'watchlist' ); |
1336 | | - $sql = "SELECT COUNT(*) AS n FROM $watchlist |
1337 | | - WHERE wl_title='" . $dbr->strencode($wgTitle->getDBkey()) . |
1338 | | - "' AND wl_namespace=" . $wgTitle->getNamespace() ; |
1339 | | - $res = $dbr->query( $sql, 'Skin::pageStats'); |
| 1338 | + $res = $dbr->select( 'watchlist', |
| 1339 | + array( 'COUNT(*) AS n' ), |
| 1340 | + array( 'wl_title' => $dbr->strencode( $wgTitle->getDBkey() ), 'wl_namespace' => $wgTitle->getNamespace() ), |
| 1341 | + __METHOD__ |
| 1342 | + ); |
1340 | 1343 | $x = $dbr->fetchObject( $res ); |
1341 | 1344 | |
1342 | 1345 | $s .= ' ' . wfMsgExt( 'number_of_watching_users_pageview', |
1343 | | - array( 'parseinline' ), $wgLang->formatNum($x->n) |
| 1346 | + array( 'parseinline' ), $wgLang->formatNum( $x->n ) |
1344 | 1347 | ); |
1345 | 1348 | } |
1346 | 1349 | |
— | — | @@ -1428,12 +1431,15 @@ |
1429 | 1432 | } |
1430 | 1433 | |
1431 | 1434 | function logoText( $align = '' ) { |
1432 | | - if ( '' != $align ) { $a = " align='{$align}'"; } |
1433 | | - else { $a = ''; } |
| 1435 | + if ( '' != $align ) { |
| 1436 | + $a = " align='{$align}'"; |
| 1437 | + } else { |
| 1438 | + $a = ''; |
| 1439 | + } |
1434 | 1440 | |
1435 | 1441 | $mp = wfMsg( 'mainpage' ); |
1436 | 1442 | $mptitle = Title::newMainPage(); |
1437 | | - $url = ( is_object($mptitle) ? $mptitle->escapeLocalURL() : '' ); |
| 1443 | + $url = ( is_object( $mptitle ) ? $mptitle->escapeLocalURL() : '' ); |
1438 | 1444 | |
1439 | 1445 | $logourl = $this->getLogo(); |
1440 | 1446 | $s = "<a href='{$url}'><img{$a} src='{$logourl}' alt='[{$mp}]' /></a>"; |
— | — | @@ -1537,9 +1543,9 @@ |
1538 | 1544 | global $wgArticle; |
1539 | 1545 | |
1540 | 1546 | if( $this->mRevisionId && ! $wgArticle->isCurrent() ) { |
1541 | | - return "action=edit&oldid=" . intval( $this->mRevisionId ); |
| 1547 | + return 'action=edit&oldid=' . intval( $this->mRevisionId ); |
1542 | 1548 | } else { |
1543 | | - return "action=edit"; |
| 1549 | + return 'action=edit'; |
1544 | 1550 | } |
1545 | 1551 | } |
1546 | 1552 | |
— | — | @@ -1547,7 +1553,7 @@ |
1548 | 1554 | global $wgUser, $wgTitle, $wgRequest; |
1549 | 1555 | |
1550 | 1556 | $diff = $wgRequest->getVal( 'diff' ); |
1551 | | - if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isAllowed('delete') ) { |
| 1557 | + if ( $wgTitle->getArticleId() && ( !$diff ) && $wgUser->isAllowed( 'delete' ) ) { |
1552 | 1558 | $t = wfMsg( 'deletethispage' ); |
1553 | 1559 | |
1554 | 1560 | $s = $this->makeKnownLinkObj( $wgTitle, $t, 'action=delete' ); |
— | — | @@ -1584,11 +1590,11 @@ |
1585 | 1591 | if ( $wgTitle->userIsWatching() ) { |
1586 | 1592 | $t = wfMsg( 'unwatchthispage' ); |
1587 | 1593 | $q = 'action=unwatch'; |
1588 | | - $id = "mw-unwatch-link".$this->mWatchLinkNum; |
| 1594 | + $id = 'mw-unwatch-link' . $this->mWatchLinkNum; |
1589 | 1595 | } else { |
1590 | 1596 | $t = wfMsg( 'watchthispage' ); |
1591 | 1597 | $q = 'action=watch'; |
1592 | | - $id = 'mw-watch-link'.$this->mWatchLinkNum; |
| 1598 | + $id = 'mw-watch-link' . $this->mWatchLinkNum; |
1593 | 1599 | } |
1594 | 1600 | $s = $this->makeKnownLinkObj( $wgTitle, $t, $q, '', '', " id=\"$id\"" ); |
1595 | 1601 | } else { |
— | — | @@ -1662,8 +1668,8 @@ |
1663 | 1669 | function trackbackLink() { |
1664 | 1670 | global $wgTitle; |
1665 | 1671 | |
1666 | | - return "<a href=\"" . $wgTitle->trackbackURL() . "\">" |
1667 | | - . wfMsg('trackbacklink') . "</a>"; |
| 1672 | + return '<a href="' . $wgTitle->trackbackURL() . '">' |
| 1673 | + . wfMsg( 'trackbacklink' ) . '</a>'; |
1668 | 1674 | } |
1669 | 1675 | |
1670 | 1676 | function otherLanguages() { |
— | — | @@ -1680,9 +1686,11 @@ |
1681 | 1687 | |
1682 | 1688 | $s = wfMsg( 'otherlanguages' ) . wfMsg( 'colon-separator' ); |
1683 | 1689 | $first = true; |
1684 | | - if($wgContLang->isRTL()) $s .= '<span dir="LTR">'; |
| 1690 | + if( $wgContLang->isRTL() ) $s .= '<span dir="LTR">'; |
1685 | 1691 | foreach( $a as $l ) { |
1686 | | - if ( ! $first ) { $s .= wfMsgExt( 'pipe-separator' , 'escapenoentities' ); } |
| 1692 | + if ( !$first ) { |
| 1693 | + $s .= wfMsgExt( 'pipe-separator', 'escapenoentities' ); |
| 1694 | + } |
1687 | 1695 | $first = false; |
1688 | 1696 | |
1689 | 1697 | $nt = Title::newFromText( $l ); |
— | — | @@ -1693,7 +1701,7 @@ |
1694 | 1702 | $style = $this->getExternalLinkAttributes( $l, $text ); |
1695 | 1703 | $s .= "<a href=\"{$url}\"{$style}>{$text}</a>"; |
1696 | 1704 | } |
1697 | | - if($wgContLang->isRTL()) $s .= '</span>'; |
| 1705 | + if( $wgContLang->isRTL() ) $s .= '</span>'; |
1698 | 1706 | return $s; |
1699 | 1707 | } |
1700 | 1708 | |
— | — | @@ -1872,24 +1880,24 @@ |
1873 | 1881 | $bar = array(); |
1874 | 1882 | $lines = explode( "\n", wfMsgForContent( 'sidebar' ) ); |
1875 | 1883 | $heading = ''; |
1876 | | - foreach ($lines as $line) { |
1877 | | - if (strpos($line, '*') !== 0) |
| 1884 | + foreach( $lines as $line ) { |
| 1885 | + if( strpos( $line, '*' ) !== 0 ) |
1878 | 1886 | continue; |
1879 | | - if (strpos($line, '**') !== 0) { |
1880 | | - $line = trim($line, '* '); |
| 1887 | + if( strpos( $line, '**') !== 0 ) { |
| 1888 | + $line = trim( $line, '* ' ); |
1881 | 1889 | $heading = $line; |
1882 | | - if( !array_key_exists($heading, $bar) ) $bar[$heading] = array(); |
| 1890 | + if( !array_key_exists( $heading, $bar ) ) $bar[$heading] = array(); |
1883 | 1891 | } else { |
1884 | | - if (strpos($line, '|') !== false) { // sanity check |
1885 | | - $line = array_map('trim', explode( '|' , trim($line, '* '), 2 ) ); |
| 1892 | + if( strpos( $line, '|' ) !== false ) { // sanity check |
| 1893 | + $line = array_map( 'trim', explode( '|', trim( $line, '* ' ), 2 ) ); |
1886 | 1894 | $link = wfMsgForContent( $line[0] ); |
1887 | | - if ($link == '-') |
| 1895 | + if( $link == '-' ) |
1888 | 1896 | continue; |
1889 | 1897 | |
1890 | | - $text = wfMsgExt($line[1], 'parsemag'); |
1891 | | - if (wfEmptyMsg($line[1], $text)) |
| 1898 | + $text = wfMsgExt( $line[1], 'parsemag' ); |
| 1899 | + if( wfEmptyMsg( $line[1], $text ) ) |
1892 | 1900 | $text = $line[1]; |
1893 | | - if (wfEmptyMsg($line[0], $link)) |
| 1901 | + if( wfEmptyMsg( $line[0], $link ) ) |
1894 | 1902 | $link = $line[0]; |
1895 | 1903 | |
1896 | 1904 | if ( preg_match( '/^(?:' . wfUrlProtocols() . ')/', $link ) ) { |
— | — | @@ -1907,15 +1915,15 @@ |
1908 | 1916 | $bar[$heading][] = array( |
1909 | 1917 | 'text' => $text, |
1910 | 1918 | 'href' => $href, |
1911 | | - 'id' => 'n-' . strtr($line[1], ' ', '-'), |
| 1919 | + 'id' => 'n-' . strtr( $line[1], ' ', '-' ), |
1912 | 1920 | 'active' => false |
1913 | 1921 | ); |
1914 | 1922 | } else { continue; } |
1915 | 1923 | } |
1916 | 1924 | } |
1917 | | - wfRunHooks('SkinBuildSidebar', array($this, &$bar)); |
| 1925 | + wfRunHooks( 'SkinBuildSidebar', array( $this, &$bar ) ); |
1918 | 1926 | if ( $wgEnableSidebarCache ) $parserMemc->set( $key, $bar, $wgSidebarCacheExpiry ); |
1919 | 1927 | wfProfileOut( __METHOD__ ); |
1920 | 1928 | return $bar; |
1921 | 1929 | } |
1922 | | -} |
| 1930 | +} |
\ No newline at end of file |