roundcubemail/program/lib/Roundcube/rcube_utils.php
public static function file2class($mimetype, $filename)
    {
        $mimetype = strtolower($mimetype);
        $filename = strtolower($filename);

        list($primary, $secondary) = explode('/', $mimetype);

        $classes = array($primary ?: 'unknown');

        if ($secondary) {
            $classes[] = $secondary;
        }

        if (preg_match('/\.([a-z0-9]+)$/', $filename, $m)) {
            if (!in_array($m[1], $classes)) {
                $classes[] = $m[1];
            }
        }

        return join(" ", $classes);
    }
public static function file2class($mimetype, $filename)
    {
        $mimetype = strtolower($mimetype);
        $filename = strtolower($filename);

        list($primary, $secondary) = explode('/', $mimetype);

        $classes = array($primary ?: 'unknown');

        if ($secondary) {
            $classes[] = $secondary;
        }

        if (preg_match('/\.([a-z0-9]+)$/', $filename, $m)) {
            if (!in_array($m[1], $classes)) {
                $classes[] = $m[1];
            }
        }

        return join(" ", $classes);
    }
public static function file2class ( $ mimetype , $ filename ) { $ mimetype = strtolower ( $ mimetype ) ; $ filename = strtolower ( $ filename ) ; list ( $ primary , $ secondary ) = explode ( '/' , $ mimetype ) ; $ classes = array ( $ primary ? : 'unknown' ) ; if ( $ secondary ) { $ classes [ ] = $ secondary ; } if ( preg_match ( '/\.([a-z0-9]+)$/' , $ filename , $ m ) ) { if ( ! in_array ( $ m [ 1 ] , $ classes ) ) { $ classes [ ] = $ m [ 1 ] ; } } return join ( " " , $ classes ) ; }
Generate CSS classes from mimetype and filename extension

@param string $mimetype Mimetype
@param string $filename Filename

@return string CSS classes separated by space
Generate CSS classes from mimetype and filename extension