MediaWiki  master
UploadStashException.php
Go to the documentation of this file.
1 <?php
28  protected $messageSpec;
29 
36  public function __construct( $messageSpec, $code = 0, Throwable $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 }
Message\newFromSpecifier
static newFromSpecifier( $value)
Transform a MessageSpecifier or a primitive value used interchangeably with specifiers (a message key...
Definition: Message.php:434
Sanitizer\stripAllTags
static stripAllTags( $html)
Take a fragment of (potentially invalid) HTML and return a version with any tags removed,...
Definition: Sanitizer.php:1860
UploadStashException\$messageSpec
string array MessageSpecifier $messageSpec
Definition: UploadStashException.php:28
MessageSpecifier
Definition: MessageSpecifier.php:21
UploadStashException\getMessageObject
getMessageObject()
Return a Message object for this exception.
Definition: UploadStashException.php:45
MWException
MediaWiki exception.
Definition: MWException.php:26
ILocalizedException
Interface for MediaWiki-localized exceptions.
Definition: ILocalizedException.php:27
UploadStashException\__construct
__construct( $messageSpec, $code=0, Throwable $previous=null)
Definition: UploadStashException.php:36
UploadStashException
Definition: UploadStashException.php:26