*/ class MediaWikiFileUrlFinder implements FileUrlFinder { public function getUrlForFileName( string $fileName ): string { $colonPosition = strpos( $fileName, ':' ); $titleWithoutPrefix = $colonPosition === false ? $fileName : substr( $fileName, $colonPosition + 1 ); $title = Title::newFromText( trim( $titleWithoutPrefix ), NS_FILE ); if ( $title !== null && $title->exists() ) { return ( new ImagePage( $title ) )->getDisplayedFile()->getURL(); } return trim( $fileName ); } }