array( 'type' => 'integer', 'default' => 100, 'minimum' => 1, 'maximum' => 500, 'description' => __( 'Maximum URLs to return.', 'acrossai-abilities-manager' ), ), 'offset' => array( 'type' => 'integer', 'default' => 0, 'minimum' => 0, 'description' => __( 'URLs to skip.', 'acrossai-abilities-manager' ), ), ); } protected function required_input(): array { return array(); } protected function output_properties(): array { return array( 'total' => array( 'type' => 'integer' ), 'urls' => array( 'type' => 'array' ), ); } protected function annotations(): array { return array( 'readonly' => true, 'destructive' => false, 'idempotent' => true, ); } /** * @param array $input Input. * @return array */ protected function run( array $input ) { $limit = isset( $input['limit'] ) ? (int) $input['limit'] : 100; $offset = isset( $input['offset'] ) ? (int) $input['offset'] : 0; $map = Crawler_Repository::map( $limit, $offset ); return array( 'total' => $map['total'], 'urls' => $map['urls'], 'message' => sprintf( /* translators: 1: returned count, 2: total */ __( '%1$d of %2$d sitemap URLs.', 'acrossai-abilities-manager' ), count( $map['urls'] ), $map['total'] ), ); } }