From a68634c3f1f9ee73a006022fbfa703be2f2ba6de Mon Sep 17 00:00:00 2001 From: Gareth Ellis Date: Thu, 4 Feb 2016 13:40:16 +0000 Subject: [PATCH 1/4] Properly fixing #257 and helps out on #324 --- src/PhpWord/Shared/Html.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 64bcab1e..f9b28366 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -177,9 +177,7 @@ class Html $cNodes = $node->childNodes; if (count($cNodes) > 0) { foreach ($cNodes as $cNode) { - if ($element instanceof AbstractContainer) { - self::parseNode($cNode, $element, $styles, $data); - } + self::parseNode($cNode, $element, $styles, $data); } } } @@ -232,11 +230,9 @@ class Html { $styles['font'] = self::parseInlineStyle($node, $styles['font']); - // Commented as source of bug #257. `method_exists` doesn't seems to work properly in this case. - // @todo Find better error checking for this one - // if (method_exists($element, 'addText')) { + if( is_callable(array($element, 'addText')) ) { $element->addText($node->nodeValue, $styles['font'], $styles['paragraph']); - // } + } return null; } From 3c3eecd4da24bf27957b2fdf73b30a03f2d3abc1 Mon Sep 17 00:00:00 2001 From: Gareth Ellis Date: Thu, 4 Feb 2016 14:06:11 +0000 Subject: [PATCH 2/4] PHPCS fixes --- src/PhpWord/Shared/Html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index f9b28366..ad2e285f 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -230,7 +230,7 @@ class Html { $styles['font'] = self::parseInlineStyle($node, $styles['font']); - if( is_callable(array($element, 'addText')) ) { + if (is_callable(array($element, 'addText'))) { $element->addText($node->nodeValue, $styles['font'], $styles['paragraph']); } From 17521e75939133191156e2bec2e70940e5ba1e16 Mon Sep 17 00:00:00 2001 From: Gareth Ellis Date: Thu, 4 Feb 2016 14:06:47 +0000 Subject: [PATCH 3/4] PHPCS fixes --- src/PhpWord/Shared/Html.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index ad2e285f..64bcab1e 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -177,7 +177,9 @@ class Html $cNodes = $node->childNodes; if (count($cNodes) > 0) { foreach ($cNodes as $cNode) { - self::parseNode($cNode, $element, $styles, $data); + if ($element instanceof AbstractContainer) { + self::parseNode($cNode, $element, $styles, $data); + } } } } @@ -230,9 +232,11 @@ class Html { $styles['font'] = self::parseInlineStyle($node, $styles['font']); - if (is_callable(array($element, 'addText'))) { + // Commented as source of bug #257. `method_exists` doesn't seems to work properly in this case. + // @todo Find better error checking for this one + // if (method_exists($element, 'addText')) { $element->addText($node->nodeValue, $styles['font'], $styles['paragraph']); - } + // } return null; } From d2daa5a48cfd182ce256802024f114b868d2384d Mon Sep 17 00:00:00 2001 From: Gareth Ellis Date: Thu, 4 Feb 2016 14:14:53 +0000 Subject: [PATCH 4/4] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7d6dc2e..2b80b62c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ Place announcement text here. - Improved error message for the case when `autoload.php` is not found. - @RomanSyroeshko #371 - Renamed the `align` option of `NumberingLevel`, `Frame`, `Table`, and `Paragraph` styles into `alignment`. - @RomanSyroeshko - Improved performance of `TemplateProcessor::setValue()`. - @kazitanvirahsan #614, #617 +- Fixed some HTML tags not rendering any output (p, header & table) - #257, #324 - @twmobius and @garethellis ### Deprecated - `getAlign` and `setAlign` methods of `NumberingLevel`, `Frame`, `Table`, and `Paragraph` styles.