diff -u -r1.94 filelib.php --- lib/filelib.php 5 Sep 2008 11:02:48 -0000 1.94 +++ lib/filelib.php 5 Sep 2008 16:27:12 -0000 @@ -596,24 +596,28 @@ * Get information about a filetype based on the icon file. * @param string $element Desired information (usually 'icon') * @param string $icon Icon file path. + * @param boolean $all return all matching entries (defaults to false - last match) * @return string Requested piece of information from array */ -function mimeinfo_from_icon($element, $icon) { +function mimeinfo_from_icon($element, $icon, $all=false) { $mimeinfo = get_mimetypes_array(); if (preg_match("/\/(.*)/", $icon, $matches)) { $icon = $matches[1]; } - $info = $mimeinfo['xxx'][$element]; // Default + $info = array($mimeinfo['xxx'][$element]); // Default foreach($mimeinfo as $values) { if($values['icon']==$icon) { if(isset($values[$element])) { - $info = $values[$element]; + $info[] = $values[$element]; } //No break, for example for 'excel.gif' we don't want 'csv'! } } - return $info; + if ($all) { + return $info; + } + return array_pop($info); // Return last match (mimicking previous behavior before I added [] - Penny 20080905) } /**