Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| SpecialNoticeTemplate | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| execute | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | use MediaWiki\SpecialPage\SpecialPage; |
| 4 | |
| 5 | class SpecialNoticeTemplate extends CentralNotice { |
| 6 | public function __construct() { |
| 7 | // Register special page |
| 8 | parent::__construct( 'NoticeTemplate' ); |
| 9 | } |
| 10 | |
| 11 | /** |
| 12 | * Handle different types of page requests |
| 13 | * @param string|null $sub |
| 14 | */ |
| 15 | public function execute( $sub ) { |
| 16 | if ( $sub == 'view' ) { |
| 17 | // Trying to view a banner -- so redirect to edit form |
| 18 | $banner = $this->getRequest()->getText( 'template' ); |
| 19 | $title = SpecialPage::getTitleFor( 'CentralNoticeBanners', "edit/$banner" ); |
| 20 | } else { |
| 21 | // don't know where they were trying to go, redirect them to the new list form |
| 22 | $title = SpecialPage::getTitleFor( 'CentralNoticeBanners' ); |
| 23 | } |
| 24 | $this->getOutput()->redirect( |
| 25 | $title->getFullUrlForRedirect(), |
| 26 | 301 |
| 27 | ); |
| 28 | } |
| 29 | } |