* separated string or null if the mime type was unrecognized. Resolves
* mime type aliases.
*
- * @param $mime string
+ * @param string $mime
* @return string|null
*/
public function getExtensionsForType( $mime ) {
* Returns a list of mime types for a given file extension as a space
* separated string or null if the extension was unrecognized.
*
- * @param $ext string
+ * @param string $ext
* @return string|null
*/
public function getTypesForExtension( $ext ) {
* Returns a single mime type for a given file extension or null if unknown.
* This is always the first type from the list returned by getTypesForExtension($ext).
*
- * @param $ext string
+ * @param string $ext
* @return string|null
*/
public function guessTypesForExtension( $ext ) {
* match was found, null if the mime type is unknown, and false if the
* mime type is known but no matches where found.
*
- * @param $extension string
- * @param $mime string
+ * @param string $extension
+ * @param string $mime
* @return bool|null
*/
public function isMatchingExtension( $extension, $mime ) {
* Returns true if the mime type is known to represent an image format
* supported by the PHP GD library.
*
- * @param $mime string
+ * @param string $mime
*
* @return bool
*/
*
* @todo Be more accurate when using fancy mime detector plugins;
* right now this is the bare minimum getimagesize() list.
+ * @param string $extension
* @return bool
*/
function isRecognizableExtension( $extension ) {
* If $mime is "application/x-opc+zip" and isMatchingExtension( $ext, $mime )
* gives true, return the result of guessTypesForExtension($ext).
*
- * @param string $mime the mime type, typically guessed from a file's content.
- * @param string $ext the file extension, as taken from the file name
+ * @param string $mime The mime type, typically guessed from a file's content.
+ * @param string $ext The file extension, as taken from the file name
*
- * @return string the mime type
+ * @return string The mime type
*/
public function improveTypeFromExtension( $mime, $ext ) {
if ( $mime === 'unknown/unknown' ) {
* detection (namely XML based formats like XHTML or SVG, as well as ZIP
* based formats like OPC/ODF files).
*
- * @param string $file the file to check
+ * @param string $file The file to check
* @param string|bool $ext The file extension, or true (default) to extract it from the filename.
* Set it to false to ignore the extension. DEPRECATED! Set to false, use
* improveTypeFromExtension($mime, $ext) later to improve mime type.
*
- * @return string the mime type of $file
+ * @return string The mime type of $file
*/
public function guessMimeType( $file, $ext = true ) {
if ( $ext ) { // TODO: make $ext default to false. Or better, remove it.
* Set it to false to ignore the extension. DEPRECATED! Set to false, use
* improveTypeFromExtension($mime, $ext) later to improve mime type.
*
- * @return string the mime type of $file
+ * @return string The mime type of $file
*/
private function detectMimeType( $file, $ext = true ) {
global $wgMimeDetectorCommand;
* @todo analyse file if need be
* @todo look at multiple extension, separately and together.
*
- * @param string $path full path to the image file, in case we have to look at the contents
+ * @param string $path Full path to the image file, in case we have to look at the contents
* (if null, only the mime type is used to determine the media type code).
- * @param string $mime mime type. If null it will be guessed using guessMimeType.
+ * @param string $mime Mime type. If null it will be guessed using guessMimeType.
*
- * @return (int?string?) a value to be used with the MEDIATYPE_xxx constants.
+ * @return string A value to be used with the MEDIATYPE_xxx constants.
*/
function getMediaType( $path = null, $mime = null ) {
if ( !$mime && !$path ) {
*
* This function relies on the mapping defined by $this->mMediaTypes
* @access private
+ * @param string $extMime
* @return int|string
*/
function findMediaType( $extMime ) {
* Get the MIME types that various versions of Internet Explorer would
* detect from a chunk of the content.
*
- * @param string $fileName the file name (unused at present)
- * @param string $chunk the first 256 bytes of the file
- * @param string $proposed the MIME type proposed by the server
- * @return Array
+ * @param string $fileName The file name (unused at present)
+ * @param string $chunk The first 256 bytes of the file
+ * @param string $proposed The MIME type proposed by the server
+ * @return array
*/
public function getIEMimeTypes( $fileName, $chunk, $proposed ) {
$ca = $this->getIEContentAnalyzer();