r51543 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51542‎ | r51543 | r51544 >
Date:17:00, 6 June 2009
Author:siebrand
Status:ok
Tags:
Comment:
* replace use of deprecated makeLink() by link() in core
* replace other deprecated Linker::*link*() methods in special pages
Modified paths:
  • /trunk/phase3/includes/ImageGallery.php (modified) (history)
  • /trunk/phase3/includes/Linker.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialFileDuplicateSearch.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialListgrouprights.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialMIMEsearch.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialStatistics.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Linker.php
@@ -1345,7 +1345,12 @@
13461346 $linkRegexp = '/\[\[(.*?)\]\]' . preg_quote( $trail, '/' ) . '/';
13471347 if (isset($match[1][0]) && $match[1][0] == ':')
13481348 $match[1] = substr($match[1], 1);
1349 - $thelink = $this->makeLink( $match[1], $text, "", $trail );
 1349+ list( $inside, $trail ) = Linker::splitTrail( $trail );
 1350+ $linkTarget = Title::newFromText( $match[1] );
 1351+ $thelink = $this->link(
 1352+ linkTarget,
 1353+ $text . $inside,
 1354+ ) . $trail;
13501355 }
13511356 $comment = preg_replace( $linkRegexp, StringUtils::escapeRegexReplacement( $thelink ), $comment, 1 );
13521357
Index: trunk/phase3/includes/specials/SpecialStatistics.php
@@ -184,13 +184,19 @@
185185 } else {
186186 $grouppageLocalized = $msg;
187187 }
188 - $grouppage = $sk->makeLink( $grouppageLocalized, htmlspecialchars( $groupnameLocalized ) );
189 - $grouplink = $sk->link( SpecialPage::getTitleFor( 'Listusers' ),
 188+ $linkTarget = Title::newFromText( $grouppageLocalized );
 189+ $grouppage = $sk->link(
 190+ $linkTarget,
 191+ htmlspecialchars( $groupnameLocalized )
 192+ );
 193+ $grouplink = $sk->link(
 194+ SpecialPage::getTitleFor( 'Listusers' ),
190195 wfMsgHtml( 'listgrouprights-members' ),
191196 array(),
192197 array( 'group' => $group ),
193 - 'known' );
194 - # Add a class when a usergroup contains no members to allow hiding these rows
 198+ 'known'
 199+ );
 200+ # Add a class when a usergroup contains no members to allow hiding these rows
