MediaWiki master
MediaTransformError.php
Go to the documentation of this file.
1<?php
25
35 private $msg;
36
45 public function __construct( $msg, $width, $height, ...$args ) {
46 $this->msg = wfMessage( $msg )->params( $args );
47 $this->width = (int)$width;
48 $this->height = (int)$height;
49 $this->url = false;
50 $this->path = false;
51 }
52
53 public function toHtml( $options = [] ) {
54 return "<div class=\"MediaTransformError\" style=\"" .
55 "width: {$this->width}px; height: {$this->height}px; display:inline-block;\">" .
56 $this->getHtmlMsg() .
57 "</div>";
58 }
59
60 public function toText() {
61 return $this->msg->text();
62 }
63
64 public function getHtmlMsg() {
65 return $this->msg->escaped();
66 }
67
68 public function getMsg() {
69 return $this->msg;
70 }
71
72 public function isError() {
73 return true;
74 }
75
81 public function getHttpStatusCode() {
82 return 500;
83 }
84}
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().
The Message class deals with fetching and processing of interface message into a variety of formats.
Definition Message.php:158