[ Index ]

PHP Cross Reference of phpBB-3.3.0-deutsch




/phpbb/mimetype/ -> guesser.php (summary)

This file is part of the phpBB Forum Software package.

Copyright: (c) phpBB Limited
License: GNU General Public License, version 2 (GPL-2.0)
File Size: 156 lines (4 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

guesser:: (5 methods):

Class: guesser  - X-Ref

__construct($mimetype_guessers)   X-Ref
Construct a mimetype guesser object

param: array $mimetype_guessers Mimetype guesser service collection

register_guessers($mimetype_guessers)   X-Ref
Register MimeTypeGuessers and sort them by priority

param: array $mimetype_guessers Mimetype guesser service collection

sort_priority($guesser_a, $guesser_b)   X-Ref
Sort the priority of supplied guessers
This is a compare function for usort. A guesser with higher priority
should be used first and vice versa. usort() orders the array values
from low to high depending on what the comparison function returns
to it. Return value should be smaller than 0 if value a is smaller
than value b. This has been reversed in the comparison function in
order to sort the guessers from high to low.
Method has been set to public in order to allow proper testing.

return: int     If both guessers have the same priority 0, bigger
param: object $guesser_a Mimetype guesser a
param: object $guesser_b Mimetype guesser b

guess($file, $file_name = '')   X-Ref
Guess mimetype of supplied file

return: string Guess for mimetype of file
param: string $file Path to file
param: string $file_name The real file name

choose_mime_type($mime_type, $guess)   X-Ref
Choose the best mime type based on the current mime type and the guess
If a guesser returns nulls or application/octet-stream, we will keep
the current guess. Guesses with a slash inside them will be favored over
already existing ones. However, any guess that will pass the first check
will always overwrite the default application/octet-stream.

return: string The best mime type based on current mime type and guess
param: string    $mime_type    The current mime type
param: string    $guess        The current mime type guess

Generated: Tue Apr 7 19:44:41 2020 Cross-referenced by PHPXref 0.7.1