public/js/kcfinder/lib/helper_dir.php
static function content($dir, array $options=null) {

        $defaultOptions = array(
            'types' => "all",   // Allowed: "all" or possible return values
                                // of filetype(), or an array with them
            'addPath' => true,  // Whether to add directory path to filenames
            'pattern' => '/./', // Regular expression pattern for filename
            'followLinks' => true
        );

        if (!is_dir($dir) || !is_readable($dir))
            return false;

        if (strtoupper(substr(PHP_OS, 0, 3)) == "WIN")
            $dir = str_replace("\\", "/", $dir);
        $dir = rtrim($dir, "/");

        $dh = @opendir($dir);
        if ($dh === false)
            return false;

        if ($options === null)
            $options = $defaultOptions;

        foreach ($defaultOptions as $key => $val)
            if (!isset($options[$key]))
                $options[$key] = $val;

        $files = array();
        while (($file = @readdir($dh)) !== false) {

            if (($file == '.') || ($file == '..') ||
                !preg_match($options['pattern'], $file)
            )
                continue;

            $fullpath = "$dir/$file";
            $type = filetype($fullpath);

            // If file is a symlink, get the true type of its destination
            if ($options['followLinks'] && ($type == "link"))
                $type = filetype(realpath($fullpath));

            if (($options['types'] === "all") || ($type === $options['types']) ||
                (is_array($options['types']) && in_array($type, $options['types']))
            )
                $files[] = $options['addPath'] ? $fullpath : $file;
        }
        closedir($dh);
        usort($files, array(__NAMESPACE__ . "\\dir", "fileSort"));
        return $files;
    }
static function content($dir, array $options=null) {

        $defaultOptions = array(
            'types' => "all",   // Allowed: "all" or possible return values
                                // of filetype(), or an array with them
            'addPath' => true,  // Whether to add directory path to filenames
            'pattern' => '/./', // Regular expression pattern for filename
            'followLinks' => true
        );

        if (!is_dir($dir) || !is_readable($dir))
            return false;

        if (strtoupper(substr(PHP_OS, 0, 3)) == "WIN")
            $dir = str_replace("\\", "/", $dir);
        $dir = rtrim($dir, "/");

        $dh = @opendir($dir);
        if ($dh === false)
            return false;

        if ($options === null)
            $options = $defaultOptions;

        foreach ($defaultOptions as $key => $val)
            if (!isset($options[$key]))
                $options[$key] = $val;

        $files = array();
        while (($file = @readdir($dh)) !== false) {

            if (($file == '.') || ($file == '..') ||
                !preg_match($options['pattern'], $file)
            )
                continue;

            $fullpath = "$dir/$file";
            $type = filetype($fullpath);

            // If file is a symlink, get the true type of its destination
            if ($options['followLinks'] && ($type == "link"))
                $type = filetype(realpath($fullpath));

            if (($options['types'] === "all") || ($type === $options['types']) ||
                (is_array($options['types']) && in_array($type, $options['types']))
            )
                $files[] = $options['addPath'] ? $fullpath : $file;
        }
        closedir($dh);
        usort($files, array(__NAMESPACE__ . "\\dir", "fileSort"));
        return $files;
    }
Get the content of the given directory. Returns an array with filenames
or FALSE on failure
@param string $dir
@param array $options
@return mixed