PluginProbe
ActivityPub / 7.7.0
ActivityPub v7.7.0
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/transformer/class-term.php +5 -35 9.2.07.7.0 View file →
@@ -6,10 +6,8 @@
6 6 */
7 7
8 8 namespace Activitypub\Transformer;
9 9
10 -use Activitypub\Activity\Base_Object;
11 -
12 10 /**
13 11 * Term Transformer Class.
14 12 */
15 13 class Term extends Base {
@@ -20,49 +18,21 @@
20 18 *
21 19 * @return \Activitypub\Activity\Base_Object|\WP_Error The OrderedCollection or WP_Error on failure.
22 20 */
23 21 public function to_object() {
24 - $base_object = new Base_Object();
22 + $base_object = new \Activitypub\Activity\Base_Object();
25 23 $base_object->{'@context'} = 'https://www.w3.org/ns/activitystreams';
26 24 $base_object->set_type( 'OrderedCollection' );
27 - $base_object->set_id( $this->get_id() );
28 - $base_object->set_url( $this->get_url() );
25 + $base_object->set_id( \get_term_link( $this->item ) );
29 26
30 27 return $base_object;
31 28 }
32 29
33 30 /**
34 - * Get the OrderedCollection ID.
31 + * Get the OrderedCollection ID (term link).
35 32 *
36 - * @return string The OrderedCollection ID.
33 + * @return string The OrderedCollection ID (term link).
37 34 */
38 35 public function to_id() {
39 - return $this->get_id();
40 - }
41 -
42 - /**
43 - * Returns the stable ID of the Term.
44 - *
45 - * Uses term_id query parameter to ensure the ID remains stable
46 - * even if the term slug is changed.
47 - *
48 - * @return string The Term's stable ID.
49 - */
50 - public function get_id() {
51 - return \add_query_arg( 'term_id', $this->item->term_id, \home_url( '/' ) );
52 - }
53 -
54 - /**
55 - * Returns the URL of the Term.
56 - *
57 - * @return string The Term's URL (term link).
58 - */
59 - public function get_url() {
60 - $term_link = \get_term_link( $this->item );
61 -
62 - if ( \is_wp_error( $term_link ) ) {
63 - return '';
64 - }
65 -
66 - return \esc_url_raw( $term_link );
36 + return \get_term_link( $this->item );
67 37 }
68 38 }