You are here

function regcode_import_text in Registration codes 5.3

Import codes from a multi-line string (plain list or CSV)

Parameters

$text: Multi-line string to import from

$action: Import action: overwrite - overwrite any existing codes with same code identifiers as the imported ones skip - skip any import of a codes, if any code with same code identifier exists clean - completely wipe the code database befor importing all codes

$code_template: Optional code data template to use as default data setting for each imported code (key/value pairs for any applicable code field, see regcode_save_code)

Return value

Whether the import operation has been successful (TRUE) or not (FALSE)

1 call to regcode_import_text()
regcode_admin_import_submit in ./regcode_admin.inc.php
Handle the processing of a submitted import form

File

./regcode_api.inc.php, line 375
regcode_api.inc.php contains general low-level functions for the registration-code module, for tasks like

Code

function regcode_import_text(&$text, $action = NULL, $code_template = NULL) {

  // open string as memory stream and delegate to regcode_import_stream
  $handle = fopen("php://temp/maxmemory:" . 5 * 1024 * 1024, 'rw');
  fputs($handle, $text);
  rewind($handle);
  $result = regcode_import_stream($handle, $action, $code_template);
  fclose($handle);
  return $result;
}