Index: trunk/extensions/Gadgets/SpecialGadgets.php |
— | — | @@ -50,54 +50,63 @@ |
51 | 51 | $listOpen = false; |
52 | 52 | |
53 | 53 | $msgOpt = array( 'parseinline', 'parsemag' ); |
54 | | - |
| 54 | + $editInterfaceAllowed = $wgUser->isAllowed( 'editinterface' ) ? true : false ; |
| 55 | + |
55 | 56 | foreach ( $gadgets as $section => $entries ) { |
56 | 57 | if ( $section !== false && $section !== '' ) { |
57 | 58 | $t = Title::makeTitleSafe( NS_MEDIAWIKI, "Gadget-section-$section$lang" ); |
58 | | - $lnk = $t ? $skin->makeLinkObj( $t, wfMsgHTML("edit"), 'action=edit' ) : htmlspecialchars($section); |
| 59 | + if ( $editInterfaceAllowed ) { |
| 60 | + $lnkTarget = $t |
| 61 | + ? $skin->link( $t, wfMsgHTML( 'edit' ), array(), array( 'action' => 'edit' ) ) |
| 62 | + : htmlspecialchars( $section ); |
| 63 | + $lnk = " [$lnkTarget]"; |
| 64 | + } else { |
| 65 | + $lnk = ''; |
| 66 | + } |
59 | 67 | $ttext = wfMsgExt( "gadget-section-$section", $msgOpt ); |
60 | 68 | |
61 | 69 | if( $listOpen ) { |
62 | | - $wgOut->addHTML( '</ul>' ); |
| 70 | + $wgOut->addHTML( Xml::closeElement( 'ul' ) . "\n" ); |
63 | 71 | $listOpen = false; |
64 | 72 | } |
65 | | - $wgOut->addHTML( "\n<h2>$ttext [$lnk]</h2>\n" ); |
| 73 | + $wgOut->addHTML( Html::rawElement( 'h2', array(), $ttext . $lnk ) . "\n" ); |
66 | 74 | } |
67 | 75 | |
68 | 76 | foreach ( $entries as $gname => $code ) { |
69 | 77 | $t = Title::makeTitleSafe( NS_MEDIAWIKI, "Gadget-$gname$lang" ); |
70 | 78 | if ( !$t ) continue; |
71 | 79 | |
72 | | - $lnk = $skin->makeLinkObj( $t, wfMsgHTML("edit"), 'action=edit' ); |
| 80 | + if ( $editInterfaceAllowed ) { |
| 81 | + $lnkTarget = $skin->link( $t, wfMsgHTML( 'edit' ), array(), array( 'action' => 'edit' ) ); |
| 82 | + $lnk = " [$lnkTarget]"; |
| 83 | + } else { |
| 84 | + $lnk = ''; |
| 85 | + } |
73 | 86 | $ttext = wfMsgExt( "gadget-$gname", $msgOpt ); |
74 | 87 | |
75 | 88 | if( !$listOpen ) { |
76 | 89 | $listOpen = true; |
77 | | - $wgOut->addHTML( '<ul>' ); |
| 90 | + $wgOut->addHTML( Xml::openElement( 'ul' ) ); |
78 | 91 | } |
79 | | - $wgOut->addHTML( "<li>" ); |
80 | | - $wgOut->addHTML( "$ttext [$lnk]<br />" ); |
| 92 | + $wgOut->addHTML( Xml::openElement( 'li' ) . |
| 93 | + $ttext . $lnk . "<br />" . |
| 94 | + wfMsgHTML( 'gadgets-uses' ) . wfMsg( 'colon-separator' ) |
| 95 | + ); |
81 | 96 | |
82 | | - $wgOut->addHTML( wfMsgHTML( "gadgets-uses" ) . wfMsg( 'colon-separator' ) ); |
83 | | - |
84 | | - $first = true; |
| 97 | + $lnk = array(); |
85 | 98 | foreach ( $code as $codePage ) { |
86 | 99 | $t = Title::makeTitleSafe( NS_MEDIAWIKI, "Gadget-$codePage" ); |
87 | 100 | if ( !$t ) continue; |
88 | 101 | |
89 | | - if ( $first ) $first = false; |
90 | | - else $wgOut->addHTML(", "); |
91 | | - |
92 | | - $lnk = $skin->makeLinkObj( $t, htmlspecialchars( $t->getText() ) ); |
93 | | - $wgOut->addHTML($lnk); |
| 102 | + $lnk[] = $skin->link( $t, htmlspecialchars( $t->getText() ) ); |
94 | 103 | } |
95 | | - |
96 | | - $wgOut->addHTML( "</li>" ); |
| 104 | + $wgOut->addHTML( $wgLang->commaList( $lnk ) ); |
| 105 | + $wgOut->addHTML( Xml::closeElement( 'li' ) . "\n" ); |
97 | 106 | } |
98 | 107 | } |
99 | 108 | |
100 | 109 | if( $listOpen ) { |
101 | | - $wgOut->addHTML( '</ul>' ); |
| 110 | + $wgOut->addHTML( Xml::closeElement( 'ul' ) . "\n" ); |
102 | 111 | } |
103 | 112 | } |
104 | 113 | } |