Refactored the get_directory_of_files().

This function now takes a glob pattern and a optional glob flag.
you can read about globs here: http://in.php.net/manual/en/function.glob.php

This does break backwards compatibillity.