function file_uri_scheme

Same name in other branches
  1. 8.9.x core/includes/file.inc \file_uri_scheme()

Returns the scheme of a URI (e.g. a stream).

Parameters

$uri: A stream, referenced as "scheme://target".

Return value

A string containing the name of the scheme, or FALSE if none. For example, the URI "public://example.txt" would return "public".

See also

file_uri_target()

Related topics

36 calls to file_uri_scheme()
drupal_dirname in includes/file.inc
Gets the name of the directory from a given path.
drupal_load_stylesheet in includes/common.inc
Loads the stylesheet and resolves all @import commands.
drupal_mkdir in includes/file.inc
Creates a directory, optionally creating missing components in the path to the directory.
drupal_rmdir in includes/file.inc
Removes a directory.
drupal_tempnam in includes/file.inc
Creates a file with a unique filename in the specified directory.

... See full list

File

includes/file.inc, line 206

Code

function file_uri_scheme($uri) {
    $position = strpos((string) $uri, '://');
    return $position ? substr($uri, 0, $position) : FALSE;
}

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