MediaWiki master
MediaTransformError.php
Go to the documentation of this file.
1<?php
13
23 private $msg;
24
33 public function __construct( $msg, $width, $height, ...$args ) {
34 $this->msg = wfMessage( $msg )->params( $args );
35 $this->width = (int)$width;
36 $this->height = (int)$height;
37 $this->url = false;
38 $this->path = false;
39 }
40
42 public function toHtml( $options = [] ) {
43 return "<div class=\"MediaTransformError\" style=\"" .
44 "width: {$this->width}px; height: {$this->height}px; display:inline-block;\">" .
45 $this->getHtmlMsg() .
46 "</div>";
47 }
48
52 public function toText() {
53 return $this->msg->text();
54 }
55
59 public function getHtmlMsg() {
60 return $this->msg->escaped();
61 }
62
66 public function getMsg() {
67 return $this->msg;
68 }
69
71 public function isError() {
72 return true;
73 }
74
80 public function getHttpStatusCode() {
81 return 500;
82 }
83}
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.alt Alternate text or caption desc-link Boolean,...
isError()
This will be overridden to return true in error classes.bool
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:144
Value object representing a message parameter that consists of a list of values.