Functions that are wrappers or custom implementations of PHP functions.
Certain PHP functions should not be used in Backdrop. Instead, Backdrop's replacement functions should be used.
For example, for improved or more secure UTF8-handling, or RFC-compliant handling of URLs in Backdrop.
For ease of use and memorizing, all these wrapper functions use the same name as the original PHP function, but prefixed with "backdrop_". 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 = backdrop_substr($original_string, 0, 5);
File
- core/
includes/ common.inc, line 10 - Common functions that many Backdrop modules will need to reference.
Functions
Name | Location | Description |
---|---|---|
backdrop_basename |
core/ |
Gets the filename from a given path. |
backdrop_chmod |
core/ |
Sets the permissions on a file or directory. |
backdrop_dirname |
core/ |
Gets the name of the directory from a given path. |
backdrop_http_build_query |
core/ |
Parses an array into a valid, rawurlencoded query string. |
backdrop_json_decode |
core/ |
Converts an HTML-safe JSON string into its PHP equivalent. |
backdrop_json_encode |
core/ |
Converts a PHP variable into its JavaScript equivalent. |
backdrop_mkdir |
core/ |
Creates a directory using Backdrop's default mode. |
backdrop_move_uploaded_file |
core/ |
Moves an uploaded file to a new location. |
backdrop_parse_url |
core/ |
Parses a system URL string into an associative array suitable for url(). |
backdrop_realpath |
core/ |
Resolves the absolute filepath of a local URI or filepath. |
backdrop_register_shutdown_function |
core/ |
Registers a function for execution on shutdown. |
backdrop_rmdir |
core/ |
Removes a directory. |
backdrop_session_regenerate |
core/ |
Called when an anonymous user becomes authenticated or vice-versa. |
backdrop_session_start |
core/ |
Starts a session forcefully, preserving already set session data. |
backdrop_set_time_limit |
core/ |
Attempts to set the PHP maximum execution time. |
backdrop_strlen |
core/ |
Counts the number of characters in a UTF-8 string. |
backdrop_strtolower |
core/ |
Lowercase a UTF-8 string. |
backdrop_strtoupper |
core/ |
Uppercase a UTF-8 string. |
backdrop_substr |
core/ |
Cuts off a piece of a string based on character indices and counts. |
backdrop_tempnam |
core/ |
Creates a file with a unique filename in the specified directory. |
backdrop_ucfirst |
core/ |
Capitalizes the first letter of a UTF-8 string. |
backdrop_unlink |
core/ |
Deletes a file. |
backdrop_xml_parser_create |
core/ |
Prepares a new XML parser. |