native function invocation
This commit is contained in:
parent
d0ec22bcc8
commit
273787295a
3 changed files with 5 additions and 5 deletions
|
@ -300,7 +300,7 @@ function get_blacklist() {
|
||||||
$blacklist_hosts = \explode( PHP_EOL, $blacklist );
|
$blacklist_hosts = \explode( PHP_EOL, $blacklist );
|
||||||
|
|
||||||
// if no values have been set, revert to the defaults
|
// if no values have been set, revert to the defaults
|
||||||
if ( ! $blacklist || ! $blacklist_hosts || ! is_array( $blacklist_hosts ) ) {
|
if ( ! $blacklist || ! $blacklist_hosts || ! \is_array( $blacklist_hosts ) ) {
|
||||||
$blacklist_hosts = array(
|
$blacklist_hosts = array(
|
||||||
'gab.com',
|
'gab.com',
|
||||||
);
|
);
|
||||||
|
|
|
@ -126,7 +126,7 @@ class Inbox {
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'validate_callback' => function( $param, $request, $key ) {
|
'validate_callback' => function( $param, $request, $key ) {
|
||||||
if ( ! is_string( $param ) ) {
|
if ( ! \is_string( $param ) ) {
|
||||||
$param = $param['id'];
|
$param = $param['id'];
|
||||||
}
|
}
|
||||||
return ! \Activitypub\is_blacklisted( $param );
|
return ! \Activitypub\is_blacklisted( $param );
|
||||||
|
@ -138,13 +138,13 @@ class Inbox {
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'type' => array( 'object', 'string' ),
|
'type' => array( 'object', 'string' ),
|
||||||
'validate_callback' => function( $param, $request, $key ) {
|
'validate_callback' => function( $param, $request, $key ) {
|
||||||
if ( ! is_string( $param ) ) {
|
if ( ! \is_string( $param ) ) {
|
||||||
$param = $param['id'];
|
$param = $param['id'];
|
||||||
}
|
}
|
||||||
return ! \Activitypub\is_blacklisted( $param );
|
return ! \Activitypub\is_blacklisted( $param );
|
||||||
},
|
},
|
||||||
'sanitize_callback' => function( $param, $request, $key ) {
|
'sanitize_callback' => function( $param, $request, $key ) {
|
||||||
if ( ! is_string( $param ) ) {
|
if ( ! \is_string( $param ) ) {
|
||||||
$param = $param['id'];
|
$param = $param['id'];
|
||||||
}
|
}
|
||||||
return \esc_url_raw( $param );
|
return \esc_url_raw( $param );
|
||||||
|
|
|
@ -19,7 +19,7 @@ class Server extends \WP_REST_Server {
|
||||||
$content_type = $request->get_content_type();
|
$content_type = $request->get_content_type();
|
||||||
|
|
||||||
// check for content-sub-types like 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
|
// 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'] ) ) {
|
if ( \preg_match( '/application\/([a-zA-Z+_-]+\+)json/', $content_type['value'] ) ) {
|
||||||
$request->set_header( 'Content-Type', 'application/json' );
|
$request->set_header( 'Content-Type', 'application/json' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue