class PHPExcel_Shared_XMLWriter in Loft Data Grids 6.2
Same name and namespace in other branches
- 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/XMLWriter.php \PHPExcel_Shared_XMLWriter
PHPExcel_Shared_XMLWriter
@category PHPExcel @package PHPExcel_Shared @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
Hierarchy
- class \PHPExcel_Shared_XMLWriter extends \XMLWriter
Expanded class hierarchy of PHPExcel_Shared_XMLWriter
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Shared/ XMLWriter.php, line 44
View source
class PHPExcel_Shared_XMLWriter extends XMLWriter {
/** Temporary storage method */
const STORAGE_MEMORY = 1;
const STORAGE_DISK = 2;
/**
* Temporary filename
*
* @var string
*/
private $_tempFileName = '';
/**
* Create a new PHPExcel_Shared_XMLWriter instance
*
* @param int $pTemporaryStorage Temporary storage location
* @param string $pTemporaryStorageFolder Temporary storage folder
*/
public function __construct($pTemporaryStorage = self::STORAGE_MEMORY, $pTemporaryStorageFolder = NULL) {
// Open temporary storage
if ($pTemporaryStorage == self::STORAGE_MEMORY) {
$this
->openMemory();
}
else {
// Create temporary filename
if ($pTemporaryStorageFolder === NULL) {
$pTemporaryStorageFolder = PHPExcel_Shared_File::sys_get_temp_dir();
}
$this->_tempFileName = @tempnam($pTemporaryStorageFolder, 'xml');
// Open storage
if ($this
->openUri($this->_tempFileName) === false) {
// Fallback to memory...
$this
->openMemory();
}
}
// Set default values
if (DEBUGMODE_ENABLED) {
$this
->setIndent(true);
}
}
/**
* Destructor
*/
public function __destruct() {
// Unlink temporary files
if ($this->_tempFileName != '') {
@unlink($this->_tempFileName);
}
}
/**
* Get written data
*
* @return $data
*/
public function getData() {
if ($this->_tempFileName == '') {
return $this
->outputMemory(true);
}
else {
$this
->flush();
return file_get_contents($this->_tempFileName);
}
}
/**
* Fallback method for writeRaw, introduced in PHP 5.2
*
* @param string $text
* @return string
*/
public function writeRawData($text) {
if (is_array($text)) {
$text = implode("\n", $text);
}
if (method_exists($this, 'writeRaw')) {
return $this
->writeRaw(htmlspecialchars($text));
}
return $this
->text($text);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PHPExcel_Shared_XMLWriter:: |
private | property | * Temporary filename * * | |
PHPExcel_Shared_XMLWriter:: |
public | function | * Get written data * * | |
PHPExcel_Shared_XMLWriter:: |
constant | |||
PHPExcel_Shared_XMLWriter:: |
constant | Temporary storage method | ||
PHPExcel_Shared_XMLWriter:: |
public | function | * Fallback method for writeRaw, introduced in PHP 5.2 * * | |
PHPExcel_Shared_XMLWriter:: |
public | function | * Create a new PHPExcel_Shared_XMLWriter instance * * | |
PHPExcel_Shared_XMLWriter:: |
public | function | * Destructor |