X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FMimeMagic.php;h=3448c6aa5cd169b72b0febfe6513bad223bd6aed;hb=b9fd30a4e41c1ccce4afdcdd4f0fe8dbc47bf5e8;hp=e3b85777c817d78d4b95b11df01d8150a737856e;hpb=3ba51575cd7718a423bfbb29956c04c8287af8df;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/MimeMagic.php b/includes/MimeMagic.php index e3b85777c8..3448c6aa5c 100644 --- a/includes/MimeMagic.php +++ b/includes/MimeMagic.php @@ -348,7 +348,7 @@ class MimeMagic { * 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 ) { @@ -374,7 +374,7 @@ class MimeMagic { * 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 ) { @@ -388,7 +388,7 @@ class MimeMagic { * 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 ) { @@ -409,8 +409,8 @@ class MimeMagic { * 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 ) { @@ -430,7 +430,7 @@ class MimeMagic { * 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 */ @@ -458,6 +458,7 @@ class MimeMagic { * * @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 ) { @@ -493,10 +494,10 @@ class MimeMagic { * 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' ) { @@ -535,12 +536,12 @@ class MimeMagic { * 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 $ext Mixed: 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. + * @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. @@ -744,11 +745,11 @@ class MimeMagic { * header data. Currently works for OpenDocument and OpenXML types... * If can't tell, returns 'application/zip'. * - * @param string $header some reasonably-sized chunk of file header - * @param $tail String: the tail of the file - * @param $ext Mixed: the file extension, or true to extract it from the filename. - * Set it to false (default) to ignore the extension. DEPRECATED! Set to false, - * use improveTypeFromExtension($mime, $ext) later to improve mime type. + * @param string $header Some reasonably-sized chunk of file header + * @param string|null $tail The tail of the file + * @param string|bool $ext The file extension, or true to extract it from the filename. + * Set it to false (default) to ignore the extension. DEPRECATED! Set to false, + * use improveTypeFromExtension($mime, $ext) later to improve mime type. * * @return string */ @@ -850,12 +851,12 @@ class MimeMagic { * mime type if the file is an image. If no mime type can be determined, * this function returns 'unknown/unknown'. * - * @param string $file the file to check - * @param $ext Mixed: 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. + * @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 */ private function detectMimeType( $file, $ext = true ) { global $wgMimeDetectorCommand; @@ -950,11 +951,11 @@ class MimeMagic { * @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 ) { @@ -1040,6 +1041,7 @@ class MimeMagic { * * This function relies on the mapping defined by $this->mMediaTypes * @access private + * @param string $extMime * @return int|string */ function findMediaType( $extMime ) { @@ -1075,10 +1077,10 @@ class MimeMagic { * 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();