Skip to content

Commit f410fca

Browse files
committed
format
1 parent 41ae435 commit f410fca

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/PhpWord/TemplateProcessor.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,9 @@ public function setHtmlBlock($search, $htmlContent, $fullHtml = false): void
334334
if (!empty($imageSrcList)) {
335335
foreach ($imageSrcList as $imageSrc) {
336336
try {
337-
file_get_contents($imageSrc);
338-
}catch (\Exception $e) {
339-
$localImg = __DIR__.'/resources/doc.png';
337+
$content= file_get_contents($imageSrc);
338+
} catch (\Exception $e) {
339+
$localImg = __DIR__ . '/resources/doc.png';
340340
$htmlContent = str_replace($imageSrc, $localImg, $htmlContent);
341341
}
342342
}

tests/PhpWordTests/TemplateProcessorTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -1634,10 +1634,10 @@ public function testShouldMakeFieldsUpdateOnOpenWithCustomMacro(): void
16341634
public function testSetHtml(): void
16351635
{
16361636
Settings::setOutputEscapingEnabled(true);
1637-
$image1 = __DIR__.'/_files/images/earth.jpg';
1638-
$image2 = __DIR__.'/_files/images/mars.jpg';
1639-
$content = '<p><img src="'.$image1.'" /></p>
1640-
<p><img src="'.$image2.'" /></p>
1637+
$image1 = __DIR__ . '/_files/images/earth.jpg';
1638+
$image2 = __DIR__ . '/_files/images/mars.jpg';
1639+
$content = '<p><img src="' . $image1 . '" /></p>
1640+
<p><img src="' . $image2 . '" /></p>
16411641
<p>HPJ LDAP(Lightweight Directory Access Protocol),轻量级目录访问协议,是一种在线目录访问协议,主要用于目录中资源的搜索和查询。如果在用户可控制的输入中没有对 LDAP 语法进行除去或引用,那么生成的 LDAP 查询可能会导致</p>';
16421642
$templateProcessor = new TemplateProcessor(__DIR__ . '/_files/templates/template_to_html.docx');
16431643
$templateProcessor->setHtmlBlock('html_content', $content);

0 commit comments

Comments
 (0)