Drupal 8  8.0.2
PublicStream Class Reference
Inheritance diagram for PublicStream:

Public Member Functions

 getName ()
 
 getDescription ()
 
 getDirectoryPath ()
 
 getExternalUrl ()
 
- Public Member Functions inherited from LocalStream
 getDirectoryPath ()
 
 setUri ($uri)
 
 getUri ()
 
 realpath ()
 
 stream_open ($uri, $mode, $options, &$opened_path)
 
 stream_lock ($operation)
 
 stream_read ($count)
 
 stream_write ($data)
 
 stream_eof ()
 
 stream_seek ($offset, $whence=SEEK_SET)
 
 stream_flush ()
 
 stream_tell ()
 
 stream_stat ()
 
 stream_close ()
 
 stream_cast ($cast_as)
 
 stream_metadata ($uri, $option, $value)
 
 stream_set_option ($option, $arg1, $arg2)
 
 stream_truncate ($new_size)
 
 unlink ($uri)
 
 rename ($from_uri, $to_uri)
 
 dirname ($uri=NULL)
 
 mkdir ($uri, $mode, $options)
 
 rmdir ($uri, $options)
 
 url_stat ($uri, $flags)
 
 dir_opendir ($uri, $options)
 
 dir_readdir ()
 
 dir_rewinddir ()
 
 dir_closedir ()
 

Static Public Member Functions

static getType ()
 
static baseUrl ()
 
static basePath (\SplString $site_path=NULL)
 
- Static Public Member Functions inherited from LocalStream
static getType ()
 

Additional Inherited Members

- Data Fields inherited from LocalStream
 $context
 
 $handle = NULL
 
- Data Fields inherited from StreamWrapperInterface
const ALL = 0x0000
 
const LOCAL = 0x0001
 
const READ = 0x0004
 
const WRITE = 0x0008
 
const VISIBLE = 0x0010
 
const HIDDEN = 0x000C
 
const LOCAL_HIDDEN = 0x000D
 
const WRITE_VISIBLE = 0x001C
 
const READ_VISIBLE = 0x0014
 
const NORMAL = 0x001C
 
const LOCAL_NORMAL = 0x001D
 
- Protected Member Functions inherited from LocalStream
 getTarget ($uri=NULL)
 
 getLocalPath ($uri=NULL)
 
- Protected Attributes inherited from LocalStream
 $uri
 

Detailed Description

Defines a Drupal public (public://) stream wrapper class.

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

Member Function Documentation

static basePath ( \SplString  $site_path = NULL)
static

Returns the base path for public://.

If we have a setting for the public:// scheme's path, we use that. Otherwise we build a reasonable default based on the site.path service if it's available, or a default behavior based on the request.

Note that this static method is used by so you should alter that form or substitute a different form if you change the class providing the stream_wrapper.public service.

The site path is injectable from the site.path service:

$base_path = PublicStream::basePath(\Drupal::service('site.path'));
Parameters
\SplString$site_path(optional) The site.path service parameter, which is typically the path to sites/ in a Drupal installation. This allows you to inject the site path using services from the caller. If omitted, this method will use the global service container or the kernel's default behavior to determine the site path.
Returns
string The base path for public:// typically sites/default/files.

References DrupalKernel\findSitePath(), Settings\get(), Drupal\hasService(), and Drupal\service().

Referenced by FileSystemForm\buildForm(), WebTestBase\drupalGetTestFiles(), PhpStorageFactory\get(), TestBase\run(), LocaleUpdateBase\setTranslationFiles(), PhpStorageFactoryTest\testGetOverride(), FilterHtmlImageSecureTest\testImageSource(), ThemeTest\testThemeSettings(), and StreamWrapperTest\testUriFunctions().

Here is the call graph for this function:

Here is the caller graph for this function:

static baseUrl ( )
static

Finds and returns the base URL for public://.

Defaults to the current site's base URL plus directory path.

Note that this static method is used by so you should alter that form or substitute a different form if you change the class providing the stream_wrapper.public service.

Returns
string The external base URL for public://

References Settings\get().

Referenced by FileSystemForm\buildForm().

Here is the call graph for this function:

Here is the caller graph for this function:

getDescription ( )

{Returns the description of the stream wrapper for use in the UI.

Returns
string The stream wrapper description.
}

Implements StreamWrapperInterface.

References t().

Here is the call graph for this function:

getDirectoryPath ( )

{}

getExternalUrl ( )

{Returns a web accessible URL for the resource.This function should return a URL that can be embedded in a web page and accessed from a browser. For example, the external URL of "youtube://xIpLd0WQKCY" might be "http://www.youtube.com/watch?v=xIpLd0WQKCY".

Returns
string Returns a string containing a web accessible URL for the resource.
}

Implements StreamWrapperInterface.

References UrlHelper\encodePath(), and LocalStream\getTarget().

Here is the call graph for this function:

getName ( )

{Returns the name of the stream wrapper for use in the UI.

Returns
string The stream wrapper name.
}

Implements StreamWrapperInterface.

References t().

Here is the call graph for this function:

static getType ( )
static

{Returns the type of stream wrapper.

Returns
int
}

Implements StreamWrapperInterface.

References StreamWrapperInterface\LOCAL_NORMAL.


The documentation for this class was generated from the following file: