/** * Get the array of allowed file extensions for a given type * * @param string $type media type could be photo, audio, video doc etc * @return mixed array of extensions e.g array( 'gif', 'jpg', 'png') etc */ function mpp_get_media_extensions($type) { $extensions = mpp_get_all_media_extensions(); if (isset($extensions[$type])) { return $extensions[$type]; } return array(); }
function mpp_get_media_type_from_extension($ext) { $ext = strtolower($ext); $all_extensions = mpp_get_all_media_extensions(); foreach ($all_extensions as $type => $extensions) { if (in_array($ext, $extensions)) { return $type; } } return false; //invalid type }