Нема описа

Importer.php 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /*******************************************************************************
  3. * Copyright (c) 2019, Code Atlantic LLC
  4. ******************************************************************************/
  5. if ( ! defined( 'ABSPATH' ) ) {
  6. exit;
  7. }
  8. /**
  9. * Promise for structuring CSV importers.
  10. *
  11. * @since 1.7.0
  12. *
  13. * @see PUM_Interface_Batch_Importer
  14. */
  15. interface PUM_Interface_CSV_Importer extends PUM_Interface_Batch_Importer {
  16. /**
  17. * Maps CSV columns to their corresponding import fields.
  18. *
  19. * @param array $import_fields Import fields to map.
  20. */
  21. public function map_fields( $import_fields = array() );
  22. /**
  23. * Retrieves the CSV columns.
  24. *
  25. * @return array The columns in the CSV.
  26. */
  27. public function get_columns();
  28. /**
  29. * Maps a single CSV row to the data passed in via init().
  30. *
  31. * @param array $csv_row CSV row data.
  32. *
  33. * @return array CSV row data mapped to form-defined arguments.
  34. */
  35. public function map_row( $csv_row );
  36. /**
  37. * Retrieves the first row of the CSV.
  38. *
  39. * This is used for showing an example of what the import will look like.
  40. *
  41. * @return array The first row after the header of the CSV.
  42. */
  43. public function get_first_row();
  44. }