PluginProbe
ActivityPub / 8.0.2
ActivityPub v8.0.2
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/class-http.php +6 -8 8.3.08.0.2 View file →
@@ -37,11 +37,10 @@
37 37 /**
38 38 * Filters the HTTP headers user agent string.
39 39 *
40 40 * @param string $user_agent The user agent string.
41 - * @param string $url The request URL.
42 41 */
43 - $user_agent = \apply_filters( 'http_headers_useragent', 'WordPress/' . get_masked_wp_version() . '; ' . \get_bloginfo( 'url' ), $url );
42 + $user_agent = \apply_filters( 'http_headers_useragent', 'WordPress/' . get_masked_wp_version() . '; ' . \get_bloginfo( 'url' ) );
44 43
45 44 /**
46 45 * Filters the timeout duration for remote POST requests in ActivityPub.
47 46 *
@@ -142,12 +141,14 @@
142 141
143 142 /**
144 143 * Filters the HTTP headers user agent string.
145 144 *
145 + * This filter allows developers to modify the user agent string that is
146 + * sent with HTTP requests.
147 + *
146 148 * @param string $user_agent The user agent string.
147 - * @param string $url The request URL.
148 149 */
149 - $user_agent = \apply_filters( 'http_headers_useragent', 'WordPress/' . get_masked_wp_version() . '; ' . \get_bloginfo( 'url' ), $url );
150 + $user_agent = \apply_filters( 'http_headers_useragent', 'WordPress/' . get_masked_wp_version() . '; ' . \get_bloginfo( 'url' ) );
150 151
151 152 /**
152 153 * Filters the timeout duration for remote GET requests in ActivityPub.
153 154 *
@@ -175,11 +176,8 @@
175 176 $response = \wp_safe_remote_get( $url, $args );
176 177 $code = \wp_remote_retrieve_response_code( $response );
177 178
178 179 if ( \is_wp_error( $response ) || $code >= 400 ) {
179 - if ( ! $code ) {
180 - $code = 0;
181 - }
182 180 $response = new \WP_Error( $code, __( 'Failed HTTP Request', 'activitypub' ), array( 'status' => $code ) );
183 181
184 182 /*
185 183 * Always cache errors to prevent repeated timeout waits.
@@ -260,9 +258,9 @@
260 258 }
261 259
262 260 $url = object_to_uri( $url_or_object );
263 261
264 - if ( Webfinger::is_acct( $url ) ) {
262 + if ( preg_match( '/^@?' . ACTIVITYPUB_USERNAME_REGEXP . '$/i', $url ) ) {
265 263 $url = Webfinger::resolve( $url );
266 264 }
267 265
268 266 if ( ! $url ) {