\__( 'Author URL test', 'activitypub' ), 'test' => array( '\Activitypub\Health_Check', 'test_author_url' ), ); $tests['direct']['activitypub_test_webfinger'] = array( 'label' => __( 'WebFinger Test', 'activitypub' ), 'test' => array( '\Activitypub\Health_Check', 'test_webfinger' ), ); return $tests; } /** * Author URL tests * * @return void */ public static function test_author_url() { $result = array( 'label' => \__( 'Author URL accessible', 'activitypub' ), 'status' => 'good', 'badge' => array( 'label' => \__( 'ActivityPub', 'activitypub' ), 'color' => 'green', ), 'description' => \sprintf( '
%s
', \__( 'Your author URL is accessible and supports the required "Accept" header.', 'activitypub' ) ), 'actions' => '', 'test' => 'test_author_url', ); $check = self::is_author_url_accessible(); if ( true === $check ) { return $result; } $result['status'] = 'critical'; $result['label'] = \__( 'Author URL is not accessible', 'activitypub' ); $result['badge']['color'] = 'red'; $result['description'] = \sprintf( '%s
', $check->get_error_message() ); return $result; } /** * WebFinger tests * * @return void */ public static function test_webfinger() { $result = array( 'label' => \__( 'WebFinger endpoint', 'activitypub' ), 'status' => 'good', 'badge' => array( 'label' => \__( 'ActivityPub', 'activitypub' ), 'color' => 'green', ), 'description' => \sprintf( '%s
', \__( 'Your WebFinger endpoint is accessible and returns the correct informations.', 'activitypub' ) ), 'actions' => '', 'test' => 'test_webfinger', ); $check = self::is_webfinger_endpoint_accessible(); if ( true === $check ) { return $result; } $result['status'] = 'critical'; $result['label'] = \__( 'WebFinger endpoint is not accessible', 'activitypub' ); $result['badge']['color'] = 'red'; $result['description'] = \sprintf( '%s
', $check->get_error_message() ); return $result; } /** * Check if `author_posts_url` is accessible and that requerst returns correct JSON * * @return boolean|WP_Error */ public static function is_author_url_accessible() { $user = \wp_get_current_user(); $author_url = \get_author_posts_url( $user->ID ); $reference_author_url = self::get_author_posts_url( $user->ID, $user->user_nicename ); // check for "author" in URL if ( $author_url !== $reference_author_url ) { return new \WP_Error( 'author_url_not_accessible', \sprintf( // translators: %s: Author URL \__( 'Your author URL %s
was replaced, this is often done by plugins.
Your author URL %s
is not accessible. Please check your WordPress setup or permalink structure. If the setup seems fine, maybe check if a plugin might restrict the access.
Your author URL %s
is redirecting to another page, this is often done by SEO plugins like "Yoast SEO".
Your author URL %s
does not return valid JSON for application/activity+json
. Please check if your hosting supports alternate Accept
headers.
Your WebFinger endpoint %s
is not accessible. Please check your WordPress setup or permalink structure.
Your WebFinger endpoint %s
does not return valid JSON for application/jrd+json
.