195201 $classZero = '';
196202 $countUsers = SiteStats::numberingroup( $groupname );
197203 if( $countUsers == 0 ) {
Index: trunk/phase3/includes/specials/SpecialFileDuplicateSearch.php
@@ -51,7 +51,10 @@
5252
5353 $nt = Title::makeTitle( NS_FILE, $result->title );
5454 $text = $wgContLang->convert( $nt->getText() );
55 - $plink = $skin->makeLink( $nt->getPrefixedText(), $text );
 55+ $plink = $skin->link(
 56+ Title::newFromText( $nt->getPrefixedText() ),
 57+ $text
 58+ );
5659
5760 $user = $skin->link( Title::makeTitle( NS_USER, $result->img_user_text ), $result->img_user_text );
5861 $time = $wgLang->timeanddate( $result->img_timestamp );
Index: trunk/phase3/includes/specials/SpecialListgrouprights.php
@@ -61,14 +61,29 @@
6262 // Do not make a link for the generic * group
6363 $grouppage = htmlspecialchars($groupnameLocalized);
6464 } else {
65 - $grouppage = $this->skin->makeLink( $grouppageLocalized, htmlspecialchars($groupnameLocalized) );
 65+ $grouppage = $this->skin->link(
 66+ Title::newFromText( $grouppageLocalized ),
 67+ htmlspecialchars($groupnameLocalized)
 68+ );
6669 }
6770
6871 if ( $group === 'user' ) {
6972 // Link to Special:listusers for implicit group 'user'
70 - $grouplink = '<br />' . $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Listusers' ), wfMsgHtml( 'listgrouprights-members' ), '' );
 73+ $grouplink = '<br />' . $this->skin->link(
 74+ SpecialPage::getTitleFor( 'Listusers' ),
 75+ wfMsgHtml( 'listgrouprights-members' ),
 76+ array(),
 77+ array(),
 78+ array( 'known', 'noclasses' )
 79+ );
7180 } elseif ( !in_array( $group, $wgImplicitGroups ) ) {
72 - $grouplink = '<br />' . $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Listusers' ), wfMsgHtml( 'listgrouprights-members' ), 'group=' . $group );
 81+ $grouplink = '<br />' . $this->skin->link(
 82+ SpecialPage::getTitleFor( 'Listusers' ),
 83+ wfMsgHtml( 'listgrouprights-members' ),
 84+ array(),
 85+ array( 'group' => $group ),
 86+ array( 'known', 'noclasses' )
 87+ );
7388 } else {
7489 // No link to Special:listusers for other implicit groups as they are unlistable
7590 $grouplink = '';
Index: trunk/phase3/includes/specials/SpecialMIMEsearch.php
@@ -65,7 +65,10 @@
6666
6767 $nt = Title::makeTitle( $result->namespace, $result->title );
6868 $text = $wgContLang->convert( $nt->getText() );
69 - $plink = $skin->makeLink( $nt->getPrefixedText(), htmlspecialchars($text) );
 69+ $plink = $skin->link(
 70+ Title::newFromText( $nt->getPrefixedText() ),
 71+ htmlspecialchars( $text )
 72+ );
7073
7174 $download = $skin->makeMediaLinkObj( $nt, wfMsgHtml( 'download' ) );
7275 $bytes = wfMsgExt( 'nbytes', array( 'parsemag', 'escape'),
Index: trunk/phase3/includes/ImageGallery.php
@@ -250,8 +250,15 @@
251251 . htmlspecialchars( $nt->getText() ) . '</div>';
252252 } elseif( $this->mHideBadImages && wfIsBadImage( $nt->getDBkey(), $this->getContextTitle() ) ) {
253253 # The image is blacklisted, just show it as a text link.
254 - $thumbhtml = "\n\t\t\t".'<div style="height: '.($this->mHeights*1.25+2).'px;">'
255 - . $sk->makeKnownLinkObj( $nt, htmlspecialchars( $nt->getText() ) ) . '</div>';
 254+ $thumbhtml = "\n\t\t\t".'<div style="height: '.($this->mHeights*1.25+2).'px;">' .
 255+ $sk->link(
 256+ $nt,
 257+ htmlspecialchars( $nt->getText() ),
 258+ array()
 259+ array(),
 260+ array( 'known', 'noclasses' )
 261+ ) .
 262+ '</div>';
256263 } elseif( !( $thumb = $img->transform( $params ) ) ) {
257264 # Error generating thumbnail.
258265 $thumbhtml = "\n\t\t\t".'<div style="height: '.($this->mHeights*1.25+2).'px;">'
@@ -274,7 +281,8 @@
275282 }
276283
277284 //TODO
278 - //$ul = $sk->makeLink( $wgContLang->getNsText( MWNamespace::getUser() ) . ":{$ut}", $ut );
 285+ // $linkTarget = Title::newFromText( $wgContLang->getNsText( MWNamespace::getUser() ) . ":{$ut}" );
 286+ // $ul = $sk->link( $linkTarget, $ut );
279287
280288 if( $this->mShowBytes ) {
281289 if( $img ) {
@@ -289,7 +297,13 @@
290298 }
291299
292300 $textlink = $this->mShowFilename ?
293 - $sk->makeKnownLinkObj( $nt, htmlspecialchars( $wgLang->truncate( $nt->getText(), 20 ) ) ) . "<br />\n" :
 301+ $sk->link(
 302+ $nt,
 303+ htmlspecialchars( $wgLang->truncate( $nt->getText(), 20 ) )
 304+ array(),
 305+ array(),
 306+ array( 'known', 'noclasses' )
 307+ ) . "<br />\n" :
294308 '' ;
295309
296310 # ATTENTION: The newline after <div class="gallerytext"> is needed to accommodate htmltidy which

Follow-up revisions

RevisionCommit summaryAuthorDate
r51545Follow-up to r51543: fix syntax error in Linker.phpsiebrand17:04, 6 June 2009
r51546Follow-up to r51543: Fix syntax error in ImageGallery.phpsiebrand17:05, 6 June 2009
r51547Follow-up to r51543: Fix another syntax error in ImageGallery.php. Sorry.siebrand17:07, 6 June 2009

Status & tagging log