[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
WordPress implementation for PHP functions either missing from older PHP versions or not included by default.
File Size: | 372 lines (12 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 2 files wp-includes/sodium_compat/autoload.php wp-includes/random_compat/random.php |
_( $string ) X-Ref |
No description |
_wp_can_use_pcre_u( $set = null ) X-Ref |
Returns whether PCRE/u (PCRE_UTF8 modifier) is available for use. param: bool $set - Used for testing only |
mb_substr( $str, $start, $length = null, $encoding = null ) X-Ref |
Compat function to mimic mb_substr(). return: string Extracted substring. param: string $str The string to extract the substring from. param: int $start Position to being extraction from in `$str`. param: int|null $length Optional. Maximum number of characters to extract from `$str`. param: string|null $encoding Optional. Character encoding to use. Default null. |
_mb_substr( $str, $start, $length = null, $encoding = null ) X-Ref |
Internal compat function to mimic mb_substr(). Only understands UTF-8 and 8bit. All other character sets will be treated as 8bit. For $encoding === UTF-8, the $str input is expected to be a valid UTF-8 byte sequence. The behavior of this function for invalid inputs is undefined. return: string Extracted substring. param: string $str The string to extract the substring from. param: int $start Position to being extraction from in `$str`. param: int|null $length Optional. Maximum number of characters to extract from `$str`. param: string|null $encoding Optional. Character encoding to use. Default null. |
mb_strlen( $str, $encoding = null ) X-Ref |
Compat function to mimic mb_strlen(). return: int String length of `$str`. param: string $str The string to retrieve the character length from. param: string|null $encoding Optional. Character encoding to use. Default null. |
_mb_strlen( $str, $encoding = null ) X-Ref |
Internal compat function to mimic mb_strlen(). Only understands UTF-8 and 8bit. All other character sets will be treated as 8bit. For $encoding === UTF-8, the `$str` input is expected to be a valid UTF-8 byte sequence. The behavior of this function for invalid inputs is undefined. return: int String length of `$str`. param: string $str The string to retrieve the character length from. param: string|null $encoding Optional. Character encoding to use. Default null. |
hash_hmac( $algo, $data, $key, $raw_output = false ) X-Ref |
Compat function to mimic hash_hmac(). The Hash extension is bundled with PHP by default since PHP 5.1.2. However, the extension may be explicitly disabled on select servers. As of PHP 7.4.0, the Hash extension is a core PHP extension and can no longer be disabled. I.e. when PHP 7.4.0 becomes the minimum requirement, this polyfill and the associated `_hash_hmac()` function can be safely removed. return: string|false The hash in output determined by `$raw_output`. False if `$algo` param: string $algo Hash algorithm. Accepts 'md5' or 'sha1'. param: string $data Data to be hashed. param: string $key Secret key to use for generating the hash. param: bool $raw_output Optional. Whether to output raw binary data (true), |
_hash_hmac( $algo, $data, $key, $raw_output = false ) X-Ref |
Internal compat function to mimic hash_hmac(). return: string|false The hash in output determined by `$raw_output`. False if `$algo` param: string $algo Hash algorithm. Accepts 'md5' or 'sha1'. param: string $data Data to be hashed. param: string $key Secret key to use for generating the hash. param: bool $raw_output Optional. Whether to output raw binary data (true), |
hash_equals( $a, $b ) X-Ref |
Timing attack safe string comparison Compares two strings using the same time whether they're equal or not. Note: It can leak the length of a string when arguments of differing length are supplied. This function was added in PHP 5.6. However, the Hash extension may be explicitly disabled on select servers. As of PHP 7.4.0, the Hash extension is a core PHP extension and can no longer be disabled. I.e. when PHP 7.4.0 becomes the minimum requirement, this polyfill can be safely removed. return: bool Whether strings are equal. param: string $a Expected string. param: string $b Actual, user supplied, string. |
is_countable( $var ) X-Ref |
Polyfill for is_countable() function added in PHP 7.3. Verify that the content of a variable is an array or an object implementing the Countable interface. return: bool True if `$var` is countable, false otherwise. param: mixed $var The value to check. |
is_iterable( $var ) X-Ref |
Polyfill for is_iterable() function added in PHP 7.1. Verify that the content of a variable is an array or an object implementing the Traversable interface. return: bool True if `$var` is iterable, false otherwise. param: mixed $var The value to check. |
Generated : Tue Jan 26 08:20:01 2021 | Cross-referenced by PHPXref |