function file_stream_wrapper_valid_scheme

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

Checks 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.

Parameters

$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

16 calls to file_stream_wrapper_valid_scheme()
drupal_dirname in includes/file.inc
Gets the name of the directory from a given path.
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.
drupal_unlink in includes/file.inc
Deletes a file.
file_download in includes/file.inc
Menu handler for private file transfers.

... See full list

File

includes/file.inc, line 225

Code

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;
    }
}

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