updated plugin Event Bridge for ActivityPub version 1.3.0

This commit is contained in:
2026-06-03 21:28:57 +00:00
committed by Gitium
parent 1f3438440f
commit f2d6714572
84 changed files with 1721 additions and 1361 deletions

View File

@ -9,10 +9,11 @@
namespace Event_Bridge_For_ActivityPub\Admin;
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
use WP_Post;
// Exit if accessed directly.
\defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
use Event_Bridge_For_ActivityPub\ActivityPub\Model\Event_Source;
use Event_Bridge_For_ActivityPub\ActivityPub\Collection\Event_Sources as Event_Sources_Collection;
use Event_Bridge_For_ActivityPub\Event_Sources;
@ -39,7 +40,7 @@ class User_Interface {
* @param array $columns The current columns.
* @return array
*/
public static function add_origin_column( $columns ) {
public static function add_origin_column( array $columns ) {
// Add a new column after the title column.
$columns['activitypub_origin'] = __( 'ActivityPub origin', 'event-bridge-for-activitypub' );
return $columns;
@ -48,12 +49,12 @@ class User_Interface {
/**
* Add a "⁂ Preview" link to the row actions.
*
* @param array $actions The existing actions.
* @param \WP_Post $post The post object.
* @param array $actions The existing actions.
* @param WP_Post $post The post object.
*
* @return array The modified actions.
*/
public static function row_actions( $actions, $post ): array {
public static function row_actions( array $actions, WP_Post $post ): array {
// check if the post is enabled for ActivityPub.
if ( ! Event_Sources::is_cached_external_post( $post ) ) {
return $actions;
@ -67,7 +68,7 @@ class User_Interface {
$url = \get_post_meta( $parent->ID, '_activitypub_actor_id', true );
}
$actions['view_origin'] = sprintf(
$actions['view_origin'] = \sprintf(
'<a href="%s" target="_blank">⁂ %s</a>',
\esc_url( $url ),
\esc_html__( 'Open original page', 'event-bridge-for-activitypub' )
@ -79,14 +80,14 @@ class User_Interface {
/**
* Modify the user capabilities so that nobody can edit external events.
*
* @param array $caps Concerned user's capabilities.
* @param mixed $cap Required primitive capabilities for the requested capability.
* @param array $user_id The WordPress user ID.
* @param array $args Additional args.
* @param string[] $caps Concerned user's capabilities.
* @param string $cap Required primitive capabilities for the requested capability.
* @param int $user_id The WordPress user ID.
* @param array $args Additional args.
*
* @return array
*/
public static function disable_editing_for_external_events( $caps, $cap, $user_id, $args ) {
public static function disable_editing_for_external_events( array $caps, string $cap, int $user_id, array $args ) {
if ( 'edit_post' === $cap && isset( $args[0] ) ) {
$post_id = $args[0];
$post = get_post( $post_id );