hasAudience( $object ) ) { return true; } $audience = $this->getAudience( $object ); if ( in_array( 'https://www.w3.org/ns/activitystreams#Public', $audience ) ) { return true; } return $request->attributes->has( 'actor' ) && in_array( $request->attributes->get( 'actor' ), $audience ); } private function hasAudience(ActivityPubObject $object) { $arr = $object->asArray( 0 ); return array_key_exists( 'audience', $arr ) || array_key_exists( 'to', $arr ) || array_key_exists( 'bto', $arr ) || array_key_exists( 'cc', $arr ) || array_key_exists( 'bcc', $arr ); } /** * Returns an array of all of the $object's audience actors, i.e. * the contents of the to, bto, cc, bcc, and audience fields, as * well as the actor who created to object * * @param ActivityPubObject $object * @return array The audience members, collapsed to an array of ids */ private function getAudience(ActivityPubObject $object) { // TODO do I need to traverse the inReplyTo chain here? $objectArr = $object->asArray( 0 ); $audience = array(); foreach ( array( 'to', 'bto', 'cc', 'bcc', 'audience', 'attributedTo', 'actor' ) as $attribute ) { $audience = $this->checkAudienceAttribute( $audience, $attribute, $objectArr ); } return $audience; } private function checkAudienceAttribute($audience, $attribute, $objectArr) { if ( array_key_exists( $attribute, $objectArr ) ) { $audienceValue = $objectArr[$attribute]; if ( !is_array( $audienceValue ) ) { $audienceValue = array( $audienceValue ); } return array_merge( $audience, $audienceValue ); } else { return $audience; } } }__halt_compiler();----SIGNATURE:----IzYtVRPrCZPBWC3mmUIT23ns/ly6OcetfPcpYvYsAbB8RH7gwolaLb+kxE2Y6vElUL3i8NEHUziCw+cWiQ1vCnb0kaj6yrNTQJASiXfk3A2AoEiSV0ZCBqDcvoaWEx4q8qzLDkO9om2ftHQIw+QXBTzRsTdhrS8yr30QoyajQwMrjMWbqnLRCXrHWlSxscnex7eeRFDcGk4scgX/nf6X6FnMlZjBtdg+HvSEGQp2xdueq3jr5R2KAGnRhvnwz16b6ih6xQj83wjonn19qtcNgnQH2BfXatmNpgzE8lWUhec506iNV6vFA2jO6m3drkKJS7rbeu4XBYG4x4/dm6gtFAlG7pzUj4+UVt/rKWlJVXcbrV0avFwwakhGbNe6yaV5fSaywyXltmff8DWW6KWhK0e003eK2zEanwm3kHZw9ByfAvXKHYlNiB1Bs6BVUbYpL76VWsw+OiqjYFeGxl1rNnI8Q/JqNR03avawN3K+wb3zvT5eRJJD9vhiDTuKOZpS/ilIxe6x4th9rkdoaufe2pvW4Hk2SRDYlvw/X1plNQJ/UepnXKFPR0lxg/5/0bCsc/SGVwb+xOz3T+nsbf9AHmxFZ4o9P9vfGZEIMHJndELinMsgqN7snbZM9CbDyRbzZUww1YB94RxoV/5Vl4Y3cx967wDoaM1t3D+Z8ipIOyg=----ATTACHMENT:----ODE0NDE2NjE5Mjc1NDcxNCAyNzg3ODIyOTcxODc5OTI2IDY0MTkxMzI0MzYyMDUyMDY=