Fix issues identified by SpaceBeforeSingleLineComment sniff
[lhc/web/wiklou.git] / includes / media / MediaHandler.php
index b88a1b1..015eb5a 100644 (file)
@@ -180,10 +180,10 @@ abstract class MediaHandler {
        function convertMetadataVersion( $metadata, $version = 1 ) {
                if ( !is_array( $metadata ) ) {
 
-                       //unserialize to keep return parameter consistent.
-                       wfSuppressWarnings();
+                       // unserialize to keep return parameter consistent.
+                       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( '<span class="mime-type">' . $file->getMimeType() . '</span>' )->parse();
        }
 
        /**
@@ -859,4 +861,33 @@ abstract class MediaHandler {
        public function sanitizeParamsForBucketing( $params ) {
                return $params;
        }
+
+       /**
+        * Gets configuration for the file warning message. Return value of
+        * the following structure:
+        *   array(
+        *     // Required, module with messages loaded for the client
+        *     'module' => 'example.filewarning.messages',
+        *     // Required, array of names of messages
+        *     'messages' => array(
+        *       // Required, main warning message
+        *       'main' => 'example-filewarning-main',
+        *       // Optional, header for warning dialog
+        *       'header' => 'example-filewarning-header',
+        *       // Optional, footer for warning dialog
+        *       'footer' => 'example-filewarning-footer',
+        *       // Optional, text for more-information link (see below)
+        *       'info' => 'example-filewarning-info',
+        *     ),
+        *     // Optional, link for more information
+        *     'link' => 'http://example.com',
+        *   )
+        *
+        * Returns null if no warning is necessary.
+        * @param File $file
+        * @return array|null
+        */
+       public function getWarningConfig( $file ) {
+               return null;
+       }
 }