Subversion Repositories fileformats

Rev

Rev 2 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 9
Line 4... Line 4...
4
define('APACHE_MIME_TYPES_URL','https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types');
4
define('APACHE_MIME_TYPES_URL','https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types');
5
 
5
 
6
function generateUpToDateMimeArray($url) {
6
function generateUpToDateMimeArray($url) {
7
        // Based on https://www.php.net/manual/de/function.mime-content-type.php#107798 , modified
7
        // Based on https://www.php.net/manual/de/function.mime-content-type.php#107798 , modified
8
        $s = array();
8
        $s = array();
-
 
9
        $dupcheck = array();
9
        foreach (@explode("\n",@file_get_contents($url))as $x) {
10
        foreach (@explode("\n",@file_get_contents($url))as $x) {
10
                if (isset($x[0])&&$x[0]!=='#'&&preg_match_all('#([^\s]+)#',$x,$out)&&isset($out[1])&&($c=count($out[1]))>1) {
11
                if (isset($x[0])&&$x[0]!=='#'&&preg_match_all('#([^\s]+)#',$x,$out)&&isset($out[1])&&($c=count($out[1]))>1) {
11
                        for ($i=1;$i<$c;$i++) {
12
                        for ($i=1;$i<$c;$i++) {
-
 
13
                                if (!isset($dupcheck[$out[1][$i]])) {
12
                                $s[] = "\t'".$out[1][$i]."' => '".$out[1][0]."'";
14
                                        $s[] = "\t'".$out[1][$i]."' => '".$out[1][0]."'";
-
 
15
                                        $dupcheck[$out[1][$i]] = true;
-
 
16
                                }
13
                        }
17
                        }
14
                }
18
                }
15
        }
19
        }
16
        return @sort($s) ? "\$mime_types = array(\n".implode($s,",\n")."\n);" : false;
20
        return @sort($s) ? "\$mime_types = array(\n".implode($s,",\n")."\n);" : false;
17
}
21
}