MediaWiki  master
MediaTransformError.php
Go to the documentation of this file.
1 <?php
33  private $msg;
34 
43  public function __construct( $msg, $width, $height, ...$args ) {
44  $this->msg = wfMessage( $msg )->params( $args );
45  $this->width = intval( $width );
46  $this->height = intval( $height );
47  $this->url = false;
48  $this->path = false;
49  }
50 
51  public function toHtml( $options = [] ) {
52  return "<div class=\"MediaTransformError\" style=\"" .
53  "width: {$this->width}px; height: {$this->height}px; display:inline-block;\">" .
54  $this->getHtmlMsg() .
55  "</div>";
56  }
57 
58  public function toText() {
59  return $this->msg->text();
60  }
61 
62  public function getHtmlMsg() {
63  return $this->msg->escaped();
64  }
65 
66  public function getMsg() {
67  return $this->msg;
68  }
69 
70  public function isError() {
71  return true;
72  }
73 
79  public function getHttpStatusCode() {
80  return 500;
81  }
82 }
MediaTransformError\isError
isError()
This will be overridden to return true in error classes.
Definition: MediaTransformError.php:70
MediaTransformError
Basic media transform error class.
Definition: MediaTransformError.php:31
MediaTransformError\$msg
Message $msg
Definition: MediaTransformError.php:33
wfMessage
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Definition: GlobalFunctions.php:1220
MediaTransformError\__construct
__construct( $msg, $width, $height,... $args)
Stable to call.
Definition: MediaTransformError.php:43
MediaTransformError\getHtmlMsg
getHtmlMsg()
Definition: MediaTransformError.php:62
$args
if( $line===false) $args
Definition: mcc.php:124
MediaTransformError\toHtml
toHtml( $options=[])
Fetch HTML for this transform output.
Definition: MediaTransformError.php:51
MediaTransformOutput\$height
int $height
Image height.
Definition: MediaTransformOutput.php:43
MediaTransformError\getMsg
getMsg()
Definition: MediaTransformError.php:66
MediaTransformOutput
Base class for the output of MediaHandler::doTransform() and File::transform().
Definition: MediaTransformOutput.php:30
MediaTransformError\toText
toText()
Definition: MediaTransformError.php:58
Message
The Message class deals with fetching and processing of interface message into a variety of formats.
Definition: Message.php:161
MediaTransformError\getHttpStatusCode
getHttpStatusCode()
Stable to override.
Definition: MediaTransformError.php:79
MediaTransformOutput\$width
int $width
Image width.
Definition: MediaTransformOutput.php:40