apache
wp-content
mu-plugins
plugins
activitypub
includes
model
peer
rest
class-followers.php
class-following.php
class-inbox.php
class-nodeinfo.php
class-ostatus.php
class-outbox.php
class-server.php
class-webfinger.php
table
class-activity-dispatcher.php
class-activitypub.php
class-admin.php
class-debug.php
class-hashtag.php
class-health-check.php
class-signature.php
functions.php
languages
templates
LICENSE
activitypub.php
readme.txt
authLdap-2.4.2
companion-auto-update
disable-wordpress-core-update
gitium
gp-premium
menu-icons
simple-local-avatars
static-html-output-plugin
wp-mail-smtp
wp-piwik
index.php
themes
index.php
.dbsetup
.gitignore
htaccess
php.ini
32 lines
947 B
PHP
32 lines
947 B
PHP
<?php
|
|
namespace Activitypub\Rest;
|
|
|
|
/**
|
|
* Custom (hopefully temporary) ActivityPub Rest Server
|
|
*
|
|
* @author Matthias Pfefferle
|
|
*/
|
|
class Server extends \WP_REST_Server {
|
|
/**
|
|
* Overwrite dispatch function to quick fix missing subtype featur
|
|
*
|
|
* @see https://core.trac.wordpress.org/ticket/49404
|
|
*
|
|
* @param WP_REST_Request $request Request to attempt dispatching.
|
|
* @return WP_REST_Response Response returned by the callback.
|
|
*/
|
|
public function dispatch( $request ) {
|
|
$content_type = $request->get_content_type();
|
|
|
|
// check for content-sub-types like 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
|
|
if ( \preg_match( '/application\/([a-zA-Z+_-]+\+)json/', $content_type['value'] ) ) {
|
|
$request->set_header( 'Content-Type', 'application/json' );
|
|
}
|
|
|
|
// make request filterable
|
|
$request = apply_filters( 'activitypub_pre_dispatch_request', $request );
|
|
|
|
return parent::dispatch( $request );
|
|
}
|
|
}
|