r51568 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51567‎ | r51568 | r51569 >
Date:15:02, 7 June 2009
Author:siebrand
Status:ok
Tags:
Comment:
* replace some use of deprecated makeKnownLinkObj() by link() in core
* use array type parameter instead of string to escapeLocalUrl(), getFullURL() and getFullUrl() for readability
* add FIXME in Parser.php and LogEventsList.php where I didn't know how to replace makeKnownLinkObj by link()
* return type for private method Skin::editUrlOptions() changed from string to array
* some code readability improvements

Linking this to r51559 for CodeReview as there is some discussion there, and these changes are very similar.

Todo: core special pages
Modified paths:
  • /trunk/phase3/includes/LogEventsList.php (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/PageHistory.php (modified) (history)
  • /trunk/phase3/includes/PatrolLog.php (modified) (history)
  • /trunk/phase3/includes/Preferences.php (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)
  • /trunk/phase3/includes/WatchlistEditor.php (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/skins/CologneBlue.php (modified) (history)
  • /trunk/phase3/skins/Standard.php (modified) (history)
  • /trunk/phase3/skins/disabled/MonoBookCBT.php (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/CologneBlue.php
@@ -79,7 +79,13 @@
8080
8181 $s .= $this->bottomLinks();
8282 $s .= $wgLang->pipeList( array(
83 - "\n<br />" . $this->makeKnownLinkObj( Title::newMainPage() ),
 83+ "\n<br />" . $this->link(
 84+ Title::newMainPage(),
 85+ null,
 86+ array(),
 87+ array(),
 88+ array( 'known', 'noclasses' )
 89+ ),
8490 $this->aboutLink(),
8591 $this->searchForm( wfMsg( 'qbfind' ) )
8692 ) );
@@ -242,20 +248,35 @@
243249 $s .= $this->menuHead( 'qbmyoptions' );
244250 if ( $wgUser->isLoggedIn() ) {
245251 $name = $wgUser->getName();
246 - $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
247 - wfMsg( 'mytalk' ) );
 252+ $tl = $this->link(
 253+ $wgUser->getTalkPage(),
 254+ wfMsg( 'mytalk' ),
 255+ array(),
 256+ array(),
 257+ array( 'known', 'noclasses' )
 258+ );
248259 if ( $wgUser->getNewtalk() ) {
249260 $tl .= " *";
250261 }
251262
252 - $s .= $this->makeKnownLinkObj( $wgUser->getUserPage(),
253 - wfMsg( 'mypage' ) )
 263+ $s .= $this->link(
 264+ $wgUser->getUserPage(),
 265+ wfMsg( 'mypage' ),
 266+ array(),
 267+ array(),
 268+ array( 'known', 'noclasses' )
 269+ )
254270 . $sep . $tl
255271 . $sep . $this->specialLink( 'watchlist' )
256 - . $sep . $this->makeKnownLinkObj( SpecialPage::getSafeTitleFor( 'Contributions', $wgUser->getName() ),
257 - wfMsg( 'mycontris' ) )
258 - . $sep . $this->specialLink( 'preferences' )
259 - . $sep . $this->specialLink( 'userlogout' );
 272+ . $sep . $this->link(
 273+ SpecialPage::getSafeTitleFor( 'Contributions', $wgUser->getName() ),
 274+ wfMsg( 'mycontris' ),
 275+ array(),
 276+ array(),
 277+ array( 'known', 'noclasses' )
 278+ )
 279+ . $sep . $this->specialLink( 'preferences' )
 280+ . $sep . $this->specialLink( 'userlogout' );
260281 } else {
261282 $s .= $this->specialLink( 'userlogin' );
262283 }
@@ -267,15 +288,21 @@
268289 if ( $wgUser->isLoggedIn() && $wgEnableUploads ) {
269290 $s .= $sep . $this->specialLink( 'upload' );
270291 }
 292+
271293 global $wgSiteSupportPage;
 294+
272295 if( $wgSiteSupportPage ) {
273296 $s .= $sep . '<a href="' . htmlspecialchars( $wgSiteSupportPage ) . '" class="internal">'
274297 . wfMsg( 'sitesupport' ) . '</a>';
275298 }
276299
277 - $s .= $sep . $this->makeKnownLinkObj(
 300+ $s .= $sep . $this->link(
278301 SpecialPage::getTitleFor( 'Specialpages' ),
279 - wfMsg( 'moredotdotdot' ) );
 302+ wfMsg( 'moredotdotdot' ),
 303+ array(),
 304+ array(),
 305+ array( 'known', 'noclasses' )
 306+ );
280307
281308 $s .= $sep . "\n</div>\n";
282309 return $s;
Index: trunk/phase3/skins/Standard.php
@@ -221,13 +221,21 @@
222222 # and to avoid messing with the separator that is prepended to the next item
223223 $s .= '<strong>' . wfMsg( 'newpage' ) . '</strong>';
224224 }
225 -
226225 }
227226
228227 # "Post a comment" link
229228 if( ( $this->mTitle->isTalkPage() || $wgOut->showNewSectionLink() ) && $action != 'edit' && !$wpPreview )
230 - $s .= '<br />' . $this->makeKnownLinkObj( $this->mTitle, wfMsg( 'postcomment' ), 'action=edit&section=new' );
231 -
 229+ $s .= '<br />' . $this->link(
 230+ $this->mTitle,
 231+ wfMsg( 'postcomment' ),
 232+ array(),
 233+ array(
 234+ 'action' => 'edit',
 235+ 'section' => 'new'
 236+ ),
 237+ array( 'known', 'noclasses' )
 238+ );
 239+
