PluginProbe
ActivityPub / 3.2.5
ActivityPub v3.2.5
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 | integration/class-opengraph.php +12 -18 8.2.13.2.5 View file →
@@ -1,21 +1,15 @@
1 1 <?php
2 -/**
3 - * Opengraph integration file.
4 - *
5 - * @package Activitypub
6 - */
7 -
8 2 namespace Activitypub\Integration;
9 3
10 -use Activitypub\Collection\Actors;
11 4 use Activitypub\Model\Blog;
5 +use Activitypub\Collection\Users;
12 6
13 7 use function Activitypub\is_single_user;
14 8 use function Activitypub\is_user_type_disabled;
15 9
16 10 /**
17 - * Compatibility with the OpenGraph plugin.
11 + * Compatibility with the OpenGraph plugin
18 12 *
19 13 * @see https://wordpress.org/plugins/opengraph/
20 14 * @see https://codeberg.org/fediverse/fep/src/branch/main/fep/XXXX/fep-XXXX.md
21 15 * @see https://github.com/mastodon/mastodon/pull/30398
@@ -21,9 +15,9 @@
21 15 * @see https://github.com/mastodon/mastodon/pull/30398
22 16 */
23 17 class Opengraph {
24 18 /**
25 - * Initialize the class, registering WordPress hooks.
19 + * Initialize the class, registering WordPress hooks
26 20 */
27 21 public static function init() {
28 22 if ( ! function_exists( 'opengraph_metadata' ) ) {
29 23 \add_action( 'wp_head', array( self::class, 'add_meta_tags' ) );
@@ -53,13 +47,13 @@
53 47 *
54 48 * @return array the updated metadata.
55 49 */
56 50 public static function add_metadata( $metadata ) {
57 - // Always show Blog-User if the Blog is in single user mode.
51 + // Always show Blog-User if the Blog is in single user mode
58 52 if ( is_single_user() ) {
59 53 $user = new Blog();
60 54
61 - // Add WebFinger resource.
55 + // add WebFinger resource
62 56 $metadata['fediverse:creator'] = $user->get_webfinger();
63 57
64 58 return $metadata;
65 59 }
@@ -64,28 +58,28 @@
64 58 return $metadata;
65 59 }
66 60
67 61 if ( \is_author() ) {
68 - // Use the Author of the Archive-Page.
62 + // Use the Author of the Archive-Page
69 63 $user_id = \get_queried_object_id();
70 64 } elseif ( \is_singular() ) {
71 - // Use the Author of the Post.
65 + // Use the Author of the Post
72 66 $user_id = \get_post_field( 'post_author', \get_queried_object_id() );
73 67 } elseif ( ! is_user_type_disabled( 'blog' ) ) {
74 - // Use the Blog-User for any other page, if the Blog-User is not disabled.
75 - $user_id = Actors::BLOG_USER_ID;
68 + // Use the Blog-User for any other page, if the Blog-User is not disabled
69 + $user_id = Users::BLOG_USER_ID;
76 70 } else {
77 - // Do not add any metadata otherwise.
71 + // Do not add any metadata otherwise
78 72 return $metadata;
79 73 }
80 74
81 - $user = Actors::get_by_id( $user_id );
75 + $user = Users::get_by_id( $user_id );
82 76
83 77 if ( ! $user || \is_wp_error( $user ) ) {
84 78 return $metadata;
85 79 }
86 80
87 - // Add WebFinger resource.
81 + // add WebFinger resource
88 82 $metadata['fediverse:creator'] = $user->get_webfinger();
89 83
90 84 return $metadata;
91 85 }