public static function listStructure($dir = ".", $filters = array(), $recurse = true, $sort = "asc", $strip_root = null, $exclude = array(), $ignore_hidden = true)
    {
        if (!is_dir($dir)) {
            return null;
        }

        // Check to see if $filters is a string containing a regex, or an array of file types
        if (is_array($filters) && !empty($filters)) {
            $filter_type = 'file';
        } elseif (is_string($filters)) {
            $filter_type = 'regex';
        } else {
            $filter_type = null;
        }
        $files = array();

        $prefix = str_replace($strip_root, '', $dir);

        if ($prefix !== "" && substr($prefix, -1) !== "/") {
            $prefix .= "/";
        }

        $files['dirlist'] = array();
        $files['filelist'] = array();

        foreach (scandir($dir) as $file) {
            if (
                ($file == '.' || $file === '..')
                || ($ignore_hidden && $file{0} === '.')
                || in_array($file, $exclude)
                || in_array("$dir/$file", $exclude)
            ) {
                continue;
            }

            $dir = rtrim($dir, '/');

            if (is_dir("$dir/$file")) {
                if ($recurse) {
                    $files["$prefix$file/"] = self::listStructure("$dir/$file", $filters, $recurse, $sort, $strip_root, $exclude, $ignore_hidden);
                }

                $files['dirlist'][] = "$prefix$file/";
            } elseif ($filter_type === 'regex') {
                if (preg_match($filters, $file)) {
                    $files['filelist'][] = "$prefix$file";
                }
            } elseif ($filter_type === 'file') {
                if (in_array(self::getExtension($file), $filters)) {
                    $files['filelist'][] = "$prefix$file";
                }
            } elseif (is_null($filter_type)) {
                $files['filelist'][] = "$prefix$file";
            }
        }

        if (is_array($files['filelist'])) {
            ($sort == 'desc') ? rsort($files['filelist']) : sort($files['filelist']);
        }

        return $files;
    }