232240 #if( $tns%2 && $action!='edit' && !$wpPreview) {
233241 #$s.= '<br />'.$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg('postcomment'),'action=edit&section=new');
234242 #}
Index: trunk/phase3/skins/disabled/MonoBookCBT.php
@@ -426,19 +426,30 @@
427427 if (count($newtalks) == 1 && $newtalks[0]["wiki"] === $wgDBname) {
428428 $usertitle = $this->getUserPageTitle();
429429 $usertalktitle = $usertitle->getTalkPage();
 430+
430431 if( !$usertalktitle->equals( $this->mTitle ) ) {
431 - $ntl = wfMsg( 'youhavenewmessages',
432 - $this->makeKnownLinkObj(
433 - $usertalktitle,
434 - wfMsgHtml( 'newmessageslink' ),
435 - 'redirect=no'
436 - ),
437 - $this->makeKnownLinkObj(
438 - $usertalktitle,
439 - wfMsgHtml( 'newmessagesdifflink' ),
440 - 'diff=cur'
441 - )
 432+ $newmessageslink = $this->link(
 433+ $usertalktitle,
 434+ wfMsgHtml( 'newmessageslink' ),
 435+ array(),
 436+ array( 'redirect' => 'no' ),
 437+ array( 'known', 'noclasses' )
442438 );
 439+
 440+ $newmessagesdifflink = $this->link(
 441+ $usertalktitle,
 442+ wfMsgHtml( 'newmessagesdifflink' ),
 443+ array(),
 444+ array( 'diff' => 'cur' ),
 445+ array( 'known', 'noclasses' )
 446+ );
 447+
 448+ $ntl = wfMsg(
 449+ 'youhavenewmessages',
 450+ $newmessageslink,
 451+ $newmessagesdifflink
 452+ );
 453+
443454 # Disable Cache
444455 $this->mOut->setSquidMaxage(0);
445456 }
Index: trunk/phase3/includes/parser/Parser.php
@@ -1793,6 +1793,7 @@
17941794 function makeKnownLinkHolder( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
17951795 list( $inside, $trail ) = Linker::splitTrail( $trail );
17961796 $sk = $this->mOptions->getSkin();
 1797+ // FIXME: use link() instead of deprecated makeKnownLinkObj()
17971798 $link = $sk->makeKnownLinkObj( $nt, $text, $query, $inside, $prefix );
17981799 return $this->armorLinks( $link ) . $trail;
17991800 }
Index: trunk/phase3/includes/PatrolLog.php
@@ -45,10 +45,18 @@
4646 $link = $skin->link( $title );
4747 if( $title->exists() ) {
4848 # Generate a diff link
49 - $bits[] = 'oldid=' . urlencode( $cur );
50 - $bits[] = 'diff=prev';
51 - $bits = implode( '&', $bits );
52 - $diff = $skin->makeKnownLinkObj( $title, htmlspecialchars( wfMsg( 'patrol-log-diff', $cur ) ), $bits );
 49+ $query = array(
 50+ 'oldid' => $cur,
 51+ 'diff' => 'prev'
 52+ );
 53+
 54+ $diff = $skin->link(
 55+ $title,
 56+ htmlspecialchars( wfMsg( 'patrol-log-diff', $cur ) ),
 57+ array(),
 58+ $query,
 59+ array( 'known', 'noclasses' )
 60+ );
5361 } else {
5462 # Don't bother with a diff link, it's useless
5563 $diff = htmlspecialchars( wfMsg( 'patrol-log-diff', $cur ) );
Index: trunk/phase3/includes/WatchlistEditor.php
@@ -340,7 +340,7 @@
341341 if( ( $count = $this->showItemCount( $output, $user ) ) > 0 ) {
342342 $self = SpecialPage::getTitleFor( 'Watchlist' );
343343 $form = Xml::openElement( 'form', array( 'method' => 'post',
344 - 'action' => $self->getLocalUrl( 'action=edit' ) ) );
 344+ 'action' => $self->getLocalUrl( array( 'action' => 'edit' ) ) ) );
345345 $form .= Xml::hidden( 'token', $wgUser->editToken( 'watchlistedit' ) );
346346 $form .= "<fieldset>\n<legend>" . wfMsgHtml( 'watchlistedit-normal-legend' ) . "</legend>";
347347 $form .= wfMsgExt( 'watchlistedit-normal-explain', 'parse' );
@@ -414,10 +414,22 @@
415415 $link = '<span class="watchlistredir">' . $link . '</span>';
416416 $tools[] = $skin->link( $title->getTalkPage(), wfMsgHtml( 'talkpagelinktext' ) );
417417 if( $title->exists() ) {
418 - $tools[] = $skin->makeKnownLinkObj( $title, wfMsgHtml( 'history_short' ), 'action=history' );
 418+ $tools[] = $skin->link(
 419+ $title,
 420+ wfMsgHtml( 'history_short' ),
 421+ array(),
 422+ array( 'action' => 'history' ),
 423+ array( 'known', 'noclasses' )
 424+ );
419425 }
420426 if( $title->getNamespace() == NS_USER && !$title->isSubpage() ) {
421 - $tools[] = $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Contributions', $title->getText() ), wfMsgHtml( 'contributions' ) );
 427+ $tools[] = $skin->link(
 428+ SpecialPage::getTitleFor( 'Contributions', $title->getText() ),
 429+ wfMsgHtml( 'contributions' ),
 430+ array(),
 431+ array(),
 432+ array( 'known', 'noclasses' )
 433+ );
422434 }
423435 return "<li>"
424436 . Xml::check( 'titles[]', false, array( 'value' => $title->getPrefixedText() ) )
@@ -435,7 +447,7 @@
436448 $this->showItemCount( $output, $user );
437449 $self = SpecialPage::getTitleFor( 'Watchlist' );
438450 $form = Xml::openElement( 'form', array( 'method' => 'post',
439 - 'action' => $self->getLocalUrl( 'action=raw' ) ) );
 451+ 'action' => $self->getLocalUrl( array( 'action' => 'raw' ) ) ) );
