You are here

interface DrupalStreamWrapperInterface in Drupal 7

Drupal stream wrapper extension.

Extend the StreamWrapperInterface with methods expected by Drupal stream wrapper classes.

Hierarchy

Expanded class hierarchy of DrupalStreamWrapperInterface

All classes that implement DrupalStreamWrapperInterface

1 string reference to 'DrupalStreamWrapperInterface'
file_get_stream_wrappers in includes/file.inc
Provides Drupal stream wrapper registry.

File

includes/stream_wrappers.inc, line 126
Drupal stream wrapper interface.

View source
interface DrupalStreamWrapperInterface extends StreamWrapperInterface {

  /**
   * Set the absolute stream resource URI.
   *
   * This allows you to set the URI. Generally is only called by the factory
   * method.
   *
   * @param $uri
   *   A string containing the URI that should be used for this instance.
   */
  public function setUri($uri);

  /**
   * Returns the stream resource URI.
   *
   * @return
   *   Returns the current URI of the instance.
   */
  public function getUri();

  /**
   * 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".
   *
   * @return
   *   Returns a string containing a web accessible URL for the resource.
   */
  public function getExternalUrl();

  /**
   * Returns the MIME type of the resource.
   *
   * @param $uri
   *   The URI, path, or filename.
   * @param $mapping
   *   An optional map of extensions to their mimetypes, in the form:
   *    - 'mimetypes': a list of mimetypes, keyed by an identifier,
   *    - 'extensions': the mapping itself, an associative array in which
   *      the key is the extension and the value is the mimetype identifier.
   *
   * @return
   *   Returns a string containing the MIME type of the resource.
   */
  public static function getMimeType($uri, $mapping = NULL);

  /**
   * Changes permissions of the resource.
   *
   * PHP lacks this functionality and it is not part of the official stream
   * wrapper interface. This is a custom implementation for Drupal.
   *
   * @param $mode
   *   Integer value for the permissions. Consult PHP chmod() documentation
   *   for more information.
   *
   * @return
   *   Returns TRUE on success or FALSE on failure.
   */
  public function chmod($mode);

  /**
   * Returns canonical, absolute path of the resource.
   *
   * Implementation placeholder. PHP's realpath() does not support stream
   * wrappers. We provide this as a default so that individual wrappers may
   * implement their own solutions.
   *
   * @return
   *   Returns a string with absolute pathname on success (implemented
   *   by core wrappers), or FALSE on failure or if the registered
   *   wrapper does not provide an implementation.
   */
  public function realpath();

  /**
   * Gets the name of the directory from a given path.
   *
   * This method is usually accessed through drupal_dirname(), which wraps
   * around the normal PHP dirname() function, which does not support stream
   * wrappers.
   *
   * @param $uri
   *   An optional URI.
   *
   * @return
   *   A string containing the directory name, or FALSE if not applicable.
   *
   * @see drupal_dirname()
   */
  public function dirname($uri = NULL);

}

Members

Namesort descending Modifiers Type Description Overrides
DrupalStreamWrapperInterface::chmod public function Changes permissions of the resource. 1
DrupalStreamWrapperInterface::dirname public function Gets the name of the directory from a given path. 1
DrupalStreamWrapperInterface::getExternalUrl public function Returns a web accessible URL for the resource. 4
DrupalStreamWrapperInterface::getMimeType public static function Returns the MIME type of the resource. 1
DrupalStreamWrapperInterface::getUri public function Returns the stream resource URI. 1
DrupalStreamWrapperInterface::realpath public function Returns canonical, absolute path of the resource. 1
DrupalStreamWrapperInterface::setUri public function Set the absolute stream resource URI. 1
StreamWrapperInterface::dir_closedir public function 1
StreamWrapperInterface::dir_opendir public function 1
StreamWrapperInterface::dir_readdir public function 1
StreamWrapperInterface::dir_rewinddir public function 1
StreamWrapperInterface::mkdir public function 1
StreamWrapperInterface::rename public function 1
StreamWrapperInterface::rmdir public function 1
StreamWrapperInterface::stream_close public function 1
StreamWrapperInterface::stream_eof public function 1
StreamWrapperInterface::stream_flush public function 1
StreamWrapperInterface::stream_lock public function 1
StreamWrapperInterface::stream_open public function 1
StreamWrapperInterface::stream_read public function 1
StreamWrapperInterface::stream_seek public function 1
StreamWrapperInterface::stream_stat public function 1
StreamWrapperInterface::stream_tell public function 1
StreamWrapperInterface::stream_write public function 1
StreamWrapperInterface::unlink public function 1
StreamWrapperInterface::url_stat public function 1