summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialRecentchanges.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/specials/SpecialRecentchanges.php')
-rw-r--r--includes/specials/SpecialRecentchanges.php119
1 files changed, 69 insertions, 50 deletions
diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php
index daf47f62..2bd8b0a9 100644
--- a/includes/specials/SpecialRecentchanges.php
+++ b/includes/specials/SpecialRecentchanges.php
@@ -190,8 +190,8 @@ class SpecialRecentChanges extends IncludableSpecialPage {
public function getFeedObject( $feedFormat ){
$changesFeed = new ChangesFeed( $feedFormat, 'rcfeed' );
$formatter = $changesFeed->getFeedObject(
- wfMsgForContent( 'recentchanges' ),
- wfMsgForContent( 'recentchanges-feed-description' ),
+ $this->msg( 'recentchanges' )->inContentLanguage()->text(),
+ $this->msg( 'recentchanges-feed-description' )->inContentLanguage()->text(),
$this->getTitle()->getFullURL()
);
return array( $changesFeed, $formatter );
@@ -366,7 +366,7 @@ class SpecialRecentChanges extends IncludableSpecialPage {
*
* @param $conds Array
* @param $opts FormOptions
- * @return database result or false (for Recentchangeslinked only)
+ * @return bool|ResultWrapper result or false (for Recentchangeslinked only)
*/
public function doMainQuery( $conds, $opts ) {
$tables = array( 'recentchanges' );
@@ -396,14 +396,15 @@ class SpecialRecentChanges extends IncludableSpecialPage {
$fields[] = 'page_latest';
$join_conds['page'] = array('LEFT JOIN', 'rc_cur_id=page_id');
}
- if ( !$this->including() ) {
- // Tag stuff.
- // Doesn't work when transcluding. See bug 23293
- ChangeTags::modifyDisplayQuery(
- $tables, $fields, $conds, $join_conds, $query_options,
- $opts['tagfilter']
- );
- }
+ // Tag stuff.
+ ChangeTags::modifyDisplayQuery(
+ $tables,
+ $fields,
+ $conds,
+ $join_conds,
+ $query_options,
+ $opts['tagfilter']
+ );
if ( !wfRunHooks( 'SpecialRecentChangesQuery',
array( &$conds, &$tables, &$join_conds, $opts, &$query_options, &$fields ) ) )
@@ -534,6 +535,7 @@ class SpecialRecentChanges extends IncludableSpecialPage {
/**
* Get the query string to append to feed link URLs.
* This is overridden by RCL to add the target parameter
+ * @return bool
*/
public function getFeedQuery() {
return false;
@@ -564,17 +566,17 @@ class SpecialRecentChanges extends IncludableSpecialPage {
$extraOpts = $this->getExtraOptions( $opts );
$extraOptsCount = count( $extraOpts );
$count = 0;
- $submit = ' ' . Xml::submitbutton( wfMsg( 'allpagessubmit' ) );
+ $submit = ' ' . Xml::submitbutton( $this->msg( 'allpagessubmit' )->text() );
$out = Xml::openElement( 'table', array( 'class' => 'mw-recentchanges-table' ) );
- foreach( $extraOpts as $optionRow ) {
+ foreach( $extraOpts as $name => $optionRow ) {
# Add submit button to the last row only
++$count;
- $addSubmit = $count === $extraOptsCount ? $submit : '';
+ $addSubmit = ( $count === $extraOptsCount ) ? $submit : '';
$out .= Xml::openElement( 'tr' );
if( is_array( $optionRow ) ) {
- $out .= Xml::tags( 'td', array( 'class' => 'mw-label' ), $optionRow[0] );
+ $out .= Xml::tags( 'td', array( 'class' => 'mw-label mw-' . $name . '-label' ), $optionRow[0] );
$out .= Xml::tags( 'td', array( 'class' => 'mw-input' ), $optionRow[1] . $addSubmit );
} else {
$out .= Xml::tags( 'td', array( 'class' => 'mw-input', 'colspan' => 2 ), $optionRow . $addSubmit );
@@ -595,7 +597,7 @@ class SpecialRecentChanges extends IncludableSpecialPage {
$panelString = implode( "\n", $panel );
$this->getOutput()->addHTML(
- Xml::fieldset( wfMsg( 'recentchanges-legend' ), $panelString, array( 'class' => 'rcoptions' ) )
+ Xml::fieldset( $this->msg( 'recentchanges-legend' )->text(), $panelString, array( 'class' => 'rcoptions' ) )
);
$this->setBottomText( $opts );
@@ -632,14 +634,18 @@ class SpecialRecentChanges extends IncludableSpecialPage {
*/
function setTopText( FormOptions $opts ) {
global $wgContLang;
- $this->getOutput()->addWikiText(
- Html::rawElement( 'p',
- array( 'lang' => $wgContLang->getCode(), 'dir' => $wgContLang->getDir() ),
- "\n" . wfMsgForContentNoTrans( 'recentchangestext' ) . "\n"
- ),
- /* $lineStart */ false,
- /* $interface */ false
- );
+
+ $message = $this->msg( 'recentchangestext' )->inContentLanguage();
+ if ( !$message->isDisabled() ) {
+ $this->getOutput()->addWikiText(
+ Html::rawElement( 'p',
+ array( 'lang' => $wgContLang->getCode(), 'dir' => $wgContLang->getDir() ),
+ "\n" . $message->plain() . "\n"
+ ),
+ /* $lineStart */ false,
+ /* $interface */ false
+ );
+ }
}
/**
@@ -662,16 +668,16 @@ class SpecialRecentChanges extends IncludableSpecialPage {
array( 'selected' => $opts['namespace'], 'all' => '' ),
array( 'name' => 'namespace', 'id' => 'namespace' )
);
- $nsLabel = Xml::label( wfMsg( 'namespace' ), 'namespace' );
+ $nsLabel = Xml::label( $this->msg( 'namespace' )->text(), 'namespace' );
$invert = Xml::checkLabel(
- wfMsg( 'invert' ), 'invert', 'nsinvert',
+ $this->msg( 'invert' )->text(), 'invert', 'nsinvert',
$opts['invert'],
- array( 'title' => wfMsg( 'tooltip-invert' ) )
+ array( 'title' => $this->msg( 'tooltip-invert' )->text() )
);
$associated = Xml::checkLabel(
- wfMsg( 'namespace_association' ), 'associated', 'nsassociated',
+ $this->msg( 'namespace_association' )->text(), 'associated', 'nsassociated',
$opts['associated'],
- array( 'title' => wfMsg( 'tooltip-namespace_association' ) )
+ array( 'title' => $this->msg( 'tooltip-namespace_association' )->text() )
);
return array( $nsLabel, "$nsSelect $invert $associated" );
}
@@ -683,10 +689,10 @@ class SpecialRecentChanges extends IncludableSpecialPage {
* @return Array
*/
protected function categoryFilterForm( FormOptions $opts ) {
- list( $label, $input ) = Xml::inputLabelSep( wfMsg( 'rc_categories' ),
+ list( $label, $input ) = Xml::inputLabelSep( $this->msg( 'rc_categories' )->text(),
'categories', 'mw-categories', false, $opts['categories'] );
- $input .= ' ' . Xml::checkLabel( wfMsg( 'rc_categories_any' ),
+ $input .= ' ' . Xml::checkLabel( $this->msg( 'rc_categories_any' )->text(),
'categories_any', 'mw-categories_any', $opts['categories_any'] );
return array( $label, $input );
@@ -763,9 +769,20 @@ class SpecialRecentChanges extends IncludableSpecialPage {
* @param $override Array: options to override
* @param $options Array: current options
* @param $active Boolean: whether to show the link in bold
+ * @return string
*/
function makeOptionsLink( $title, $override, $options, $active = false ) {
$params = $override + $options;
+
+ // Bug 36524: false values have be converted to "0" otherwise
+ // wfArrayToCgi() will omit it them.
+ foreach ( $params as &$value ) {
+ if ( $value === false ) {
+ $value = '0';
+ }
+ }
+ unset( $value );
+
$text = htmlspecialchars( $title );
if ( $active ) {
$text = '<strong>' . $text . '</strong>';
@@ -778,6 +795,7 @@ class SpecialRecentChanges extends IncludableSpecialPage {
*
* @param $defaults Array
* @param $nondefaults Array
+ * @return string
*/
function optionsPanel( $defaults, $nondefaults ) {
global $wgRCLinkLimits, $wgRCLinkDays;
@@ -785,16 +803,18 @@ class SpecialRecentChanges extends IncludableSpecialPage {
$options = $nondefaults + $defaults;
$note = '';
- if( !wfEmptyMsg( 'rclegend' ) ) {
- $note .= '<div class="mw-rclegend">' .
- wfMsgExt( 'rclegend', array( 'parseinline' ) ) . "</div>\n";
+ $msg = $this->msg( 'rclegend' );
+ if( !$msg->isDisabled() ) {
+ $note .= '<div class="mw-rclegend">' . $msg->parse() . "</div>\n";
}
+
+ $lang = $this->getLanguage();
+ $user = $this->getUser();
if( $options['from'] ) {
- $note .= wfMsgExt( 'rcnotefrom', array( 'parseinline' ),
- $this->getLanguage()->formatNum( $options['limit'] ),
- $this->getLanguage()->timeanddate( $options['from'], true ),
- $this->getLanguage()->date( $options['from'], true ),
- $this->getLanguage()->time( $options['from'], true ) ) . '<br />';
+ $note .= $this->msg( 'rcnotefrom' )->numParams( $options['limit'] )->params(
+ $lang->userTimeAndDate( $options['from'], $user ),
+ $lang->userDate( $options['from'], $user ),
+ $lang->userTime( $options['from'], $user ) )->parse() . '<br />';
}
# Sort data for display and make sure it's unique after we've added user data.
@@ -807,21 +827,21 @@ class SpecialRecentChanges extends IncludableSpecialPage {
// limit links
foreach( $wgRCLinkLimits as $value ) {
- $cl[] = $this->makeOptionsLink( $this->getLanguage()->formatNum( $value ),
+ $cl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
array( 'limit' => $value ), $nondefaults, $value == $options['limit'] );
}
- $cl = $this->getLanguage()->pipeList( $cl );
+ $cl = $lang->pipeList( $cl );
// day links, reset 'from' to none
foreach( $wgRCLinkDays as $value ) {
- $dl[] = $this->makeOptionsLink( $this->getLanguage()->formatNum( $value ),
+ $dl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
array( 'days' => $value, 'from' => '' ), $nondefaults, $value == $options['days'] );
}
- $dl = $this->getLanguage()->pipeList( $dl );
+ $dl = $lang->pipeList( $dl );
// show/hide links
- $showhide = array( wfMsg( 'show' ), wfMsg( 'hide' ) );
+ $showhide = array( $this->msg( 'show' )->text(), $this->msg( 'hide' )->text() );
$filters = array(
'hideminor' => 'rcshowhideminor',
'hidebots' => 'rcshowhidebots',
@@ -834,7 +854,7 @@ class SpecialRecentChanges extends IncludableSpecialPage {
$filters[$key] = $params['msg'];
}
// Disable some if needed
- if ( !$this->getUser()->useRCPatrol() ) {
+ if ( !$user->useRCPatrol() ) {
unset( $filters['hidepatrolled'] );
}
@@ -842,19 +862,18 @@ class SpecialRecentChanges extends IncludableSpecialPage {
foreach ( $filters as $key => $msg ) {
$link = $this->makeOptionsLink( $showhide[1 - $options[$key]],
array( $key => 1-$options[$key] ), $nondefaults );
- $links[] = wfMsgHtml( $msg, $link );
+ $links[] = $this->msg( $msg )->rawParams( $link )->escaped();
}
// show from this onward link
$timestamp = wfTimestampNow();
- $now = $this->getLanguage()->timeanddate( $timestamp, true );
+ $now = $lang->userTimeAndDate( $timestamp, $user );
$tl = $this->makeOptionsLink(
$now, array( 'from' => $timestamp ), $nondefaults
);
- $rclinks = wfMsgExt( 'rclinks', array( 'parseinline', 'replaceafter' ),
- $cl, $dl, $this->getLanguage()->pipeList( $links ) );
- $rclistfrom = wfMsgExt( 'rclistfrom', array( 'parseinline', 'replaceafter' ), $tl );
+ $rclinks = $this->msg( 'rclinks' )->rawParams( $cl, $dl, $lang->pipeList( $links ) )->parse();
+ $rclistfrom = $this->msg( 'rclistfrom' )->rawParams( $tl )->parse();
return "{$note}$rclinks<br />$rclistfrom";
}