<?php
/**
- * Special:Contributions, show user contributions in a paged list
+ * Implements Special:Contributions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
* @file
* @ingroup SpecialPage
*/
+/**
+ * Special:Contributions, show user contributions in a paged list
+ *
+ * @ingroup SpecialPage
+ */
+
class SpecialContributions extends SpecialPage {
public function __construct() {
}
public function execute( $par ) {
- global $wgUser, $wgOut, $wgLang, $wgRequest;
+ global $wgUser, $wgOut, $wgRequest;
$this->setHeaders();
$this->outputHeader();
$this->opts['namespace'] = '';
}
- $this->opts['tagfilter'] = (string) $wgRequest->getVal( 'tagfilter' );
+ $this->opts['tagFilter'] = (string) $wgRequest->getVal( 'tagFilter' );
// Allows reverts to have the bot flag in recent changes. It is just here to
// be passed in the form at the top of the page
$wgOut->addHTML( $this->getForm() );
- $pager = new ContribsPager( $target, $this->opts['namespace'], $this->opts['year'],
- $this->opts['month'], false, $this->opts['deletedOnly'], $this->opts['topOnly'] );
+ $pager = new ContribsPager( array(
+ 'target' => $target,
+ 'namespace' => $this->opts['namespace'],
+ 'year' => $this->opts['year'],
+ 'month' => $this->opts['month'],
+ 'deletedOnly' => $this->opts['deletedOnly'],
+ 'topOnly' => $this->opts['topOnly'],
+ ) );
if( !$pager->getNumRows() ) {
$wgOut->addWikiMsg( 'nocontribs', $target );
} else {
$this->opts['target'] = '';
}
- if( !isset( $this->opts['tagfilter'] ) ) {
- $this->opts['tagfilter'] = '';
+ if( !isset( $this->opts['tagFilter'] ) ) {
+ $this->opts['tagFilter'] = '';
}
if( !isset( $this->opts['topOnly'] ) ) {
$f .= "\t" . Xml::hidden( $name, $value ) . "\n";
}
- $tagFilter = ChangeTags::buildTagFilterSelector( $this->opts['tagfilter'] );
+ $tagFilter = ChangeTags::buildTagFilterSelector( $this->opts['tagFilter'] );
$f .= '<fieldset>' .
Xml::element( 'legend', array(), wfMsg( 'sp-contributions-search' ) ) .
* @param $type String
*/
protected function feed( $type ) {
- global $wgRequest, $wgFeed, $wgFeedClasses, $wgFeedLimit;
+ global $wgFeed, $wgFeedClasses, $wgFeedLimit, $wgOut;
if( !$wgFeed ) {
- global $wgOut;
$wgOut->addWikiMsg( 'feed-unavailable' );
return;
}
if( !isset( $wgFeedClasses[$type] ) ) {
- global $wgOut;
$wgOut->addWikiMsg( 'feed-invalid' );
return;
}
$nt = Title::makeTitleSafe( NS_USER, $this->opts['target'] );
$target = $this->opts['target'] == 'newbies' ? 'newbies' : $nt->getText();
- $pager = new ContribsPager( $target, $this->opts['namespace'], $this->opts['year'],
- $this->opts['month'], $this->opts['tagfilter'], $this->opts['deletedOnly'], $this->opts['topOnly'] );
+ $pager = new ContribsPager( array(
+ 'target' => $target,
+ 'namespace' => $this->opts['namespace'],
+ 'year' => $this->opts['year'],
+ 'month' => $this->opts['month'],
+ 'tagFilter' => $this->opts['tagFilter'],
+ 'deletedOnly' => $this->opts['deletedOnly'],
+ 'topOnly' => $this->opts['topOnly'],
+ ) );
$pager->mLimit = min( $this->opts['limit'], $wgFeedLimit );
var $messages, $target;
var $namespace = '', $mDb;
- function __construct( $target, $namespace = false, $year = false, $month = false, $tagFilter = false, $deletedOnly = false, $topOnly = false ) {
+ function __construct( $options ) {
parent::__construct();
$msgs = array( 'uctop', 'diff', 'newarticle', 'rollbacklink', 'diff', 'hist', 'rev-delundel', 'pipe-separator' );
$this->messages[$msg] = wfMsgExt( $msg, array( 'escapenoentities' ) );
}
- $this->target = $target;
- $this->namespace = $namespace;
- $this->tagFilter = $tagFilter;
- $this->deletedOnly = $deletedOnly;
- $this->topOnly = $topOnly;
+ $this->target = isset( $options['target'] ) ? $options['target'] : '';
+ $this->namespace = isset( $options['namespace'] ) ? $options['namespace'] : '';
+ $this->tagFilter = isset( $options['tagFilter'] ) ? $options['tagFilter'] : false;
+
+ $this->deletedOnly = !empty( $options['deletedOnly'] );
+ $this->topOnly = !empty( $options['topOnly'] );
+ $year = isset( $options['year'] ) ? $options['year'] : false;
+ $month = isset( $options['month'] ) ? $options['month'] : false;
$this->getDateCond( $year, $month );
$this->mDb = wfGetDB( DB_SLAVE, 'contributions' );