Subversion Repositories php_utils

Rev

Rev 7 | Rev 32 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7 Rev 24
Line 31... Line 31...
31
                return true;
31
                return true;
32
        }
32
        }
33
 
33
 
34
        private static function getMimeType($file_extension) {
34
        private static function getMimeType($file_extension) {
35
                $file_extension = strtolower($file_extension);
35
                $file_extension = strtolower($file_extension);
-
 
36
                if (!class_exists('VtsFileTypeDetect')) {
-
 
37
                        // https://github.com/danielmarschall/fileformats
-
 
38
                        throw new Exception("Require 'fileformats' package");
-
 
39
                }
36
                return VtsFileTypeDetect::getMimeType('dummy.'.$file_extension);
40
                return VtsFileTypeDetect::getMimeType('dummy.'.$file_extension);
37
        }
41
        }
38
 
42
 
39
        public static function output_file($file, $mime_type='', $inline_mode=2/*2=auto*/) {
43
        public static function output_file($file, $mime_type='', $inline_mode=2/*2=auto*/) {
40
                // Partitally taken from:
44
                // Partitally taken from: