MediaWiki  master
UploadStashException.php
Go to the documentation of this file.
1 <?php
24 
31  protected $messageSpec;
32 
39  public function __construct( $messageSpec, $code = 0, Throwable $previous = null ) {
40  $this->messageSpec = $messageSpec;
41 
42  $msg = $this->getMessageObject()->text();
43  $msg = preg_replace( '!</?(var|kbd|samp|code)>!', '"', $msg );
44  $msg = Sanitizer::stripAllTags( $msg );
45  parent::__construct( $msg, $code, $previous );
46  }
47 
48  public function getMessageObject() {
49  return Message::newFromSpecifier( $this->messageSpec );
50  }
51 }
MediaWiki exception.
Definition: MWException.php:33
HTML sanitizer for MediaWiki.
Definition: Sanitizer.php:46
static newFromSpecifier( $value)
Transform a MessageSpecifier or a primitive value used interchangeably with specifiers (a message key...
Definition: Message.php:427
string array MessageSpecifier $messageSpec
getMessageObject()
Return a Message object for this exception.
__construct( $messageSpec, $code=0, Throwable $previous=null)
Interface for MediaWiki-localized exceptions.