function DrupalLocalStreamWrapper::dirname

Gets the name of the directory from a given path.

This method is usually accessed through drupal_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 DrupalStreamWrapperInterface::dirname

See also

drupal_dirname()

File

includes/stream_wrappers.inc, line 754

Class

DrupalLocalStreamWrapper
Drupal 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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.