is_activitypub_request(); } /** * Check if content negotiation is allowed for a request. * * @return bool True if content negotiation is allowed, false otherwise. */ function should_negotiate_content() { return Query::get_instance()->should_negotiate_content(); } /** * Requests the Meta-Data from the Actors profile. * * @param array|string $actor The Actor array or URL. * @param bool $cached Optional. Whether the result should be cached. Default true. * * @return array|\WP_Error The Actor profile as array or WP_Error on failure. */ function get_remote_metadata_by_actor( $actor, $cached = true ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable, Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed /** * Filters the metadata before it is retrieved from a remote actor. * * Passing a non-false value will effectively short-circuit the remote request, * returning that value instead. * * @param mixed $pre The value to return instead of the remote metadata. * Default false to continue with the remote request. * @param string $actor The actor URL. */ $pre = apply_filters( 'pre_get_remote_metadata_by_actor', false, $actor ); if ( $pre ) { return $pre; } $remote_actor = Remote_Actors::fetch_by_various( $actor ); if ( is_wp_error( $remote_actor ) ) { return $remote_actor; } return json_decode( $remote_actor->post_content, true ); }