ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
PhpOffice\PhpSpreadsheet\Shared\XMLWriter Class Reference
+ Inheritance diagram for PhpOffice\PhpSpreadsheet\Shared\XMLWriter:
+ Collaboration diagram for PhpOffice\PhpSpreadsheet\Shared\XMLWriter:

Public Member Functions

 __construct ($pTemporaryStorage=self::STORAGE_MEMORY, $pTemporaryStorageFolder=null)
 Create a new XMLWriter instance. More...
 
 __destruct ()
 Destructor. More...
 
 getData ()
 Get written data. More...
 
 writeRawData ($text)
 Wrapper method for writeRaw. More...
 

Data Fields

const STORAGE_MEMORY = 1
 Temporary storage method. More...
 
const STORAGE_DISK = 2
 

Static Public Attributes

static $debugEnabled = false
 

Private Attributes

 $tempFileName = ''
 

Detailed Description

Definition at line 5 of file XMLWriter.php.

Constructor & Destructor Documentation

◆ __construct()

PhpOffice\PhpSpreadsheet\Shared\XMLWriter::__construct (   $pTemporaryStorage = self::STORAGE_MEMORY,
  $pTemporaryStorageFolder = null 
)

Create a new XMLWriter instance.

Parameters
int$pTemporaryStorageTemporary storage location
string$pTemporaryStorageFolderTemporary storage folder

Definition at line 26 of file XMLWriter.php.

References PhpOffice\PhpSpreadsheet\Shared\File\sysGetTempDir().

27  {
28  // Open temporary storage
29  if ($pTemporaryStorage == self::STORAGE_MEMORY) {
30  $this->openMemory();
31  } else {
32  // Create temporary filename
33  if ($pTemporaryStorageFolder === null) {
34  $pTemporaryStorageFolder = File::sysGetTempDir();
35  }
36  $this->tempFileName = @tempnam($pTemporaryStorageFolder, 'xml');
37 
38  // Open storage
39  if ($this->openUri($this->tempFileName) === false) {
40  // Fallback to memory...
41  $this->openMemory();
42  }
43  }
44 
45  // Set default values
46  if (self::$debugEnabled) {
47  $this->setIndent(true);
48  }
49  }
static sysGetTempDir()
Get the systems temporary directory.
Definition: File.php:111
+ Here is the call graph for this function:

◆ __destruct()

PhpOffice\PhpSpreadsheet\Shared\XMLWriter::__destruct ( )

Destructor.

Definition at line 54 of file XMLWriter.php.

55  {
56  // Unlink temporary files
57  if ($this->tempFileName != '') {
58  @unlink($this->tempFileName);
59  }
60  }

Member Function Documentation

◆ getData()

PhpOffice\PhpSpreadsheet\Shared\XMLWriter::getData ( )

Get written data.

Returns
string

Definition at line 67 of file XMLWriter.php.

68  {
69  if ($this->tempFileName == '') {
70  return $this->outputMemory(true);
71  }
72  $this->flush();
73 
74  return file_get_contents($this->tempFileName);
75  }

◆ writeRawData()

PhpOffice\PhpSpreadsheet\Shared\XMLWriter::writeRawData (   $text)

Wrapper method for writeRaw.

Parameters
string|string[]$text
Returns
bool

Definition at line 84 of file XMLWriter.php.

References $text.

Referenced by PhpOffice\PhpSpreadsheet\Writer\Ods\Meta\writeDocPropsCustom(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Chart\writePlotSeriesValues(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\StringTable\writeRichText(), and PhpOffice\PhpSpreadsheet\Writer\Xlsx\StringTable\writeRichTextForCharts().

85  {
86  if (is_array($text)) {
87  $text = implode("\n", $text);
88  }
89 
90  return $this->writeRaw(htmlspecialchars($text ?? ''));
91  }
$text
Definition: errorreport.php:18
+ Here is the caller graph for this function:

Field Documentation

◆ $debugEnabled

PhpOffice\PhpSpreadsheet\Shared\XMLWriter::$debugEnabled = false
static

Definition at line 7 of file XMLWriter.php.

◆ $tempFileName

PhpOffice\PhpSpreadsheet\Shared\XMLWriter::$tempFileName = ''
private

Definition at line 18 of file XMLWriter.php.

◆ STORAGE_DISK

const PhpOffice\PhpSpreadsheet\Shared\XMLWriter::STORAGE_DISK = 2

Definition at line 11 of file XMLWriter.php.

◆ STORAGE_MEMORY

const PhpOffice\PhpSpreadsheet\Shared\XMLWriter::STORAGE_MEMORY = 1

Temporary storage method.

Definition at line 10 of file XMLWriter.php.


The documentation for this class was generated from the following file: