class PrivateStream

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

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

Hierarchy

Expanded class hierarchy of PrivateStream

File

drupal/core/lib/Drupal/Core/StreamWrapper/PrivateStream.php, line 16
Definition of Drupal\Core\StreamWrapper\PrivateStream.

Namespace

Drupal\Core\StreamWrapper
View source
class PrivateStream extends LocalStream {

  /**
   * Implements Drupal\Core\StreamWrapper\LocalStream::getDirectoryPath()
   */
  public function getDirectoryPath() {
    return variable_get('file_private_path', '');
  }

  /**
   * Implements Drupal\Core\StreamWrapper\StreamWrapperInterface::getExternalUrl().
   *
   * @return string
   *   Returns the HTML URI of a private file.
   */
  function getExternalUrl() {
    $path = str_replace('\\', '/', $this
      ->getTarget());
    return url('system/files/' . $path, array(
      'absolute' => TRUE,
    ));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
LocalStream::$context public property Stream context resource.
LocalStream::$handle public property A generic resource handle.
LocalStream::$uri protected property Instance URI (stream).
LocalStream::chmod function Implements Drupal\Core\StreamWrapper\StreamWrapperInterface::chmod(). Overrides StreamWrapperInterface::chmod
LocalStream::dirname public function Gets the name of the directory from a given path. Overrides StreamWrapperInterface::dirname
LocalStream::dir_closedir public function Support for closedir(). Overrides PhpStreamWrapperInterface::dir_closedir
LocalStream::dir_opendir public function Support for opendir(). Overrides PhpStreamWrapperInterface::dir_opendir
LocalStream::dir_readdir public function Support for readdir(). Overrides PhpStreamWrapperInterface::dir_readdir
LocalStream::dir_rewinddir public function Support for rewinddir(). Overrides PhpStreamWrapperInterface::dir_rewinddir
LocalStream::getLocalPath protected function Returns the canonical absolute path of the URI, if possible.
LocalStream::getMimeType static function Implements Drupal\Core\StreamWrapper\StreamWrapperInterface::getMimeType(). Overrides StreamWrapperInterface::getMimeType
LocalStream::getTarget protected function Returns the local writable target of the resource within the stream.
LocalStream::getUri function Implements Drupal\Core\StreamWrapper\StreamWrapperInterface::getUri(). Overrides StreamWrapperInterface::getUri
LocalStream::mkdir public function Support for mkdir(). Overrides PhpStreamWrapperInterface::mkdir
LocalStream::realpath function Implements Drupal\Core\StreamWrapper\StreamWrapperInterface::realpath(). Overrides StreamWrapperInterface::realpath 1
LocalStream::rename public function Support for rename(). Overrides PhpStreamWrapperInterface::rename
LocalStream::rmdir public function Support for rmdir(). Overrides PhpStreamWrapperInterface::rmdir
LocalStream::setUri function Implements Drupal\Core\StreamWrapper\StreamWrapperInterface::setUri(). Overrides StreamWrapperInterface::setUri
LocalStream::stream_close public function Support for fclose(). Overrides PhpStreamWrapperInterface::stream_close
LocalStream::stream_eof public function Support for feof(). Overrides PhpStreamWrapperInterface::stream_eof
LocalStream::stream_flush public function Support for fflush(). Overrides PhpStreamWrapperInterface::stream_flush
LocalStream::stream_lock public function Support for flock(). Overrides PhpStreamWrapperInterface::stream_lock
LocalStream::stream_open public function Support for fopen(), file_get_contents(), file_put_contents() etc. Overrides PhpStreamWrapperInterface::stream_open
LocalStream::stream_read public function Support for fread(), file_get_contents() etc. Overrides PhpStreamWrapperInterface::stream_read
LocalStream::stream_seek public function Support for fseek(). Overrides PhpStreamWrapperInterface::stream_seek
LocalStream::stream_stat public function Support for fstat(). Overrides PhpStreamWrapperInterface::stream_stat
LocalStream::stream_tell public function Support for ftell(). Overrides PhpStreamWrapperInterface::stream_tell
LocalStream::stream_write public function Support for fwrite(), file_put_contents() etc. Overrides PhpStreamWrapperInterface::stream_write
LocalStream::unlink public function Support for unlink(). Overrides PhpStreamWrapperInterface::unlink
LocalStream::url_stat public function Support for stat(). Overrides PhpStreamWrapperInterface::url_stat
PrivateStream::getDirectoryPath public function Implements Drupal\Core\StreamWrapper\LocalStream::getDirectoryPath() Overrides LocalStream::getDirectoryPath
PrivateStream::getExternalUrl function Implements Drupal\Core\StreamWrapper\StreamWrapperInterface::getExternalUrl(). Overrides StreamWrapperInterface::getExternalUrl