8.5.x file.inc file_stream_wrapper_valid_scheme($scheme)
8.0.x file.inc file_stream_wrapper_valid_scheme($scheme)
8.1.x file.inc file_stream_wrapper_valid_scheme($scheme)
8.2.x file.inc file_stream_wrapper_valid_scheme($scheme)
8.3.x file.inc file_stream_wrapper_valid_scheme($scheme)
8.4.x file.inc file_stream_wrapper_valid_scheme($scheme)
8.6.x file.inc file_stream_wrapper_valid_scheme($scheme)
7.x file.inc file_stream_wrapper_valid_scheme($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

2 calls to file_stream_wrapper_valid_scheme()
image_style_deliver in modules/image/image.module
Page callback: Generates a derivative, given a style and image path.
StreamWrapperTest::testGetValidStreamScheme in modules/simpletest/tests/file.test
Test the scheme functions.

File

includes/file.inc, line 218
API for handling file uploads and server file management.

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