| @@ -39,13 +39,13 @@ | ||
| 39 | 39 | * @param string $old_status Old comment status. |
| 40 | 40 | * @param \WP_Comment $comment Comment object. |
| 41 | 41 | */ |
| 42 | 42 | public static function schedule_comment_activity( $new_status, $old_status, $comment ) { |
| 43 | - if ( \defined( 'WP_IMPORTING' ) && WP_IMPORTING ) { | |
| 43 | + if ( defined( 'WP_IMPORTING' ) && WP_IMPORTING ) { | |
| 44 | 44 | return; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - $comment = \get_comment( $comment ); | |
| 47 | + $comment = get_comment( $comment ); | |
| 48 | 48 | |
| 49 | 49 | // Federate only comments that are written by a registered user. |
| 50 | 50 | if ( ! $comment || ! $comment->user_id ) { |
| 51 | 51 | return; |
| @@ -54,19 +54,13 @@ | ||
| 54 | 54 | /* |
| 55 | 55 | * Check against supported comment types. |
| 56 | 56 | * Only federate registered ActivityPub comment types and standard WordPress comments. |
| 57 | 57 | */ |
| 58 | - $comment_type = $comment->comment_type; | |
| 59 | - if ( '' === $comment_type ) { | |
| 60 | - // Be backwards compatible with comments that have an empty type by treating them as standard comments. | |
| 61 | - $comment_type = 'comment'; | |
| 62 | - } | |
| 63 | - | |
| 64 | 58 | $allowed_types = Comment_Utils::get_comment_type_slugs(); |
| 65 | 59 | $allowed_types[] = 'comment'; // Add core WordPress comment types. |
| 66 | 60 | |
| 67 | 61 | // Check if comment type is in allowed list. |
| 68 | - if ( ! \in_array( $comment_type, $allowed_types, true ) ) { | |
| 62 | + if ( ! in_array( $comment->comment_type, $allowed_types, true ) ) { | |
| 69 | 63 | return; |
| 70 | 64 | } |
| 71 | 65 | |
| 72 | 66 | $type = false; |
| @@ -77,9 +71,9 @@ | ||
| 77 | 71 | ) { |
| 78 | 72 | $type = 'Create'; |
| 79 | 73 | } elseif ( 'approved' === $new_status ) { |
| 80 | 74 | $type = 'Update'; |
| 81 | - \update_comment_meta( $comment->comment_ID, 'activitypub_comment_modified', \time(), true ); | |
| 75 | + \update_comment_meta( $comment->comment_ID, 'activitypub_comment_modified', time(), true ); | |
| 82 | 76 | } elseif ( |
| 83 | 77 | 'trash' === $new_status || |
| 84 | 78 | ( 'delete' === $new_status && '' === $old_status ) || // Went through schedule_comment_delete_activity(). |
| 85 | 79 | 'spam' === $new_status |