1 file_example_session_streams.inc public FileExampleSessionStreamWrapper::dir_opendir($uri, $options)

Support for opendir().

Parameters

string $uri: A string containing the URI to the directory to open.

int $options: Whether or not to enforce safe_mode (0x04).

Return value

bool: TRUE on success.

Overrides StreamWrapperInterface::dir_opendir

See also

http://php.net/manual/en/streamwrapper.dir-opendir.php

File

modules/examples/file_example/file_example_session_streams.inc, line 656
Provides a demonstration session:// stream-wrapper.

Class

FileExampleSessionStreamWrapper
Example stream wrapper class to handle session:// streams.

Code

public function dir_opendir($uri, $options) {
  $var = &$this->uri_to_session_key($uri, FALSE);
  if ($var === FALSE || !array_key_exists('.isadir.txt', $var)) {
    return FALSE;
  }

  // We grab the list of key names, flip it so that .isadir.txt can easily
  // be removed, then flip it back so we can easily walk it as a list.
  $this->directoryKeys = array_flip(array_keys($var));
  unset($this->directoryKeys['.isadir.txt']);
  $this->directoryKeys = array_keys($this->directoryKeys);
  $this->directoryPointer = 0;

  return TRUE;
}