@@ -101,6 +101,9 @@ discard block |
||
| 101 | 101 | ->extractTo($this->storagePath($this->local_path), array($file), \Chumper\Zipper\Zipper::WHITELIST); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | + /** |
|
| 105 | + * @param string $file |
|
| 106 | + */ |
|
| 104 | 107 | protected function ReadOpenXmlFile($file, $type="file") |
| 105 | 108 | { |
| 106 | 109 | $this->exctractOpenXmlFile($file); |
@@ -126,6 +129,10 @@ discard block |
||
| 126 | 129 | } |
| 127 | 130 | } |
| 128 | 131 | |
| 132 | + /** |
|
| 133 | + * @param string $file |
|
| 134 | + * @param string|false $folder |
|
| 135 | + */ |
|
| 129 | 136 | protected function saveOpenXmlFile($file, $folder, $content) |
| 130 | 137 | { |
| 131 | 138 | \Storage::disk($this->storageDisk) |
@@ -193,6 +200,9 @@ discard block |
||
| 193 | 200 | } |
| 194 | 201 | } |
| 195 | 202 | |
| 203 | + /** |
|
| 204 | + * @param \SimpleXMLElement $main_file |
|
| 205 | + */ |
|
| 196 | 206 | protected function FetchReplaceableImages(&$main_file, $ns) |
| 197 | 207 | { |
| 198 | 208 | //set up basic arrays to keep track of imgs |
@@ -101,11 +101,11 @@ discard block |
||
| 101 | 101 | ->extractTo($this->storagePath($this->local_path), array($file), \Chumper\Zipper\Zipper::WHITELIST); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - protected function ReadOpenXmlFile($file, $type="file") |
|
| 104 | + protected function ReadOpenXmlFile($file, $type = "file") |
|
| 105 | 105 | { |
| 106 | 106 | $this->exctractOpenXmlFile($file); |
| 107 | 107 | |
| 108 | - if($type=="file") |
|
| 108 | + if ($type == "file") |
|
| 109 | 109 | { |
| 110 | 110 | if ($file_contents = \Storage::disk($this->storageDisk)->get($this->local_path.$file)) |
| 111 | 111 | { |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | { |
| 140 | 140 | $this->log('Analyze Template'); |
| 141 | 141 | //get the main document out of the docx archive |
| 142 | - $this->word_doc = ReadOpenXmlFile('word/document.xml','file'); |
|
| 142 | + $this->word_doc = ReadOpenXmlFile('word/document.xml', 'file'); |
|
| 143 | 143 | |
| 144 | 144 | $this->log('Merge Data into Template'); |
| 145 | 145 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | protected function AddContentType($imageCt = "jpeg") |
| 159 | 159 | { |
| 160 | - $ct_file = $this->ReadOpenXmlFile('[Content_Types].xml','object'); |
|
| 160 | + $ct_file = $this->ReadOpenXmlFile('[Content_Types].xml', 'object'); |
|
| 161 | 161 | |
| 162 | 162 | if (!($ct_file instanceof \Traversable)) { |
| 163 | 163 | throw new Exception('Cannot traverse through [Content_Types].xml.'); |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | $imgs = $replaceableImage['imgs']; |
| 331 | 331 | $imgs_replaced = $replaceableImage['imgs_replaced']; |
| 332 | 332 | |
| 333 | - $rels_file = $this->ReadOpenXmlFile('word/_rels/document.xml.rels','object'); |
|
| 333 | + $rels_file = $this->ReadOpenXmlFile('word/_rels/document.xml.rels', 'object'); |
|
| 334 | 334 | |
| 335 | 335 | $this->RemoveReplaceImages($imgs_replaced, $rels_file); |
| 336 | 336 | |