PluginProbe
ActivityPub / 9.2.1
ActivityPub v9.2.1
9.3.1 9.3.0 9.2.2 9.2.1 9.2.0 9.1.0 9.0.2 9.0.1 9.0.0 8.3.0 8.2.1 8.2.0 8.1.1 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.2.0 1.3.0 2.0.0 2.0.1 2.1.0 2.1.1 All 160 releases
← All changes | includes/class-post-types.php +44 -9 8.2.19.2.1 View file →
@@ -33,8 +33,9 @@
33 33 \add_action( 'init', array( self::class, 'register_post_post_type' ), 11 );
34 34 \add_action( 'init', array( self::class, 'register_extra_fields_post_types' ), 11 );
35 35 \add_action( 'init', array( self::class, 'register_activitypub_post_meta' ), 11 );
36 36 \add_action( 'init', array( self::class, 'register_oauth_post_types' ), 11 );
37 + \add_action( 'init', array( self::class, 'register_tombstone_post_type' ), 11 );
37 38
38 39 \add_action( 'rest_api_init', array( self::class, 'register_ap_actor_rest_field' ) );
39 40 \add_action( 'rest_api_init', array( self::class, 'register_ap_post_actor_rest_field' ) );
40 41 \add_action( 'rest_api_init', array( self::class, 'register_ap_post_rest_params' ) );
@@ -517,12 +518,12 @@
517 518 'type' => 'array',
518 519 'single' => true,
519 520 'description' => 'Allowed redirect URIs for this client.',
520 521 'sanitize_callback' => static function ( $value ) {
521 - if ( ! is_array( $value ) ) {
522 + if ( ! \is_array( $value ) ) {
522 523 return array();
523 524 }
524 - return array_map( array( Sanitize::class, 'redirect_uri' ), $value );
525 + return \array_map( array( Sanitize::class, 'redirect_uri' ), $value );
525 526 },
526 527 )
527 528 );
528 529
@@ -561,8 +562,42 @@
561 562 );
562 563 }
563 564
564 565 /**
566 + * Register the ap_tombstone post type.
567 + *
568 + * Stores local tombstone URLs out of the autoloaded options row.
569 + * The post type is fully internal — never queried publicly, never shown in UI.
570 + *
571 + * @since 8.3.0
572 + */
573 + public static function register_tombstone_post_type() {
574 + \register_post_type(
575 + Tombstone::POST_TYPE,
576 + array(
577 + 'labels' => array(
578 + 'name' => \_x( 'Tombstones', 'post_type plural name', 'activitypub' ),
579 + 'singular_name' => \_x( 'Tombstone', 'post_type single name', 'activitypub' ),
580 + ),
581 + 'public' => false,
582 + 'publicly_queryable' => false,
583 + 'show_ui' => false,
584 + 'show_in_menu' => false,
585 + 'show_in_nav_menus' => false,
586 + 'show_in_admin_bar' => false,
587 + 'show_in_rest' => false,
588 + 'exclude_from_search' => true,
589 + 'has_archive' => false,
590 + 'rewrite' => false,
591 + 'query_var' => false,
592 + 'can_export' => false,
593 + 'delete_with_user' => false,
594 + 'supports' => array(),
595 + )
596 + );
597 + }
598 +
599 + /**
565 600 * Register post meta for ActivityPub supported post types.
566 601 */
567 602 public static function register_activitypub_post_meta() {
568 603 $ap_post_types = \get_post_types_by_support( 'activitypub' );
@@ -709,10 +744,10 @@
709 744 }
710 745 return array(
711 746 'username' => $actor->get_preferred_username(),
712 747 'name' => $actor->get_name() ?? $actor->get_preferred_username(),
713 - 'icon' => object_to_uri( $actor->get_icon() ),
714 - 'url' => object_to_uri( $actor->get_url() ?? $actor->get_id() ),
748 + 'icon' => \sanitize_url( object_to_uri( $actor->get_icon() ) ?? '' ),
749 + 'url' => \sanitize_url( object_to_uri( $actor->get_url() ?? $actor->get_id() ) ?? '' ),
715 750 'webfinger' => Remote_Actors::get_acct( $response['id'] ),
716 751 'identifier' => $actor->get_id(),
717 752 );
718 753 },
@@ -797,10 +832,10 @@
797 832
798 833 return array(
799 834 'username' => $actor->get_preferred_username(),
800 835 'name' => $actor->get_name() ?? $actor->get_preferred_username(),
801 - 'icon' => object_to_uri( $actor->get_icon() ),
802 - 'url' => object_to_uri( $actor->get_url() ?? $actor->get_id() ),
836 + 'icon' => \sanitize_url( object_to_uri( $actor->get_icon() ) ?? '' ),
837 + 'url' => \sanitize_url( object_to_uri( $actor->get_url() ?? $actor->get_id() ) ?? '' ),
803 838 'webfinger' => Remote_Actors::get_acct( $id ),
804 839 'identifier' => $actor->get_id(),
805 840 );
806 841 },
@@ -820,9 +855,9 @@
820 855 \add_filter(
821 856 'rest_' . Remote_Posts::POST_TYPE . '_collection_params',
822 857 function ( $params ) {
823 858 $params['user_id'] = array(
824 - 'description' => __( 'Filter posts by user ID (0 for site/blog actor).', 'activitypub' ),
859 + 'description' => \__( 'Filter posts by user ID (0 for site/blog actor).', 'activitypub' ),
825 860 'type' => 'integer',
826 861 'sanitize_callback' => 'absint',
827 862 );
828 863
@@ -910,9 +945,9 @@
910 945 * @return array Modified collection parameters.
911 946 */
912 947 public static function register_object_type_user_param( $params ) {
913 948 $params['user_id'] = array(
914 - 'description' => __( 'Filter terms to those with posts from this user ID.', 'activitypub' ),
949 + 'description' => \__( 'Filter terms to those with posts from this user ID.', 'activitypub' ),
915 950 'type' => 'integer',
916 951 'sanitize_callback' => 'absint',
917 952 );
918 953
@@ -978,9 +1013,9 @@
978 1013 'activitypub_max_image_attachments' => (string) \get_option( 'activitypub_max_image_attachments', ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS ),
979 1014 );
980 1015
981 1016 if ( isset( $post_metas[ $meta_key ] ) && $post_metas[ $meta_key ] === (string) $meta_value ) {
982 - if ( 'update_post_metadata' === current_action() ) {
1017 + if ( 'update_post_metadata' === \current_action() ) {
983 1018 \delete_post_meta( $object_id, $meta_key );
984 1019 }
985 1020
986 1021 $check = true;