+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018 |
+ | Copyright CiviCRM LLC (c) 2004-2019 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC (c) 2004-2019
*/
class CRM_Import_DataSource_CSV extends CRM_Import_DataSource {
const
* collection of info about this data source
*/
public function getInfo() {
- return array('title' => ts('Comma-Separated Values (CSV)'));
+ return ['title' => ts('Comma-Separated Values (CSV)')];
}
/**
$form->assign('uploadSize', $uploadSize);
$form->add('File', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE);
$form->setMaxFileSize($uploadFileSize);
- $form->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(
- 1 => $uploadSize,
- 2 => $uploadFileSize,
- )), 'maxfilesize', $uploadFileSize);
+ $form->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', [
+ 1 => $uploadSize,
+ 2 => $uploadFileSize,
+ ]), 'maxfilesize', $uploadFileSize);
$form->addRule('uploadFile', ts('Input file must be in CSV format'), 'utf8File');
$form->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile');
$table = NULL,
$fieldSeparator = ','
) {
- $result = array();
+ $result = [];
$fd = fopen($file, 'r');
if (!$fd) {
CRM_Core_Error::fatal("Could not read $file");
}
}
else {
- $columns = array();
+ $columns = [];
foreach ($firstrow as $i => $_) {
$columns[] = "col_$i";
}
function($string) {
return trim($string, chr(0xC2) . chr(0xA0));
}, $row);
- $row = array_map(array('CRM_Core_DAO', 'escapeString'), $row);
+ $row = array_map(['CRM_Core_DAO', 'escapeString'], $row);
$sql .= "('" . implode("', '", $row) . "')";
$count++;