440452 $form .= Xml::hidden( 'token', $wgUser->editToken( 'watchlistedit' ) );
441453 $form .= '<fieldset><legend>' . wfMsgHtml( 'watchlistedit-raw-legend' ) . '</legend>';
442454 $form .= wfMsgExt( 'watchlistedit-raw-explain', 'parse' );
@@ -487,7 +499,14 @@
488500 $tools = array();
489501 $modes = array( 'view' => false, 'edit' => 'edit', 'raw' => 'raw' );
490502 foreach( $modes as $mode => $subpage ) {
491 - $tools[] = $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Watchlist', $subpage ), wfMsgHtml( "watchlisttools-{$mode}" ) );
 503+ // can use messages 'watchlisttools-view', 'watchlisttools-edit', 'watchlisttools-raw'
 504+ $tools[] = $skin->link(
 505+ SpecialPage::getTitleFor( 'Watchlist', $subpage ),
 506+ wfMsgHtml( "watchlisttools-{$mode}" ),
 507+ array(),
 508+ array(),
 509+ array( 'known', 'noclasses' )
 510+ );
492511 }
493512 return $wgLang->pipeList( $tools );
494513 }
Index: trunk/phase3/includes/OutputPage.php
@@ -1254,7 +1254,13 @@
12551255 $this->setArticleFlag( false );
12561256
12571257 $loginTitle = SpecialPage::getTitleFor( 'Userlogin' );
1258 - $loginLink = $skin->makeKnownLinkObj( $loginTitle, wfMsgHtml( 'loginreqlink' ), 'returnto=' . $this->getTitle()->getPrefixedUrl() );
 1258+ $loginLink = $skin->link(
 1259+ $loginTitle,
 1260+ wfMsgHtml( 'loginreqlink' ),
 1261+ array(),
 1262+ array( 'returnto' => $this->getTitle()->getPrefixedUrl() ),
 1263+ array( 'known', 'noclasses' )
 1264+ );
12591265 $this->addHTML( wfMsgWikiHtml( 'loginreqpagetext', $loginLink ) );
12601266 $this->addHTML( "\n<!--" . $this->getTitle()->getPrefixedUrl() . "-->" );
12611267
@@ -1336,7 +1342,18 @@
13371343 // Permissions error
13381344 if( $source ) {
13391345 $this->setPageTitle( wfMsg( 'viewsource' ) );
1340 - $this->setSubtitle( wfMsg( 'viewsourcefor', $skin->makeKnownLinkObj( $this->getTitle() ) ) );
 1346+ $this->setSubtitle(
 1347+ wfMsg(
 1348+ 'viewsourcefor',
 1349+ $skin->link(
 1350+ $this->getTitle(),
 1351+ null,
 1352+ array(),
 1353+ array(),
 1354+ array( 'known', 'noclasses' )
 1355+ )
 1356+ )
 1357+ );
13411358 } else {
13421359 $this->setPageTitle( wfMsg( 'badaccess' ) );
13431360 }
Index: trunk/phase3/includes/LogEventsList.php
@@ -109,6 +109,7 @@
110110 $hiddens = ''; // keep track for "go" button
111111 foreach( $filter as $type => $val ) {
112112 $hideVal = 1 - intval($val);
 113+ // FIXME: use link() here. Needs changes in getDefaultQuery()
113114 $link = $this->skin->makeKnownLinkObj( $wgTitle, $messages[$hideVal],
114115 wfArrayToCGI( array( "hide_{$type}_log" => $hideVal ), $this->getDefaultQuery() )
115116 );
@@ -242,33 +243,55 @@
243244 } else if( self::typeAction($row,'move','move','move') && !empty($paramArray[0]) ) {
244245 $destTitle = Title::newFromText( $paramArray[0] );
245246 if( $destTitle ) {
246 - $revert = '(' . $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Movepage' ),
 247+ $revert = '(' . $this->skin->link(
 248+ SpecialPage::getTitleFor( 'Movepage' ),
247249 $this->message['revertmove'],
248 - 'wpOldTitle=' . urlencode( $destTitle->getPrefixedDBkey() ) .
249 - '&wpNewTitle=' . urlencode( $title->getPrefixedDBkey() ) .
250 - '&wpReason=' . urlencode( wfMsgForContent( 'revertmove' ) ) .
251 - '&wpMovetalk=0' ) . ')';
 250+ array(),
 251+ array(
 252+ 'wpOldTitle' => $destTitle->getPrefixedDBkey(),
 253+ 'wpNewTitle' => $title->getPrefixedDBkey(),
 254+ 'wpReason' => wfMsgForContent( 'revertmove' ),
 255+ 'wpMovetalk' => 0
 256+ ),
 257+ array( 'known', 'noclasses' )
 258+ ) . ')';
252259 }
253260 // Show undelete link
254261 } else if( self::typeAction($row,array('delete','suppress'),'delete','deletedhistory') ) {
255 - if( !$wgUser->isAllowed( 'undelete' ) )
 262+ if( !$wgUser->isAllowed( 'undelete' ) ) {
256263 $viewdeleted = $this->message['undeleteviewlink'];
257 - else
 264+ } else {
258265 $viewdeleted = $this->message['undeletelink'];
259 - $revert = '(' . $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Undelete' ),
260 - $viewdeleted, 'target='. urlencode( $title->getPrefixedDBkey() ) ) . ')';
 266+ }
 267+
 268+ $revert = '(' . $this->skin->link(
 269+ SpecialPage::getTitleFor( 'Undelete' ),
 270+ $viewdeleted,
 271+ array(),
 272+ array( 'target' => $title->getPrefixedDBkey() ),
 273+ array( 'known', 'noclasses' )
 274+ ) . ')';
