- /**
- * Returns the appropriate MIME type for a given content format,
- * or null if no MIME type is known for this format.
- *
- * MIME types can be registered in the global array $wgContentFormatMimeTypes.
- *
- * @static
- * @param $id int The content format id, as given by a CONTENT_FORMAT_XXX
- * constant or returned by Revision::getContentFormat().
- *
- * @return string|null The content format's MIME type.
- */
- public static function getContentFormatMimeType( $id ) {
- global $wgContentFormatMimeTypes;
-
- if ( !isset( $wgContentFormatMimeTypes[ $id ] ) ) {
- return null;
- }
-
- return $wgContentFormatMimeTypes[ $id ];
- }
-
- /**
- * Returns the content format if for a given MIME type,
- * or null if no format ID if known for this MIME type.
- *
- * Mime types can be registered in the global array $wgContentFormatMimeTypes.
- *
- * @static
- * @param $mime string the MIME type
- *
- * @return int|null The format ID, as defined by a CONTENT_FORMAT_XXX constant
- */
- public static function getContentFormatID( $mime ) {
- global $wgContentFormatMimeTypes;
-
- static $format_ids = null;
-
- if ( $format_ids === null ) {
- $format_ids = array_flip( $wgContentFormatMimeTypes );
- }
-
- if ( !isset( $format_ids[ $mime ] ) ) {
- return null;
- }
-
- return $format_ids[ $mime ];
- }
-
- /**
- * Returns the symbolic name for a given content model.
- *
- * @param $id int The content model ID, as given by a CONTENT_MODEL_XXX
- * constant or returned by Revision::getContentModel().
- *
- * @return string The content model's symbolic name.
- * @throws MWException if the model id isn't known.
- */
- public static function getContentModelName( $id ) {
- $handler = self::getForModelID( $id );
- return $handler->getModelName();
- }
-
-