diff options
| author | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-12-16 18:38:59 +0000 |
|---|---|---|
| committer | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-12-16 18:38:59 +0000 |
| commit | edb5c078d3ea1afbc63669ce4eb93eef224259b7 (patch) | |
| tree | e603e73cbaf3f91ec19ece69326f931b15b784c2 /roundcubemail/program/include/main.inc | |
| parent | dd656467d101bef66fcefcf7e6d5d7962f8cda08 (diff) | |
Add more classes and options to HTML elements for better styleability
git-svn-id: https://svn.roundcube.net/trunk@5623 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/main.inc')
| -rw-r--r-- | roundcubemail/program/include/main.inc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/roundcubemail/program/include/main.inc b/roundcubemail/program/include/main.inc index 55f0a8aae..012ee8ddf 100644 --- a/roundcubemail/program/include/main.inc +++ b/roundcubemail/program/include/main.inc @@ -1608,6 +1608,26 @@ function rcmail_display_server_error($fallback=null, $fallback_args=null) /** + * Generate CSS classes from mimetype and filename extension + * + * @param string Mimetype + * @param string The filename + * @return string CSS classes separated by space + */ +function rcmail_filetype2classname($mimetype, $filename) +{ + list($primary, $secondary) = explode('/', $mimetype); + + $classes = array($primary ? $primary : 'unknown'); + if ($secondary) + $classes[] = $secondary; + if (preg_match('/\.([a-z0-9]+)$/', $filename, $m)) + $classes[] = $m[1]; + + return join(" ", $classes); +} + +/** * Output HTML editor scripts * * @param string Editor mode |