261275 // Show unblock/change block link
262276 } else if( self::typeAction($row,array('block','suppress'),array('block','reblock'),'block') ) {
263277 $revert = '(' .
264 - $this->skin->link( SpecialPage::getTitleFor( 'Ipblocklist' ),
 278+ $this->skin->link(
 279+ SpecialPage::getTitleFor( 'Ipblocklist' ),
265280 $this->message['unblocklink'],
266281 array(),
267 - array( 'action' => 'unblock', 'ip' => $row->log_title ),
268 - 'known' )
269 - . $this->message['pipe-separator'] .
270 - $this->skin->link( SpecialPage::getTitleFor( 'Blockip', $row->log_title ),
 282+ array(
 283+ 'action' => 'unblock',
 284+ 'ip' => $row->log_title
 285+ ),
 286+ 'known'
 287+ ) .
 288+ $this->message['pipe-separator'] .
 289+ $this->skin->link(
 290+ SpecialPage::getTitleFor( 'Blockip', $row->log_title ),
271291 $this->message['change-blocklink'],
272 - array(), array(), 'known' ) .
 292+ array(),
 293+ array(),
 294+ 'known'
 295+ ) .
273296 ')';
274297 // Show change protection link
275298 } else if( self::typeAction( $row, 'protect', array( 'modify', 'protect', 'unprotect' ) ) ) {
@@ -276,7 +299,11 @@
277300 $this->skin->link( $title,
278301 $this->message['hist'],
279302 array(),
280 - array( 'action' => 'history', 'offset' => $row->log_timestamp ) );
 303+ array(
 304+ 'action' => 'history',
 305+ 'offset' => $row->log_timestamp
 306+ )
 307+ );
281308 if( $wgUser->isAllowed( 'protect' ) ) {
282309 $revert .= $this->message['pipe-separator'] .
283310 $this->skin->link( $title,
@@ -289,9 +316,17 @@
290317 // Show unmerge link
291318 } else if( self::typeAction($row,'merge','merge','mergehistory') ) {
292319 $merge = SpecialPage::getTitleFor( 'Mergehistory' );
293 - $revert = '(' . $this->skin->makeKnownLinkObj( $merge, $this->message['revertmerge'],
294 - wfArrayToCGI( array('target' => $paramArray[0], 'dest' => $title->getPrefixedDBkey(),
295 - 'mergepoint' => $paramArray[1] ) ) ) . ')';
 320+ $revert = '(' . $this->skin->link(
 321+ $merge,
 322+ $this->message['revertmerge'],
 323+ array(),
 324+ array(
 325+ 'target' => $paramArray[0],
 326+ 'dest' => $title->getPrefixedDBkey(),
 327+ 'mergepoint' => $paramArray[1]
 328+ ),
 329+ array( 'known', 'noclasses' )
 330+ ) . ')';
296331 // If an edit was hidden from a page give a review link to the history
297332 } else if( self::typeAction($row,array('delete','suppress'),'revision','deleterevision') ) {
298333 if( count($paramArray) >= 2 ) {
@@ -300,16 +335,33 @@
301336 $key = $paramArray[0];
302337 // $paramArray[1] is a CSV of the IDs
303338 $Ids = explode( ',', $paramArray[1] );
304 - $query = urlencode($paramArray[1]);
 339+ $query = $paramArray[1];
305340 $revert = array();
306341 // Diff link for single rev deletions
307342 if( ( $key === 'oldid' || $key == 'revision' ) && count($Ids) == 1 ) {
308 - $revert[] = $this->skin->makeKnownLinkObj( $title, $this->message['diff'],
309 - 'diff='.intval($Ids[0])."&unhide=1" );
 343+ $revert[] = $this->skin->link(
 344+ $title,
 345+ $this->message['diff'],
 346+ array(),
 347+ array(
 348+ 'diff' => intval( $Ids[0] ),
 349+ 'unhide' => 1
 350+ ),
 351+ array( 'known', 'noclasses' )
 352+ );
310353 }
311354 // View/modify link...
312 - $revert[] = $this->skin->makeKnownLinkObj( $revdel, $this->message['revdel-restore'],
313 - 'target='.$title->getPrefixedUrl()."&type=$key&ids=$query" );
 355+ $revert[] = $this->skin->link(
 356+ $revdel,
 357+ $this->message['revdel-restore'],
 358+ array(),
 359+ array(
 360+ 'target' => $title->getPrefixedUrl(),
 361+ 'type' => $key,
 362+ 'ids' => $query
 363+ ),
 364+ array( 'known', 'noclasses' )
 365+ );
314366 // Pipe links
315367 $revert = '(' . implode(' | ',$revert) . ')';
316368 }
@@ -319,10 +371,19 @@
320372 $revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
321373 // $paramArray[1] is a CSV of the IDs
322374 $Ids = explode( ',', $paramArray[0] );
323 - $query = urlencode($paramArray[0]);
 375+ $query = $paramArray[0];
324376 // Link to each hidden object ID, $paramArray[1] is the url param
325 - $revert = '(' . $this->skin->makeKnownLinkObj( $revdel, $this->message['revdel-restore'],
326 - 'target='.$title->getPrefixedUrl()."&type=logging&ids=$query" ) . ')';
 377+ $revert = '(' . $this->skin->link(
 378+ $revdel,
 379+ $this->message['revdel-restore'],
 380+ array(),
 381+ array(
 382+ 'target' => $title->getPrefixedUrl(),
 383+ 'type' => 'logging',
 384+ 'ids' => $query
 385+ ),
 386+ array( 'known', 'noclasses' )
 387+ ) . ')';
327388 }
328389 // Self-created users
329390 } else if( self::typeAction($row,'newusers','create2') ) {
Index: trunk/phase3/includes/SkinTemplate.php
@@ -290,24 +290,35 @@
291291 } else {
292292 $tpl->set( 'jsvarurl', false );
293293 }
 294+
