file_stream_wrapper_valid_scheme

  1. drupal
    1. 8
    2. 7
Versions
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.

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

▾ 13 functions call 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
Remove 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.
file_prepare_directory in includes/file.inc
Check that the directory exists and is writable.
file_save_upload in includes/file.inc
Saves a file upload to a new location.
file_stream_wrapper_uri_normalize in includes/file.inc
Normalizes a URI by making it syntactically correct.
file_transfer in includes/file.inc
Transfer file using HTTP to client.
file_valid_uri in includes/file.inc
Determine whether the URI has a valid scheme for file API operations.
image_gd_save in modules/system/image.gd.inc
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.

Code

includes/file.inc, line 222

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