PluginProbe
ActivityPub / 3.2.5
ActivityPub v3.2.5
9.3.1 9.3.0 9.2.2 9.2.1 9.2.0 9.1.0 9.0.2 9.0.1 9.0.0 8.3.0 8.2.1 8.2.0 8.1.1 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.2.0 1.3.0 2.0.0 2.0.1 2.1.0 2.1.1 All 160 releases
← All changes | includes/compat.php +52 -1 1.2.03.2.5 View file →
@@ -43,7 +43,58 @@
43 43 * @param mixed $value The value to check.
44 44 * @return bool True if `$value` is countable, otherwise false.
45 45 */
46 46 function is_countable( $value ) {
47 - return is_array( $value ) || $value instanceof \Countable;
47 + return is_array( $value ) || $value instanceof \Countable;
48 + }
49 +}
50 +
51 +/**
52 + * Polyfill for `array_is_list()` function added in PHP 7.3.
53 + *
54 + * @param array $array The array to check.
55 + *
56 + * @return bool True if `$array` is a list, otherwise false.
57 + */
58 +if ( ! function_exists( 'array_is_list' ) ) {
59 + // phpcs:disable Universal.NamingConventions.NoReservedKeywordParameterNames.arrayFound
60 + function array_is_list( $array ) {
61 + if ( ! is_array( $array ) ) {
62 + return false;
63 + }
64 +
65 + if ( array_values( $array ) === $array ) {
66 + return true;
67 + }
68 +
69 + $next_key = -1;
70 +
71 + foreach ( $array as $k => $v ) {
72 + if ( ++$next_key !== $k ) {
73 + return false;
74 + }
75 + }
76 +
77 + return true;
78 + }
79 +}
80 +
81 +if ( ! function_exists( 'str_contains' ) ) {
82 + /**
83 + * Polyfill for `str_contains()` function added in PHP 8.0.
84 + *
85 + * Performs a case-sensitive check indicating if needle is
86 + * contained in haystack.
87 + *
88 + * @param string $haystack The string to search in.
89 + * @param string $needle The substring to search for in the `$haystack`.
90 + *
91 + * @return bool True if `$needle` is in `$haystack`, otherwise false.
92 + */
93 + function str_contains( $haystack, $needle ) {
94 + if ( '' === $needle ) {
95 + return true;
96 + }
97 +
98 + return false !== strpos( $haystack, $needle );
48 99 }
49 100 }