file_stream_wrapper_valid_scheme

Versions
7
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

▾ 7 functions call file_stream_wrapper_valid_scheme()

drupal_dirname in includes/file.inc
Gets the name of the directory from a given path.
drupal_tempnam in includes/file.inc
Creates a file with a unique filename in the specified directory.
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. Pipes a file through Drupal to the client.
file_unmanaged_copy in includes/file.inc
Copy a file to a new location without calling any hooks or making any changes to the database.

Code

includes/file.inc, line 160

<?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;
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.