updated plugin ActivityPub
version 2.3.0
This commit is contained in:
@ -38,8 +38,9 @@ class Activitypub {
|
||||
\add_action( 'untrash_post', array( self::class, 'untrash_post' ), 1 );
|
||||
|
||||
\add_action( 'init', array( self::class, 'add_rewrite_rules' ), 11 );
|
||||
\add_action( 'init', array( self::class, 'theme_compat' ), 11 );
|
||||
|
||||
\add_action( 'after_setup_theme', array( self::class, 'theme_compat' ), 99 );
|
||||
\add_action( 'user_register', array( self::class, 'user_register' ) );
|
||||
|
||||
\add_action( 'in_plugin_update_message-' . ACTIVITYPUB_PLUGIN_BASENAME, array( self::class, 'plugin_update_message' ) );
|
||||
|
||||
@ -202,14 +203,16 @@ class Activitypub {
|
||||
$avatar = self::get_avatar_url( $id_or_email->comment_ID );
|
||||
|
||||
if ( $avatar ) {
|
||||
if ( ! isset( $args['class'] ) || ! \is_array( $args['class'] ) ) {
|
||||
$args['class'] = array( 'u-photo' );
|
||||
} else {
|
||||
$args['class'][] = 'u-photo';
|
||||
$args['class'] = \array_unique( $args['class'] );
|
||||
if ( empty( $args['class'] ) ) {
|
||||
$args['class'] = array();
|
||||
} elseif ( \is_string( $args['class'] ) ) {
|
||||
$args['class'] = \explode( ' ', $args['class'] );
|
||||
}
|
||||
|
||||
$args['url'] = $avatar;
|
||||
$args['class'][] = 'avatar-activitypub';
|
||||
$args['class'][] = 'u-photo';
|
||||
$args['class'] = \array_unique( $args['class'] );
|
||||
}
|
||||
|
||||
return $args;
|
||||
@ -334,6 +337,23 @@ class Activitypub {
|
||||
);
|
||||
add_theme_support( 'custom-header', $custom_header_args );
|
||||
}
|
||||
|
||||
// We assume that you want to use Post-Formats when enabling the setting
|
||||
if ( 'wordpress-post-format' === \get_option( 'activitypub_object_type', ACTIVITYPUB_DEFAULT_OBJECT_TYPE ) ) {
|
||||
if ( ! get_theme_support( 'post-formats' ) ) {
|
||||
// Add support for the Aside, Gallery Post Formats...
|
||||
add_theme_support(
|
||||
'post-formats',
|
||||
array(
|
||||
'gallery',
|
||||
'status',
|
||||
'image',
|
||||
'video',
|
||||
'audio',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -437,4 +457,17 @@ class Activitypub {
|
||||
|
||||
\do_action( 'activitypub_after_register_post_type' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the 'activitypub' query variable so WordPress won't mangle it.
|
||||
*
|
||||
* @param int $user_id User ID.
|
||||
* @param array $userdata The raw array of data passed to wp_insert_user().
|
||||
*/
|
||||
public static function user_register( $user_id ) {
|
||||
if ( \user_can( $user_id, 'publish_posts' ) ) {
|
||||
$user = \get_user_by( 'id', $user_id );
|
||||
$user->add_cap( 'activitypub' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user