MediaWiki  master
UploadStashException.php
Go to the documentation of this file.
1 <?php
28  protected $messageSpec;
29 
36  public function __construct( $messageSpec, $code = 0, $previous = null ) {
37  $this->messageSpec = $messageSpec;
38 
39  $msg = $this->getMessageObject()->text();
40  $msg = preg_replace( '!</?(var|kbd|samp|code)>!', '"', $msg );
41  $msg = Sanitizer::stripAllTags( $msg );
42  parent::__construct( $msg, $code, $previous );
43  }
44 
45  public function getMessageObject() {
46  return Message::newFromSpecifier( $this->messageSpec );
47  }
48 }
getMessageObject()
Return a Message object for this exception.
static stripAllTags( $html)
Take a fragment of (potentially invalid) HTML and return a version with any tags removed, encoded as plain text.
Definition: Sanitizer.php:2041
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
Interface for MediaWiki-localized exceptions.
__construct( $messageSpec, $code=0, $previous=null)