Completed
Branch master (227f0c)
by
unknown
30:54
created

SpecialNewFiles::execute()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 21
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 3
eloc 14
nc 4
nop 1
dl 0
loc 21
rs 9.3142
c 2
b 0
f 0
1
<?php
2
/**
3
 * Implements Special:Newimages
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation; either version 2 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License along
16
 * with this program; if not, write to the Free Software Foundation, Inc.,
17
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
 * http://www.gnu.org/copyleft/gpl.html
19
 *
20
 * @file
21
 * @ingroup SpecialPage
22
 */
23
24
class SpecialNewFiles extends IncludableSpecialPage {
25
	public function __construct() {
26
		parent::__construct( 'Newimages' );
27
	}
28
29
	public function execute( $par ) {
30
		$this->setHeaders();
31
		$this->outputHeader();
32
33
		$out = $this->getOutput();
34
		$this->addHelpLink( 'Help:New images' );
35
36
		$pager = new NewFilesPager( $this->getContext(), $par );
37
38
		if ( !$this->including() ) {
39
			$this->setTopText();
40
			$form = $pager->getForm();
41
			$form->prepareForm();
42
			$form->displayForm( '' );
43
		}
44
45
		$out->addHTML( $pager->getBody() );
46
		if ( !$this->including() ) {
47
			$out->addHTML( $pager->getNavigationBar() );
48
		}
49
	}
50
51
	protected function getGroupName() {
52
		return 'changes';
53
	}
54
55
	/**
56
	 * Send the text to be displayed above the options
57
	 */
58 View Code Duplication
	function setTopText() {
59
		global $wgContLang;
60
61
		$message = $this->msg( 'newimagestext' )->inContentLanguage();
62
		if ( !$message->isDisabled() ) {
63
			$this->getOutput()->addWikiText(
64
				Html::rawElement( 'p',
65
					[ 'lang' => $wgContLang->getHtmlCode(), 'dir' => $wgContLang->getDir() ],
66
					"\n" . $message->plain() . "\n"
67
				),
68
				/* $lineStart */ false,
69
				/* $interface */ false
70
			);
71
		}
72
	}
73
}
74