X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fmedia%2FMediaHandler.php;h=3a59996c58316d3bfefffc7049f81d1561f58a9c;hb=1162636d5a5e9e9e701c68341fa2bdcbe7c94b54;hp=b88a1b12a0ca9384ab4126374e20f909dc747c20;hpb=2a2bbf0a5ddb382d2ca1ef7618c42ce3023379d8;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/media/MediaHandler.php b/includes/media/MediaHandler.php index b88a1b12a0..3a59996c58 100644 --- a/includes/media/MediaHandler.php +++ b/includes/media/MediaHandler.php @@ -181,9 +181,9 @@ abstract class MediaHandler { if ( !is_array( $metadata ) ) { //unserialize to keep return parameter consistent. - wfSuppressWarnings(); + MediaWiki\suppressWarnings(); $ret = unserialize( $metadata ); - wfRestoreWarnings(); + MediaWiki\restoreWarnings(); return $ret; } @@ -507,9 +507,10 @@ abstract class MediaHandler { * to some standard. That makes it possible to do things like visual * indication of grouped and chained streams in ogg container files. * @param File $image + * @param bool|IContextSource $context Context to use (optional) * @return array|bool */ - function formatMetadata( $image ) { + function formatMetadata( $image, $context = false ) { return false; } @@ -520,15 +521,16 @@ abstract class MediaHandler { * This is used by the media handlers that use the FormatMetadata class * * @param array $metadataArray Metadata array + * @param bool|IContextSource $context Context to use (optional) * @return array Array for use displaying metadata. */ - function formatMetadataHelper( $metadataArray ) { + function formatMetadataHelper( $metadataArray, $context = false ) { $result = array( 'visible' => array(), 'collapsed' => array() ); - $formatted = FormatMetadata::getFormattedData( $metadataArray ); + $formatted = FormatMetadata::getFormattedData( $metadataArray, $context ); // Sort fields into visible and collapsed $visibleFields = $this->visibleMetadataFields(); foreach ( $formatted as $name => $value ) { @@ -637,7 +639,7 @@ abstract class MediaHandler { */ static function getGeneralLongDesc( $file ) { return wfMessage( 'file-info' )->sizeParams( $file->getSize() ) - ->params( $file->getMimeType() )->parse(); + ->params( '' . $file->getMimeType() . '' )->parse(); } /** @@ -859,4 +861,26 @@ abstract class MediaHandler { public function sanitizeParamsForBucketing( $params ) { return $params; } + + /** + * Gets configuration for the file warning message. Return value of + * the following structure: + * array( + * 'module' => 'example.filewarning.messages', // Required, module with messages loaded for the client + * 'messages' => array( // Required, array of names of messages + * 'main' => 'example-filewarning-main', // Required, main warning message + * 'header' => 'example-filewarning-header', // Optional, header for warning dialog + * 'footer' => 'example-filewarning-footer', // Optional, footer for warning dialog + * 'info' => 'example-filewarning-info', // Optional, text for more-information link (see below) + * ), + * 'link' => 'http://example.com', // Optional, link for more information + * ) + * + * Returns null if no warning is necessary. + * @param File $file + * @return array|null + */ + public function getWarningConfig( $file ) { + return null; + } }