file($path); // Heuristically determine most likely MIME type based on the contents of the file at $path return $type; } } } /** * @param $content * @return string */ private static function physical_check_from_content($content) { if ($finfo = self::get_finfo()) { $type = $finfo->buffer($content); return $type; } } /** * @return finfo */ private static function get_finfo() { static $finfo = false; global $prefs; if ($finfo) { return $finfo; } if ($prefs['tiki_check_file_content'] == 'y' && class_exists('finfo')) { $finfo = new finfo(FILEINFO_MIME_TYPE); if ($finfo) { return $finfo; } } } }