Skip navigation
Help

DrupalPrivateStreamWrapper

  1. drupal
    1. 7 drupal/includes/stream_wrappers.inc

Drupal private (private://) stream wrapper class.

Provides support for storing privately accessible files with the Drupal file interface.

Extends DrupalPublicStreamWrapper.

Hierarchy

Properties

NameDescription
DrupalLocalStreamWrapper::$contextStream context resource.
DrupalLocalStreamWrapper::$handleA generic resource handle.
DrupalLocalStreamWrapper::$uriInstance URI (stream).

Functions & methods

NameDescription
DrupalLocalStreamWrapper::chmodBase implementation of chmod(). Overrides DrupalStreamWrapperInterface::chmod
DrupalLocalStreamWrapper::dirnameGets the name of the directory from a given path. Overrides DrupalStreamWrapperInterface::dirname
DrupalLocalStreamWrapper::dir_closedirSupport for closedir().
DrupalLocalStreamWrapper::dir_opendirSupport for opendir().
DrupalLocalStreamWrapper::dir_readdirSupport for readdir().
DrupalLocalStreamWrapper::dir_rewinddirSupport for rewinddir().
DrupalLocalStreamWrapper::getLocalPathReturn the local filesystem path.
DrupalLocalStreamWrapper::getMimeTypeBase implementation of getMimeType(). Overrides DrupalStreamWrapperInterface::getMimeType
DrupalLocalStreamWrapper::getTargetReturns the local writable target of the resource within the stream.
DrupalLocalStreamWrapper::getUriBase implementation of getUri(). Overrides DrupalStreamWrapperInterface::getUri
DrupalLocalStreamWrapper::mkdirSupport for mkdir().
DrupalLocalStreamWrapper::realpathBase implementation of realpath(). Overrides DrupalStreamWrapperInterface::realpath
DrupalLocalStreamWrapper::renameSupport for rename().
DrupalLocalStreamWrapper::rmdirSupport for rmdir().
DrupalLocalStreamWrapper::setUriBase implementation of setUri(). Overrides DrupalStreamWrapperInterface::setUri
DrupalLocalStreamWrapper::stream_closeSupport for fclose().
DrupalLocalStreamWrapper::stream_eofSupport for feof().
DrupalLocalStreamWrapper::stream_flushSupport for fflush().
DrupalLocalStreamWrapper::stream_lockSupport for flock().
DrupalLocalStreamWrapper::stream_openSupport for fopen(), file_get_contents(), file_put_contents() etc.
DrupalLocalStreamWrapper::stream_readSupport for fread(), file_get_contents() etc.
DrupalLocalStreamWrapper::stream_seekSupport for fseek().
DrupalLocalStreamWrapper::stream_statSupport for fstat().
DrupalLocalStreamWrapper::stream_tellSupport for ftell().
DrupalLocalStreamWrapper::stream_writeSupport for fwrite(), file_put_contents() etc.
DrupalLocalStreamWrapper::unlinkSupport for unlink().
DrupalLocalStreamWrapper::url_statSupport for stat().
DrupalPrivateStreamWrapper::getDirectoryPathImplements abstract public function getDirectoryPath() Overrides DrupalLocalStreamWrapper::getDirectoryPath
DrupalPrivateStreamWrapper::getExternalUrlOverrides getExternalUrl(). Overrides DrupalStreamWrapperInterface::getExternalUrl

File

drupal/includes/stream_wrappers.inc, line 786
Drupal stream wrapper interface.

View source
class DrupalPrivateStreamWrapper extends DrupalLocalStreamWrapper {
  /**
   * Implements abstract public function getDirectoryPath()
   */
  public function getDirectoryPath() {
    return variable_get('file_private_path', '');
  }

  /**
   * Overrides getExternalUrl().
   *
   * Return the HTML URI of a private file.
   */
  function getExternalUrl() {
    $path = str_replace('\\', '/', $this->getTarget());
    return url('system/files/' . $path, array('absolute' => TRUE));
  }
}