PluginProbe
ActivityPub / 5.3.1
ActivityPub v5.3.1
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 +25 -11 8.2.15.3.1 View file →
@@ -24,27 +24,41 @@
24 24 return 0 === strpos( $haystack, $needle );
25 25 }
26 26 }
27 27
28 -if ( ! function_exists( 'str_ends_with' ) ) {
28 +if ( ! function_exists( 'get_self_link' ) ) {
29 29 /**
30 - * Polyfill for `str_ends_with()` function added in PHP 8.0.
30 + * Returns the link for the currently displayed feed.
31 31 *
32 - * Performs a case-sensitive check indicating if
33 - * the haystack ends with needle.
32 + * @return string Correct link for the atom:self element.
33 + */
34 + function get_self_link() {
35 + $host = wp_parse_url( home_url() );
36 + $path = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
37 +
38 + /**
39 + * Filters the self link.
40 + *
41 + * @param string $link The self link.
42 + */
43 + return esc_url( apply_filters( 'self_link', set_url_scheme( 'http://' . $host['host'] . $path ) ) );
44 + }
45 +}
46 +
47 +if ( ! function_exists( 'is_countable' ) ) {
48 + /**
49 + * Polyfill for `is_countable()` function added in PHP 7.3.
34 50 *
35 - * @param string $haystack The string to search in.
36 - * @param string $needle The substring to search for in the `$haystack`.
37 - *
38 - * @return bool True if `$haystack` ends with `$needle`, otherwise false.
51 + * @param mixed $value The value to check.
52 + * @return bool True if `$value` is countable, otherwise false.
39 53 */
40 - function str_ends_with( $haystack, $needle ) {
41 - return strlen( $needle ) === 0 || substr( $haystack, - strlen( $needle ) ) === $needle;
54 + function is_countable( $value ) {
55 + return is_array( $value ) || $value instanceof \Countable;
42 56 }
43 57 }
44 58
45 59 /**
46 - * Polyfill for `array_is_list()` function added in PHP 8.1.
60 + * Polyfill for `array_is_list()` function added in PHP 7.3.
47 61 *
48 62 * @param array $array The array to check.
49 63 *
50 64 * @return bool True if `$array` is a list, otherwise false.