Same name and namespace in other branches
- 7.x includes/common.inc \php_wrappers
- 8.9.x core/includes/common.inc \php_wrappers
- 9 core/includes/common.inc \php_wrappers
Functions that are wrappers or custom implementations of PHP functions.
Certain PHP functions should not be used in Drupal. Instead, Drupal's replacement functions should be used.
For example, for improved or more secure UTF8-handling, or RFC-compliant handling of URLs in Drupal.
For ease of use and memorizing, all these wrapper functions use the same name as the original PHP function, but prefixed with "drupal_". Beware, however, that not all wrapper functions support the same arguments as the original functions.
You should always use these wrapper functions in your code.
Wrong:
$my_substring = substr($original_string, 0, 5);
Correct:
$my_substring = mb_substr($original_string, 0, 5);
File
- core/
includes/ common.inc, line 16 - Common functions that many Drupal modules will need to reference.
Functions
Name | Location | Description |
---|---|---|
UrlHelper:: |
core/ |
Parses a URL string into its path, query, and fragment components. |
UrlHelper:: |
core/ |
Parses an array into a valid query string encoded with rawurlencode(). |
Unicode:: |
core/ |
Capitalizes the first character of each word in a UTF-8 string. |
Unicode:: |
core/ |
Converts the first character of a UTF-8 string to lowercase. |
FileSystemInterface:: |
core/ |
Deletes a file. |
FileSystemInterface:: |
core/ |
Creates a file with a unique filename in the specified directory. |
FileSystemInterface:: |
core/ |
Removes a directory. |
FileSystemInterface:: |
core/ |
Resolves the absolute filepath of a local URI or filepath. |
FileSystemInterface:: |
core/ |
Moves an uploaded file to a new location. |
FileSystemInterface:: |
core/ |
Creates a directory, optionally creating missing components in the path. |
FileSystemInterface:: |
core/ |
Gets the name of the directory from a given path. |
FileSystemInterface:: |
core/ |
Sets the permissions on a file or directory. |
FileSystemInterface:: |
core/ |
Gets the filename from a given path. |
drupal_register_shutdown_function |
core/ |
Registers a function for execution on shutdown. |