294295 $newtalks = $wgUser->getNewMessageLinks();
295296
296297 if( count( $newtalks ) == 1 && $newtalks[0]['wiki'] === wfWikiID() ) {
297298 $usertitle = $this->mUser->getUserPage();
298299 $usertalktitle = $usertitle->getTalkPage();
 300+
299301 if( !$usertalktitle->equals( $this->mTitle ) ) {
300 - $ntl = wfMsg( 'youhavenewmessages',
301 - $this->makeKnownLinkObj(
302 - $usertalktitle,
303 - wfMsgHtml( 'newmessageslink' ),
304 - 'redirect=no'
305 - ),
306 - $this->makeKnownLinkObj(
307 - $usertalktitle,
308 - wfMsgHtml( 'newmessagesdifflink' ),
309 - 'diff=cur'
310 - )
 302+ $newmessageslink = $this->link(
 303+ $usertalktitle,
 304+ wfMsgHtml( 'newmessageslink' ),
 305+ array(),
 306+ array( 'redirect' => 'no' ),
 307+ array( 'known', 'noclasses' )
311308 );
 309+
 310+ $newmessagesdifflink = $this->link(
 311+ $usertalktitle,
 312+ wfMsgHtml( 'newmessagesdifflink' ),
 313+ array(),
 314+ array( 'diff' => 'cur' ),
 315+ array( 'known', 'noclasses' )
 316+ );
 317+
 318+ $ntl = wfMsg(
 319+ 'youhavenewmessages',
 320+ $newmessageslink,
 321+ $newmessagesdifflink
 322+ );
312323 # Disable Cache
313324 $out->setSquidMaxage( 0 );
314325 }
Index: trunk/phase3/includes/PageHistory.php
@@ -90,8 +90,13 @@
9191 $wgOut->addScriptFile( 'history.js' );
9292
9393 $logPage = SpecialPage::getTitleFor( 'Log' );
94 - $logLink = $this->mSkin->makeKnownLinkObj( $logPage, wfMsgHtml( 'viewpagelogs' ),
95 - 'page=' . $this->mTitle->getPrefixedUrl() );
 94+ $logLink = $this->mSkin->link(
 95+ $logPage,
 96+ wfMsgHtml( 'viewpagelogs' ),
 97+ array(),
 98+ array( 'page' => $this->mTitle->getPrefixedUrl() ),
 99+ array( 'known', 'noclasses' )
 100+ );
96101 $wgOut->setSubtitle( $logLink );
97102
98103 $feedType = $wgRequest->getVal( 'feed' );
@@ -379,7 +384,13 @@
380385 $date = $wgLang->timeanddate( wfTimestamp(TS_MW, $rev->getTimestamp()), true );
381386 $date = htmlspecialchars( $date );
382387 if( !$rev->isDeleted( Revision::DELETED_TEXT ) ) {
383 - $link = $this->mSkin->makeKnownLinkObj( $this->mTitle, $date, "oldid=" . $rev->getId() );
 388+ $link = $this->mSkin->link(
 389+ $this->mTitle,
 390+ $date,
 391+ array(),
 392+ array( 'oldid' => $rev->getId() ),
 393+ array( 'known', 'noclasses' )
 394+ );
384395 } else {
385396 $link = "<span class=\"history-deleted\">$date</span>";
386397 }
@@ -397,8 +408,16 @@
398409 if( $latest || !$rev->userCan( Revision::DELETED_TEXT ) ) {
399410 return $cur;
400411 } else {
401 - return $this->mSkin->makeKnownLinkObj( $this->mTitle, $cur,
402 - 'diff=' . $this->mTitle->getLatestRevID() . "&oldid=" . $rev->getId() );
 412+ return $this->mSkin->link(
 413+ $this->mTitle,
 414+ $cur,
 415+ array(),
 416+ array(
 417+ 'diff' => $this->mTitle->getLatestRevID(),
 418+ 'oldid' => $rev->getId()
 419+ ),
 420+ array( 'known', 'noclasses' )
 421+ );
403422 }
404423 }
405424
@@ -418,13 +437,29 @@
419438 return $last;
420439 } elseif( $next === 'unknown' ) {
421440 # Next row probably exists but is unknown, use an oldid=prev link
422 - return $this->mSkin->makeKnownLinkObj( $this->mTitle, $last,
423 - "diff=" . $prevRev->getId() . "&oldid=prev" );
 441+ return $this->mSkin->link(
 442+ $this->mTitle,
 443+ $last,
 444+ array(),
 445+ array(
 446+ 'diff' => $prevRev->getId(),
 447+ 'oldid' => 'prev'
 448+ ),
 449+ array( 'known', 'noclasses' )
 450+ );
424451 } elseif( !$prevRev->userCan(Revision::DELETED_TEXT) || !$nextRev->userCan(Revision::DELETED_TEXT) ) {
425452 return $last;
426453 } else {
427 - return $this->mSkin->makeKnownLinkObj( $this->mTitle, $last,
428 - "diff=" . $prevRev->getId() . "&oldid={$next->rev_id}" );
 454+ return $this->mSkin->link(
 455+ $this->mTitle,
 456+ $last,
 457+ array(),
 458+ array(
 459+ 'diff' => $prevRev->getId(),
 460+ 'oldid' => $next->rev_id
 461+ ),
 462+ array( 'known', 'noclasses' )
 463+ );
429464 }
430465 }
431466
@@ -506,10 +541,11 @@
507542 }
508543
509544 $feed = new $wgFeedClasses[$type](
510 - $this->mTitle->getPrefixedText() . ' - ' .
511 - wfMsgForContent( 'history-feed-title' ),
512 - wfMsgForContent( 'history-feed-description' ),
513 - $this->mTitle->getFullUrl( 'action=history' ) );
 545+ $this->mTitle->getPrefixedText() . ' - ' .
 546+ wfMsgForContent( 'history-feed-title' ),
 547+ wfMsgForContent( 'history-feed-description' ),
 548+ $this->mTitle->getFullUrl( array( 'action' => 'history' ) )
 549+ );
