@@ -40,6 +40,10 @@ |
||
40 | 40 | return false; |
41 | 41 | } |
42 | 42 | |
43 | + /** |
|
44 | + * @param DocxMustache $parent |
|
45 | + * @param string $data |
|
46 | + */ |
|
43 | 47 | protected function ResampleImage($parent, $imgs, $k, $data) |
44 | 48 | { |
45 | 49 | \Storage::disk($parent->storageDisk)->put($parent->local_path.'word/media/'.$imgs[$k]['img_file_src'], $data); |
@@ -2,9 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace WrkLst\DocxMustache; |
4 | 4 | |
5 | -use Exception; |
|
6 | -use Illuminate\Support\Facades\Log; |
|
7 | - |
|
8 | 5 | class DocImage |
9 | 6 | { |
10 | 7 | protected function AllowedContentTypeImages() |
@@ -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 |
@@ -7,6 +7,9 @@ |
||
7 | 7 | |
8 | 8 | class HtmlConversion |
9 | 9 | { |
10 | + /** |
|
11 | + * @param MustacheRender $value |
|
12 | + */ |
|
10 | 13 | public function __construct($value) |
11 | 14 | { |
12 | 15 | return $this->convertHtmlToOpenXML($value); |
@@ -2,9 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace WrkLst\DocxMustache; |
4 | 4 | |
5 | -use Exception; |
|
6 | -use Illuminate\Support\Facades\Log; |
|
7 | - |
|
8 | 5 | class HtmlConversion |
9 | 6 | { |
10 | 7 | public function __construct($value) |