18
18
namespace PhpOffice \PhpPresentation \Reader ;
19
19
20
20
use ZipArchive ;
21
- use PhpOffice \Common \Text ;
22
21
use PhpOffice \Common \XMLReader ;
23
22
use PhpOffice \Common \Drawing as CommonDrawing ;
24
- use PhpOffice \PhpPresentation \AbstractShape ;
25
23
use PhpOffice \PhpPresentation \PhpPresentation ;
26
- use PhpOffice \PhpPresentation \Shape \Drawing ;
27
- use PhpOffice \PhpPresentation \Shape \Group ;
28
24
use PhpOffice \PhpPresentation \Shape \Hyperlink ;
29
- use PhpOffice \PhpPresentation \Shape \Line ;
30
25
use PhpOffice \PhpPresentation \Shape \MemoryDrawing ;
31
- use PhpOffice \PhpPresentation \Shape \RichText ;
32
- use PhpOffice \PhpPresentation \Style \Alignment ;
33
26
use PhpOffice \PhpPresentation \Style \Bullet ;
34
27
use PhpOffice \PhpPresentation \Style \Color ;
35
28
@@ -142,28 +135,29 @@ protected function loadFile($pFilename)
142
135
protected function loadDocumentProperties ($ sPart )
143
136
{
144
137
$ xmlReader = new XMLReader ();
145
- if ($ xmlReader ->getDomFromString ($ sPart )) {
146
- $ arrayProperties = array (
147
- '/cp:coreProperties/dc:creator ' => 'setCreator ' ,
148
- '/cp:coreProperties/cp:lastModifiedBy ' => 'setLastModifiedBy ' ,
149
- '/cp:coreProperties/dc:title ' => 'setTitle ' ,
150
- '/cp:coreProperties/dc:description ' => 'setDescription ' ,
151
- '/cp:coreProperties/dc:subject ' => 'setSubject ' ,
152
- '/cp:coreProperties/cp:keywords ' => 'setKeywords ' ,
153
- '/cp:coreProperties/cp:category ' => 'setCategory ' ,
154
- '/cp:coreProperties/dcterms:created ' => 'setCreated ' ,
155
- '/cp:coreProperties/dcterms:modified ' => 'setModified ' ,
156
- );
157
- $ oProperties = $ this ->oPhpPresentation ->getProperties ();
158
- foreach ($ arrayProperties as $ path => $ property ) {
159
- if (is_object ($ oElement = $ xmlReader ->getElement ($ path ))) {
160
- if ($ oElement ->hasAttribute ('xsi:type ' ) && $ oElement ->getAttribute ('xsi:type ' ) == 'dcterms:W3CDTF ' ) {
161
- $ oDateTime = new \DateTime ();
162
- $ oDateTime ->createFromFormat (\DateTime::W3C , $ oElement ->nodeValue );
163
- $ oProperties ->{$ property }($ oDateTime ->getTimestamp ());
164
- } else {
165
- $ oProperties ->{$ property }($ oElement ->nodeValue );
166
- }
138
+ if (!$ xmlReader ->getDomFromString ($ sPart )) {
139
+ return false ;
140
+ }
141
+ $ arrayProperties = array (
142
+ '/cp:coreProperties/dc:creator ' => 'setCreator ' ,
143
+ '/cp:coreProperties/cp:lastModifiedBy ' => 'setLastModifiedBy ' ,
144
+ '/cp:coreProperties/dc:title ' => 'setTitle ' ,
145
+ '/cp:coreProperties/dc:description ' => 'setDescription ' ,
146
+ '/cp:coreProperties/dc:subject ' => 'setSubject ' ,
147
+ '/cp:coreProperties/cp:keywords ' => 'setKeywords ' ,
148
+ '/cp:coreProperties/cp:category ' => 'setCategory ' ,
149
+ '/cp:coreProperties/dcterms:created ' => 'setCreated ' ,
150
+ '/cp:coreProperties/dcterms:modified ' => 'setModified ' ,
151
+ );
152
+ $ oProperties = $ this ->oPhpPresentation ->getProperties ();
153
+ foreach ($ arrayProperties as $ path => $ property ) {
154
+ if (is_object ($ oElement = $ xmlReader ->getElement ($ path ))) {
155
+ if ($ oElement ->hasAttribute ('xsi:type ' ) && $ oElement ->getAttribute ('xsi:type ' ) == 'dcterms:W3CDTF ' ) {
156
+ $ oDateTime = new \DateTime ();
157
+ $ oDateTime ->createFromFormat (\DateTime::W3C , $ oElement ->nodeValue );
158
+ $ oProperties ->{$ property }($ oDateTime ->getTimestamp ());
159
+ } else {
160
+ $ oProperties ->{$ property }($ oElement ->nodeValue );
167
161
}
168
162
}
169
163
}
@@ -196,6 +190,8 @@ protected function loadSlides($sPart)
196
190
197
191
/**
198
192
* Extract data from slide
193
+ * @param string $sPart
194
+ * @param string $baseFile
199
195
*/
200
196
protected function loadSlide ($ sPart , $ baseFile )
201
197
{
@@ -454,7 +450,7 @@ protected function loadShapeRichText(XMLReader $document, \DOMElement $node, $ba
454
450
$ oText ->getHyperlink ()->setUrl ($ this ->arrayRels [$ fileRels ][$ oElementHlinkClick ->getAttribute ('r:id ' )]);
455
451
}
456
452
}
457
- } else {
453
+ // } else {
458
454
// $oText = $oParagraph->createText();
459
455
}
460
456
@@ -471,7 +467,7 @@ protected function loadShapeRichText(XMLReader $document, \DOMElement $node, $ba
471
467
472
468
/**
473
469
*
474
- * @param string $rId
470
+ * @param string $fileRels
475
471
* @return string
476
472
*/
477
473
protected function loadRels ($ fileRels )
0 commit comments