PluginProbe
ActivityPub / 8.0.2
ActivityPub v8.0.2
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/activity/class-generic-object.php +5 -27 8.3.08.0.2 View file →
@@ -230,20 +230,13 @@
230 230 *
231 231 * It tries to get the object attributes if they exist
232 232 * and falls back to the getters. Empty values are ignored.
233 233 *
234 - * By default, `bto` and `bcc` (the blind audience fields) are stripped
235 - * from the output per ActivityPub Section 6, so every serialization path
236 - * is safe for emission. Internal callers that need to persist the blind
237 - * audience (e.g., outbox/inbox storage) can opt in by passing
238 - * `$include_blind_audience = true`.
239 - *
240 234 * @param bool $include_json_ld_context Whether to include the JSON-LD context. Default true.
241 - * @param bool $include_blind_audience Whether to keep `bto` and `bcc` in the output. Default false.
242 235 *
243 236 * @return array An array built from the Object.
244 237 */
245 - public function to_array( $include_json_ld_context = true, $include_blind_audience = false ) {
238 + public function to_array( $include_json_ld_context = true ) {
246 239 $array = array();
247 240 $vars = get_object_vars( $this );
248 241
249 242 foreach ( $vars as $key => $value ) {
@@ -261,9 +254,9 @@
261 254 $value = call_user_func( array( $this, 'get_' . $key ) );
262 255 }
263 256
264 257 if ( is_object( $value ) ) {
265 - $value = $value->to_array( false, $include_blind_audience );
258 + $value = $value->to_array( false );
266 259 }
267 260
268 261 if ( is_array( $value ) && $this->is_namespaced( $key ) ) {
269 262 foreach ( $value as $sub_key => $sub_value ) {
@@ -302,23 +295,9 @@
302 295 * @param Generic_Object $object The ActivityPub object.
303 296 *
304 297 * @return array The filtered array of the ActivityPub object.
305 298 */
306 - $array = \apply_filters( "activitypub_activity_{$class}_object_array", $array, $this->id, $this );
307 -
308 - if ( ! $include_blind_audience ) {
309 - /*
310 - * Strip `bto` and `bcc` from the serialized array per ActivityPub Section 6.
311 - * Callers that need the blind audience either read it from the object via
312 - * `get_bto()` / `get_bcc()` or opt in with `$include_blind_audience = true`.
313 - */
314 - unset( $array['bto'], $array['bcc'] );
315 - if ( isset( $array['object'] ) && \is_array( $array['object'] ) ) {
316 - unset( $array['object']['bto'], $array['object']['bcc'] );
317 - }
318 - }
319 -
320 - return $array;
299 + return \apply_filters( "activitypub_activity_{$class}_object_array", $array, $this->id, $this );
321 300 }
322 301
323 302 /**
324 303 * Convert Object to JSON.
@@ -323,14 +302,13 @@
323 302 /**
324 303 * Convert Object to JSON.
325 304 *
326 305 * @param bool $include_json_ld_context Whether to include the JSON-LD context. Default true.
327 - * @param bool $include_blind_audience Whether to keep `bto` and `bcc` in the output. Default false.
328 306 *
329 307 * @return string The JSON string.
330 308 */
331 - public function to_json( $include_json_ld_context = true, $include_blind_audience = false ) {
332 - $array = $this->to_array( $include_json_ld_context, $include_blind_audience );
309 + public function to_json( $include_json_ld_context = true ) {
310 + $array = $this->to_array( $include_json_ld_context );
333 311 $options = \JSON_HEX_TAG | \JSON_HEX_AMP | \JSON_HEX_QUOT | \JSON_UNESCAPED_SLASHES;
334 312
335 313 /**
336 314 * Options to be passed to json_encode().