MediaWiki REL1_31
LocalizedException.php
Go to the documentation of this file.
1<?php
32 public function getMessageObject();
33}
34
42class LocalizedException extends Exception implements ILocalizedException {
44 protected $messageSpec;
45
51 public function __construct( $messageSpec, $code = 0, $previous = null ) {
52 $this->messageSpec = $messageSpec;
53
54 // Exception->getMessage() should be in plain English, not localized.
55 // So fetch the English version of the message, without local
56 // customizations, and make a basic attempt to turn markup into text.
57 $msg = $this->getMessageObject()->inLanguage( 'en' )->useDatabase( false )->text();
58 $msg = preg_replace( '!</?(var|kbd|samp|code)>!', '"', $msg );
59 $msg = Sanitizer::stripAllTags( $msg );
60 parent::__construct( $msg, $code, $previous );
61 }
62
63 public function getMessageObject() {
64 return Message::newFromSpecifier( $this->messageSpec );
65 }
66}
Basic localized exception.
__construct( $messageSpec, $code=0, $previous=null)
string array MessageSpecifier $messageSpec
getMessageObject()
Return a Message object for this exception.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
Definition hooks.txt:865
Interface for MediaWiki-localized exceptions.
getMessageObject()
Return a Message object for this exception.