function SessionStreamWrapper::dir_opendir
Same name and namespace in other branches
- 3.x modules/stream_wrapper_example/src/StreamWrapper/SessionStreamWrapper.php \Drupal\stream_wrapper_example\StreamWrapper\SessionStreamWrapper::dir_opendir()
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 PhpStreamWrapperInterface::dir_opendir
See also
http://php.net/manual/en/streamwrapper.dir-opendir.php
File
-
modules/
stream_wrapper_example/ src/ StreamWrapper/ SessionStreamWrapper.php, line 773
Class
- SessionStreamWrapper
- Example stream wrapper class to handle session:// streams.
Namespace
Drupal\stream_wrapper_example\StreamWrapperCode
public function dir_opendir($uri, $options) {
$path = $this->getLocalPath($uri);
if (!$this->sessionHelper
->checkPath($path)) {
return FALSE;
}
$var = $this->sessionHelper
->getPath($path);
if (!is_array($var)) {
return FALSE;
}
// We grab the list of key names, flip it to easily remove .is_a_dir.txt,
// and flip it back.
$this->directoryKeys = array_flip(array_keys($var));
unset($this->directoryKeys['.is_a_dir.txt']);
$this->directoryKeys = array_keys($this->directoryKeys);
$this->directoryPointer = 0;
return TRUE;
}