Login | ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/fileformats/trunk/VtsFileTypeDetect.class.php
(Generate patch)

Comparing trunk/VtsFileTypeDetect.class.php (file contents):
Revision 7 by daniel-marschall, Sun Nov 15 13:47:58 2020 UTC vs.
Revision 8 by daniel-marschall, Sun May 23 21:06:46 2021 UTC

# Line 2 | Line 2
2  
3   /*
4   * File Type Detection for PHP
5 < * Copyright 2020 Daniel Marschall, ViaThinkSoft
5 > * Copyright 2020 - 2021 Daniel Marschall, ViaThinkSoft
6   *
7 < *    Revision 2020-05-17
7 > *    Revision 2021-05-21
8   *
9   * Licensed under the Apache License, Version 2.0 (the "License");
10   * you may not use this file except in compliance with the License.
# Line 22 | Line 22
22   class VtsFileTypeDetect {
23  
24          public static function getMimeType($filename) {
25 <            $mime_types = array();
26 <            
25 >                $mime_types = array();
26 >
27                  include __DIR__ . '/mimetype_lookup.inc.php';
28  
29 +                /** @phpstan-ignore-next-line */
30                  foreach ($mime_types as $ext => $mime) {
31                          if (strtoupper(substr($filename, -strlen($ext)-1)) == strtoupper('.'.$ext)) {
32                                  return $mime;
# Line 83 | Line 84 | class VtsFileTypeDetect {
84                          }
85                  }
86  
87 <                return $ini['Static']['LngUnknown'];
87 >                foreach ($inis as $ini) {
88 >                        if (isset($ini['Static']['LngUnknown'])) {
89 >                                return $ini['Static']['LngUnknown'];
90 >                        }
91 >                }
92 >                return 'Unknown';
93          }
94  
95   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines