* @param $key string 'newpage', 'unpatrolled', 'minor', or 'bot'
* @return string Raw HTML
*/
- public static function flagLegend( $key ) {
+ private static function flagLine( $key ) {
return wfMsgExt( "recentchanges-legend-$key", array( 'escapenoentities',
'replaceafter' ), self::flag( $key ) );
}
+ /**
+ * A handy legend to tell users what the little "m", "b", and so on mean.
+ *
+ * @return string Raw HTML
+ */
+ public static function flagLegend() {
+ global $wgGroupPermissions, $wgLang;
+
+ $flags = array( self::flagLine( 'newpage' ),
+ self::flagLine( 'minor' ) );
+
+ # Don't show info on bot edits unless there's a bot group of some kind
+ foreach ( $wgGroupPermissions as $rights ) {
+ if ( isset( $rights['bot'] ) && $rights['bot'] ) {
+ $flags[] = self::flagLine( 'bot' );
+ break;
+ }
+ }
+
+ if ( self::usePatrol() ) {
+ $flags[] = self::flagLine( 'unpatrolled' );
+ }
+
+ return '<div class="mw-rc-label-legend">' .
+ wfMsgWikiHtml( 'recentchanges-label-legend', $wgLang->commaList( $flags ) )
+ . '</div>';
+ }
+
/**
* Returns text for the start of the tabular part of RC
* @return string
* @return String: XHTML
*/
public function doHeader( $opts ) {
- global $wgScript, $wgOut, $wgLang, $wgUser, $wgGroupPermissions;
+ global $wgScript, $wgOut;
$this->setTopText( $wgOut, $opts );
Xml::fieldset( wfMsg( 'recentchanges-legend' ), $panelString, array( 'class' => 'rcoptions' ) )
);
- $flags = array( ChangesList::flagLegend( 'newpage' ),
- ChangesList::flagLegend( 'minor' ) );
-
- # Don't show info on bot edits unless there's a bot group of some kind
- foreach ( $wgGroupPermissions as $rights ) {
- if ( isset( $rights['bot'] ) && $rights['bot'] ) {
- $flags[] = ChangesList::flagLegend( 'bot' );
- break;
- }
- }
-
- if ( $wgUser->useRCPatrol() ) {
- $flags[] = ChangesList::flagLegend( 'unpatrolled' );
- }
-
- $wgOut->addHTML( '<div class="mw-rc-label-legend">' );
- $wgOut->addWikiMsg( 'recentchanges-label-legend',
- $wgLang->commaList( $flags ) );
- $wgOut->addHTML( '</div>' );
+ $wgOut->addHTML( ChangesList::flagLegend() );
$this->setBottomText( $wgOut, $opts );
}
$form .= Xml::closeElement( 'fieldset' );
$wgOut->addHTML( $form );
- $wgOut->addWikiMsg( 'recentchanges-label-legend',
- ChangesList::flag( 'newpage' ), ChangesList::flag( 'minor' ),
- ChangesList::flag( 'bot' ), ChangesList::flag( 'unpatrolled' ) );
+ $wgOut->addHTML( ChangesList::flagLegend() );
# If there's nothing to show, stop here
if( $numRows == 0 ) {