You are here

function is_media_by_extension in Quiz 6.5

Same name and namespace in other branches
  1. 6.6 includes/moodle/question/format/qti2/qt_common.php \is_media_by_extension()

determines whether or not a file is a media file, based on the file extension

Parameters

string $file the filename:

Return value

boolean

1 call to is_media_by_extension()
get_course_media_files in includes/moodle/question/format/qti2/qt_common.php
gets a list of all the media files for the given course

File

includes/moodle/question/format/qti2/qt_common.php, line 55

Code

function is_media_by_extension($file) {
  $extensionsregex = '/\\.(gif|jpg|jpeg|jpe|png|tif|tiff|bmp|xbm|rgb|svf|swf|mov|mpg|mpeg|wmf|avi|mpe|flv|mp3|ra|ram)$/';
  if (preg_match($extensionsregex, $file)) {
    return true;
  }
  return false;
}