[ Index ]

PHP Cross Reference of phpBB-3.2.11-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 comparision function in
order to sort the guessers from high to low.
Method has been set to public in order to allow proper testing.

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

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

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

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.

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

Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1