514550
515551 // Get a limit on number of feed entries. Provide a sane default
516552 // of 10 if none is defined (but limit to $wgFeedLimit max)
@@ -573,14 +609,16 @@
574610 return new FeedItem(
575611 $title,
576612 $text,
577 - $this->mTitle->getFullUrl( 'diff=' . $rev->getId() . '&oldid=prev' ),
 613+ $this->mTitle->getFullUrl( array(
 614+ 'diff' => $rev->getId(),
 615+ 'oldid' => 'prev'
 616+ ) ),
578617 $rev->getTimestamp(),
579618 $rev->getUserText(),
580619 $this->mTitle->getTalkPage()->getFullUrl() );
581620 }
582621 }
583622
584 -
585623 /**
586624 * @ingroup Pager
587625 */
Index: trunk/phase3/includes/Preferences.php
@@ -310,8 +310,13 @@
311311 global $wgUser; // wgUser is okay here, it's for display
312312 $skin = $wgUser->getSkin();
313313 $emailauthenticated = wfMsgHtml('emailnotauthenticated').'<br />' .
314 - $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Confirmemail' ),
315 - wfMsg( 'emailconfirmlink' ) ) . '<br />';
 314+ $skin->link(
 315+ SpecialPage::getTitleFor( 'Confirmemail' ),
 316+ wfMsg( 'emailconfirmlink' ),
 317+ array(),
 318+ array(),
 319+ array( 'known', 'noclasses' )
 320+ ) . '<br />';
316321 }
317322 } else {
318323 $disableEmailPrefs = true;
Index: trunk/phase3/includes/Skin.php
@@ -992,16 +992,34 @@
993993 }
994994 }
995995 if ( 'history' == $action || isset( $diff ) || isset( $oldid ) ) {
996 - $s[] .= $this->makeKnownLinkObj( $this->mTitle,
997 - wfMsg( 'currentrev' ) );
 996+ $s[] .= $this->link(
 997+ $this->mTitle,
 998+ wfMsg( 'currentrev' ),
 999+ array(),
 1000+ array(),
 1001+ array( 'known', 'noclasses' )
 1002+ );
9981003 }
9991004
10001005 if ( $wgUser->getNewtalk() ) {
10011006 # do not show "You have new messages" text when we are viewing our
10021007 # own talk page
10031008 if( !$this->mTitle->equals( $wgUser->getTalkPage() ) ) {
1004 - $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(), wfMsgHtml( 'newmessageslink' ), 'redirect=no' );
1005 - $dl = $this->makeKnownLinkObj( $wgUser->getTalkPage(), wfMsgHtml( 'newmessagesdifflink' ), 'diff=cur' );
 1009+ $tl = $this->link(
 1010+ $wgUser->getTalkPage(),
 1011+ wfMsgHtml( 'newmessageslink' ),
 1012+ array(),
 1013+ array( 'redirect' => 'no' ),
 1014+ array( 'known', 'noclasses' )
 1015+ );
 1016+
 1017+ $dl = $this->link(
 1018+ $wgUser->getTalkPage(),
 1019+ wfMsgHtml( 'newmessagesdifflink' ),
 1020+ array(),
 1021+ array( 'diff' => 'cur' ),
 1022+ array( 'known', 'noclasses' )
 1023+ );
10061024 $s[] = '<strong>'. wfMsg( 'youhavenewmessages', $tl, $dl ) . '</strong>';
10071025 # disable caching
10081026 $wgOut->setSquidMaxage( 0 );
@@ -1030,10 +1048,16 @@
10311049 } else {
10321050 $msg = 'viewdeleted';
10331051 }
1034 - return wfMsg( $msg,
1035 - $this->makeKnownLinkObj(
 1052+ return wfMsg(
 1053+ $msg,
 1054+ $this->link(
10361055 SpecialPage::getTitleFor( 'Undelete', $this->mTitle->getPrefixedDBkey() ),
1037 - wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $wgLang->formatNum( $n ) ) ) );
 1056+ wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $wgLang->formatNum( $n ) ),
 1057+ array(),
 1058+ array(),
 1059+ array( 'known', 'noclasses' )
 1060+ )
 1061+ );
