PluginProbe
ActivityPub / 2.6.0
ActivityPub v2.6.0
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 +51 -1 1.2.02.6.0 View file →
@@ -43,7 +43,57 @@
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 + function array_is_list( $array ) {
60 + if ( ! is_array( $array ) ) {
61 + return false;
62 + }
63 +
64 + if ( array_values( $array ) === $array ) {
65 + return true;
66 + }
67 +
68 + $next_key = -1;
69 +
70 + foreach ( $array as $k => $v ) {
71 + if ( ++$next_key !== $k ) {
72 + return false;
73 + }
74 + }
75 +
76 + return true;
77 + }
78 +}
79 +
80 +if ( ! function_exists( 'str_contains' ) ) {
81 + /**
82 + * Polyfill for `str_contains()` function added in PHP 8.0.
83 + *
84 + * Performs a case-sensitive check indicating if needle is
85 + * contained in haystack.
86 + *
87 + * @param string $haystack The string to search in.
88 + * @param string $needle The substring to search for in the `$haystack`.
89 + *
90 + * @return bool True if `$needle` is in `$haystack`, otherwise false.
91 + */
92 + function str_contains( $haystack, $needle ) {
93 + if ( '' === $needle ) {
94 + return true;
95 + }
96 +
97 + return false !== strpos( $haystack, $needle );
48 98 }
49 99 }