From e8b2b4c899d41ca4ac78365b01fd8aafd462ccb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 7 Dec 2024 20:20:17 +0100 Subject: [PATCH] fix more namespaces --- .../collection/class-event-sources.php | 16 +++++++------- includes/table/class-event-sources.php | 22 +++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/includes/activitypub/collection/class-event-sources.php b/includes/activitypub/collection/class-event-sources.php index c72453d..2d29b03 100644 --- a/includes/activitypub/collection/class-event-sources.php +++ b/includes/activitypub/collection/class-event-sources.php @@ -10,7 +10,7 @@ namespace Event_Bridge_For_ActivityPub\ActivityPub\Collection; use WP_Error; use WP_Query; -use Event_Bridge_For_ActivityPub\ActivityPub\Event_Source; +use Event_Bridge_For_ActivityPub\ActivityPub\Model\Event_Source; use function Activitypub\is_tombstone; use function Activitypub\get_remote_metadata_by_actor; @@ -32,8 +32,8 @@ class Event_Sources { self::POST_TYPE, array( 'labels' => array( - 'name' => _x( 'Event Sources', 'post_type plural name', 'activitypub' ), - 'singular_name' => _x( 'Event Source', 'post_type single name', 'activitypub' ), + 'name' => _x( 'Event Sources', 'post_type plural name', 'event-bridge-for-activitypub' ), + 'singular_name' => _x( 'Event Source', 'post_type single name', 'event-bridge-for-activitypub' ), ), 'public' => false, 'hierarchical' => false, @@ -63,7 +63,7 @@ class Event_Sources { 'single' => false, 'sanitize_callback' => function ( $value ) { if ( ! is_string( $value ) ) { - throw new Exception( 'Error message is no valid string' ); + throw new \Exception( 'Error message is no valid string' ); } return esc_sql( $value ); @@ -111,7 +111,7 @@ class Event_Sources { } if ( empty( $meta ) || ! is_array( $meta ) || is_wp_error( $meta ) ) { - return new WP_Error( 'activitypub_invalid_follower', __( 'Invalid Follower', 'activitypub' ), array( 'status' => 400 ) ); + return new WP_Error( 'activitypub_invalid_actor', __( 'Invalid ActivityPub Actor', 'event-bridge-for-activitypub' ), array( 'status' => 400 ) ); } $event_source = new Event_Source(); @@ -139,9 +139,9 @@ class Event_Sources { } /** - * Get all Followers. + * Get all Event-Sources. * - * @return array The Term list of Followers. + * @return array The Term list of Event Sources. */ public static function get_all_followers() { $args = array( @@ -159,6 +159,6 @@ class Event_Sources { ), ), ); - return self::get_followers( null, null, null, $args ); + return self::get_event_sources( null, null, null, $args ); } } diff --git a/includes/table/class-event-sources.php b/includes/table/class-event-sources.php index 7575d8a..200aebb 100644 --- a/includes/table/class-event-sources.php +++ b/includes/table/class-event-sources.php @@ -27,8 +27,8 @@ class Event_Sources extends WP_List_Table { public function __construct() { parent::__construct( array( - 'singular' => \__( 'Event Source', 'activitypub' ), - 'plural' => \__( 'Event Sources', 'activitypub' ), + 'singular' => \__( 'Event Source', 'event-bridge-for-activitypub' ), + 'plural' => \__( 'Event Sources', 'event-bridge-for-activitypub' ), 'ajax' => false, ) ); @@ -42,12 +42,12 @@ class Event_Sources extends WP_List_Table { public function get_columns() { return array( 'cb' => '', - 'avatar' => \__( 'Avatar', 'activitypub' ), - 'post_title' => \__( 'Name', 'activitypub' ), - 'username' => \__( 'Username', 'activitypub' ), - 'url' => \__( 'URL', 'activitypub' ), - 'published' => \__( 'Followed', 'activitypub' ), - 'modified' => \__( 'Last updated', 'activitypub' ), + 'avatar' => \__( 'Avatar', 'event-bridge-for-activitypub' ), + 'post_title' => \__( 'Name', 'event-bridge-for-activitypub' ), + 'username' => \__( 'Username', 'event-bridge-for-activitypub' ), + 'url' => \__( 'URL', 'event-bridge-for-activitypub' ), + 'published' => \__( 'Followed', 'event-bridge-for-activitypub' ), + 'modified' => \__( 'Last updated', 'event-bridge-for-activitypub' ), ); } @@ -146,7 +146,7 @@ class Event_Sources extends WP_List_Table { */ public function get_bulk_actions() { return array( - 'delete' => __( 'Delete', 'activitypub' ), + 'delete' => __( 'Delete', 'event-bridge-for-activitypub' ), ); } @@ -159,7 +159,7 @@ class Event_Sources extends WP_List_Table { */ public function column_default( $item, $column_name ) { if ( ! array_key_exists( $column_name, $item ) ) { - return __( 'None', 'activitypub' ); + return __( 'None', 'event-bridge-for-activitypub' ); } return $item[ $column_name ]; } @@ -224,7 +224,7 @@ class Event_Sources extends WP_List_Table { $followers = array( $followers ); } foreach ( $followers as $follower ) { - FollowerCollection::remove_follower( $this->user_id, $follower ); + Event_Source::remove( $this->user_id, $follower ); } } }