10381062 }
10391063 }
10401064 return '';
@@ -1094,7 +1118,13 @@
10951119 $display .= $link;
10961120 $linkObj = Title::newFromText( $growinglink );
10971121 if( is_object( $linkObj ) && $linkObj->exists() ){
1098 - $getlink = $this->makeKnownLinkObj( $linkObj, htmlspecialchars( $display ) );
 1122+ $getlink = $this->link(
 1123+ $linkObj,
 1124+ htmlspecialchars( $display ),
 1125+ array(),
 1126+ array(),
 1127+ array( 'known', 'noclasses' )
 1128+ );
10991129 $c++;
11001130 if( $c > 1 ) {
11011131 $subpages .= wfMsgExt( 'pipe-separator', 'escapenoentities' );
@@ -1503,7 +1533,13 @@
15041534 }
15051535
15061536 function mainPageLink() {
1507 - $s = $this->makeKnownLinkObj( Title::newMainPage(), wfMsg( 'mainpage' ) );
 1537+ $s = $this->link(
 1538+ Title::newMainPage(),
 1539+ wfMsg( 'mainpage' ),
 1540+ array(),
 1541+ array(),
 1542+ array( 'known', 'noclasses' )
 1543+ );
15081544 return $s;
15091545 }
15101546
@@ -1553,7 +1589,13 @@
15541590 $t = wfMsg( 'viewsource' );
15551591 }
15561592
1557 - $s = $this->makeKnownLinkObj( $this->mTitle, $t, $this->editUrlOptions() );
 1593+ $s = $this->link(
 1594+ $this->mTitle,
 1595+ $t,
 1596+ array(),
 1597+ $this->editUrlOptions(),
 1598+ array( 'known', 'noclasses' )
 1599+ );
15581600 }
15591601 return $s;
15601602 }
@@ -1562,17 +1604,19 @@
15631605 * Return URL options for the 'edit page' link.
15641606 * This may include an 'oldid' specifier, if the current page view is such.
15651607 *
1566 - * @return string
 1608+ * @return array
