public function FileSystem::uriScheme in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/File/FileSystem.php \Drupal\Core\File\FileSystem::uriScheme()
Returns the scheme of a URI (e.g. a stream).
Parameters
string $uri: A stream, referenced as "scheme://target" or "data:target".
Return value
string|bool A string containing the name of the scheme, or FALSE if none. For example, the URI "public://example.txt" would return "public".
Overrides FileSystemInterface::uriScheme
See also
5 calls to FileSystem::uriScheme()
- FileSystem::dirname in core/
lib/ Drupal/ Core/ File/ FileSystem.php - Gets the name of the directory from a given path.
- FileSystem::mkdir in core/
lib/ Drupal/ Core/ File/ FileSystem.php - Creates a directory, optionally creating missing components in the path to the directory.
- FileSystem::rmdir in core/
lib/ Drupal/ Core/ File/ FileSystem.php - Removes a directory.
- FileSystem::tempnam in core/
lib/ Drupal/ Core/ File/ FileSystem.php - Creates a file with a unique filename in the specified directory.
- FileSystem::unlink in core/
lib/ Drupal/ Core/ File/ FileSystem.php - Deletes a file.
File
- core/
lib/ Drupal/ Core/ File/ FileSystem.php, line 288 - Contains \Drupal\Core\File\FileSystem.
Class
- FileSystem
- Provides helpers to operate on files and stream wrappers.
Namespace
Drupal\Core\FileCode
public function uriScheme($uri) {
if (preg_match('/^([\\w\\-]+):\\/\\/|^(data):/', $uri, $matches)) {
// The scheme will always be the last element in the matches array.
return array_pop($matches);
}
return FALSE;
}