hash in output determined by `$binary`.
* False if `$algo` is unknown or invalid.
*/
function hash_hmac( $algo, $data, $key, $binary = false ) {
return _hash_hmac( $algo, $data, $key, $binary );
}
endif;
/**
* Internal compat function to mimic hash_hmac().
*
* @ignore
* @since 3.2.0
*
* @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 $binary Optional. Whether to output raw binary data (true),
* or lowercase hexits (false). Default false.
* @return string|false The hash in output determined by `$binary`.
* False if `$algo` is unknown or invalid.
*/
function _hash_hmac( $algo, $data, $key, $binary = false ) {
$packs = array(
'md5' => 'H32',
'sha1' => 'H40',
);
if ( ! isset( $packs[ $algo ] ) ) {
return false;
}
$pack = $packs[ $algo ];
if ( strlen( $key ) > 64 ) {
$key = pack( $pack, $algo( $key ) );
}
$key = str_pad( $key, 64, chr( 0 ) );
$ipad = ( substr( $key, 0, 64 ) ^ str_repeat( chr( 0x36 ), 64 ) );
$opad = ( substr( $key, 0, 64 ) ^ str_repeat( chr( 0x5C ), 64 ) );
$hmac = $algo( $opad . pack( $pack, $algo( $ipad . $data ) ) );
if ( $binary ) {
return pack( $pack, $hmac );
}
return $hmac;
}
if ( ! function_exists( 'hash_equals' ) ) :
/**
* 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.
*
* @since 3.9.2
*
* @param string $known_string Expected string.
* @param string $user_string Actual, user supplied, string.
* @return bool Whether strings are equal.
*/
function hash_equals( $known_string, $user_string ) {
$known_string_length = strlen( $known_string );
if ( strlen( $user_string ) !== $known_string_length ) {
return false;
}
$result = 0;
// Do not attempt to "optimize" this.
for ( $i = 0; $i < $known_string_length; $i++ ) {
$result |= ord( $known_string[ $i ] ) ^ ord( $user_string[ $i ] );
}
return 0 === $result;
}
endif;
// sodium_crypto_box() was introduced in PHP 7.2.
if ( ! function_exists( 'sodium_crypto_box' ) ) {
require ABSPATH . WPINC . '/sodium_compat/autoload.php';
}
if ( ! function_exists( 'is_countable' ) ) {
/**
* 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.
*
* @since 4.9.6
*
* @param mixed $value The value to check.
* @return bool True if `$value` is countable, false otherwise.
*/
function is_countable( $value ) {
return ( is_array( $value )
|| $value instanceof Countable
|| $value instanceof SimpleXMLElement
|| $value instanceof ResourceBundle
);
}
}
if ( ! function_exists( 'is_iterable' ) ) {
/**
* 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.
*
* @since 4.9.6
*
* @param mixed $value The value to check.
* @return bool True if `$value` is iterable, false otherwise.
*/
function is_iterable( $value ) {
return ( is_array( $value ) || $value instanceof Traversable );
}
}
if ( ! function_exists( 'array_key_first' ) ) {
/**
* Polyfill for array_key_first() function added in PHP 7.3.
*
* Get the first key of the given array without affecting
* the internal array pointer.
*
* @since 5.9.0
*
* @param array $array An array.
* @return string|int|null The first key of array if the array
* is not empty; `null` otherwise.
*/
function array_key_first( array $array ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.arrayFound
foreach ( $array as $key => $value ) {
return $key;
}
}
}
if ( ! function_exists( 'array_key_last' ) ) {
/**
* Polyfill for `array_key_last()` function added in PHP 7.3.
*
* Get the last key of the given array without affecting the
* internal array pointer.
*
* @since 5.9.0
*
* @param array $array An array.
* @return string|int|null The last key of array if the array
*. is not empty; `null` otherwise.
*/
function array_key_last( array $array ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.arrayFound
if ( empty( $array ) ) {
return null;
}
end( $array );
return key( $array );
}
}
if ( ! function_exists( 'str_contains' ) ) {
/**
* Polyfill for `str_contains()` function added in PHP 8.0.
*
* Performs a case-sensitive check indicating if needle is
* contained in haystack.
*
* @since 5.9.0
*
* @param string $haystack The string to search in.
* @param string $needle The substring to search for in the `$haystack`.
* @return bool True if `$needle` is in `$haystack`, otherwise false.
*/
function str_contains( $haystack, $needle ) {
if ( '' === $needle ) {
return true;
}
return false !== strpos( $haystack, $needle );
}
}
if ( ! function_exists( 'str_starts_with' ) ) {
/**
* Polyfill for `str_starts_with()` function added in PHP 8.0.
*
* Performs a case-sensitive check indicating if
* the haystack begins with needle.
*
* @since 5.9.0
*
* @param string $haystack The string to search in.
* @param string $needle The substring to search for in the `$haystack`.
* @return bool True if `$haystack` starts with `$needle`, otherwise false.
*/
function str_starts_with( $haystack, $needle ) {
if ( '' === $needle ) {
return true;
}
return 0 === strpos( $haystack, $needle );
}
}
if ( ! function_exists( 'str_ends_with' ) ) {
/**
* Polyfill for `str_ends_with()` function added in PHP 8.0.
*
* Performs a case-sensitive check indicating if
* the haystack ends with needle.
*
* @since 5.9.0
*
* @param string $haystack The string to search in.
* @param string $needle The substring to search for in the `$haystack`.
* @return bool True if `$haystack` ends with `$needle`, otherwise false.
*/
function str_ends_with( $haystack, $needle ) {
if ( '' === $haystack ) {
return '' === $needle;
}
$len = strlen( $needle );
return substr( $haystack, -$len, $len ) === $needle;
}
}
// IMAGETYPE_WEBP constant is only defined in PHP 7.1 or later.
if ( ! defined( 'IMAGETYPE_WEBP' ) ) {
define( 'IMAGETYPE_WEBP', 18 );
}
// IMG_WEBP constant is only defined in PHP 7.0.10 or later.
if ( ! defined( 'IMG_WEBP' ) ) {
define( 'IMG_WEBP', IMAGETYPE_WEBP );
}
Fatal error: Uncaught Error: Call to undefined function str_contains() in /home/wesuppor/brandaholic.com.pk/wp-includes/load.php:1626
Stack trace:
#0 /home/wesuppor/brandaholic.com.pk/wp-includes/default-constants.php(43): wp_convert_hr_to_bytes('512m')
#1 /home/wesuppor/brandaholic.com.pk/wp-settings.php(62): wp_initial_constants()
#2 /home/wesuppor/brandaholic.com.pk/wp-config.php(119): require_once('/home/wesuppor/...')
#3 /home/wesuppor/brandaholic.com.pk/wp-load.php(50): require_once('/home/wesuppor/...')
#4 /home/wesuppor/brandaholic.com.pk/wp-blog-header.php(13): require_once('/home/wesuppor/...')
#5 /home/wesuppor/brandaholic.com.pk/index.php(17): require('/home/wesuppor/...')
#6 {main}
thrown in /home/wesuppor/brandaholic.com.pk/wp-includes/load.php on line 1626