public function SessionStreamWrapper::dir_opendir in Examples for Developers 3.x
Same name and namespace in other branches
- 8 stream_wrapper_example/src/StreamWrapper/SessionStreamWrapper.php \Drupal\stream_wrapper_example\StreamWrapper\SessionStreamWrapper::dir_opendir()
Open directory handle.
This method is called in response to opendir().
Parameters
string $path: Specifies the URL that was passed to opendir().
int $options: Whether or not to enforce safe_mode (0x04).
Return value
bool Returns TRUE on success or FALSE on failure.
Overrides PhpStreamWrapperInterface::dir_opendir
See also
opendir()
http://php.net/manual/en/streamwrapper.dir-opendir.php
File
- modules/
stream_wrapper_example/ src/ StreamWrapper/ SessionStreamWrapper.php, line 805
Class
- SessionStreamWrapper
- Example stream wrapper class to handle session:// streams.
Namespace
Drupal\stream_wrapper_example\StreamWrapperCode
public function dir_opendir($uri, $options) {
// @codingStandardsIgnoreEnd
$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 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;
}