Added compatibility for versions of PHP that don't support fnmatch.