mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-29 07:12:15 +09:00
Use Rhymix Framework to decide whether a file can be directly downloaded
xpressengine/xe-core#1997
This commit is contained in:
parent
f17fa23598
commit
e1ffe39a2e
4 changed files with 41 additions and 2 deletions
|
|
@ -85,4 +85,22 @@ class FilenameFilter
|
|||
// Trim trailing slashes.
|
||||
return rtrim($path, '/');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a file has an extension that would allow direct download.
|
||||
*
|
||||
* @param string $filename
|
||||
* @return bool
|
||||
*/
|
||||
public static function isDirectDownload($filename)
|
||||
{
|
||||
if (preg_match('/\.(as[fx]|avi|flac|flv|gif|jpe?g|m4[av]|midi?|mkv|moov|mov|mp[1234]|mpe?g|ogg|png|qt|ram?|rmm?|swf|wav|web[mp]|wm[av])$/i', $filename))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue