Manual:Hooks/MimeMagicGuessFromContent
From Linux Web Expert
MimeMagicGuessFromContent | |
---|---|
<translate> Available from <tvar name=1><translate> version <tvar (Gerrit change 141240)</tvar></translate> Allows MW extensions guess the MIME by content. | |
<translate> Define function:</translate> | public static function onMimeMagicGuessFromContent( $mimeAnalyzer, &$head, &$tail, $file, &$mime ) { ... }
|
<translate> Attach hook:</translate> | <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
"Hooks": {
"MimeMagicGuessFromContent": "MediaWiki\\Extension\\MyExtension\\Hooks::onMimeMagicGuessFromContent"
}
}
|
<translate> Called from:</translate> | <translate> File(s):</translate> ServiceWiring.php <translate> Function(s):</translate> MimeAnalyzer::guessCallback |
<translate> Interface:</translate> | MimeMagicGuessFromContentHook.php |
<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:MimeMagicGuessFromContent extensions</tvar>.</translate>
Details
- $mimeMagic
- Instance of MimeMagic.
- &$head
- First 1024 bytes of the file in a string (in - Do not alter!).
- &$tail
- More or equal than last 65558 bytes of the file in a string (input only - passed by reference for performance - do not alter!).
- $file
- File path.
- &$mime
- MIME type (out).