[ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Formatter for move log entries. 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 * @author Niklas Laxström 22 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later 23 * @since 1.22 24 */ 25 26 /** 27 * This class formats move log entries. 28 * 29 * @since 1.19 30 */ 31 class MoveLogFormatter extends LogFormatter { 32 public function getPreloadTitles() { 33 $params = $this->extractParameters(); 34 35 return array( Title::newFromText( $params[3] ) ); 36 } 37 38 protected function getMessageKey() { 39 $key = parent::getMessageKey(); 40 $params = $this->getMessageParameters(); 41 if ( isset( $params[4] ) && $params[4] === '1' ) { 42 $key .= '-noredirect'; 43 } 44 45 return $key; 46 } 47 48 protected function getMessageParameters() { 49 $params = parent::getMessageParameters(); 50 $oldname = $this->makePageLink( $this->entry->getTarget(), array( 'redirect' => 'no' ) ); 51 $newname = $this->makePageLink( Title::newFromText( $params[3] ) ); 52 $params[2] = Message::rawParam( $oldname ); 53 $params[3] = Message::rawParam( $newname ); 54 55 return $params; 56 } 57 58 public function getActionLinks() { 59 if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) // Action is hidden 60 || $this->entry->getSubtype() !== 'move' 61 || !$this->context->getUser()->isAllowed( 'move' ) 62 ) { 63 return ''; 64 } 65 66 $params = $this->extractParameters(); 67 $destTitle = Title::newFromText( $params[3] ); 68 if ( !$destTitle ) { 69 return ''; 70 } 71 72 $revert = Linker::linkKnown( 73 SpecialPage::getTitleFor( 'Movepage' ), 74 $this->msg( 'revertmove' )->escaped(), 75 array(), 76 array( 77 'wpOldTitle' => $destTitle->getPrefixedDBkey(), 78 'wpNewTitle' => $this->entry->getTarget()->getPrefixedDBkey(), 79 'wpReason' => $this->msg( 'revertmove' )->inContentLanguage()->text(), 80 'wpMovetalk' => 0 81 ) 82 ); 83 84 return $this->msg( 'parentheses' )->rawParams( $revert )->escaped(); 85 } 86 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |