array( 'type' => 'array', 'items' => array( 'type' => 'string' ), 'minItems' => 1, 'description' => __( 'Absolute URLs to submit. Each must be a valid URL on this site.', 'acrossai-abilities-manager' ), ), ); } protected function output_properties(): array { return array( 'submitted' => array( 'type' => 'array' ), 'accepted' => array( 'type' => 'boolean' ), 'response_code' => array( 'type' => 'integer' ), 'key_location' => array( 'type' => 'string' ), ); } protected function required_input(): array { return array( 'urls' ); } protected function annotations(): array { return array( 'readonly' => false, 'destructive' => false, 'idempotent' => false ); } /** * @param array $input * @return array|WP_Error */ protected function run( array $input ) { if ( ! isset( $input['urls'] ) || ! is_array( $input['urls'] ) ) { return new WP_Error( 'invalid_input', __( 'urls must be a list of URLs.', 'acrossai-abilities-manager' ) ); } $result = Instant_Indexing_Repository::submit( $input['urls'] ); if ( is_wp_error( $result ) ) { return $result; } $count = count( $result['submitted'] ); $result['message'] = sprintf( /* translators: %d: number of URLs submitted */ _n( 'Submitted %d URL to IndexNow.', 'Submitted %d URLs to IndexNow.', $count, 'acrossai-abilities-manager' ), $count ); return $result; } }