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 = (int)$width;
46 $this->height = (int)$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}
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Basic media transform error class.
__construct( $msg, $width, $height,... $args)
toHtml( $options=[])
Fetch HTML for this transform output.
isError()
This will be overridden to return true in error classes.
Base class for the output of MediaHandler::doTransform() and File::transform().