file_stream_wrapper_valid_scheme

function file_stream_wrapper_valid_scheme

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

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!file.inc/function/file_stream_wrapper_valid_scheme/7.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部