updated plugin ActivityPub version 8.3.0
This commit is contained in:
@ -25,20 +25,25 @@ if ( ! function_exists( 'str_starts_with' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'is_countable' ) ) {
|
||||
if ( ! function_exists( 'str_ends_with' ) ) {
|
||||
/**
|
||||
* Polyfill for `is_countable()` function added in PHP 7.3.
|
||||
* Polyfill for `str_ends_with()` function added in PHP 8.0.
|
||||
*
|
||||
* @param mixed $value The value to check.
|
||||
* @return bool True if `$value` is countable, otherwise false.
|
||||
* Performs a case-sensitive check indicating if
|
||||
* the haystack ends with needle.
|
||||
*
|
||||
* @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 is_countable( $value ) {
|
||||
return is_array( $value ) || $value instanceof \Countable;
|
||||
function str_ends_with( $haystack, $needle ) {
|
||||
return strlen( $needle ) === 0 || substr( $haystack, - strlen( $needle ) ) === $needle;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Polyfill for `array_is_list()` function added in PHP 7.3.
|
||||
* Polyfill for `array_is_list()` function added in PHP 8.1.
|
||||
*
|
||||
* @param array $array The array to check.
|
||||
*
|
||||
@ -96,16 +101,3 @@ if ( ! function_exists( 'str_contains' ) ) {
|
||||
return false !== strpos( $haystack, $needle );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'wp_is_serving_rest_request' ) ) {
|
||||
/**
|
||||
* Polyfill for `wp_is_serving_rest_request()` function added in WordPress 6.5.
|
||||
*
|
||||
* @see https://developer.wordpress.org/reference/functions/wp_is_serving_rest_request/
|
||||
*
|
||||
* @return bool True if it's a WordPress REST API request, false otherwise.
|
||||
*/
|
||||
function wp_is_serving_rest_request() {
|
||||
return defined( 'REST_REQUEST' ) && REST_REQUEST;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user