array( 'type' => 'integer', 'minimum' => 1, 'description' => __( 'Inspect inbound links to this post.', 'acrossai-abilities-manager' ) ), 'target_url' => array( 'type' => 'string', 'description' => __( 'Inspect inbound links to this URL, resolved to a post.', 'acrossai-abilities-manager' ) ), 'post_types' => array( 'type' => 'array', 'items' => array( 'type' => 'string' ), 'description' => __( 'Source post types to scan. Defaults to all public types.', 'acrossai-abilities-manager' ), ), 'include_sources' => array( 'type' => 'boolean', 'default' => true, 'description' => __( 'Include the linking pages, not just counts.', 'acrossai-abilities-manager' ) ), 'include_menus' => array( 'type' => 'boolean', 'default' => true, 'description' => __( 'Count navigation-menu links as inbound.', 'acrossai-abilities-manager' ) ), 'min_count' => array( 'type' => 'integer', 'default' => 1, 'minimum' => 0, 'description' => __( 'Minimum inbound count. Use 0 with no target to include orphans.', 'acrossai-abilities-manager' ) ), 'limit' => array( 'type' => 'integer', 'default' => 100, 'minimum' => 1, 'maximum' => 500 ), ); } protected function output_properties(): array { return array( 'items' => array( 'type' => 'array' ), 'count' => array( 'type' => 'integer' ), 'scanned_sources' => array( 'type' => 'integer' ), 'menus_included' => array( 'type' => 'boolean' ), ); } protected function required_input(): array { return array(); } protected function annotations(): array { return array( 'readonly' => true, 'destructive' => false, 'idempotent' => true ); } /** * @param array $input * @return array|WP_Error */ protected function run( array $input ) { $result = Content_Audit_Repository::inbound_links( $input ); $result['message'] = sprintf( /* translators: 1: number of targets returned, 2: number of source pages scanned */ __( 'Returned %1$d link targets after scanning %2$d source pages.', 'acrossai-abilities-manager' ), $result['count'], $result['scanned_sources'] ); return $result; } }