MediaWiki  master
UploadStashException.php
Go to the documentation of this file.
1 <?php
29  protected $messageSpec;
30 
37  public function __construct( $messageSpec, $code = 0, Throwable $previous = null ) {
38  $this->messageSpec = $messageSpec;
39 
40  $msg = $this->getMessageObject()->text();
41  $msg = preg_replace( '!</?(var|kbd|samp|code)>!', '"', $msg );
42  $msg = Sanitizer::stripAllTags( $msg );
43  parent::__construct( $msg, $code, $previous );
44  }
45 
46  public function getMessageObject() {
47  return Message::newFromSpecifier( $this->messageSpec );
48  }
49 }
Message\newFromSpecifier
static newFromSpecifier( $value)
Transform a MessageSpecifier or a primitive value used interchangeably with specifiers (a message key...
Definition: Message.php:423
Sanitizer\stripAllTags
static stripAllTags( $html)
Take a fragment of (potentially invalid) HTML and return a version with any tags removed,...
Definition: Sanitizer.php:1574
UploadStashException\$messageSpec
string array MessageSpecifier $messageSpec
Definition: UploadStashException.php:29
MessageSpecifier
Stable for implementing.
Definition: MessageSpecifier.php:24
UploadStashException\getMessageObject
getMessageObject()
Return a Message object for this exception.
Definition: UploadStashException.php:46
MWException
MediaWiki exception.
Definition: MWException.php:29
ILocalizedException
Interface for MediaWiki-localized exceptions.
Definition: ILocalizedException.php:29
UploadStashException\__construct
__construct( $messageSpec, $code=0, Throwable $previous=null)
Definition: UploadStashException.php:37
UploadStashException
@newable
Definition: UploadStashException.php:27