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/rest/class-interaction-controller.php +10 -15 9.2.07.7.0 View file →
@@ -52,9 +52,9 @@
52 52 ),
53 53 'intent' => array(
54 54 'description' => 'The intent of the interaction, e.g., follow, reply, import.',
55 55 'type' => 'string',
56 - 'enum' => \array_map( 'Activitypub\camel_to_snake_case', Activity::TYPES ),
56 + 'enum' => array_map( 'Activitypub\camel_to_snake_case', Activity::TYPES ),
57 57 ),
58 58 ),
59 59 ),
60 60 )
@@ -69,9 +69,9 @@
69 69 * @return string Sanitized URI.
70 70 */
71 71 public function sanitize_uri( $uri ) {
72 72 // Remove "acct:" prefix if present.
73 - if ( \str_starts_with( $uri, 'acct:' ) ) {
73 + if ( str_starts_with( $uri, 'acct:' ) ) {
74 74 $uri = \substr( $uri, 5 );
75 75 }
76 76
77 77 // Remove "@" prefix if present.
@@ -76,9 +76,9 @@
76 76
77 77 // Remove "@" prefix if present.
78 78 $uri = \ltrim( $uri, '@' );
79 79
80 - if ( \is_email( $uri ) ) {
80 + if ( is_email( $uri ) ) {
81 81 return \sanitize_text_field( $uri );
82 82 }
83 83
84 84 return \sanitize_url( $uri );
@@ -92,9 +92,8 @@
92 92 * @return \WP_REST_Response Response object on success, dies on failure.
93 93 */
94 94 public function get_item( $request ) {
95 95 $uri = $request->get_param( 'uri' );
96 - $intent = $request->get_param( 'intent' );
97 96 $redirect_url = '';
98 97 $object = Http::get_remote_object( $uri );
99 98
100 99 if ( \is_wp_error( $object ) || ! isset( $object['type'] ) ) {
@@ -99,9 +98,9 @@
99 98
100 99 if ( \is_wp_error( $object ) || ! isset( $object['type'] ) ) {
101 100 // Use wp_die as this can be called from the front-end. See https://github.com/Automattic/wordpress-activitypub/pull/1149/files#r1915297109.
102 101 \wp_die(
103 - \esc_html__( 'The URL is not supported!', 'activitypub' ),
102 + esc_html__( 'The URL is not supported!', 'activitypub' ),
104 103 '',
105 104 array(
106 105 'response' => 400,
107 106 'back_link' => true,
@@ -109,9 +108,9 @@
109 108 );
110 109 }
111 110
112 111 if ( ! empty( $object['id'] ) ) {
113 - $uri = \esc_url_raw( $object['id'] );
112 + $uri = \esc_url( $object['id'] );
114 113 }
115 114
116 115 // Prepare URL parameter.
117 116 $url_param = \rawurlencode( $uri );
@@ -135,11 +134,10 @@
135 134 *
136 135 * @param string $redirect_url The URL to redirect to.
137 136 * @param string $uri The URI of the actor to follow.
138 137 * @param array $object The full actor object data.
139 - * @param string $intent The intent of the interaction.
140 138 */
141 - $redirect_url = \apply_filters( 'activitypub_interactions_follow_url', $redirect_url, $uri, $object, $intent );
139 + $redirect_url = \apply_filters( 'activitypub_interactions_follow_url', $redirect_url, $uri, $object );
142 140 break;
143 141 case 'Collection':
144 142 case 'CollectionPage':
145 143 case 'OrderedCollection':
@@ -153,11 +151,10 @@
153 151 *
154 152 * @param string $redirect_url The URL to redirect to.
155 153 * @param string $uri The URI of the collection to import.
156 154 * @param array $object The full collection object data.
157 - * @param string $intent The intent of the interaction.
158 155 */
159 - $redirect_url = \apply_filters( 'activitypub_interactions_starter_kit_url', $redirect_url, $uri, $object, $intent );
156 + $redirect_url = \apply_filters( 'activitypub_interactions_starter_kit_url', $redirect_url, $uri, $object );
160 157 break;
161 158 default:
162 159 $redirect_url = \admin_url( 'post-new.php?in_reply_to=' . $url_param );
163 160
@@ -168,11 +165,10 @@
168 165 *
169 166 * @param string $redirect_url The URL to redirect to.
170 167 * @param string $uri The URI of the object to reply to.
171 168 * @param array $object The full object data being replied to.
172 - * @param string $intent The intent of the interaction.
173 169 */
174 - $redirect_url = \apply_filters( 'activitypub_interactions_reply_url', $redirect_url, $uri, $object, $intent );
170 + $redirect_url = \apply_filters( 'activitypub_interactions_reply_url', $redirect_url, $uri, $object );
175 171 }
176 172
177 173 /**
178 174 * Filters the redirect URL.
@@ -182,17 +178,16 @@
182 178 *
183 179 * @param string $redirect_url The URL to redirect to.
184 180 * @param string $uri The URI of the object.
185 181 * @param array $object The object being interacted with.
186 - * @param string $intent The intent of the interaction.
187 182 */
188 - $redirect_url = \apply_filters( 'activitypub_interactions_url', $redirect_url, $uri, $object, $intent );
183 + $redirect_url = \apply_filters( 'activitypub_interactions_url', $redirect_url, $uri, $object );
189 184
190 185 // Check if hook is implemented.
191 186 if ( ! $redirect_url ) {
192 187 // Use wp_die as this can be called from the front-end. See https://github.com/Automattic/wordpress-activitypub/pull/1149/files#r1915297109.
193 188 \wp_die(
194 - \esc_html__( 'This Interaction type is not supported yet!', 'activitypub' ),
189 + esc_html__( 'This Interaction type is not supported yet!', 'activitypub' ),
195 190 '',
196 191 array(
197 192 'response' => 400,
198 193 'back_link' => true,