Skip to content

Commit

Permalink
MDL-22061 get_mimetype_description() does not rely on get_string() re…
Browse files Browse the repository at this point in the history
…turning square brackets
  • Loading branch information
mudrd8mz committed May 4, 2010
1 parent 9a6606b commit 1b80c91
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/filelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1383,11 +1383,10 @@ function file_extension_icon($filename, $size=null) {
* @return string Text description
*/
function get_mimetype_description($mimetype,$capitalise=false) {
$result=get_string($mimetype,'mimetypes');
// Surrounded by square brackets indicates that there isn't a string for that
// (maybe there is a better way to find this out?)
if(strpos($result,'[')===0) {
$result=get_string('document/unknown','mimetypes');
if (get_string_manager()->string_exists($mimetype, 'mimetypes')) {
$result = get_string($mimetype, 'mimetypes');
} else {
$result = get_string('document/unknown','mimetypes');
}
if($capitalise) {
$result=ucfirst($result);
Expand Down

0 comments on commit 1b80c91

Please sign in to comment.