15671609 * @private
15681610 */
15691611 function editUrlOptions() {
15701612 global $wgArticle;
15711613
 1614+ $options = array( 'action' => 'edit' );
 1615+
15721616 if( $this->mRevisionId && ! $wgArticle->isCurrent() ) {
1573 - return 'action=edit&oldid=' . intval( $this->mRevisionId );
1574 - } else {
1575 - return 'action=edit';
 1617+ $options['oldid'] = intval( $this->mRevisionId );
15761618 }
 1619+
 1620+ return $options;
15771621 }
15781622
15791623 function deleteThisPage() {
@@ -1582,7 +1626,13 @@
15831627 if ( $this->mTitle->getArticleId() && ( !$diff ) && $wgUser->isAllowed( 'delete' ) ) {
15841628 $t = wfMsg( 'deletethispage' );
15851629
1586 - $s = $this->makeKnownLinkObj( $this->mTitle, $t, 'action=delete' );
 1630+ $s = $this->link(
 1631+ $this->mTitle,
 1632+ $t,
 1633+ array(),
 1634+ array( 'action' => 'delete' ),
 1635+ array( 'known', 'noclasses' )
 1636+ );
15871637 } else {
15881638 $s = '';
15891639 }
@@ -1595,13 +1645,20 @@
15961646 $diff = $wgRequest->getVal( 'diff' );
15971647 if ( $this->mTitle->getArticleId() && ( ! $diff ) && $wgUser->isAllowed('protect') ) {
15981648 if ( $this->mTitle->isProtected() ) {
1599 - $t = wfMsg( 'unprotectthispage' );
1600 - $q = 'action=unprotect';
 1649+ $text = wfMsg( 'unprotectthispage' );
 1650+ $query = array( 'action' => 'unprotect' );
16011651 } else {
1602 - $t = wfMsg( 'protectthispage' );
1603 - $q = 'action=protect';
 1652+ $text = wfMsg( 'protectthispage' );
 1653+ $query = array( 'action' => 'protect' );
16041654 }
1605 - $s = $this->makeKnownLinkObj( $this->mTitle, $t, $q );
 1655+
 1656+ $s = $this->link(
 1657+ $this->mTitle,
 1658+ $text,
 1659+ array(),
 1660+ $query,
 1661+ array( 'known', 'noclasses' )
 1662+ );
16061663 } else {
16071664 $s = '';
16081665 }
@@ -1614,15 +1671,22 @@
16151672
16161673 if ( $wgOut->isArticleRelated() ) {
16171674 if ( $this->mTitle->userIsWatching() ) {
1618 - $t = wfMsg( 'unwatchthispage' );
1619 - $q = 'action=unwatch';
1620 - $id = 'mw-unwatch-link' . $this->mWatchLinkNum;
 1675+ $text = wfMsg( 'unwatchthispage' );
 1676+ $query = array( 'action' => 'unwatch' );
 1677+ $id = array( 'mw-unwatch-link' => $this->mWatchLinkNum );
16211678 } else {
1622 - $t = wfMsg( 'watchthispage' );
1623 - $q = 'action=watch';
1624 - $id = 'mw-watch-link' . $this->mWatchLinkNum;
 1679+ $text = wfMsg( 'watchthispage' );
 1680+ $query = array( 'action' => 'watch' );
 1681+ $id = array( 'mw-watch-link' => $this->mWatchLinkNum );
16251682 }
1626 - $s = $this->makeKnownLinkObj( $this->mTitle, $t, $q, '', '', " id=\"$id\"" );
 1683+
 1684+ $s = $this->link(
 1685+ $this->mTitle,
 1686+ $text,
 1687+ array( 'id' => $id ),
 1688+ $query,
 1689+ array( 'known', 'noclasses' )
 1690+ );
16271691 } else {
16281692 $s = wfMsg( 'notanarticle' );
16291693 }
@@ -1631,8 +1695,13 @@
16321696
16331697 function moveThisPage() {
16341698 if ( $this->mTitle->quickUserCan( 'move' ) ) {
1635 - return $this->makeKnownLinkObj( SpecialPage::getTitleFor( 'Movepage' ),
1636 - wfMsg( 'movethispage' ), 'target=' . $this->mTitle->getPrefixedURL() );
 1699+ return $this->link(
 1700+ SpecialPage::getTitleFor( 'Movepage' ),
 1701+ wfMsg( 'movethispage' ),
 1702+ array(),
 1703+ array( 'target' => $this->mTitle->getPrefixedURL() ),
 1704+ array( 'known', 'noclasses' )
 1705+ );
16371706 } else {
16381707 // no message if page is protected - would be redundant
16391708 return '';
@@ -1640,20 +1709,32 @@
16411710 }
16421711
16431712 function historyLink() {
1644 - return $this->link( $this->mTitle, wfMsgHtml( 'history' ),
1645 - array( 'rel' => 'archives' ), array( 'action' => 'history' ) );
 1713+ return $this->link(
 1714+ $this->mTitle,
 1715+ wfMsgHtml( 'history' ),
 1716+ array( 'rel' => 'archives' ),
 1717+ array( 'action' => 'history' )
 1718+ );
16461719 }
16471720
16481721 function whatLinksHere() {
1649 - return $this->makeKnownLinkObj(
 1722+ return $this->link(
16501723 SpecialPage::getTitleFor( 'Whatlinkshere', $this->mTitle->getPrefixedDBkey() ),
1651 - wfMsgHtml( 'whatlinkshere' ) );
 1724+ wfMsgHtml( 'whatlinkshere' ),
 1725+ array(),
 1726+ array(),
 1727+ array( 'known', 'noclasses' )
 1728+ );
16521729 }
16531730
16541731 function userContribsLink() {
1655 - return $this->makeKnownLinkObj(
 1732+ return $this->link(
16561733 SpecialPage::getTitleFor( 'Contributions', $this->mTitle->getDBkey() ),
1657 - wfMsgHtml( 'contributions' ) );
 1734+ wfMsgHtml( 'contributions' ),
 1735+ array(),
 1736+ array(),
 1737+ array( 'known', 'noclasses' )
 1738+ );
16581739 }
16591740
16601741 function showEmailUser( $id ) {
@@ -1664,9 +1745,13 @@
16651746 }
16661747
16671748 function emailUserLink() {
1668 - return $this->makeKnownLinkObj(
 1749+ return $this->link(
16691750 SpecialPage::getTitleFor( 'Emailuser', $this->mTitle->getDBkey() ),
1670 - wfMsg( 'emailuser' ) );
 1751+ wfMsg( 'emailuser' ),
 1752+ array(),
 1753+ array(),
 1754+ array( 'known', 'noclasses' )
 1755+ );
16711756 }
16721757
16731758 function watchPageLinksLink() {
@@ -1674,9 +1759,13 @@
16751760 if ( ! $wgOut->isArticleRelated() ) {
16761761 return '(' . wfMsg( 'notanarticle' ) . ')';
16771762 } else {
1678 - return $this->makeKnownLinkObj(
 1763+ return $this->link(
16791764 SpecialPage::getTitleFor( 'Recentchangeslinked', $this->mTitle->getPrefixedDBkey() ),
1680 - wfMsg( 'recentchangeslinked-toolbox' ) );
 1765+ wfMsg( 'recentchangeslinked-toolbox' ),
 1766+ array(),
 1767+ array(),
 1768+ array( 'known', 'noclasses' )
 1769+ );
16811770 }
16821771 }
16831772
@@ -1777,7 +1866,7 @@
17781867 }
17791868
17801869 # __NEWSECTIONLINK___ changes behaviour here
1781 - # If it's present, the link points to this page, otherwise
 1870+ # If it is present, the link points to this page, otherwise
17821871 # it points to the talk page
17831872 if( $this->mTitle->isTalkPage() ) {
17841873 $title = $this->mTitle;
@@ -1787,7 +1876,16 @@
17881877 $title = $this->mTitle->getTalkPage();
17891878 }
17901879
1791 - return $this->makeKnownLinkObj( $title, wfMsg( 'postcomment' ), 'action=edit&section=new' );
 1880+ return $this->link(
 1881+ $title,
 1882+ wfMsg( 'postcomment' ),
 1883+ array(),
 1884+ array(
 1885+ 'action' => 'edit',
 1886+ 'section' => 'new'
 1887+ ),
 1888+ array( 'known', 'noclasses' )
 1889+ );
17921890 }
17931891
17941892 /* these are used extensively in SkinTemplate, but also some other places */

Follow-up revisions

RevisionCommit summaryAuthorDate
r51819* follow-up to r51568: $id should not have been made an array...siebrand12:24, 13 June 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r51559* replace some use of deprecated makeKnownLinkObj() by link() in core...siebrand22:42, 6 June 2009

Status & tagging log