File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -54,17 +54,20 @@ public static function render_json_template( $template ) {
5454 return $ template ;
5555 }
5656
57- // interpret accept header
58- $ pos = \stripos ( $ _SERVER ['HTTP_ACCEPT ' ], '; ' );
59- if ( $ pos ) {
60- $ accept_header = \substr ( $ _SERVER ['HTTP_ACCEPT ' ], 0 , $ pos );
61- } else {
62- $ accept_header = $ _SERVER ['HTTP_ACCEPT ' ];
57+ $ accept_header = $ _SERVER ['HTTP_ACCEPT ' ];
58+
59+ if (
60+ stristr ( $ accept_header , 'application/activity+json ' ) ||
61+ stristr ( $ accept_header , 'application/ld+json ' )
62+ ) {
63+ return $ template ;
6364 }
65+
6466 // accept header as an array
6567 $ accept = \explode ( ', ' , trim ( $ accept_header ) );
6668
6769 if (
70+ ! \in_array ( 'application/ld+json; profile="https://www.w3.org/ns/activitystreams" ' , $ accept , true ) &&
6871 ! \in_array ( 'application/activity+json ' , $ accept , true ) &&
6972 ! \in_array ( 'application/ld+json ' , $ accept , true ) &&
7073 ! \in_array ( 'application/json ' , $ accept , true )
You can’t perform that action at this time.
0 commit comments