Introduce wp_scandir, remove opendir / closedir code
|Reported by:||wonderboymusic||Owned by:|
There is @opendir code all over the place that is not standardized. On top of that, there is plenty of code that is duplicated and could be condensed into one handy function. Plus, in all of the places we are using opendir(), we really want to be using scandir().
I have created a master function in load.php called wp_scandir() that does the basics:
- scans a directory for files / subdirectories
- filters list by extension(s)
- optionally returns ONLY files
This cleans up code in many places.