function StreamWrapperManager::getTarget

Same name in other branches
  1. 9 core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php \Drupal\Core\StreamWrapper\StreamWrapperManager::getTarget()
  2. 10 core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php \Drupal\Core\StreamWrapper\StreamWrapperManager::getTarget()
  3. 11.x core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php \Drupal\Core\StreamWrapper\StreamWrapperManager::getTarget()

Overrides StreamWrapperManagerInterface::getTarget

12 calls to StreamWrapperManager::getTarget()
config_file_download in core/modules/config/config.module
Implements hook_file_download().
file_uri_target in core/includes/file.inc
Returns the part of a URI after the schema.
hook_file_download in core/lib/Drupal/Core/File/file.api.php
Control access to private file downloads and specify HTTP headers.
ImageStyle::buildUri in core/modules/image/src/Entity/ImageStyle.php
Returns the URI of this image when using this style.
ImageStyle::fileUriTarget in core/modules/image/src/Entity/ImageStyle.php
Provides a wrapper for file_uri_target() to allow unit testing.

... See full list

File

core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php, line 214

Class

StreamWrapperManager
Provides a StreamWrapper manager.

Namespace

Drupal\Core\StreamWrapper

Code

public static function getTarget($uri) {
    // Remove the scheme from the URI and remove erroneous leading or trailing,
    // forward-slashes and backslashes.
    $target = trim(preg_replace('/^[\\w\\-]+:\\/\\/|^data:/', '', $uri), '\\/');
    // If nothing was replaced, the URI doesn't have a valid scheme.
    return $target !== $uri ? $target : FALSE;
}

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