diff options
| author | Chad Parry <github@chad.parry.org> | 2011-04-21 02:06:53 -0600 |
|---|---|---|
| committer | Chad Parry <github@chad.parry.org> | 2011-04-21 02:11:04 -0600 |
| commit | 31ba081b793141ca36866a6dd349cd2eac5af68e (patch) | |
| tree | 9a538198a7353b2c6c356736ebd74276349be500 /system/helpers | |
| parent | 14eadea2c26e2f284b43bfe73e920dcd07837c1b (diff) | |
Add an event that will collect all valid filename extensions.
Diffstat (limited to 'system/helpers')
| -rw-r--r-- | system/helpers/upload.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/system/helpers/upload.php b/system/helpers/upload.php index 62de674f..cfd92dd1 100644 --- a/system/helpers/upload.php +++ b/system/helpers/upload.php @@ -154,4 +154,24 @@ class upload_Core { return ($file['size'] <= $size); } + + static function get_upload_extensions() { + // Create a default list of allowed extensions and then let modules modify it. + $extensions_wrapper = new stdClass(); + $extensions_wrapper->extensions = array("gif", "jpg", "jpeg", "png"); + if (movie::find_ffmpeg()) { + array_push($extensions_wrapper->extensions, "flv", "mp4", "m4v"); + } + module::event("upload_extensions", $extensions_wrapper); + return $extensions_wrapper->extensions; + } + + static function get_upload_filters() { + $filters = array(); + foreach (upload::get_upload_extensions() as $extension) { + array_push($filters, "*." . $extension, "*." . strtoupper($extension)); + } + return $filters; + } + } // End upload
\ No newline at end of file |
