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 +22 -4 2.0.05.3.1 View file →
@@ -1,7 +1,9 @@
1 1 <?php
2 2 /**
3 3 * ActivityPub implementation for WordPress/PHP functions either missing from older WordPress/PHP versions or not included by default.
4 + *
5 + * @package Activitypub
4 6 */
5 7
6 8 if ( ! function_exists( 'str_starts_with' ) ) {
7 9 /**
@@ -31,8 +33,14 @@
31 33 */
32 34 function get_self_link() {
33 35 $host = wp_parse_url( home_url() );
34 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 + */
35 43 return esc_url( apply_filters( 'self_link', set_url_scheme( 'http://' . $host['host'] . $path ) ) );
36 44 }
37 45 }
38 46
@@ -55,20 +63,30 @@
55 63 *
56 64 * @return bool True if `$array` is a list, otherwise false.
57 65 */
58 66 if ( ! function_exists( 'array_is_list' ) ) {
59 - function array_is_list( $array ) {
60 - if ( ! is_array( $array ) ) {
67 + /**
68 + * Check if an array is a list.
69 + *
70 + * An array is considered a list if its keys are a range of numbers
71 + * starting from 0 and ending at count( $array ) - 1.
72 + *
73 + * @param array $input The array to check.
74 + *
75 + * @return bool True if `$input` is a list, otherwise false.
76 + */
77 + function array_is_list( $input ) {
78 + if ( ! is_array( $input ) ) {
61 79 return false;
62 80 }
63 81
64 - if ( array_values( $array ) === $array ) {
82 + if ( array_values( $input ) === $input ) {
65 83 return true;
66 84 }
67 85
68 86 $next_key = -1;
69 87
70 - foreach ( $array as $k => $v ) {
88 + foreach ( $input as $k => $v ) {
71 89 if ( ++$next_key !== $k ) {
72 90 return false;
73 91 }
74 92 }