Page MenuHomePhorge

PhabricatorTextExportFormat.php
No OneTemporary

PhabricatorTextExportFormat.php

<?php
final class PhabricatorTextExportFormat
extends PhabricatorExportFormat {
const EXPORTKEY = 'text';
private $rows = array();
public function getExportFormatName() {
return 'Tab-Separated Text (.txt)';
}
public function isExportFormatEnabled() {
return true;
}
public function getFileExtension() {
return 'txt';
}
public function getMIMEContentType() {
return 'text/plain';
}
public function addHeaders(array $fields) {
$headers = mpull($fields, 'getLabel');
$this->addRow($headers);
}
public function addObject($object, array $fields, array $map) {
$values = array();
foreach ($fields as $key => $field) {
$value = $map[$key];
$value = $field->getTextValue($value);
$values[] = $value;
}
$this->addRow($values);
}
private function addRow(array $values) {
$row = array();
foreach ($values as $value) {
if (phutil_nonempty_string($value)) {
$row[] = addcslashes($value, "\0..\37\\\177..\377");
}
}
$this->rows[] = implode("\t", $row);
}
public function newFileData() {
return implode("\n", $this->rows)."\n";
}
}

File Metadata

Mime Type
text/x-php
Expires
Sun, Jan 19, 19:43 (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1128099
Default Alt Text
PhabricatorTextExportFormat.php (1 KB)

Event Timeline