124 if ( $this->path ===
false ) {
149 abstract public function toHtml( $options = [] );
173 return ( !$this->
isError() && ( $this->path || $this->path ===
null ) );
183 return ( !$this->
isError() && $this->path ===
null );
197 if ( $this->path ===
null ) {
198 return $this->file->getLocalRefPath();
201 $be = $this->file->getRepo()->getBackend();
203 $fsFile = $be->getLocalReference( [
'src' => $this->path ] );
205 return $fsFile ? $fsFile->getPath() :
false;
218 if ( !$this->path ) {
219 return Status::newFatal(
'backend-fail-stream',
'<no path>' );
222 $be = $this->file->getRepo()->getBackend();
224 $be->streamFile( [
'src' => $this->path,
'headers' => $headers ] ) );
228 return $success ? Status::newGood() : Status::newFatal(
'backend-fail-stream', $this->path );
250 protected function linkWrap( $linkAttribs, $contents ) {
251 if ( isset( $linkAttribs[
'href'] ) ) {
252 return Xml::tags(
'a', $linkAttribs, $contents );
254 $parserEnableLegacyMediaDOM = MediaWikiServices::getInstance()
255 ->getMainConfig()->get( MainConfigNames::ParserEnableLegacyMediaDOM );
256 if ( $parserEnableLegacyMediaDOM ) {
259 return Xml::tags(
'span', $linkAttribs ?:
null, $contents );
268 if ( is_array( $params ) ) {
273 if ( $this->page && $this->page !== 1 ) {
280 if ( is_string( $params ) && $params !==
'' ) {
285 'href' => $this->file->getTitle()->getLocalURL( $query ),
288 $parserEnableLegacyMediaDOM = MediaWikiServices::getInstance()
289 ->getMainConfig()->get( MainConfigNames::ParserEnableLegacyMediaDOM );
290 if ( $parserEnableLegacyMediaDOM ) {
291 $attribs[
'class'] =
'image';
293 $attribs[
'class'] =
'mw-file-description';
297 $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 tags( $element, $attribs, $contents)
Same as Xml::element(), but does not escape contents.