1 stream_wrappers.inc public BackdropLocalStreamWrapper::dirname($uri = NULL)

Gets the name of the directory from a given path.

This method is usually accessed through backdrop_dirname(), which wraps around the PHP dirname() function because it does not support stream wrappers.

Parameters

$uri: A URI or path.

Return value

A string containing the directory name.:

Overrides BackdropStreamWrapperInterface::dirname

See also

backdrop_dirname()

File

core/includes/stream_wrappers.inc, line 752
Backdrop stream wrapper interface.

Class

BackdropLocalStreamWrapper
Backdrop stream wrapper base class for local files.

Code

public function dirname($uri = NULL) {
  list($scheme, $target) = explode('://', $uri, 2);
  $target = $this->getTarget($uri);
  $dirname = dirname($target);

  if ($dirname == '.') {
    $dirname = '';
  }

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