public static function get_dirArray($dir, $filenameKey = false, $filter = null, $positive = false)
    {
        /*
         * Normalize the Filter.
         */
        if (empty($filter)) {
            $filter = array('.', '_');
        } elseif(is_object($filter)) {
            $filter = self::ar($filter, null, true);
        } elseif(!is_array($filter)) {
            $filter = array($filter);
        }

        if ($handle = opendir($dir)) {
            $r = array();
            $i = 0;
            while (false !== ($file = readdir($handle))) {
                $ok = !$positive;
                if (!empty($filter)) {
                    foreach ($filter as $f) {
                        if ($positive && strpos($file, $f) === 0) {
                            $ok = true;
                            break;
                        } elseif(!$positive && strpos($file, $f) === 0) {
                            $ok = false;
                            break;
                        }
                    }
                }
                if (!$ok) {
                    continue;
                }

                $k = $filenameKey ? $file : $i;
                $r[$k] = $file;
                $i++;
            }
            return $r;
        } else {
            return false;
        }
    }