122 if ( $this->path ===
false ) {
147 abstract public function toHtml( $options = [] );
171 return ( !$this->
isError() && ( $this->path || $this->path ===
null ) );
181 return ( !$this->
isError() && $this->path ===
null );
195 if ( $this->path ===
null ) {
196 return $this->file->getLocalRefPath();
199 $be = $this->file->getRepo()->getBackend();
201 $fsFile = $be->getLocalReference( [
'src' => $this->path ] );
203 return $fsFile ? $fsFile->getPath() :
false;
216 if ( !$this->path ) {
220 $be = $this->file->getRepo()->getBackend();
222 $be->streamFile( [
'src' => $this->path,
'headers' => $headers ] ) );
248 protected function linkWrap( $linkAttribs, $contents ) {
249 if ( isset( $linkAttribs[
'href'] ) ) {
250 return Xml::tags(
'a', $linkAttribs, $contents );
252 $parserEnableLegacyMediaDOM = MediaWikiServices::getInstance()
253 ->getMainConfig()->get( MainConfigNames::ParserEnableLegacyMediaDOM );
254 if ( $parserEnableLegacyMediaDOM ) {
257 return Xml::tags(
'span', $linkAttribs ?:
null, $contents );
266 if ( is_array( $params ) ) {
271 if ( $this->page && $this->page !== 1 ) {
278 if ( is_string( $params ) && $params !==
'' ) {
283 'href' => $this->file->getTitle()->getLocalURL( $query ),
286 $parserEnableLegacyMediaDOM = MediaWikiServices::getInstance()
287 ->getMainConfig()->get( MainConfigNames::ParserEnableLegacyMediaDOM );
288 if ( $parserEnableLegacyMediaDOM ) {
289 $attribs[
'class'] =
'image';
291 $attribs[
'class'] =
'mw-file-description';
295 $attribs[
'title'] =
$title;
wfArrayToCgi( $array1, $array2=null, $prefix='')
This function takes one or two arrays as input, and returns a CGI-style string, e....
static isStoragePath( $path)
Check if a given path is a "mwstore://" path.
static extensionFromPath( $path, $case='lowercase')
Get the final extension from a storage or FS path.
A class containing constants representing the names of configuration variables.
static newFatal( $message,... $parameters)
Factory function for fatal errors.
static newGood( $value=null)
Factory function for good results.
static wrap( $sv)
Succinct helper method to wrap a StatusValue.
static stream( $fname, $headers=[], $sendErrors=true, $optHeaders=[], $flags=0)
Stream a file to the browser, adding all the headings and fun stuff.
static tags( $element, $attribs, $contents)
Same as Xml::element(), but does not escape contents.