1. drupal
    1. 8
    2. 7
7 – 8 file_stream_wrapper_valid_scheme($scheme)

Check that the scheme of a stream URI is valid.

Confirms that there is a registered stream handler for the provided scheme and that it is callable. This is useful if you want to confirm a valid scheme without creating a new instance of the registered handler.


$scheme A URI scheme, a stream is referenced as "scheme://target".

Return value

Returns TRUE if the string is the name of a validated stream, or FALSE if the scheme does not have a registered handler.

Related topics

▾ 13 functions call file_stream_wrapper_valid_scheme()

drupal_dirname in includes/
Gets the name of the directory from a given path.
drupal_rmdir in includes/
Remove a directory.
drupal_tempnam in includes/
Creates a file with a unique filename in the specified directory.
drupal_unlink in includes/
Deletes a file.
file_download in includes/
Menu handler for private file transfers.
file_prepare_directory in includes/
Check that the directory exists and is writable.
file_save_upload in includes/
Saves a file upload to a new location.
file_stream_wrapper_uri_normalize in includes/
Normalizes a URI by making it syntactically correct.
file_transfer in includes/
Transfer file using HTTP to client.
file_valid_uri in includes/
Determine whether the URI has a valid scheme for file API operations.
image_gd_save in modules/system/
GD helper to write an image resource to a destination file.
image_style_deliver in modules/image/image.module
Menu callback; Given a style and image path, generate a derivative.
StreamWrapperTest::testGetValidStreamScheme in modules/simpletest/tests/file.test
Test the scheme functions.


includes/, line 222

function file_stream_wrapper_valid_scheme($scheme) {
  // Does the scheme have a registered handler that is callable?
  $class = file_stream_wrapper_get_class($scheme);
  if (class_exists($class)) {
    return TRUE;
  else {
    return FALSE;