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;
}
* 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;
}
* 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 ) {
*/
static function getGeneralLongDesc( $file ) {
return wfMessage( 'file-info' )->sizeParams( $file->getSize() )
- ->params( $file->getMimeType() )->parse();
+ ->params( '<span class="mime-type">' . $file->getMimeType() . '</span>' )->parse();
}
/**
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;
+ }
}