1 file_example_session_streams.inc public FileExampleSessionStreamWrapper::dirname($uri = NULL)

Gets the name of the directory from a given path.

Parameters

string $uri: A URI.

Return value

string: A string containing the directory name.

Overrides BackdropStreamWrapperInterface::dirname

See also

backdrop_dirname()

File

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

Class

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

Code

public function dirname($uri = NULL) {
  list($scheme, $target) = explode('://', $uri, 2);
  $target = $this->getTarget($uri);
  if (strpos($target, '/')) {
    $dirname = preg_replace('@/[^/]*$@', '', $target);
  }
  else {
    $dirname = '';
  }

  return $scheme . '://' . $dirname;
}