From 00adf6de810f403273d77779adfd8a8034001e72 Mon Sep 17 00:00:00 2001 From: fergusean Date: Fri, 13 Feb 2015 00:12:13 -0500 Subject: [PATCH 001/370] Skip inquiring PHP for temp directory when it's user defined --- src/PhpWord/Settings.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/PhpWord/Settings.php b/src/PhpWord/Settings.php index 67b1dbed..d0c09205 100644 --- a/src/PhpWord/Settings.php +++ b/src/PhpWord/Settings.php @@ -298,12 +298,11 @@ class Settings */ public static function getTempDir() { - $tempDir = sys_get_temp_dir(); - if (!empty(self::$tempDir)) { $tempDir = self::$tempDir; + } else { + $tempDir = sys_get_temp_dir(); } - return $tempDir; } From daf7d1114470d858ccbf10e3895e29f4c53f4d5c Mon Sep 17 00:00:00 2001 From: ejuhjav Date: Wed, 20 May 2015 13:17:11 +0200 Subject: [PATCH 002/370] Update elements.rst Fixed a typo in the $lineStyle example (defined previously as $linestyle but used as $lineStyle) --- docs/elements.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/elements.rst b/docs/elements.rst index eb70f9ad..0980eed0 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -497,7 +497,7 @@ Line elements can be added to sections by using ``addLine``. .. code-block:: php - $linestyle = array('weight' => 1, 'width' => 100, 'height' => 0, 'color' => 635552); + $lineStyle = array('weight' => 1, 'width' => 100, 'height' => 0, 'color' => 635552); $section->addLine($lineStyle) Available line style attributes: From 62d3f97e30a5b7262c6655c9a87686254daf5793 Mon Sep 17 00:00:00 2001 From: Frank Meyer Date: Tue, 21 Jul 2015 14:07:23 +0200 Subject: [PATCH 003/370] dded the ability to enable gridlines and axislabels on charts added options 'showAxisLabels', 'showGridX', 'showGridY' to charts style element --- samples/Sample_32_Chart.php | 8 +- src/PhpWord/Style/Chart.php | 90 ++++++++++++++++++++++ src/PhpWord/Writer/Word2007/Part/Chart.php | 9 ++- 3 files changed, 103 insertions(+), 4 deletions(-) diff --git a/samples/Sample_32_Chart.php b/samples/Sample_32_Chart.php index bc18392e..b6830fa0 100644 --- a/samples/Sample_32_Chart.php +++ b/samples/Sample_32_Chart.php @@ -22,11 +22,16 @@ $categories = array('A', 'B', 'C', 'D', 'E'); $series1 = array(1, 3, 2, 5, 4); $series2 = array(3, 1, 7, 2, 6); $series3 = array(8, 3, 2, 5, 4); +$showGridLines = false; +$showAxisLabels = false; foreach ($chartTypes as $chartType) { $section->addTitle(ucfirst($chartType), 2); $chart = $section->addChart($chartType, $categories, $series1); $chart->getStyle()->setWidth(Converter::inchToEmu(2.5))->setHeight(Converter::inchToEmu(2)); + $chart->getStyle()->setShowGridX($showGridLines); + $chart->getStyle()->setShowGridY($showGridLines); + $chart->getStyle()->setShowAxisLabels($showAxisLabels); if (in_array($chartType, $twoSeries)) { $chart->addSeries($categories, $series2); } @@ -43,7 +48,8 @@ $section = $phpWord->addSection(array('colsNum' => 2, 'breakType' => 'continuous $chartTypes = array('pie', 'bar', 'column', 'line', 'area'); $multiSeries = array('bar', 'column', 'line', 'area'); -$style = array('width' => Converter::cmToEmu(5), 'height' => Converter::cmToEmu(4), '3d' => true); +$style = array('width' => Converter::cmToEmu(5), 'height' => Converter::cmToEmu(4), '3d' => true, + 'showAxisLabels' => $showAxisLabels, 'showGridX' => $showGridLines, 'showGridY' => $showGridLines); foreach ($chartTypes as $chartType) { $section->addTitle(ucfirst($chartType), 2); $chart = $section->addChart($chartType, $categories, $series1, $style); diff --git a/src/PhpWord/Style/Chart.php b/src/PhpWord/Style/Chart.php index 13b72a33..112a0a4a 100644 --- a/src/PhpWord/Style/Chart.php +++ b/src/PhpWord/Style/Chart.php @@ -46,6 +46,27 @@ class Chart extends AbstractStyle */ private $is3d = false; + /** + * Show labels for axis + * + * @var bool + */ + private $showAxisLabels = false; + + /** + * Show Gridlines for Y-Axis + * + * @var bool + */ + private $gridY = false; + + /** + * Show Gridlines for X-Axis + * + * @var bool + */ + private $gridX = false; + /** * Create a new instance * @@ -124,4 +145,73 @@ class Chart extends AbstractStyle return $this; } + + /** + * Show labels for axis + * + * @return bool + */ + public function showAxisLabels() + { + return $this->showAxisLabels; + } + + /** + * Set show Gridlines for Y-Axis + * + * @param bool $value + * @return self + */ + public function setShowAxisLabels($value = true) + { + $this->showAxisLabels = $this->setBoolVal($value, $this->showAxisLabels); + + return $this; + } + + /** + * Show Gridlines for Y-Axis + * + * @return bool + */ + public function showGridY() + { + return $this->gridY; + } + + /** + * Set show Gridlines for Y-Axis + * + * @param bool $value + * @return self + */ + public function setShowGridY($value = true) + { + $this->gridY = $this->setBoolVal($value, $this->gridY); + + return $this; + } + + /** + * Show Gridlines for X-Axis + * + * @return bool + */ + public function showGridX() + { + return $this->gridX; + } + + /** + * Set show Gridlines for X-Axis + * + * @param bool $value + * @return self + */ + public function setShowGridX($value = true) + { + $this->gridX = $this->setBoolVal($value, $this->gridX); + + return $this; + } } diff --git a/src/PhpWord/Writer/Word2007/Part/Chart.php b/src/PhpWord/Writer/Word2007/Part/Chart.php index 8423762c..abc2962a 100644 --- a/src/PhpWord/Writer/Word2007/Part/Chart.php +++ b/src/PhpWord/Writer/Word2007/Part/Chart.php @@ -264,6 +264,7 @@ class Chart extends AbstractPart */ private function writeAxis(XMLWriter $xmlWriter, $type) { + $style = $this->element->getStyle(); $types = array( 'cat' => array('c:catAx', 1, 'b', 2), 'val' => array('c:valAx', 2, 'l', 1), @@ -273,7 +274,7 @@ class Chart extends AbstractPart $xmlWriter->startElement($axisType); $xmlWriter->writeElementBlock('c:axId', 'val', $axisId); - $xmlWriter->writeElementBlock('c:axPos', 'val', $axisPos); + $xmlWriter->writeElementBlock('c:axPos', 'val', $axisPos); $xmlWriter->writeElementBlock('c:crossAx', 'val', $axisCross); $xmlWriter->writeElementBlock('c:auto', 'val', 1); @@ -281,10 +282,12 @@ class Chart extends AbstractPart $xmlWriter->writeElementBlock('c:delete', 'val', 0); $xmlWriter->writeElementBlock('c:majorTickMark', 'val', 'none'); $xmlWriter->writeElementBlock('c:minorTickMark', 'val', 'none'); - $xmlWriter->writeElementBlock('c:tickLblPos', 'val', 'none'); // nextTo + if($style->showAxisLabels()) + $xmlWriter->writeElementBlock('c:tickLblPos', 'val', 'nextTo'); + else $xmlWriter->writeElementBlock('c:tickLblPos', 'val', 'none'); $xmlWriter->writeElementBlock('c:crosses', 'val', 'autoZero'); } - if (isset($this->options['radar'])) { + if (isset($this->options['radar']) || ($type == "cat" && $style->showGridX()) || ($type == "val" && $style->showGridY())) { $xmlWriter->writeElement('c:majorGridlines'); } From 3a251770e89d0052b50c6b41551291692d46d559 Mon Sep 17 00:00:00 2001 From: Frank Meyer Date: Tue, 21 Jul 2015 14:56:29 +0200 Subject: [PATCH 004/370] Removed complains of php-codesniffer removed whitespace changed inline if statement --- src/PhpWord/Writer/Word2007/Part/Chart.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/PhpWord/Writer/Word2007/Part/Chart.php b/src/PhpWord/Writer/Word2007/Part/Chart.php index abc2962a..56df1027 100644 --- a/src/PhpWord/Writer/Word2007/Part/Chart.php +++ b/src/PhpWord/Writer/Word2007/Part/Chart.php @@ -274,7 +274,7 @@ class Chart extends AbstractPart $xmlWriter->startElement($axisType); $xmlWriter->writeElementBlock('c:axId', 'val', $axisId); - $xmlWriter->writeElementBlock('c:axPos', 'val', $axisPos); + $xmlWriter->writeElementBlock('c:axPos', 'val', $axisPos); $xmlWriter->writeElementBlock('c:crossAx', 'val', $axisCross); $xmlWriter->writeElementBlock('c:auto', 'val', 1); @@ -282,9 +282,12 @@ class Chart extends AbstractPart $xmlWriter->writeElementBlock('c:delete', 'val', 0); $xmlWriter->writeElementBlock('c:majorTickMark', 'val', 'none'); $xmlWriter->writeElementBlock('c:minorTickMark', 'val', 'none'); - if($style->showAxisLabels()) + if($style->showAxisLabels()) { $xmlWriter->writeElementBlock('c:tickLblPos', 'val', 'nextTo'); - else $xmlWriter->writeElementBlock('c:tickLblPos', 'val', 'none'); + } + else { + $xmlWriter->writeElementBlock('c:tickLblPos', 'val', 'none'); + } $xmlWriter->writeElementBlock('c:crosses', 'val', 'autoZero'); } if (isset($this->options['radar']) || ($type == "cat" && $style->showGridX()) || ($type == "val" && $style->showGridY())) { From a6528471c26f280cb74cd1add9e8ae1c5676956a Mon Sep 17 00:00:00 2001 From: Frank Meyer Date: Tue, 21 Jul 2015 15:11:34 +0200 Subject: [PATCH 005/370] changed if statement due to error in codesniffer --- src/PhpWord/Writer/Word2007/Part/Chart.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/PhpWord/Writer/Word2007/Part/Chart.php b/src/PhpWord/Writer/Word2007/Part/Chart.php index 56df1027..92d61e6e 100644 --- a/src/PhpWord/Writer/Word2007/Part/Chart.php +++ b/src/PhpWord/Writer/Word2007/Part/Chart.php @@ -282,10 +282,9 @@ class Chart extends AbstractPart $xmlWriter->writeElementBlock('c:delete', 'val', 0); $xmlWriter->writeElementBlock('c:majorTickMark', 'val', 'none'); $xmlWriter->writeElementBlock('c:minorTickMark', 'val', 'none'); - if($style->showAxisLabels()) { + if ($style->showAxisLabels()) { $xmlWriter->writeElementBlock('c:tickLblPos', 'val', 'nextTo'); - } - else { + } else { $xmlWriter->writeElementBlock('c:tickLblPos', 'val', 'none'); } $xmlWriter->writeElementBlock('c:crosses', 'val', 'autoZero'); From 304765162e7c01e8954c69a405966fcf80ee8931 Mon Sep 17 00:00:00 2001 From: Russ Date: Wed, 22 Jul 2015 08:57:15 -0500 Subject: [PATCH 006/370] #574 Incorrect Constant Names in \Style\Font.php Correct constants mapped to "dotDash" and "dotDashHeavy", leaving old spellings for backwards compatibility. --- src/PhpWord/Style/Font.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/Style/Font.php b/src/PhpWord/Style/Font.php index 8980258b..148dadc9 100644 --- a/src/PhpWord/Style/Font.php +++ b/src/PhpWord/Style/Font.php @@ -33,8 +33,10 @@ class Font extends AbstractStyle const UNDERLINE_DASHLONG = 'dashLong'; const UNDERLINE_DASHLONGHEAVY = 'dashLongHeavy'; const UNDERLINE_DOUBLE = 'dbl'; - const UNDERLINE_DOTHASH = 'dotDash'; - const UNDERLINE_DOTHASHHEAVY = 'dotDashHeavy'; + const UNDERLINE_DOTHASH = 'dotDash'; // Incorrect spelling, for backwards compatibility + const UNDERLINE_DOTHASHHEAVY = 'dotDashHeavy'; // Incorrect spelling, for backwards compatibility + const UNDERLINE_DOTDASH = 'dotDash'; // Correct spelling + const UNDERLINE_DOTDASHHEAVY = 'dotDashHeavy'; // Correct spelling const UNDERLINE_DOTDOTDASH = 'dotDotDash'; const UNDERLINE_DOTDOTDASHHEAVY = 'dotDotDashHeavy'; const UNDERLINE_DOTTED = 'dotted'; From e9296107461090db6d8ff491bc89249c0d99280e Mon Sep 17 00:00:00 2001 From: Russ Date: Wed, 22 Jul 2015 09:01:01 -0500 Subject: [PATCH 007/370] Map Underline Codes to Corrected Constant Values --- src/PhpWord/Reader/MsDoc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/Reader/MsDoc.php b/src/PhpWord/Reader/MsDoc.php index c63d8d9e..f3878fa8 100644 --- a/src/PhpWord/Reader/MsDoc.php +++ b/src/PhpWord/Reader/MsDoc.php @@ -1686,7 +1686,7 @@ class MsDoc extends AbstractReader implements ReaderInterface $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DASH; break; case 0x09: - $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DOTHASH; + $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DOTDASH; break; case 0x0A: $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DOTDOTDASH; @@ -1701,7 +1701,7 @@ class MsDoc extends AbstractReader implements ReaderInterface $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DASHHEAVY; break; case 0x19: - $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DOTHASHHEAVY; + $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DOTDASHHEAVY; break; case 0x1A: $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_DOTDOTDASHHEAVY; From 13a1c9f24f99402edc574bbade7961dc8a524a67 Mon Sep 17 00:00:00 2001 From: Sebastian Schwaiger Date: Wed, 29 Jul 2015 11:16:04 +0200 Subject: [PATCH 008/370] A chart object can also be added to a table cell --- src/PhpWord/Element/AbstractContainer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Element/AbstractContainer.php b/src/PhpWord/Element/AbstractContainer.php index 57d646a0..13512694 100644 --- a/src/PhpWord/Element/AbstractContainer.php +++ b/src/PhpWord/Element/AbstractContainer.php @@ -211,7 +211,7 @@ abstract class AbstractContainer extends AbstractElement 'Title' => array('Section'), 'TOC' => array('Section'), 'PageBreak' => array('Section'), - 'Chart' => array('Section'), + 'Chart' => array('Section', 'Cell'), ); // Special condition, e.g. preservetext can only exists in cell when From cb034879b40c0aa1faee6a699eb50ce48cbf8c4d Mon Sep 17 00:00:00 2001 From: Russ Date: Thu, 6 Aug 2015 12:50:31 -0500 Subject: [PATCH 009/370] Add Date Formats to Field Element Fix a typo (d-M-yyy H:mm), and expand the list of valid date formats. --- src/PhpWord/Element/Field.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/PhpWord/Element/Field.php b/src/PhpWord/Element/Field.php index 1eaa6f24..b277494e 100644 --- a/src/PhpWord/Element/Field.php +++ b/src/PhpWord/Element/Field.php @@ -47,9 +47,23 @@ class Field extends AbstractElement ), 'DATE'=>array( 'properties'=> array( - 'dateformat' =>array('d-M-yyyy', 'dddd d MMMM yyyy', 'd MMMM yyyy', 'd-M-yy', 'yyyy-MM-dd', - 'd-MMM-yy', 'd/M/yyyy', 'd MMM. yy', 'd/M/yy', 'MMM-yy', 'd-M-yyy H:mm', 'd-M-yyyy H:mm:ss', - 'h:mm am/pm', 'h:mm:ss am/pm', 'HH:mm', 'HH:mm:ss') + 'dateformat' =>array( + /* Generic formats */ + 'yyyy-MM-dd', 'yyyy-MM', 'MMM-yy', 'MMM-yyyy', 'h:mm am/pm', 'h:mm:ss am/pm', 'HH:mm', 'HH:mm:ss', + + /* Day-Month-Year formats */ + 'dddd d MMMM yyyy', 'd MMMM yyyy', 'd-MMM-yy', 'd MMM. yy', + 'd-M-yy', 'd-M-yy H:mm', 'd-M-yy H:mm:ss', 'd-M-yy H:mm am/pm', 'd-M-yy H:mm:ss am/pm', 'd-M-yy HH:mm', 'd-M-yy HH:mm:ss', + 'd/M/yy', 'd/M/yy H:mm', 'd/M/yy H:mm:ss', 'd/M/yy H:mm am/pm', 'd/M/yy H:mm:ss am/pm', 'd/M/yy HH:mm', 'd/M/yy HH:mm:ss', + 'd-M-yyyy', 'd-M-yyyy H:mm', 'd-M-yyyy H:mm:ss', 'd-M-yyyy H:mm am/pm', 'd-M-yyyy H:mm:ss am/pm', 'd-M-yyyy HH:mm', 'd-M-yyyy HH:mm:ss', + 'd/M/yyyy', 'd/M/yyyy H:mm', 'd/M/yyyy H:mm:ss', 'd/M/yyyy H:mm am/pm', 'd/M/yyyy H:mm:ss am/pm', 'd/M/yyyy HH:mm', 'd/M/yyyy HH:mm:ss', + + /* Month-Day-Year formats */ + 'dddd, MMMM d yyyy', 'MMMM d yyyy', 'MMM-d-yy', 'MMM. d yy', + 'M-d-yy', 'M-d-yy H:mm', 'M-d-yy H:mm:ss', 'M-d-yy H:mm am/pm', 'M-d-yy H:mm:ss am/pm', 'M-d-yy HH:mm', 'M-d-yy HH:mm:ss', + 'M/d/yy', 'M/d/yy H:mm', 'M/d/yy H:mm:ss', 'M/d/yy H:mm am/pm', 'M/d/yy H:mm:ss am/pm', 'M/d/yy HH:mm', 'M/d/yy HH:mm:ss', + 'M-d-yyyy', 'M-d-yyyy H:mm', 'M-d-yyyy H:mm:ss', 'M-d-yyyy H:mm am/pm', 'M-d-yyyy H:mm:ss am/pm', 'M-d-yyyy HH:mm', 'M-d-yyyy HH:mm:ss', + 'M/d/yyyy', 'M/d/yyyy H:mm', 'M/d/yyyy H:mm:ss', 'M/d/yyyy H:mm am/pm', 'M/d/yyyy H:mm:ss am/pm', 'M/d/yyyy HH:mm', 'M/d/yyyy HH:mm:ss') ), 'options'=>array('PreserveFormat', 'LunarCalendar', 'SakaEraCalendar', 'LastUsedFormat') ) From a9398e32c7f6f5371693878509da50c7eb0ea27c Mon Sep 17 00:00:00 2001 From: Russ Date: Thu, 6 Aug 2015 13:22:01 -0500 Subject: [PATCH 010/370] Fix Hour Casing for Intended Formats to Work Correctly Time formats should either be "h" or "HH". There were some formats which were incorrectly specified as "H". --- src/PhpWord/Element/Field.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/PhpWord/Element/Field.php b/src/PhpWord/Element/Field.php index b277494e..4e8195b3 100644 --- a/src/PhpWord/Element/Field.php +++ b/src/PhpWord/Element/Field.php @@ -53,17 +53,17 @@ class Field extends AbstractElement /* Day-Month-Year formats */ 'dddd d MMMM yyyy', 'd MMMM yyyy', 'd-MMM-yy', 'd MMM. yy', - 'd-M-yy', 'd-M-yy H:mm', 'd-M-yy H:mm:ss', 'd-M-yy H:mm am/pm', 'd-M-yy H:mm:ss am/pm', 'd-M-yy HH:mm', 'd-M-yy HH:mm:ss', - 'd/M/yy', 'd/M/yy H:mm', 'd/M/yy H:mm:ss', 'd/M/yy H:mm am/pm', 'd/M/yy H:mm:ss am/pm', 'd/M/yy HH:mm', 'd/M/yy HH:mm:ss', - 'd-M-yyyy', 'd-M-yyyy H:mm', 'd-M-yyyy H:mm:ss', 'd-M-yyyy H:mm am/pm', 'd-M-yyyy H:mm:ss am/pm', 'd-M-yyyy HH:mm', 'd-M-yyyy HH:mm:ss', - 'd/M/yyyy', 'd/M/yyyy H:mm', 'd/M/yyyy H:mm:ss', 'd/M/yyyy H:mm am/pm', 'd/M/yyyy H:mm:ss am/pm', 'd/M/yyyy HH:mm', 'd/M/yyyy HH:mm:ss', + 'd-M-yy', 'd-M-yy h:mm', 'd-M-yy h:mm:ss', 'd-M-yy h:mm am/pm', 'd-M-yy h:mm:ss am/pm', 'd-M-yy HH:mm', 'd-M-yy HH:mm:ss', + 'd/M/yy', 'd/M/yy h:mm', 'd/M/yy h:mm:ss', 'd/M/yy h:mm am/pm', 'd/M/yy h:mm:ss am/pm', 'd/M/yy HH:mm', 'd/M/yy HH:mm:ss', + 'd-M-yyyy', 'd-M-yyyy h:mm', 'd-M-yyyy h:mm:ss', 'd-M-yyyy h:mm am/pm', 'd-M-yyyy h:mm:ss am/pm', 'd-M-yyyy HH:mm', 'd-M-yyyy HH:mm:ss', + 'd/M/yyyy', 'd/M/yyyy h:mm', 'd/M/yyyy h:mm:ss', 'd/M/yyyy h:mm am/pm', 'd/M/yyyy h:mm:ss am/pm', 'd/M/yyyy HH:mm', 'd/M/yyyy HH:mm:ss', /* Month-Day-Year formats */ 'dddd, MMMM d yyyy', 'MMMM d yyyy', 'MMM-d-yy', 'MMM. d yy', - 'M-d-yy', 'M-d-yy H:mm', 'M-d-yy H:mm:ss', 'M-d-yy H:mm am/pm', 'M-d-yy H:mm:ss am/pm', 'M-d-yy HH:mm', 'M-d-yy HH:mm:ss', - 'M/d/yy', 'M/d/yy H:mm', 'M/d/yy H:mm:ss', 'M/d/yy H:mm am/pm', 'M/d/yy H:mm:ss am/pm', 'M/d/yy HH:mm', 'M/d/yy HH:mm:ss', - 'M-d-yyyy', 'M-d-yyyy H:mm', 'M-d-yyyy H:mm:ss', 'M-d-yyyy H:mm am/pm', 'M-d-yyyy H:mm:ss am/pm', 'M-d-yyyy HH:mm', 'M-d-yyyy HH:mm:ss', - 'M/d/yyyy', 'M/d/yyyy H:mm', 'M/d/yyyy H:mm:ss', 'M/d/yyyy H:mm am/pm', 'M/d/yyyy H:mm:ss am/pm', 'M/d/yyyy HH:mm', 'M/d/yyyy HH:mm:ss') + 'M-d-yy', 'M-d-yy h:mm', 'M-d-yy h:mm:ss', 'M-d-yy h:mm am/pm', 'M-d-yy h:mm:ss am/pm', 'M-d-yy HH:mm', 'M-d-yy HH:mm:ss', + 'M/d/yy', 'M/d/yy h:mm', 'M/d/yy h:mm:ss', 'M/d/yy h:mm am/pm', 'M/d/yy h:mm:ss am/pm', 'M/d/yy HH:mm', 'M/d/yy HH:mm:ss', + 'M-d-yyyy', 'M-d-yyyy h:mm', 'M-d-yyyy h:mm:ss', 'M-d-yyyy h:mm am/pm', 'M-d-yyyy h:mm:ss am/pm', 'M-d-yyyy HH:mm', 'M-d-yyyy HH:mm:ss', + 'M/d/yyyy', 'M/d/yyyy h:mm', 'M/d/yyyy h:mm:ss', 'M/d/yyyy h:mm am/pm', 'M/d/yyyy h:mm:ss am/pm', 'M/d/yyyy HH:mm', 'M/d/yyyy HH:mm:ss') ), 'options'=>array('PreserveFormat', 'LunarCalendar', 'SakaEraCalendar', 'LastUsedFormat') ) From d11b2467aa0d36bea5c1febfb1fd05b605338d36 Mon Sep 17 00:00:00 2001 From: Russ Date: Thu, 6 Aug 2015 15:57:18 -0500 Subject: [PATCH 011/370] Fix Empty Dropdown Entry Pad any empty dropdown entries we find so that xmlWriter doesn't generate an error. --- src/PhpWord/Writer/Word2007/Element/FormField.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/PhpWord/Writer/Word2007/Element/FormField.php b/src/PhpWord/Writer/Word2007/Element/FormField.php index 432dc9c2..f8a6a128 100644 --- a/src/PhpWord/Writer/Word2007/Element/FormField.php +++ b/src/PhpWord/Writer/Word2007/Element/FormField.php @@ -165,6 +165,9 @@ class FormField extends Text $xmlWriter->writeElementBlock('w:result', 'w:val', $value); $xmlWriter->writeElementBlock('w:default', 'w:val', $default); foreach ($entries as $entry) { + if ($entry == null || $entry == '') { + $entry = str_repeat(' ', self::FILLER_LENGTH); + } $xmlWriter->writeElementBlock('w:listEntry', 'w:val', $entry); } $xmlWriter->endElement(); From f7afdebb0331b393a157bb0874c7cf5209a9fbe3 Mon Sep 17 00:00:00 2001 From: Henri MEDOT Date: Thu, 12 Nov 2015 18:51:04 +0100 Subject: [PATCH 012/370] Added support for linebreaks
in Shared\Html::addHtml() --- src/PhpWord/Shared/Html.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index cdc88b43..d9a3f40e 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -128,6 +128,7 @@ class Html 'ul' => array('List', null, null, $styles, $data, 3, null), 'ol' => array('List', null, null, $styles, $data, 7, null), 'li' => array('ListItem', $node, $element, $styles, $data, null, null), + 'br' => array('LineBreak', null, $element, $styles, null, null, null), ); $newElement = null; @@ -374,4 +375,17 @@ class Html return $styles; } + + /** + * Parse line break + * + * @param \PhpOffice\PhpWord\Element\AbstractContainer $element + * @return null + */ + private static function parseLineBreak($element) + { + $element->addTextBreak(); + + return null; + } } From a68634c3f1f9ee73a006022fbfa703be2f2ba6de Mon Sep 17 00:00:00 2001 From: Gareth Ellis Date: Thu, 4 Feb 2016 13:40:16 +0000 Subject: [PATCH 013/370] 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 014/370] 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 015/370] 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 016/370] 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. From 0857f36572269aa12c33485384c6ccbfb938e7a7 Mon Sep 17 00:00:00 2001 From: Denis Solovyov Date: Fri, 12 Feb 2016 17:37:44 +0200 Subject: [PATCH 017/370] Add TextRun as container for CheckBox --- src/PhpWord/Element/AbstractContainer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Element/AbstractContainer.php b/src/PhpWord/Element/AbstractContainer.php index d211ae07..260d2300 100644 --- a/src/PhpWord/Element/AbstractContainer.php +++ b/src/PhpWord/Element/AbstractContainer.php @@ -207,7 +207,7 @@ abstract class AbstractContainer extends AbstractElement 'ListItem' => array('Section', 'Header', 'Footer', 'Cell', 'TextBox'), 'ListItemRun' => array('Section', 'Header', 'Footer', 'Cell', 'TextBox'), 'Table' => array('Section', 'Header', 'Footer', 'Cell', 'TextBox'), - 'CheckBox' => array('Section', 'Header', 'Footer', 'Cell'), + 'CheckBox' => array('Section', 'Header', 'Footer', 'Cell', 'TextRun'), 'TextBox' => array('Section', 'Header', 'Footer', 'Cell'), 'Footnote' => array('Section', 'TextRun', 'Cell'), 'Endnote' => array('Section', 'TextRun', 'Cell'), From adfcc62e644f1fe6ce24f5392803cebdf9a02760 Mon Sep 17 00:00:00 2001 From: Sam Sullivan Date: Mon, 11 Apr 2016 12:48:43 -0500 Subject: [PATCH 018/370] imagesavealpha() in Writer\AbstractWriter --- src/PhpWord/Writer/AbstractWriter.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/PhpWord/Writer/AbstractWriter.php b/src/PhpWord/Writer/AbstractWriter.php index 55b20232..c6b64c28 100644 --- a/src/PhpWord/Writer/AbstractWriter.php +++ b/src/PhpWord/Writer/AbstractWriter.php @@ -360,6 +360,10 @@ abstract class AbstractWriter implements WriterInterface // Retrive GD image content or get local media if (isset($element['isMemImage']) && $element['isMemImage']) { $image = call_user_func($element['createFunction'], $element['source']); + if ($element['imageType'] === 'image/png') { + // PNG images need to preserve alpha channel information + imagesavealpha($image, true); + } ob_start(); call_user_func($element['imageFunction'], $image); $imageContents = ob_get_contents(); From f4ec74a4c5338f1df4a3dbb58a19b946ab627005 Mon Sep 17 00:00:00 2001 From: Sam Sullivan Date: Mon, 11 Apr 2016 12:49:18 -0500 Subject: [PATCH 019/370] imagesavealpha() in Element\Image --- src/PhpWord/Element/Image.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/PhpWord/Element/Image.php b/src/PhpWord/Element/Image.php index f5cc7ccc..64ddfd86 100644 --- a/src/PhpWord/Element/Image.php +++ b/src/PhpWord/Element/Image.php @@ -335,6 +335,10 @@ class Image extends AbstractElement // Read image binary data and convert to hex/base64 string if ($this->sourceType == self::SOURCE_GD) { $imageResource = call_user_func($this->imageCreateFunc, $actualSource); + if ($this->imageType === 'image/png') { + // PNG images need to preserve alpha channel information + imagesavealpha($imageResource, true); + } ob_start(); call_user_func($this->imageFunc, $imageResource); $imageBinary = ob_get_contents(); From 133b727f592eef4c47d099f543fcdbe45833bc42 Mon Sep 17 00:00:00 2001 From: ale rimoldi Date: Mon, 25 Jul 2016 10:11:52 +0200 Subject: [PATCH 020/370] table->setStretch() optionally avoids the table to stretch to the page width (only for word output) --- src/PhpWord/Style/Table.php | 33 +++++++++++++++++++++ src/PhpWord/Writer/Word2007/Style/Table.php | 15 ++++++++++ 2 files changed, 48 insertions(+) diff --git a/src/PhpWord/Style/Table.php b/src/PhpWord/Style/Table.php index 24f50667..4b411cdc 100644 --- a/src/PhpWord/Style/Table.php +++ b/src/PhpWord/Style/Table.php @@ -28,6 +28,8 @@ class Table extends Border const WIDTH_AUTO = 'auto'; // Automatically determined width const WIDTH_PERCENT = 'pct'; // Width in fiftieths (1/50) of a percent (1% = 50 unit) const WIDTH_TWIP = 'dxa'; // Width in twentieths (1/20) of a point (twip) + const STRETCH_AUTO = 'autofit'; // Automatically stretch the table to fit the page width + const STRETCH_FIXED = 'fixed'; // Do not stretch the table to fit the page width /** * Is this a first row style? @@ -121,6 +123,11 @@ class Table extends Border */ private $unit = self::WIDTH_AUTO; + /** + * @var string Stretch the table to the page width + */ + private $stretch = self::STRETCH_AUTO; + /** * Create new table style * @@ -563,6 +570,32 @@ class Table extends Border return $this; } + /** + * Get stretch + * + * @return string + */ + public function getStretch() + { + return $this->stretch; + } + + /** + * Set stretch + * + * Stretch the table to the page width + * + * @param string $value + * @return self + */ + public function setStretch($value = null) + { + $enum = array(self::STRETCH_AUTO, self::STRETCH_FIXED); + $this->stretch = $this->setEnumVal($value, $enum, $this->stretch); + + return $this; + } + /** * Get table style only property by checking if it's a firstRow * diff --git a/src/PhpWord/Writer/Word2007/Style/Table.php b/src/PhpWord/Writer/Word2007/Style/Table.php index 8bbad107..b3686f90 100644 --- a/src/PhpWord/Writer/Word2007/Style/Table.php +++ b/src/PhpWord/Writer/Word2007/Style/Table.php @@ -74,6 +74,7 @@ class Table extends AbstractStyle $styleWriter->write(); $this->writeWidth($xmlWriter, $style->getWidth(), $style->getUnit()); + $this->writeLayout($xmlWriter, $style->getStretch()); $this->writeMargin($xmlWriter, $style); $this->writeBorder($xmlWriter, $style); @@ -104,6 +105,20 @@ class Table extends AbstractStyle $xmlWriter->endElement(); // w:tblW } + /** + * Enable/Disable automatic resizing of the table + * + * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter + * @param string $layout autofit / fixed + * @return void + */ + private function writeLayout(XMLWriter $xmlWriter, $stretch) + { + $xmlWriter->startElement('w:tblLayout'); + $xmlWriter->writeAttribute('w:type', $stretch); + $xmlWriter->endElement(); // w:tblLayout + } + /** * Write margin. * From 98d2e0df335d8ef820efe9c7843add2966a603fb Mon Sep 17 00:00:00 2001 From: Michael Spahn Date: Tue, 16 Aug 2016 17:10:51 +0200 Subject: [PATCH 021/370] Implement PageBreak for odt writer --- .../Writer/ODText/Element/PageBreak.php | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/PhpWord/Writer/ODText/Element/PageBreak.php diff --git a/src/PhpWord/Writer/ODText/Element/PageBreak.php b/src/PhpWord/Writer/ODText/Element/PageBreak.php new file mode 100644 index 00000000..47b4eeba --- /dev/null +++ b/src/PhpWord/Writer/ODText/Element/PageBreak.php @@ -0,0 +1,36 @@ +getXmlWriter(); + + $xmlWriter->startElement('text:p'); + $xmlWriter->writeAttribute('text:style-name', 'P1'); + $xmlWriter->endElement(); + } +} From 49492b25162e5ec89aaacfb11cfbe9dceddd33fd Mon Sep 17 00:00:00 2001 From: Brandon Skrtich Date: Fri, 26 Aug 2016 11:06:19 -0600 Subject: [PATCH 022/370] Fix incorrect image size between windows and mac. See Issue #224 --- src/PhpWord/Style/Image.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/Style/Image.php b/src/PhpWord/Style/Image.php index f2c88b5f..497c6781 100644 --- a/src/PhpWord/Style/Image.php +++ b/src/PhpWord/Style/Image.php @@ -60,9 +60,9 @@ class Image extends Frame public function __construct() { parent::__construct(); - $this->setUnit('px'); + $this->setUnit(self::UNIT_PT); - // Backward compatilibity setting + // Backward compatibility setting // @todo Remove on 1.0.0 $this->setWrap(self::WRAPPING_STYLE_INLINE); $this->setHPos(self::POSITION_HORIZONTAL_LEFT); From 23e19a2d47da150aa138ab462cfa7684418e3b7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Mourey?= Date: Mon, 12 Sep 2016 16:43:21 +0200 Subject: [PATCH 023/370] Fix division by zero See #886 --- src/PhpWord/Writer/ODText/Style/Paragraph.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/Writer/ODText/Style/Paragraph.php b/src/PhpWord/Writer/ODText/Style/Paragraph.php index 1d821810..494142d7 100644 --- a/src/PhpWord/Writer/ODText/Style/Paragraph.php +++ b/src/PhpWord/Writer/ODText/Style/Paragraph.php @@ -37,8 +37,8 @@ class Paragraph extends AbstractStyle } $xmlWriter = $this->getXmlWriter(); - $marginTop = is_null($style->getSpaceBefore()) ? '0' : round(17.6 / $style->getSpaceBefore(), 2); - $marginBottom = is_null($style->getSpaceAfter()) ? '0' : round(17.6 / $style->getSpaceAfter(), 2); + $marginTop = ($style->getSpaceBefore()==0) ? '0' : round(17.6 / $style->getSpaceBefore(), 2); + $marginBottom = ($style->getSpaceAfter()==0) ? '0' : round(17.6 / $style->getSpaceAfter(), 2); $xmlWriter->startElement('style:style'); $xmlWriter->writeAttribute('style:name', $style->getStyleName()); From d52d9b8985d763f227c59ae95353ab26658ca422 Mon Sep 17 00:00:00 2001 From: antoine Date: Thu, 27 Oct 2016 23:12:26 +0200 Subject: [PATCH 024/370] Add support for XE and INDEX fields --- samples/Sample_27_Field.php | 12 ++++- src/PhpWord/Element/Field.php | 52 ++++++++++++++++++- src/PhpWord/Writer/Word2007/Element/Field.php | 42 +++++++++++++-- tests/PhpWord/Element/FieldTest.php | 14 +++++ 4 files changed, 111 insertions(+), 9 deletions(-) diff --git a/samples/Sample_27_Field.php b/samples/Sample_27_Field.php index 57747895..7e2b968e 100644 --- a/samples/Sample_27_Field.php +++ b/samples/Sample_27_Field.php @@ -14,10 +14,18 @@ $section->addText('Date field:'); $section->addField('DATE', array('dateformat' => 'dddd d MMMM yyyy H:mm:ss'), array('PreserveFormat')); $section->addText('Page field:'); -$section->addField('PAGE', array('format' => 'ArabicDash')); +$section->addField('PAGE', array('format' => 'Arabic')); $section->addText('Number of pages field:'); -$section->addField('NUMPAGES', array('format' => 'Arabic', 'numformat' => '0,00'), array('PreserveFormat')); +$section->addField('NUMPAGES', array('numformat' => '0,00', 'format' => 'Arabic'), array('PreserveFormat')); + +$textrun = $section->addTextRun(); +$textrun->addText('An index field is '); +$textrun->addField('XE', array(), array('Bold'), 'FieldValue'); +$textrun->addText('here:'); + +$section->addText('The actual index:'); +$section->addField('INDEX', array(), array('PreserveFormat')); $textrun = $section->addTextRun(array('alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER)); $textrun->addText('This is the date of lunar calendar '); diff --git a/src/PhpWord/Element/Field.php b/src/PhpWord/Element/Field.php index 48dc1d2e..b5dec19a 100644 --- a/src/PhpWord/Element/Field.php +++ b/src/PhpWord/Element/Field.php @@ -40,7 +40,8 @@ class Field extends AbstractElement ), 'NUMPAGES'=>array( 'properties'=>array( - 'format' => array('Arabic', 'ArabicDash', 'alphabetic', 'ALPHABETIC', 'roman', 'ROMAN'), + 'format' => array('Arabic', 'ArabicDash', 'CardText', 'DollarText', 'Ordinal', 'OrdText', + 'alphabetic', 'ALPHABETIC', 'roman', 'ROMAN', 'Caps', 'FirstCap', 'Lower', 'Upper'), 'numformat' => array('0', '0,00', '#.##0', '#.##0,00', '€ #.##0,00(€ #.##0,00)', '0%', '0,00%') ), 'options'=>array('PreserveFormat') @@ -52,6 +53,14 @@ class Field extends AbstractElement 'h:mm am/pm', 'h:mm:ss am/pm', 'HH:mm', 'HH:mm:ss') ), 'options'=>array('PreserveFormat', 'LunarCalendar', 'SakaEraCalendar', 'LastUsedFormat') + ), + 'XE'=>array( + 'properties' => array(), + 'options' => array('Bold', 'Italic') + ), + 'INDEX'=>array( + 'properties' => array(), + 'options'=>array('PreserveFormat') ) ); @@ -62,6 +71,13 @@ class Field extends AbstractElement */ protected $type; + /** + * Field text + * + * @var string + */ + protected $text; + /** * Field properties * @@ -83,11 +99,12 @@ class Field extends AbstractElement * @param array $properties * @param array $options */ - public function __construct($type = null, $properties = array(), $options = array()) + public function __construct($type = null, $properties = array(), $options = array(), $text = null) { $this->setType($type); $this->setProperties($properties); $this->setOptions($options); + $this->setText($text); } /** @@ -184,4 +201,35 @@ class Field extends AbstractElement { return $this->options; } + + /** + * Set Field text + * + * @param string $text + * + * @return string + * + * @throws \InvalidArgumentException + */ + public function setText($text) + { + if (isset($text)) { + if (is_string($text)) { + $this->text = $text; + } else { + throw new \InvalidArgumentException("Invalid text"); + } + } + return $this->text; + } + + /** + * Get Field text + * + * @return string + */ + public function getText() + { + return $this->text; + } } diff --git a/src/PhpWord/Writer/Word2007/Element/Field.php b/src/PhpWord/Writer/Word2007/Element/Field.php index ae4c66ba..ad8032c7 100644 --- a/src/PhpWord/Writer/Word2007/Element/Field.php +++ b/src/PhpWord/Writer/Word2007/Element/Field.php @@ -38,13 +38,18 @@ class Field extends Text } $instruction = ' ' . $element->getType() . ' '; + if ($element->getText() != null) { + $instruction .= '"' . $element->getText() . '" '; + } $properties = $element->getProperties(); foreach ($properties as $propkey => $propval) { switch ($propkey) { case 'format': - case 'numformat': $instruction .= '\* ' . $propval . ' '; break; + case 'numformat': + $instruction .= '\# ' . $propval . ' '; + break; case 'dateformat': $instruction .= '\@ "' . $propval . '" '; break; @@ -66,22 +71,49 @@ class Field extends Text case 'LastUsedFormat': $instruction .= '\l '; break; + case 'Bold': + $instruction .= '\b '; + break; + case 'Italic': + $instruction .= '\i '; + break; } } $this->startElementP(); - $xmlWriter->startElement('w:fldSimple'); - $xmlWriter->writeAttribute('w:instr', $instruction); + $xmlWriter->startElement('w:r'); + $xmlWriter->startElement('w:fldChar'); + $xmlWriter->writeAttribute('w:fldCharType', 'begin'); + $xmlWriter->endElement(); // w:fldChar + $xmlWriter->endElement(); // w:r + + $xmlWriter->startElement('w:r'); + $xmlWriter->startElement('w:instrText'); + $xmlWriter->writeAttribute('xml:space', 'preserve'); + $xmlWriter->text($instruction); + $xmlWriter->endElement(); // w:instrText + $xmlWriter->endElement(); // w:r + + $xmlWriter->startElement('w:r'); + $xmlWriter->startElement('w:fldChar'); + $xmlWriter->writeAttribute('w:fldCharType', 'separate'); + $xmlWriter->endElement(); // w:fldChar + $xmlWriter->endElement(); // w:r + $xmlWriter->startElement('w:r'); $xmlWriter->startElement('w:rPr'); $xmlWriter->startElement('w:noProof'); $xmlWriter->endElement(); // w:noProof $xmlWriter->endElement(); // w:rPr - $xmlWriter->writeElement('w:t', '1'); $xmlWriter->endElement(); // w:r - $xmlWriter->endElement(); // w:fldSimple + + $xmlWriter->startElement('w:r'); + $xmlWriter->startElement('w:fldChar'); + $xmlWriter->writeAttribute('w:fldCharType', 'end'); + $xmlWriter->endElement(); // w:fldChar + $xmlWriter->endElement(); // w:r $this->endElementP(); // w:p } diff --git a/tests/PhpWord/Element/FieldTest.php b/tests/PhpWord/Element/FieldTest.php index b9afad1f..a37722e5 100644 --- a/tests/PhpWord/Element/FieldTest.php +++ b/tests/PhpWord/Element/FieldTest.php @@ -70,6 +70,20 @@ class FieldTest extends \PHPUnit_Framework_TestCase $this->assertEquals(array('SakaEraCalendar', 'PreserveFormat'), $oField->getOptions()); } + /** + * New instance with type and properties and options and text + */ + public function testConstructWithTypePropertiesOptionsText() + { + $oField = new Field('XE', array(), array('Bold'), 'FieldValue'); + + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Field', $oField); + $this->assertEquals('XE', $oField->getType()); + $this->assertEquals(array(), $oField->getProperties()); + $this->assertEquals(array('Bold'), $oField->getOptions()); + $this->assertEquals('FieldValue', $oField->getText()); + } + /** * Test setType exception * From 0953065b8c2d20c1b49f62dac7920dba91cf14cd Mon Sep 17 00:00:00 2001 From: antoine Date: Fri, 28 Oct 2016 00:20:47 +0200 Subject: [PATCH 025/370] improve code coverage --- tests/PhpWord/Element/FieldTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/PhpWord/Element/FieldTest.php b/tests/PhpWord/Element/FieldTest.php index a37722e5..d4e47e62 100644 --- a/tests/PhpWord/Element/FieldTest.php +++ b/tests/PhpWord/Element/FieldTest.php @@ -119,4 +119,16 @@ class FieldTest extends \PHPUnit_Framework_TestCase $object = new Field('PAGE'); $object->setOptions(array('foo' => 'bar')); } + + /** + * Test setText exception + * + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Invalid text + */ + public function testSetTextException() + { + $object = new Field('XE'); + $object->setText(array()); + } } From e7229fc15c12858a6f6bba4750f96e1332e7b1b9 Mon Sep 17 00:00:00 2001 From: antoine Date: Fri, 28 Oct 2016 22:27:05 +0200 Subject: [PATCH 026/370] make FontStyle based on paragraph if it set --- src/PhpWord/Style/Font.php | 2 +- src/PhpWord/Writer/Word2007/Part/Styles.php | 7 +++- .../Writer/Word2007/Part/StylesTest.php | 40 +++++++++++++++++++ 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/Style/Font.php b/src/PhpWord/Style/Font.php index b625e3b8..9056844a 100644 --- a/src/PhpWord/Style/Font.php +++ b/src/PhpWord/Style/Font.php @@ -725,7 +725,7 @@ class Font extends AbstractStyle } /** - * Set shading + * Set Paragraph * * @param mixed $value * @return self diff --git a/src/PhpWord/Writer/Word2007/Part/Styles.php b/src/PhpWord/Writer/Word2007/Part/Styles.php index 7bcb8d92..9ad87510 100644 --- a/src/PhpWord/Writer/Word2007/Part/Styles.php +++ b/src/PhpWord/Writer/Word2007/Part/Styles.php @@ -170,6 +170,9 @@ class Styles extends AbstractPart $xmlWriter->startElement('w:link'); $xmlWriter->writeAttribute('w:val', $styleLink); $xmlWriter->endElement(); + } else if (!is_null($paragraphStyle)) { + // if type is 'paragraph' it should have a styleId + $xmlWriter->writeAttribute('w:styleId', $styleName); } // Style name @@ -178,7 +181,9 @@ class Styles extends AbstractPart $xmlWriter->endElement(); // Parent style - $xmlWriter->writeElementIf(!is_null($paragraphStyle), 'w:basedOn', 'w:val', 'Normal'); + if (!is_null($paragraphStyle)) { + $xmlWriter->writeElementBlock('w:basedOn', 'w:val', $paragraphStyle->getStyleName()); + } // w:pPr if (!is_null($paragraphStyle)) { diff --git a/tests/PhpWord/Writer/Word2007/Part/StylesTest.php b/tests/PhpWord/Writer/Word2007/Part/StylesTest.php index f40387a1..df20ab3b 100644 --- a/tests/PhpWord/Writer/Word2007/Part/StylesTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/StylesTest.php @@ -18,7 +18,10 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\SimpleType\Jc; +use PhpOffice\PhpWord\Style\Font; +use PhpOffice\PhpWord\Style\Paragraph; use PhpOffice\PhpWord\TestHelperDOCX; +use PhpOffice\PhpWord\Writer\Word2007; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Styles @@ -74,4 +77,41 @@ class StylesTest extends \PHPUnit_Framework_TestCase $element = $doc->getElement($path, $file); $this->assertEquals('Normal', $element->getAttribute('w:val')); } + + public function testFontStyleBasedOn() + { + $phpWord = new PhpWord(); + + $baseParagraphStyle = new Paragraph(); + $baseParagraphStyle->setAlignment(Jc::CENTER); + $baseParagraphStyle = $phpWord->addParagraphStyle('BaseStyle', $baseParagraphStyle); + + $childFont = new Font(); + $childFont->setParagraph($baseParagraphStyle); + $childFont->setSize(16); + $childFont = $phpWord->addFontStyle('ChildFontStyle', $childFont); + + $otherFont = new Font(); + $otherFont->setSize(20); + $otherFont = $phpWord->addFontStyle('OtherFontStyle', $otherFont); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/styles.xml'; + + // Normal style generated? + $path = '/w:styles/w:style[@w:styleId="BaseStyle"]/w:name'; + $element = $doc->getElement($path, $file); + $this->assertEquals('BaseStyle', $element->getAttribute('w:val')); + + // Font style with paragraph should have it's base style set to that paragraphs style name + $path = '/w:styles/w:style[w:name/@w:val="ChildFontStyle"]/w:basedOn'; + $element = $doc->getElement($path, $file); + $this->assertEquals('BaseStyle', $element->getAttribute('w:val')); + + // Font style without paragraph should not have a base style set + $path = '/w:styles/w:style[w:name/@w:val="OtherFontStyle"]/w:basedOn'; + $element = $doc->getElement($path, $file); + $this->assertNull($element); + } } From 77ed1565c3d058c4ad6f3b655efdba90a0ebf0d8 Mon Sep 17 00:00:00 2001 From: antoine Date: Fri, 28 Oct 2016 22:27:05 +0200 Subject: [PATCH 027/370] make FontStyle based on paragraph if it set --- src/PhpWord/Style/Font.php | 2 +- src/PhpWord/Writer/Word2007/Part/Styles.php | 7 +++- .../Writer/Word2007/Part/StylesTest.php | 40 +++++++++++++++++++ 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/Style/Font.php b/src/PhpWord/Style/Font.php index b625e3b8..9056844a 100644 --- a/src/PhpWord/Style/Font.php +++ b/src/PhpWord/Style/Font.php @@ -725,7 +725,7 @@ class Font extends AbstractStyle } /** - * Set shading + * Set Paragraph * * @param mixed $value * @return self diff --git a/src/PhpWord/Writer/Word2007/Part/Styles.php b/src/PhpWord/Writer/Word2007/Part/Styles.php index 7bcb8d92..9ad87510 100644 --- a/src/PhpWord/Writer/Word2007/Part/Styles.php +++ b/src/PhpWord/Writer/Word2007/Part/Styles.php @@ -170,6 +170,9 @@ class Styles extends AbstractPart $xmlWriter->startElement('w:link'); $xmlWriter->writeAttribute('w:val', $styleLink); $xmlWriter->endElement(); + } else if (!is_null($paragraphStyle)) { + // if type is 'paragraph' it should have a styleId + $xmlWriter->writeAttribute('w:styleId', $styleName); } // Style name @@ -178,7 +181,9 @@ class Styles extends AbstractPart $xmlWriter->endElement(); // Parent style - $xmlWriter->writeElementIf(!is_null($paragraphStyle), 'w:basedOn', 'w:val', 'Normal'); + if (!is_null($paragraphStyle)) { + $xmlWriter->writeElementBlock('w:basedOn', 'w:val', $paragraphStyle->getStyleName()); + } // w:pPr if (!is_null($paragraphStyle)) { diff --git a/tests/PhpWord/Writer/Word2007/Part/StylesTest.php b/tests/PhpWord/Writer/Word2007/Part/StylesTest.php index f40387a1..df20ab3b 100644 --- a/tests/PhpWord/Writer/Word2007/Part/StylesTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/StylesTest.php @@ -18,7 +18,10 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\SimpleType\Jc; +use PhpOffice\PhpWord\Style\Font; +use PhpOffice\PhpWord\Style\Paragraph; use PhpOffice\PhpWord\TestHelperDOCX; +use PhpOffice\PhpWord\Writer\Word2007; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Styles @@ -74,4 +77,41 @@ class StylesTest extends \PHPUnit_Framework_TestCase $element = $doc->getElement($path, $file); $this->assertEquals('Normal', $element->getAttribute('w:val')); } + + public function testFontStyleBasedOn() + { + $phpWord = new PhpWord(); + + $baseParagraphStyle = new Paragraph(); + $baseParagraphStyle->setAlignment(Jc::CENTER); + $baseParagraphStyle = $phpWord->addParagraphStyle('BaseStyle', $baseParagraphStyle); + + $childFont = new Font(); + $childFont->setParagraph($baseParagraphStyle); + $childFont->setSize(16); + $childFont = $phpWord->addFontStyle('ChildFontStyle', $childFont); + + $otherFont = new Font(); + $otherFont->setSize(20); + $otherFont = $phpWord->addFontStyle('OtherFontStyle', $otherFont); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/styles.xml'; + + // Normal style generated? + $path = '/w:styles/w:style[@w:styleId="BaseStyle"]/w:name'; + $element = $doc->getElement($path, $file); + $this->assertEquals('BaseStyle', $element->getAttribute('w:val')); + + // Font style with paragraph should have it's base style set to that paragraphs style name + $path = '/w:styles/w:style[w:name/@w:val="ChildFontStyle"]/w:basedOn'; + $element = $doc->getElement($path, $file); + $this->assertEquals('BaseStyle', $element->getAttribute('w:val')); + + // Font style without paragraph should not have a base style set + $path = '/w:styles/w:style[w:name/@w:val="OtherFontStyle"]/w:basedOn'; + $element = $doc->getElement($path, $file); + $this->assertNull($element); + } } From 18474c56c42516c22a49399f912da3932742ed70 Mon Sep 17 00:00:00 2001 From: antoine Date: Fri, 28 Oct 2016 23:27:24 +0200 Subject: [PATCH 028/370] replace tab with spaces --- src/PhpWord/Writer/Word2007/Part/Styles.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Writer/Word2007/Part/Styles.php b/src/PhpWord/Writer/Word2007/Part/Styles.php index 9ad87510..637c60ff 100644 --- a/src/PhpWord/Writer/Word2007/Part/Styles.php +++ b/src/PhpWord/Writer/Word2007/Part/Styles.php @@ -171,7 +171,7 @@ class Styles extends AbstractPart $xmlWriter->writeAttribute('w:val', $styleLink); $xmlWriter->endElement(); } else if (!is_null($paragraphStyle)) { - // if type is 'paragraph' it should have a styleId + // if type is 'paragraph' it should have a styleId $xmlWriter->writeAttribute('w:styleId', $styleName); } From c50e3c581a47a79ae1f3de8ec3df9847f0352f55 Mon Sep 17 00:00:00 2001 From: antoine Date: Fri, 28 Oct 2016 23:27:24 +0200 Subject: [PATCH 029/370] replace tab with spaces --- src/PhpWord/Writer/Word2007/Part/Styles.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Writer/Word2007/Part/Styles.php b/src/PhpWord/Writer/Word2007/Part/Styles.php index 9ad87510..637c60ff 100644 --- a/src/PhpWord/Writer/Word2007/Part/Styles.php +++ b/src/PhpWord/Writer/Word2007/Part/Styles.php @@ -171,7 +171,7 @@ class Styles extends AbstractPart $xmlWriter->writeAttribute('w:val', $styleLink); $xmlWriter->endElement(); } else if (!is_null($paragraphStyle)) { - // if type is 'paragraph' it should have a styleId + // if type is 'paragraph' it should have a styleId $xmlWriter->writeAttribute('w:styleId', $styleName); } From 46eebe2136babf70cba9508ae6d2e047743b66a8 Mon Sep 17 00:00:00 2001 From: antoine Date: Tue, 8 Nov 2016 23:22:22 +0100 Subject: [PATCH 030/370] add support for Image creation from string image data --- src/PhpWord/Element/Image.php | 31 +++++++++++++++-- tests/PhpWord/Element/ImageTest.php | 53 +++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/Element/Image.php b/src/PhpWord/Element/Image.php index bf2b03d6..d7e5a665 100644 --- a/src/PhpWord/Element/Image.php +++ b/src/PhpWord/Element/Image.php @@ -35,6 +35,7 @@ class Image extends AbstractElement const SOURCE_LOCAL = 'local'; // Local images const SOURCE_GD = 'gd'; // Generated using GD const SOURCE_ARCHIVE = 'archive'; // Image in archives zip://$archive#$image + const SOURCE_STRING = 'string'; // Image from string /** * Image source @@ -379,6 +380,8 @@ class Image extends AbstractElement // Check image data if ($this->sourceType == self::SOURCE_ARCHIVE) { $imageData = $this->getArchiveImageSize($source); + } else if ($this->sourceType == self::SOURCE_STRING) { + $imageData = $this->getStringImageSize($source); } else { $imageData = @getimagesize($source); } @@ -416,9 +419,15 @@ class Image extends AbstractElement } elseif (strpos($source, 'zip://') !== false) { $this->memoryImage = false; $this->sourceType = self::SOURCE_ARCHIVE; + } elseif (filter_var($source, FILTER_VALIDATE_URL) !== false) { + $this->memoryImage = true; + $this->sourceType = self::SOURCE_GD; + } elseif (@file_exists($source)) { + $this->memoryImage = false; + $this->sourceType = self::SOURCE_LOCAL; } else { - $this->memoryImage = (filter_var($source, FILTER_VALIDATE_URL) !== false); - $this->sourceType = $this->memoryImage ? self::SOURCE_GD : self::SOURCE_LOCAL; + $this->memoryImage = true; + $this->sourceType = self::SOURCE_STRING; } } @@ -460,6 +469,24 @@ class Image extends AbstractElement return $imageData; } + /** + * get image size from string + * + * @param string $source + * + * @codeCoverageIgnore this method is just a replacement for getimagesizefromstring which exists only as of PHP 5.4 + */ + private function getStringImageSize($source) + { + if (!function_exists('getimagesizefromstring')) { + $uri = 'data://application/octet-stream;base64,' . base64_encode($source); + return @getimagesize($uri); + } else { + return @getimagesizefromstring($source); + } + return false; + } + /** * Set image functions and extensions. * diff --git a/tests/PhpWord/Element/ImageTest.php b/tests/PhpWord/Element/ImageTest.php index c463b0c4..9ef9694b 100644 --- a/tests/PhpWord/Element/ImageTest.php +++ b/tests/PhpWord/Element/ImageTest.php @@ -156,4 +156,57 @@ class ImageTest extends \PHPUnit_Framework_TestCase $image = new Image("zip://{$archiveFile}#{$imageFile}"); $this->assertEquals('image/jpeg', $image->getImageType()); } + + /** + * Test getting image as string + */ + public function testImageAsStringFromFile() + { + $image = new Image(__DIR__ . '/../_files/images/earth.jpg'); + + $this->assertNotNull($image->getImageStringData()); + $this->assertNotNull($image->getImageStringData(true)); + } + + /** + * Test getting image from zip as string + */ + public function testImageAsStringFromZip() + { + $archiveFile = __DIR__ . '/../_files/documents/reader.docx'; + $imageFile = 'word/media/image1.jpeg'; + $image = new Image("zip://{$archiveFile}#{$imageFile}"); + + $this->assertNotNull($image->getImageStringData()); + $this->assertNotNull($image->getImageStringData(true)); + } + + /** + * Test construct from string + */ + public function testConstructFromString() + { + $source = file_get_contents(__DIR__ . '/../_files/images/earth.jpg'); + + $image = new Image($source); + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Image', $image); + $this->assertEquals($source, $image->getSource()); + $this->assertEquals(md5($source), $image->getMediaId()); + $this->assertEquals('image/jpeg', $image->getImageType()); + $this->assertEquals('jpg', $image->getImageExtension()); + $this->assertEquals('imagecreatefromjpeg', $image->getImageCreateFunction()); + $this->assertEquals('imagejpeg', $image->getImageFunction()); + $this->assertTrue($image->isMemImage()); + } + + /** + * Test invalid string image + * + * @expectedException \PhpOffice\PhpWord\Exception\InvalidImageException + */ + public function testInvalidImageString() + { + $object = new Image('this_is-a_non_valid_image'); + $object->getSource(); + } } From 1a1b362f401ba84eb2133f465a1d4027a7467c1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Mourey?= Date: Tue, 13 Dec 2016 21:51:44 +0100 Subject: [PATCH 031/370] Update Paragraph.php --- src/PhpWord/Writer/ODText/Style/Paragraph.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/Writer/ODText/Style/Paragraph.php b/src/PhpWord/Writer/ODText/Style/Paragraph.php index 494142d7..14adda85 100644 --- a/src/PhpWord/Writer/ODText/Style/Paragraph.php +++ b/src/PhpWord/Writer/ODText/Style/Paragraph.php @@ -37,8 +37,8 @@ class Paragraph extends AbstractStyle } $xmlWriter = $this->getXmlWriter(); - $marginTop = ($style->getSpaceBefore()==0) ? '0' : round(17.6 / $style->getSpaceBefore(), 2); - $marginBottom = ($style->getSpaceAfter()==0) ? '0' : round(17.6 / $style->getSpaceAfter(), 2); + $marginTop = ($style->getSpaceBefore() ==0 ) ? '0' : round(17.6 / $style->getSpaceBefore(), 2); + $marginBottom = ($style->getSpaceAfter() == 0) ? '0' : round(17.6 / $style->getSpaceAfter(), 2); $xmlWriter->startElement('style:style'); $xmlWriter->writeAttribute('style:name', $style->getStyleName()); From b6a9f7c9b3d809e10c38834a27a94058526ac5df Mon Sep 17 00:00:00 2001 From: antoine Date: Sat, 21 Jan 2017 19:06:49 +0100 Subject: [PATCH 032/370] fix paper size and add tests for Paper class --- src/PhpWord/Style/Paper.php | 14 ++++-- tests/PhpWord/Style/PaperTest.php | 72 +++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 4 deletions(-) create mode 100644 tests/PhpWord/Style/PaperTest.php diff --git a/src/PhpWord/Style/Paper.php b/src/PhpWord/Style/Paper.php index ed1c59eb..eb0bcd77 100644 --- a/src/PhpWord/Style/Paper.php +++ b/src/PhpWord/Style/Paper.php @@ -17,6 +17,8 @@ namespace PhpOffice\PhpWord\Style; +use PhpOffice\PhpWord\Shared\Converter; + /** * Paper size from ISO/IEC 29500-1:2012 pg. 1656-1657 * @@ -100,6 +102,7 @@ class Paper extends AbstractStyle 'A3' => array(297, 420, 'mm'), 'A4' => array(210, 297, 'mm'), 'A5' => array(148, 210, 'mm'), + 'B5' => array(176, 250, 'mm'), 'Folio' => array(8.5, 13, 'in'), 'Legal' => array(8.5, 14, 'in'), 'Letter' => array(8.5, 11, 'in'), @@ -157,11 +160,14 @@ class Paper extends AbstractStyle $this->size = $this->setEnumVal($size, array_keys($this->sizes), $this->size); list($width, $height, $unit) = $this->sizes[$this->size]; - $multipliers = array('mm' => 56.5217, 'in' => 1440); - $multiplier = $multipliers[$unit]; - $this->width = (int)round($width * $multiplier); - $this->height = (int)round($height * $multiplier); + if ($unit == 'mm') { + $this->width = Converter::cmToTwip($width / 10); + $this->height = Converter::cmToTwip($height / 10); + } else { + $this->width = Converter::inchToTwip($width); + $this->height = Converter::inchToTwip($height); + } return $this; } diff --git a/tests/PhpWord/Style/PaperTest.php b/tests/PhpWord/Style/PaperTest.php new file mode 100644 index 00000000..8e1dd960 --- /dev/null +++ b/tests/PhpWord/Style/PaperTest.php @@ -0,0 +1,72 @@ +assertEquals('A4', $object->getSize()); + } + + /** + * Test paper size for B5 format + */ + public function testB5Size() + { + $object = new Paper('B5'); + + $this->assertEquals('B5', $object->getSize()); + $this->assertEquals(9977.9527559055, $object->getWidth(), '', 0.000000001); + $this->assertEquals(14173.228346457, $object->getHeight(), '', 0.000000001); + } + + /** + * Test paper size for Folio format + */ + public function testFolioSize() + { + $object = new Paper(); + $object->setSize('Folio'); + + $this->assertEquals('Folio', $object->getSize()); + $this->assertEquals(12240, $object->getWidth(), '', 0.1); + $this->assertEquals(18720, $object->getHeight(), '', 0.1); + } +} From fc3bc29a026ab31825390873da874b50f9e8863c Mon Sep 17 00:00:00 2001 From: antoine Date: Sun, 22 Jan 2017 11:09:44 +0100 Subject: [PATCH 033/370] fix default page size --- src/PhpWord/Style/Section.php | 14 +++++++------- tests/PhpWord/Style/SectionTest.php | 20 ++++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/PhpWord/Style/Section.php b/src/PhpWord/Style/Section.php index 62eb8f11..be8a3aad 100644 --- a/src/PhpWord/Style/Section.php +++ b/src/PhpWord/Style/Section.php @@ -35,14 +35,14 @@ class Section extends Border * * @const int|float */ - const DEFAULT_WIDTH = 11870; // In twips. - const DEFAULT_HEIGHT = 16787; // In twips. - const DEFAULT_MARGIN = 1440; // In twips. - const DEFAULT_GUTTER = 0; // In twips. - const DEFAULT_HEADER_HEIGHT = 720; // In twips. - const DEFAULT_FOOTER_HEIGHT = 720; // In twips. + const DEFAULT_WIDTH = 11905.511811024; // In twips. + const DEFAULT_HEIGHT = 16837.79527559; // In twips. + const DEFAULT_MARGIN = 1440; // In twips. + const DEFAULT_GUTTER = 0; // In twips. + const DEFAULT_HEADER_HEIGHT = 720; // In twips. + const DEFAULT_FOOTER_HEIGHT = 720; // In twips. const DEFAULT_COLUMN_COUNT = 1; - const DEFAULT_COLUMN_SPACING = 720; // In twips. + const DEFAULT_COLUMN_SPACING = 720; // In twips. /** * Page Orientation diff --git a/tests/PhpWord/Style/SectionTest.php b/tests/PhpWord/Style/SectionTest.php index ed25ac36..d15dc490 100644 --- a/tests/PhpWord/Style/SectionTest.php +++ b/tests/PhpWord/Style/SectionTest.php @@ -33,14 +33,14 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $oSettings = new Section(); $this->assertEquals('portrait', $oSettings->getOrientation()); - $this->assertEquals(Section::DEFAULT_WIDTH, $oSettings->getPageSizeW()); - $this->assertEquals(Section::DEFAULT_HEIGHT, $oSettings->getPageSizeH()); + $this->assertEquals(Section::DEFAULT_WIDTH, $oSettings->getPageSizeW(), '', 0.000000001); + $this->assertEquals(Section::DEFAULT_HEIGHT, $oSettings->getPageSizeH(), '', 0.000000001); $this->assertEquals('A4', $oSettings->getPaperSize()); $oSettings->setSettingValue('orientation', 'landscape'); $this->assertEquals('landscape', $oSettings->getOrientation()); - $this->assertEquals(Section::DEFAULT_HEIGHT, $oSettings->getPageSizeW()); - $this->assertEquals(Section::DEFAULT_WIDTH, $oSettings->getPageSizeH()); + $this->assertEquals(Section::DEFAULT_HEIGHT, $oSettings->getPageSizeW(), '', 0.000000001); + $this->assertEquals(Section::DEFAULT_WIDTH, $oSettings->getPageSizeH(), '', 0.000000001); $iVal = rand(1, 1000); $oSettings->setSettingValue('borderSize', $iVal); @@ -110,7 +110,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase // Section Settings $oSettings = new Section(); - $this->assertEquals(Section::DEFAULT_WIDTH, $oSettings->getPageSizeW()); + $this->assertEquals(Section::DEFAULT_WIDTH, $oSettings->getPageSizeW(), '', 0.000000001); $iVal = rand(1, 1000); $oSettings->setSettingValue('pageSizeW', $iVal); $this->assertEquals($iVal, $oSettings->getPageSizeW()); @@ -124,7 +124,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase // Section Settings $oSettings = new Section(); - $this->assertEquals(Section::DEFAULT_HEIGHT, $oSettings->getPageSizeH()); + $this->assertEquals(Section::DEFAULT_HEIGHT, $oSettings->getPageSizeH(), '', 0.000000001); $iVal = rand(1, 1000); $oSettings->setSettingValue('pageSizeH', $iVal); $this->assertEquals($iVal, $oSettings->getPageSizeH()); @@ -140,8 +140,8 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $oSettings->setLandscape(); $this->assertEquals('landscape', $oSettings->getOrientation()); - $this->assertEquals(Section::DEFAULT_HEIGHT, $oSettings->getPageSizeW()); - $this->assertEquals(Section::DEFAULT_WIDTH, $oSettings->getPageSizeH()); + $this->assertEquals(Section::DEFAULT_HEIGHT, $oSettings->getPageSizeW(), '', 0.000000001); + $this->assertEquals(Section::DEFAULT_WIDTH, $oSettings->getPageSizeH(), '', 0.000000001); } /** @@ -154,8 +154,8 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $oSettings->setPortrait(); $this->assertEquals('portrait', $oSettings->getOrientation()); - $this->assertEquals(Section::DEFAULT_WIDTH, $oSettings->getPageSizeW()); - $this->assertEquals(Section::DEFAULT_HEIGHT, $oSettings->getPageSizeH()); + $this->assertEquals(Section::DEFAULT_WIDTH, $oSettings->getPageSizeW(), '', 0.000000001); + $this->assertEquals(Section::DEFAULT_HEIGHT, $oSettings->getPageSizeH(), '', 0.000000001); } /** From 1ab93e7e8a188ba9a984784b9c5c0a90d492ee06 Mon Sep 17 00:00:00 2001 From: sergeizelenyi Date: Mon, 23 Jan 2017 16:15:33 +0300 Subject: [PATCH 034/370] added functionality specified alias and tag --- src/PhpWord/Element/SDT.php | 46 +++++++++++++++++++++ src/PhpWord/Writer/Word2007/Element/SDT.php | 4 ++ 2 files changed, 50 insertions(+) diff --git a/src/PhpWord/Element/SDT.php b/src/PhpWord/Element/SDT.php index 58a477d9..68a79108 100644 --- a/src/PhpWord/Element/SDT.php +++ b/src/PhpWord/Element/SDT.php @@ -45,6 +45,20 @@ class SDT extends Text */ private $listItems = array(); + /** + * Alias + * + * @var string + */ + private $alias; + + /** + * Tag + * + * @var string + */ + private $tag; + /** * Create new instance * @@ -127,4 +141,36 @@ class SDT extends Text return $this; } + + /** + * @return string + */ + public function getTag() + { + return $this->tag; + } + + /** + * @param string $tag + */ + public function setTag($tag) + { + $this->tag = $tag; + } + + /** + * @return mixed + */ + public function getAlias() + { + return $this->alias; + } + + /** + * @param mixed $alias + */ + public function setAlias($alias) + { + $this->alias = $alias; + } } diff --git a/src/PhpWord/Writer/Word2007/Element/SDT.php b/src/PhpWord/Writer/Word2007/Element/SDT.php index 313bf7e0..b4b241aa 100644 --- a/src/PhpWord/Writer/Word2007/Element/SDT.php +++ b/src/PhpWord/Writer/Word2007/Element/SDT.php @@ -43,6 +43,8 @@ class SDT extends Text } $type = $element->getType(); $writeFormField = "write{$type}"; + $alias = $element->getAlias(); + $tag = $element->getTag(); $this->startElementP(); @@ -50,6 +52,8 @@ class SDT extends Text // Properties $xmlWriter->startElement('w:sdtPr'); + $xmlWriter->writeElementBlock('w:alias', 'w:val', $alias); + $xmlWriter->writeElementBlock('w:tag', 'w:val', $tag); $xmlWriter->writeElementBlock('w:id', 'w:val', rand(100000000, 999999999)); $xmlWriter->writeElementBlock('w:lock', 'w:val', 'sdtLocked'); $this->$writeFormField($xmlWriter, $element); From 8b960c79d5bb2ec1c24e4f97118edf574e457f54 Mon Sep 17 00:00:00 2001 From: sergeizelenyi Date: Mon, 23 Jan 2017 16:43:56 +0300 Subject: [PATCH 035/370] stylization code --- src/PhpWord/Element/SDT.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/Element/SDT.php b/src/PhpWord/Element/SDT.php index 68a79108..89a14197 100644 --- a/src/PhpWord/Element/SDT.php +++ b/src/PhpWord/Element/SDT.php @@ -143,6 +143,8 @@ class SDT extends Text } /** + * Get tag + * * @return string */ public function getTag() @@ -151,15 +153,22 @@ class SDT extends Text } /** + * Set tag + * * @param string $tag + * @return self */ public function setTag($tag) { $this->tag = $tag; + + return $this; } /** - * @return mixed + * Get alias + * + * @return string */ public function getAlias() { @@ -167,10 +176,15 @@ class SDT extends Text } /** - * @param mixed $alias + * Set alias + * + * @param string $alias + * @return self */ public function setAlias($alias) { $this->alias = $alias; + + return $this; } } From d23409f687ec864ba6c489923be124ce29efb8e0 Mon Sep 17 00:00:00 2001 From: antoine Date: Sat, 28 Jan 2017 11:39:43 +0100 Subject: [PATCH 036/370] Add possibility to show/hide spelling and grammatical errors --- docs/general.rst | 13 +++++ src/PhpWord/Settings.php | 52 +++++++++++++++++++ src/PhpWord/Writer/Word2007/Part/Settings.php | 4 ++ tests/PhpWord/SettingsTest.php | 14 +++++ .../Writer/Word2007/Part/SettingsTest.php | 38 ++++++++++++++ 5 files changed, 121 insertions(+) diff --git a/docs/general.rst b/docs/general.rst index 27d0448a..9b7eb54b 100644 --- a/docs/general.rst +++ b/docs/general.rst @@ -183,3 +183,16 @@ points to twips. $sectionStyle->setMarginLeft(\PhpOffice\PhpWord\Shared\Converter::inchToTwip(.5)); // 2 cm right margin $sectionStyle->setMarginRight(\PhpOffice\PhpWord\Shared\Converter::cmToTwip(2)); + +Language +-------- + +You can hide spelling errors: + +.. code-block:: php + \PhpOffice\PhpWord\Settings::setSpellingErrorsHidden(true); + +And hide grammatical errors: + +.. code-block:: php + \PhpOffice\PhpWord\Settings::setGrammaticalErrorsHidden(true); diff --git a/src/PhpWord/Settings.php b/src/PhpWord/Settings.php index e049c46e..b1ef2759 100644 --- a/src/PhpWord/Settings.php +++ b/src/PhpWord/Settings.php @@ -119,6 +119,18 @@ class Settings */ private static $defaultFontSize = self::DEFAULT_FONT_SIZE; + /** + * Hide spelling errors + * @var boolean + */ + private static $spellingErrorsHidden = false; + + /** + * Hide grammatical errors + * @var boolean + */ + private static $grammaticalErrorsHidden = false; + /** * The user defined temporary directory. * @@ -393,6 +405,46 @@ class Settings return false; } + /** + * Are spelling errors hidden + * + * @return boolean + */ + public static function isSpellingErrorsHidden() + { + return self::$spellingErrorsHidden; + } + + /** + * Hide spelling errors + * + * @param boolean $spellingErrorsHidden + */ + public static function setSpellingErrorsHidden($spellingErrorsHidden) + { + self::$spellingErrorsHidden = $spellingErrorsHidden; + } + + /** + * Are grammatical errors hidden + * + * @return boolean + */ + public static function isGrammaticalErrorsHidden() + { + return self::$grammaticalErrorsHidden; + } + + /** + * Hide grammatical errors + * + * @param boolean $grammaticalErrorsHidden + */ + public static function setGrammaticalErrorsHidden($grammaticalErrorsHidden) + { + self::$grammaticalErrorsHidden = $grammaticalErrorsHidden; + } + /** * Load setting from phpword.yml or phpword.yml.dist * diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index d881e13a..f13381d2 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -17,6 +17,8 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Part; +use PhpOffice\PhpWord\Settings as DocumentSettings; + /** * Word2007 settings part writer: word/settings.xml * @@ -104,6 +106,8 @@ class Settings extends AbstractPart 'w:hyphenationZone' => array('@attributes' => array('w:val' => '425')), 'w:characterSpacingControl' => array('@attributes' => array('w:val' => 'doNotCompress')), 'w:themeFontLang' => array('@attributes' => array('w:val' => 'en-US')), + 'w:hideSpellingErrors' => array('@attributes' => array('w:val' => DocumentSettings::isSpellingErrorsHidden() ? 'true' : 'false')), + 'w:hideGrammaticalErrors' => array('@attributes' => array('w:val' => DocumentSettings::isGrammaticalErrorsHidden() ? 'true' : 'false')), 'w:decimalSymbol' => array('@attributes' => array('w:val' => '.')), 'w:listSeparator' => array('@attributes' => array('w:val' => ';')), 'w:compat' => array(), diff --git a/tests/PhpWord/SettingsTest.php b/tests/PhpWord/SettingsTest.php index f5ac3ed6..0d007b74 100644 --- a/tests/PhpWord/SettingsTest.php +++ b/tests/PhpWord/SettingsTest.php @@ -114,6 +114,20 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertFalse(Settings::setDefaultFontSize(null)); } + /** + * Test set/get spelling and grammar + */ + public function testSetGetSpellingGrammar() + { + $this->assertFalse(Settings::isSpellingErrorsHidden()); + Settings::setSpellingErrorsHidden(true); + $this->assertTrue(Settings::isSpellingErrorsHidden()); + + $this->assertFalse(Settings::isGrammaticalErrorsHidden()); + Settings::setGrammaticalErrorsHidden(true); + $this->assertTrue(Settings::isGrammaticalErrorsHidden()); + } + /** * Test load config */ diff --git a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php index 6ed23e44..7ae06e14 100644 --- a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php @@ -18,6 +18,7 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\TestHelperDOCX; +use PhpOffice\PhpWord\Settings; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Settings @@ -66,4 +67,41 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertTrue($doc->elementExists($path, $file)); $this->assertEquals($phpWord->getCompatibility()->getOoxmlVersion(), 15); } + + /** + * Test language + */ + public function testLanguage() + { + $phpWord = new PhpWord(); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:themeFontLang'; + $this->assertTrue($doc->elementExists($path, $file)); + $element = $doc->getElement($path, $file); + + $this->assertEquals('en-US', $element->getAttribute('w:val')); + } + + /** + * Test spelling + */ + public function testSpelling() + { + $phpWord = new PhpWord(); + Settings::setSpellingErrorsHidden(true); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:hideSpellingErrors'; + $this->assertTrue($doc->elementExists($path, $file)); + $element = $doc->getElement($path, $file); + + $this->assertEquals('true', $element->getAttribute('w:val')); + } } From 517c432ee68bd079e85542a8f6d8bb9a30a33758 Mon Sep 17 00:00:00 2001 From: antoine Date: Sun, 29 Jan 2017 13:16:54 +0100 Subject: [PATCH 037/370] fix image loading over https --- samples/Sample_13_Images.php | 6 ++++ src/PhpWord/Element/Image.php | 43 ++++++++++++++++------------- tests/PhpWord/Element/ImageTest.php | 12 ++++++-- 3 files changed, 40 insertions(+), 21 deletions(-) diff --git a/samples/Sample_13_Images.php b/samples/Sample_13_Images.php index a3c2af23..1e6943db 100644 --- a/samples/Sample_13_Images.php +++ b/samples/Sample_13_Images.php @@ -20,6 +20,12 @@ $source = 'http://php.net/images/logos/php-med-trans-light.gif'; $section->addText("Remote image from: {$source}"); $section->addImage($source); +// Image from string +$source = 'resources/_mars.jpg'; +$fileContent = file_get_contents($source); +$section->addText("Image from string"); +$section->addImage($fileContent); + //Wrapping style $text = str_repeat('Hello World! ', 15); $wrappingStyles = array('inline', 'behind', 'infront', 'square', 'tight'); diff --git a/src/PhpWord/Element/Image.php b/src/PhpWord/Element/Image.php index d7e5a665..b8b5cca1 100644 --- a/src/PhpWord/Element/Image.php +++ b/src/PhpWord/Element/Image.php @@ -340,6 +340,8 @@ class Image extends AbstractElement call_user_func($this->imageFunc, $imageResource); $imageBinary = ob_get_contents(); ob_end_clean(); + } elseif ($this->sourceType == self::SOURCE_STRING) { + $imageBinary = $this->source; } else { $fileHandle = fopen($actualSource, 'rb', false); if ($fileHandle !== false) { @@ -366,33 +368,31 @@ class Image extends AbstractElement /** * Check memory image, supported type, image functions, and proportional width/height. * - * @param string $source - * * @return void * * @throws \PhpOffice\PhpWord\Exception\InvalidImageException * @throws \PhpOffice\PhpWord\Exception\UnsupportedImageTypeException */ - private function checkImage($source) + private function checkImage() { - $this->setSourceType($source); + $this->setSourceType(); // Check image data if ($this->sourceType == self::SOURCE_ARCHIVE) { - $imageData = $this->getArchiveImageSize($source); + $imageData = $this->getArchiveImageSize($this->source); } else if ($this->sourceType == self::SOURCE_STRING) { - $imageData = $this->getStringImageSize($source); + $imageData = $this->getStringImageSize($this->source); } else { - $imageData = @getimagesize($source); + $imageData = @getimagesize($this->source); } if (!is_array($imageData)) { - throw new InvalidImageException(sprintf('Invalid image: %s', $source)); + throw new InvalidImageException(sprintf('Invalid image: %s', $this->source)); } list($actualWidth, $actualHeight, $imageType) = $imageData; // Check image type support $supportedTypes = array(IMAGETYPE_JPEG, IMAGETYPE_GIF, IMAGETYPE_PNG); - if ($this->sourceType != self::SOURCE_GD) { + if ($this->sourceType != self::SOURCE_GD && $this->sourceType != self::SOURCE_STRING) { $supportedTypes = array_merge($supportedTypes, array(IMAGETYPE_BMP, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM)); } if (!in_array($imageType, $supportedTypes)) { @@ -408,21 +408,26 @@ class Image extends AbstractElement /** * Set source type. * - * @param string $source * @return void */ - private function setSourceType($source) + private function setSourceType() { - if (stripos(strrev($source), strrev('.php')) === 0) { + if (stripos(strrev($this->source), strrev('.php')) === 0) { $this->memoryImage = true; $this->sourceType = self::SOURCE_GD; - } elseif (strpos($source, 'zip://') !== false) { + } elseif (strpos($this->source, 'zip://') !== false) { $this->memoryImage = false; $this->sourceType = self::SOURCE_ARCHIVE; - } elseif (filter_var($source, FILTER_VALIDATE_URL) !== false) { + } elseif (filter_var($this->source, FILTER_VALIDATE_URL) !== false) { $this->memoryImage = true; - $this->sourceType = self::SOURCE_GD; - } elseif (@file_exists($source)) { + if (strpos($this->source, 'https') === 0) { + $fileContent = file_get_contents($this->source); + $this->source = $fileContent; + $this->sourceType = self::SOURCE_STRING; + } else { + $this->sourceType = self::SOURCE_GD; + } + } elseif (@file_exists($this->source)) { $this->memoryImage = false; $this->sourceType = self::SOURCE_LOCAL; } else { @@ -496,18 +501,18 @@ class Image extends AbstractElement { switch ($this->imageType) { case 'image/png': - $this->imageCreateFunc = 'imagecreatefrompng'; + $this->imageCreateFunc = $this->sourceType == self::SOURCE_STRING ? 'imagecreatefromstring' : 'imagecreatefrompng'; $this->imageFunc = 'imagepng'; $this->imageExtension = 'png'; break; case 'image/gif': - $this->imageCreateFunc = 'imagecreatefromgif'; + $this->imageCreateFunc = $this->sourceType == self::SOURCE_STRING ? 'imagecreatefromstring' : 'imagecreatefromgif'; $this->imageFunc = 'imagegif'; $this->imageExtension = 'gif'; break; case 'image/jpeg': case 'image/jpg': - $this->imageCreateFunc = 'imagecreatefromjpeg'; + $this->imageCreateFunc = $this->sourceType == self::SOURCE_STRING ? 'imagecreatefromstring' : 'imagecreatefromjpeg'; $this->imageFunc = 'imagejpeg'; $this->imageExtension = 'jpg'; break; diff --git a/tests/PhpWord/Element/ImageTest.php b/tests/PhpWord/Element/ImageTest.php index 9ef9694b..974e868c 100644 --- a/tests/PhpWord/Element/ImageTest.php +++ b/tests/PhpWord/Element/ImageTest.php @@ -131,7 +131,15 @@ class ImageTest extends \PHPUnit_Framework_TestCase */ public function testUnsupportedImage() { - $object = new Image('http://samples.libav.org/image-samples/RACECAR.BMP'); + //disable ssl verification, never do this in real application, you should pass the certiciate instead!!! + $arrContextOptions = array( + "ssl" => array( + "verify_peer" => false, + "verify_peer_name" => false, + ), + ); + stream_context_set_default($arrContextOptions); + $object = new Image('https://samples.libav.org/image-samples/RACECAR.BMP'); $object->getSource(); } @@ -194,7 +202,7 @@ class ImageTest extends \PHPUnit_Framework_TestCase $this->assertEquals(md5($source), $image->getMediaId()); $this->assertEquals('image/jpeg', $image->getImageType()); $this->assertEquals('jpg', $image->getImageExtension()); - $this->assertEquals('imagecreatefromjpeg', $image->getImageCreateFunction()); + $this->assertEquals('imagecreatefromstring', $image->getImageCreateFunction()); $this->assertEquals('imagejpeg', $image->getImageFunction()); $this->assertTrue($image->isMemImage()); } From 217fd6ecf1906a1534a88a5e608f73464509163c Mon Sep 17 00:00:00 2001 From: antoine Date: Sun, 29 Jan 2017 13:16:54 +0100 Subject: [PATCH 038/370] fix image loading over https --- samples/Sample_13_Images.php | 6 ++++ src/PhpWord/Element/Image.php | 43 ++++++++++++++++------------- tests/PhpWord/Element/ImageTest.php | 12 ++++++-- 3 files changed, 40 insertions(+), 21 deletions(-) diff --git a/samples/Sample_13_Images.php b/samples/Sample_13_Images.php index a3c2af23..1e6943db 100644 --- a/samples/Sample_13_Images.php +++ b/samples/Sample_13_Images.php @@ -20,6 +20,12 @@ $source = 'http://php.net/images/logos/php-med-trans-light.gif'; $section->addText("Remote image from: {$source}"); $section->addImage($source); +// Image from string +$source = 'resources/_mars.jpg'; +$fileContent = file_get_contents($source); +$section->addText("Image from string"); +$section->addImage($fileContent); + //Wrapping style $text = str_repeat('Hello World! ', 15); $wrappingStyles = array('inline', 'behind', 'infront', 'square', 'tight'); diff --git a/src/PhpWord/Element/Image.php b/src/PhpWord/Element/Image.php index d7e5a665..b8b5cca1 100644 --- a/src/PhpWord/Element/Image.php +++ b/src/PhpWord/Element/Image.php @@ -340,6 +340,8 @@ class Image extends AbstractElement call_user_func($this->imageFunc, $imageResource); $imageBinary = ob_get_contents(); ob_end_clean(); + } elseif ($this->sourceType == self::SOURCE_STRING) { + $imageBinary = $this->source; } else { $fileHandle = fopen($actualSource, 'rb', false); if ($fileHandle !== false) { @@ -366,33 +368,31 @@ class Image extends AbstractElement /** * Check memory image, supported type, image functions, and proportional width/height. * - * @param string $source - * * @return void * * @throws \PhpOffice\PhpWord\Exception\InvalidImageException * @throws \PhpOffice\PhpWord\Exception\UnsupportedImageTypeException */ - private function checkImage($source) + private function checkImage() { - $this->setSourceType($source); + $this->setSourceType(); // Check image data if ($this->sourceType == self::SOURCE_ARCHIVE) { - $imageData = $this->getArchiveImageSize($source); + $imageData = $this->getArchiveImageSize($this->source); } else if ($this->sourceType == self::SOURCE_STRING) { - $imageData = $this->getStringImageSize($source); + $imageData = $this->getStringImageSize($this->source); } else { - $imageData = @getimagesize($source); + $imageData = @getimagesize($this->source); } if (!is_array($imageData)) { - throw new InvalidImageException(sprintf('Invalid image: %s', $source)); + throw new InvalidImageException(sprintf('Invalid image: %s', $this->source)); } list($actualWidth, $actualHeight, $imageType) = $imageData; // Check image type support $supportedTypes = array(IMAGETYPE_JPEG, IMAGETYPE_GIF, IMAGETYPE_PNG); - if ($this->sourceType != self::SOURCE_GD) { + if ($this->sourceType != self::SOURCE_GD && $this->sourceType != self::SOURCE_STRING) { $supportedTypes = array_merge($supportedTypes, array(IMAGETYPE_BMP, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM)); } if (!in_array($imageType, $supportedTypes)) { @@ -408,21 +408,26 @@ class Image extends AbstractElement /** * Set source type. * - * @param string $source * @return void */ - private function setSourceType($source) + private function setSourceType() { - if (stripos(strrev($source), strrev('.php')) === 0) { + if (stripos(strrev($this->source), strrev('.php')) === 0) { $this->memoryImage = true; $this->sourceType = self::SOURCE_GD; - } elseif (strpos($source, 'zip://') !== false) { + } elseif (strpos($this->source, 'zip://') !== false) { $this->memoryImage = false; $this->sourceType = self::SOURCE_ARCHIVE; - } elseif (filter_var($source, FILTER_VALIDATE_URL) !== false) { + } elseif (filter_var($this->source, FILTER_VALIDATE_URL) !== false) { $this->memoryImage = true; - $this->sourceType = self::SOURCE_GD; - } elseif (@file_exists($source)) { + if (strpos($this->source, 'https') === 0) { + $fileContent = file_get_contents($this->source); + $this->source = $fileContent; + $this->sourceType = self::SOURCE_STRING; + } else { + $this->sourceType = self::SOURCE_GD; + } + } elseif (@file_exists($this->source)) { $this->memoryImage = false; $this->sourceType = self::SOURCE_LOCAL; } else { @@ -496,18 +501,18 @@ class Image extends AbstractElement { switch ($this->imageType) { case 'image/png': - $this->imageCreateFunc = 'imagecreatefrompng'; + $this->imageCreateFunc = $this->sourceType == self::SOURCE_STRING ? 'imagecreatefromstring' : 'imagecreatefrompng'; $this->imageFunc = 'imagepng'; $this->imageExtension = 'png'; break; case 'image/gif': - $this->imageCreateFunc = 'imagecreatefromgif'; + $this->imageCreateFunc = $this->sourceType == self::SOURCE_STRING ? 'imagecreatefromstring' : 'imagecreatefromgif'; $this->imageFunc = 'imagegif'; $this->imageExtension = 'gif'; break; case 'image/jpeg': case 'image/jpg': - $this->imageCreateFunc = 'imagecreatefromjpeg'; + $this->imageCreateFunc = $this->sourceType == self::SOURCE_STRING ? 'imagecreatefromstring' : 'imagecreatefromjpeg'; $this->imageFunc = 'imagejpeg'; $this->imageExtension = 'jpg'; break; diff --git a/tests/PhpWord/Element/ImageTest.php b/tests/PhpWord/Element/ImageTest.php index 9ef9694b..974e868c 100644 --- a/tests/PhpWord/Element/ImageTest.php +++ b/tests/PhpWord/Element/ImageTest.php @@ -131,7 +131,15 @@ class ImageTest extends \PHPUnit_Framework_TestCase */ public function testUnsupportedImage() { - $object = new Image('http://samples.libav.org/image-samples/RACECAR.BMP'); + //disable ssl verification, never do this in real application, you should pass the certiciate instead!!! + $arrContextOptions = array( + "ssl" => array( + "verify_peer" => false, + "verify_peer_name" => false, + ), + ); + stream_context_set_default($arrContextOptions); + $object = new Image('https://samples.libav.org/image-samples/RACECAR.BMP'); $object->getSource(); } @@ -194,7 +202,7 @@ class ImageTest extends \PHPUnit_Framework_TestCase $this->assertEquals(md5($source), $image->getMediaId()); $this->assertEquals('image/jpeg', $image->getImageType()); $this->assertEquals('jpg', $image->getImageExtension()); - $this->assertEquals('imagecreatefromjpeg', $image->getImageCreateFunction()); + $this->assertEquals('imagecreatefromstring', $image->getImageCreateFunction()); $this->assertEquals('imagejpeg', $image->getImageFunction()); $this->assertTrue($image->isMemImage()); } From aef7a0ba76ef774ea2731882870cb0800ce73398 Mon Sep 17 00:00:00 2001 From: antoine Date: Sun, 29 Jan 2017 14:34:19 +0100 Subject: [PATCH 039/370] add possibility to write w:evenAndOddHeaders in settings.xml --- src/PhpWord/Settings.php | 25 ++++++++++++++++++- src/PhpWord/Writer/Word2007/Part/Settings.php | 3 +++ tests/PhpWord/SettingsTest.php | 10 ++++++++ .../Writer/Word2007/Part/SettingsTest.php | 20 +++++++++++++++ 4 files changed, 57 insertions(+), 1 deletion(-) diff --git a/src/PhpWord/Settings.php b/src/PhpWord/Settings.php index e049c46e..3fbbb0a6 100644 --- a/src/PhpWord/Settings.php +++ b/src/PhpWord/Settings.php @@ -133,7 +133,14 @@ class Settings * @var bool */ private static $outputEscapingEnabled = false; - + + /** + * Enables different header for odd and even pages. + * + * @var bool + */ + private static $evenAndOddHeaders = false; + /** * Return the compatibility option used by the XMLWriter * @@ -340,6 +347,22 @@ class Settings self::$outputEscapingEnabled = $outputEscapingEnabled; } + /** + * @return boolean + */ + public static function isEvenAndOddHeaders() + { + return self::$evenAndOddHeaders; + } + + /** + * @param boolean $evenAndOddHeaders + */ + public static function setEvenAndOddHeaders($evenAndOddHeaders) + { + self::$evenAndOddHeaders = $evenAndOddHeaders; + } + /** * Get default font name * diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index d881e13a..82669f91 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -17,6 +17,8 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Part; +use PhpOffice\PhpWord\Settings as DocumentSettings; + /** * Word2007 settings part writer: word/settings.xml * @@ -103,6 +105,7 @@ class Settings extends AbstractPart 'w:defaultTabStop' => array('@attributes' => array('w:val' => '708')), 'w:hyphenationZone' => array('@attributes' => array('w:val' => '425')), 'w:characterSpacingControl' => array('@attributes' => array('w:val' => 'doNotCompress')), + 'w:evenAndOddHeaders' => array('@attributes' => array('w:val' => DocumentSettings::isEvenAndOddHeaders() ? 'true': 'false')), 'w:themeFontLang' => array('@attributes' => array('w:val' => 'en-US')), 'w:decimalSymbol' => array('@attributes' => array('w:val' => '.')), 'w:listSeparator' => array('@attributes' => array('w:val' => ';')), diff --git a/tests/PhpWord/SettingsTest.php b/tests/PhpWord/SettingsTest.php index f5ac3ed6..764fccd4 100644 --- a/tests/PhpWord/SettingsTest.php +++ b/tests/PhpWord/SettingsTest.php @@ -114,6 +114,16 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertFalse(Settings::setDefaultFontSize(null)); } + /** + * Test set/get even and odd headers + */ + public function testSetGetEvenAndOddHeaders() + { + $this->assertFalse(Settings::isEvenAndOddHeaders()); + Settings::setEvenAndOddHeaders(true); + $this->assertTrue(Settings::isEvenAndOddHeaders()); + } + /** * Test load config */ diff --git a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php index 6ed23e44..be018f8c 100644 --- a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php @@ -18,6 +18,7 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\TestHelperDOCX; +use PhpOffice\PhpWord\Settings; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Settings @@ -66,4 +67,23 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertTrue($doc->elementExists($path, $file)); $this->assertEquals($phpWord->getCompatibility()->getOoxmlVersion(), 15); } + + /** + * Test even and odd headers + */ + public function testEvenAndOddHeaders() + { + $phpWord = new PhpWord(); + Settings::setEvenAndOddHeaders(true); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:evenAndOddHeaders'; + $this->assertTrue($doc->elementExists($path, $file)); + + $element = $doc->getElement($path, $file); + $this->assertEquals('true', $element->getAttribute('w:val')); + } } From f9cab8d02c94854155dd86bbf66b57ba3506b086 Mon Sep 17 00:00:00 2001 From: Andrey Tyshev Date: Tue, 21 Feb 2017 21:42:56 +0300 Subject: [PATCH 040/370] Fix name of style definitions --- src/PhpWord/Reader/Word2007/Document.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/PhpWord/Reader/Word2007/Document.php b/src/PhpWord/Reader/Word2007/Document.php index b89a99ad..e5063fd9 100644 --- a/src/PhpWord/Reader/Word2007/Document.php +++ b/src/PhpWord/Reader/Word2007/Document.php @@ -113,10 +113,10 @@ class Document extends AbstractPart 'orientation' => array(self::READ_VALUE, 'w:pgSz', 'w:orient'), 'colsNum' => array(self::READ_VALUE, 'w:cols', 'w:num'), 'colsSpace' => array(self::READ_VALUE, 'w:cols', 'w:space'), - 'topMargin' => array(self::READ_VALUE, 'w:pgMar', 'w:top'), - 'leftMargin' => array(self::READ_VALUE, 'w:pgMar', 'w:left'), - 'bottomMargin' => array(self::READ_VALUE, 'w:pgMar', 'w:bottom'), - 'rightMargin' => array(self::READ_VALUE, 'w:pgMar', 'w:right'), + 'marginTop' => array(self::READ_VALUE, 'w:pgMar', 'w:top'), + 'marginLeft' => array(self::READ_VALUE, 'w:pgMar', 'w:left'), + 'marginBottom' => array(self::READ_VALUE, 'w:pgMar', 'w:bottom'), + 'marginRight' => array(self::READ_VALUE, 'w:pgMar', 'w:right'), 'headerHeight' => array(self::READ_VALUE, 'w:pgMar', 'w:header'), 'footerHeight' => array(self::READ_VALUE, 'w:pgMar', 'w:footer'), 'gutter' => array(self::READ_VALUE, 'w:pgMar', 'w:gutter'), From 488b10b73b5ccd9bb8fe8a7b2195cd444edf4093 Mon Sep 17 00:00:00 2001 From: Maria Haubner Date: Wed, 8 Mar 2017 13:08:33 +0100 Subject: [PATCH 041/370] allow setValue() for SDTs --- samples/Sample_34_SDT.php | 8 +++++++- src/PhpWord/Writer/Word2007/Element/SDT.php | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/samples/Sample_34_SDT.php b/samples/Sample_34_SDT.php index a5042279..f9077a1a 100644 --- a/samples/Sample_34_SDT.php +++ b/samples/Sample_34_SDT.php @@ -15,10 +15,16 @@ $textrun->addSDT('comboBox')->setListItems(array('1' => 'Choice 1', '2' => 'Choi $textrun = $section->addTextRun(); $textrun->addText('Date: '); $textrun->addSDT('date'); +$textrun->addTextBreak(1); +$textrun->addText('Date with pre set value: '); +$textrun->addSDT('date')->setValue('03/30/2017'); +$textrun->addTextBreak(1); +$textrun->addText('Date with pre set value: '); +$textrun->addSDT('date')->setValue('30.03.2017'); $textrun = $section->addTextRun(); $textrun->addText('Drop down list: '); -$textrun->addSDT('dropDownList')->setListItems(array('1' => 'Choice 1', '2' => 'Choice 2')); +$textrun->addSDT('dropDownList')->setListItems(array('1' => 'Choice 1', '2' => 'Choice 2'))->setValue('Choice 1'); // Save file echo write($phpWord, basename(__FILE__, '.php'), $writers); diff --git a/src/PhpWord/Writer/Word2007/Element/SDT.php b/src/PhpWord/Writer/Word2007/Element/SDT.php index 313bf7e0..e25e8989 100644 --- a/src/PhpWord/Writer/Word2007/Element/SDT.php +++ b/src/PhpWord/Writer/Word2007/Element/SDT.php @@ -43,6 +43,10 @@ class SDT extends Text } $type = $element->getType(); $writeFormField = "write{$type}"; + $value = $element->getValue(); + if ($value === null) { + $value = 'Pick value'; + } $this->startElementP(); @@ -58,7 +62,7 @@ class SDT extends Text // Content $xmlWriter->startElement('w:sdtContent'); $xmlWriter->startElement('w:r'); - $xmlWriter->writeElement('w:t', 'Pick value'); + $xmlWriter->writeElement('w:t', $value); $xmlWriter->endElement(); // w:r $xmlWriter->endElement(); // w:sdtContent From 05387fac0903969fb88c832042991bd34f0154b0 Mon Sep 17 00:00:00 2001 From: Maria Haubner Date: Fri, 10 Mar 2017 13:28:32 +0100 Subject: [PATCH 042/370] enable password setting in word --- src/PhpWord/Metadata/Protection.php | 224 +++++++++++++++++- src/PhpWord/Writer/Word2007/Part/Settings.php | 28 ++- 2 files changed, 244 insertions(+), 8 deletions(-) diff --git a/src/PhpWord/Metadata/Protection.php b/src/PhpWord/Metadata/Protection.php index 0e2ee7c1..bcc0d652 100644 --- a/src/PhpWord/Metadata/Protection.php +++ b/src/PhpWord/Metadata/Protection.php @@ -22,18 +22,77 @@ namespace PhpOffice\PhpWord\Metadata; * * @since 0.12.0 * @link http://www.datypic.com/sc/ooxml/t-w_CT_DocProtect.html - * @todo Password! */ class Protection { + static $algorithmMapping = [ + 1 => 'md2', + 2 => 'md4', + 3 => 'md5', + 4 => 'sha1', + 5 => '', // 'mac' -> not possible with hash() + 6 => 'ripemd', + 7 => 'ripemd160', + 8 => '', + 9 => '', //'hmac' -> not possible with hash() + 10 => '', + 11 => '', + 12 => 'sha256', + 13 => 'sha384', + 14 => 'sha512', + ]; + static $initialCodeArray = [ + 0xE1F0, + 0x1D0F, + 0xCC9C, + 0x84C0, + 0x110C, + 0x0E10, + 0xF1CE, + 0x313E, + 0x1872, + 0xE139, + 0xD40F, + 0x84F9, + 0x280C, + 0xA96A, + 0x4EC3 + ]; + static $encryptionMatrix = + [ + [0xAEFC, 0x4DD9, 0x9BB2, 0x2745, 0x4E8A, 0x9D14, 0x2A09], + [0x7B61, 0xF6C2, 0xFDA5, 0xEB6B, 0xC6F7, 0x9DCF, 0x2BBF], + [0x4563, 0x8AC6, 0x05AD, 0x0B5A, 0x16B4, 0x2D68, 0x5AD0], + [0x0375, 0x06EA, 0x0DD4, 0x1BA8, 0x3750, 0x6EA0, 0xDD40], + [0xD849, 0xA0B3, 0x5147, 0xA28E, 0x553D, 0xAA7A, 0x44D5], + [0x6F45, 0xDE8A, 0xAD35, 0x4A4B, 0x9496, 0x390D, 0x721A], + [0xEB23, 0xC667, 0x9CEF, 0x29FF, 0x53FE, 0xA7FC, 0x5FD9], + [0x47D3, 0x8FA6, 0x0F6D, 0x1EDA, 0x3DB4, 0x7B68, 0xF6D0], + [0xB861, 0x60E3, 0xC1C6, 0x93AD, 0x377B, 0x6EF6, 0xDDEC], + [0x45A0, 0x8B40, 0x06A1, 0x0D42, 0x1A84, 0x3508, 0x6A10], + [0xAA51, 0x4483, 0x8906, 0x022D, 0x045A, 0x08B4, 0x1168], + [0x76B4, 0xED68, 0xCAF1, 0x85C3, 0x1BA7, 0x374E, 0x6E9C], + [0x3730, 0x6E60, 0xDCC0, 0xA9A1, 0x4363, 0x86C6, 0x1DAD], + [0x3331, 0x6662, 0xCCC4, 0x89A9, 0x0373, 0x06E6, 0x0DCC], + [0x1021, 0x2042, 0x4084, 0x8108, 0x1231, 0x2462, 0x48C4] + ]; + /** - * Editing restriction readOnly|comments|trackedChanges|forms + * Editing restriction none|readOnly|comments|trackedChanges|forms * * @var string * @link http://www.datypic.com/sc/ooxml/a-w_edit-1.html */ private $editing; + private $password; + + private $spinCount = 100000; + + private $algorithmSid = 4; + + private $salt; + /** * Create a new instance * @@ -66,4 +125,165 @@ class Protection return $this; } + + public function getPassword() + { + return $this->password; + } + + public function setPassword($password) + { + $this->password = $this->getPasswordHash($password); + + return $this; + } + + public function getSpinCount() + { + return $this->spinCount; + } + + public function setSpinCount($spinCount) + { + $this->spinCount = $spinCount; + + return $this; + } + + public function getAlgorithmSid() + { + return $this->algorithmSid; + } + + public function setAlgorithmSid($algorithmSid) + { + $this->algorithmSid = $algorithmSid; + + return $this; + } + + public function setSalt($salt) + { + $this->salt = $salt; + } + + public function getSalt() + { + return $this->salt; + } + + private function getAlgorithm() + { + $algorithm = self::$algorithmMapping[$this->algorithmSid]; + if ($algorithm == '') { + $algorithm = 'sha1'; + } + + return $algorithm; + } + + private function getPasswordHash($password) + { + if (empty($password)) { + return ''; + } + $passwordMaxLength = 15; + + // Truncate the password to $passwordMaxLength characters + $password = mb_substr($password, 0, min($passwordMaxLength, mb_strlen($password))); + + $byteChars = []; + + echo "password: '{$password}'(".mb_strlen($password).")"; + + $pass_utf8 = mb_convert_encoding($password, 'UCS-2LE', 'UTF-8'); + for ($i = 0; $i < mb_strlen($password); $i++) { + $byteChars[$i] = ord(substr($pass_utf8, $i*2, 1)); + if ($byteChars[$i] == 0) { + echo "hi!$i"; + $byteChars[$i] = ord(substr($pass_utf8, $i*2+1, 1)); + } + } + + // Compute the high-order word + $highOrderWord = self::$initialCodeArray[sizeof($byteChars) - 1]; + for ($i = 0; $i < sizeof($byteChars); $i++) { + $tmp = $passwordMaxLength - sizeof($byteChars) + $i; + $matrixRow = self::$encryptionMatrix[$tmp]; + + for ($intBit = 0; $intBit < 7; $intBit++) { + if (($byteChars[$i] & (0x0001 << $intBit)) != 0) { + $highOrderWord = ($highOrderWord ^ $matrixRow[$intBit]); + } + } + } + + // Compute low-order word + $lowOrderWord = 0; + for ($i = sizeof($byteChars) - 1; $i >= 0; $i--) { + $lowOrderWord = (((($lowOrderWord >> 14) & 0x0001) | (($lowOrderWord << 1) & 0x7FFF)) ^ $byteChars[$i]); + } + $lowOrderWord = (((($lowOrderWord >> 14) & 0x0001) | (($lowOrderWord << 1) & 0x7FFF)) ^ sizeof($byteChars) ^ 0xCE4B); + + $combinedKey = $this->int32(($highOrderWord << 16) + $lowOrderWord); + $generatedKey = [ + 0 => (($combinedKey & 0x000000FF) >> 0), + 1 => (($combinedKey & 0x0000FF00) >> 8), + 2 => (($combinedKey & 0x00FF0000) >> 16), + 3 => (($combinedKey & 0xFF000000) >> 24), + ]; + + $tmpStr = ''; + for ($i = 0; $i < 4; $i++) { + $tmpStr .= strtoupper(dechex($generatedKey[$i])); + } + $generatedKey = []; + $tmpStr = mb_convert_encoding($tmpStr, 'UCS-2LE', 'UTF-8'); + for ($i = 0; $i < strlen($tmpStr); $i++) { + $generatedKey[] = ord(substr($tmpStr, $i, 1)); + } + + $salt = unpack('C*', base64_decode($this->getSalt())); + $algorithm = $this->getAlgorithm(); + + $tmpArray1 = $generatedKey; + $tmpArray2 = $salt; + $generatedKey = array_merge($tmpArray2, $tmpArray1); + + $generatedKey = $this->hashByteArray($algorithm, $generatedKey); + + for ($i = 0; $i < $this->getSpinCount(); $i++) { + $iterator = [ + 0 => (($i & 0x000000FF) >> 0), + 1 => (($i & 0x0000FF00) >> 8), + 2 => (($i & 0x00FF0000) >> 16), + 3 => (($i & 0xFF000000) >> 24), + ]; + $generatedKey = array_merge($generatedKey, $iterator); + $generatedKey = $this->hashByteArray($algorithm, $generatedKey); + } + + $hash = implode(array_map("chr", $generatedKey)); + + return base64_encode($hash); + } + + private function int32($value) + { + $value = ($value & 0xFFFFFFFF); + + if ($value & 0x80000000) { + $value = -((~$value & 0xFFFFFFFF) + 1); + } + + return $value; + } + + private function hashByteArray($algorithm, $array) + { + $string = implode(array_map("chr", $array)); + $string = hash($algorithm, $string, true); + + return unpack('C*', $string); + } } diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index d881e13a..11549e08 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -152,12 +152,28 @@ class Settings extends AbstractPart { $protection = $this->getParentWriter()->getPhpWord()->getProtection(); if ($protection->getEditing() !== null) { - $this->settings['w:documentProtection'] = array( - '@attributes' => array( - 'w:enforcement' => 1, - 'w:edit' => $protection->getEditing(), - ) - ); + if (empty($protection->getPassword())) { + $this->settings['w:documentProtection'] = array( + '@attributes' => array( + 'w:enforcement' => 1, + 'w:edit' => $protection->getEditing(), + ) + ); + } else { + $this->settings['w:documentProtection'] = array( + '@attributes' => array( + 'w:enforcement' => 1, + 'w:edit' => $protection->getEditing(), + 'w:cryptProviderType' => 'rsaFull', + 'w:cryptAlgorithmClass' => 'hash', + 'w:cryptAlgorithmType' => 'typeAny', + 'w:cryptAlgorithmSid' => $protection->getAlgorithmSid(), + 'w:cryptSpinCount' => $protection->getSpinCount(), + 'w:hash' => $protection->getPassword(), + 'w:salt' => $protection->getSalt(), + ) + ); + } } } From 483a167500a008d4895a79f594658dc3b5fc2769 Mon Sep 17 00:00:00 2001 From: Maria Haubner Date: Fri, 10 Mar 2017 15:44:13 +0100 Subject: [PATCH 043/370] refactoring of hash function --- src/PhpWord/Metadata/Protection.php | 214 +++++++++++++++++++--------- 1 file changed, 145 insertions(+), 69 deletions(-) diff --git a/src/PhpWord/Metadata/Protection.php b/src/PhpWord/Metadata/Protection.php index bcc0d652..5427f570 100644 --- a/src/PhpWord/Metadata/Protection.php +++ b/src/PhpWord/Metadata/Protection.php @@ -76,6 +76,7 @@ class Protection [0x3331, 0x6662, 0xCCC4, 0x89A9, 0x0373, 0x06E6, 0x0DCC], [0x1021, 0x2042, 0x4084, 0x8108, 0x1231, 0x2462, 0x48C4] ]; + static $passwordMaxLength = 15; /** * Editing restriction none|readOnly|comments|trackedChanges|forms @@ -85,12 +86,32 @@ class Protection */ private $editing; + /** + * Hashed password + * + * @var string + */ private $password; + /** + * Number of hashing iterations + * + * @var int + */ private $spinCount = 100000; + /** + * Algorithm-SID according to self::$algorithmMapping + * + * @var int + */ private $algorithmSid = 4; + /** + * Hashed salt + * + * @var string + */ private $salt; /** @@ -126,11 +147,22 @@ class Protection return $this; } + /** + * Get password hash + * + * @return string + */ public function getPassword() { return $this->password; } + /** + * Set password + * + * @param $password + * @return self + */ public function setPassword($password) { $this->password = $this->getPasswordHash($password); @@ -138,11 +170,22 @@ class Protection return $this; } + /** + * Get count for hash iterations + * + * @return int + */ public function getSpinCount() { return $this->spinCount; } + /** + * Set count for hash iterations + * + * @param $spinCount + * @return self + */ public function setSpinCount($spinCount) { $this->spinCount = $spinCount; @@ -150,11 +193,22 @@ class Protection return $this; } + /** + * Get algorithm-sid + * + * @return int + */ public function getAlgorithmSid() { return $this->algorithmSid; } + /** + * Set algorithm-sid (see self::$algorithmMapping) + * + * @param $algorithmSid + * @return self + */ public function setAlgorithmSid($algorithmSid) { $this->algorithmSid = $algorithmSid; @@ -162,16 +216,34 @@ class Protection return $this; } - public function setSalt($salt) - { - $this->salt = $salt; - } - + /** + * Get salt hash + * + * @return string + */ public function getSalt() { return $this->salt; } + /** + * Set salt hash + * + * @param $salt + * @return self + */ + public function setSalt($salt) + { + $this->salt = $salt; + + return $this; + } + + /** + * Get algorithm from self::$algorithmMapping + * + * @return string + */ private function getAlgorithm() { $algorithm = self::$algorithmMapping[$this->algorithmSid]; @@ -182,35 +254,76 @@ class Protection return $algorithm; } + /** + * Create a hashed password that MS Word will be able to work with + * + * @param string $password + * @return string + */ private function getPasswordHash($password) { + $orig_encoding = mb_internal_encoding(); + mb_internal_encoding("UTF-8"); + if (empty($password)) { return ''; } - $passwordMaxLength = 15; - // Truncate the password to $passwordMaxLength characters - $password = mb_substr($password, 0, min($passwordMaxLength, mb_strlen($password))); + $password = mb_substr($password, 0, min(self::$passwordMaxLength, mb_strlen($password))); + // Construct a new NULL-terminated string consisting of single-byte characters: + // Get the single-byte values by iterating through the Unicode characters of the truncated password. + // For each character, if the low byte is not equal to 0, take it. Otherwise, take the high byte. + $pass_utf8 = mb_convert_encoding($password, 'UCS-2LE', 'UTF-8'); $byteChars = []; - - echo "password: '{$password}'(".mb_strlen($password).")"; - - $pass_utf8 = mb_convert_encoding($password, 'UCS-2LE', 'UTF-8'); for ($i = 0; $i < mb_strlen($password); $i++) { - $byteChars[$i] = ord(substr($pass_utf8, $i*2, 1)); + $byteChars[$i] = ord(substr($pass_utf8, $i * 2, 1)); if ($byteChars[$i] == 0) { - echo "hi!$i"; - $byteChars[$i] = ord(substr($pass_utf8, $i*2+1, 1)); + $byteChars[$i] = ord(substr($pass_utf8, $i * 2 + 1, 1)); } } - // Compute the high-order word - $highOrderWord = self::$initialCodeArray[sizeof($byteChars) - 1]; - for ($i = 0; $i < sizeof($byteChars); $i++) { - $tmp = $passwordMaxLength - sizeof($byteChars) + $i; - $matrixRow = self::$encryptionMatrix[$tmp]; + // build low-order word and hig-order word and combine them + $combinedKey = $this->buildCombinedKey($byteChars); + // build reversed hexadecimal string + $hex = strtoupper(dechex($combinedKey & 0xFFFFFFFF)); + $reversedHex = $hex[6].$hex[7].$hex[4].$hex[5].$hex[2].$hex[3].$hex[0].$hex[1]; + $generatedKey = mb_convert_encoding($reversedHex, 'UCS-2LE', 'UTF-8'); + + // Implementation Notes List: + // Word requires that the initial hash of the password with the salt not be considered in the count. + // The initial hash of salt + key is not included in the iteration count. + $generatedKey = hash($this->getAlgorithm(), base64_decode($this->getSalt()) . $generatedKey, true); + for ($i = 0; $i < $this->getSpinCount(); $i++) { + $generatedKey = hash($this->getAlgorithm(), $generatedKey . pack("CCCC", $i, $i>>8, $i>>16, $i>>24), true); + } + $generatedKey = base64_encode($generatedKey); + + mb_internal_encoding($orig_encoding); + + return $generatedKey; + } + + /** + * Build combined key from low-order word and high-order word + * + * @param array $byteChars -> byte array representation of password + * @return int + */ + private function buildCombinedKey($byteChars) + { + // Compute the high-order word + // Initialize from the initial code array (see above), depending on the passwords length. + $highOrderWord = self::$initialCodeArray[sizeof($byteChars) - 1]; + + // For each character in the password: + // For every bit in the character, starting with the least significant and progressing to (but excluding) + // the most significant, if the bit is set, XOR the key’s high-order word with the corresponding word from + // the Encryption Matrix + for ($i = 0; $i < sizeof($byteChars); $i++) { + $tmp = self::$passwordMaxLength - sizeof($byteChars) + $i; + $matrixRow = self::$encryptionMatrix[$tmp]; for ($intBit = 0; $intBit < 7; $intBit++) { if (($byteChars[$i] & (0x0001 << $intBit)) != 0) { $highOrderWord = ($highOrderWord ^ $matrixRow[$intBit]); @@ -219,55 +332,26 @@ class Protection } // Compute low-order word + // Initialize with 0 $lowOrderWord = 0; + // For each character in the password, going backwards for ($i = sizeof($byteChars) - 1; $i >= 0; $i--) { + // low-order word = (((low-order word SHR 14) AND 0x0001) OR (low-order word SHL 1) AND 0x7FFF)) XOR character $lowOrderWord = (((($lowOrderWord >> 14) & 0x0001) | (($lowOrderWord << 1) & 0x7FFF)) ^ $byteChars[$i]); } + // Lastly, low-order word = (((low-order word SHR 14) AND 0x0001) OR (low-order word SHL 1) AND 0x7FFF)) XOR strPassword length XOR 0xCE4B. $lowOrderWord = (((($lowOrderWord >> 14) & 0x0001) | (($lowOrderWord << 1) & 0x7FFF)) ^ sizeof($byteChars) ^ 0xCE4B); - $combinedKey = $this->int32(($highOrderWord << 16) + $lowOrderWord); - $generatedKey = [ - 0 => (($combinedKey & 0x000000FF) >> 0), - 1 => (($combinedKey & 0x0000FF00) >> 8), - 2 => (($combinedKey & 0x00FF0000) >> 16), - 3 => (($combinedKey & 0xFF000000) >> 24), - ]; - - $tmpStr = ''; - for ($i = 0; $i < 4; $i++) { - $tmpStr .= strtoupper(dechex($generatedKey[$i])); - } - $generatedKey = []; - $tmpStr = mb_convert_encoding($tmpStr, 'UCS-2LE', 'UTF-8'); - for ($i = 0; $i < strlen($tmpStr); $i++) { - $generatedKey[] = ord(substr($tmpStr, $i, 1)); - } - - $salt = unpack('C*', base64_decode($this->getSalt())); - $algorithm = $this->getAlgorithm(); - - $tmpArray1 = $generatedKey; - $tmpArray2 = $salt; - $generatedKey = array_merge($tmpArray2, $tmpArray1); - - $generatedKey = $this->hashByteArray($algorithm, $generatedKey); - - for ($i = 0; $i < $this->getSpinCount(); $i++) { - $iterator = [ - 0 => (($i & 0x000000FF) >> 0), - 1 => (($i & 0x0000FF00) >> 8), - 2 => (($i & 0x00FF0000) >> 16), - 3 => (($i & 0xFF000000) >> 24), - ]; - $generatedKey = array_merge($generatedKey, $iterator); - $generatedKey = $this->hashByteArray($algorithm, $generatedKey); - } - - $hash = implode(array_map("chr", $generatedKey)); - - return base64_encode($hash); + // Combine the Low and High Order Word + return $this->int32(($highOrderWord << 16) + $lowOrderWord); } + /** + * simulate behaviour of int32 + * + * @param int $value + * @return int + */ private function int32($value) { $value = ($value & 0xFFFFFFFF); @@ -278,12 +362,4 @@ class Protection return $value; } - - private function hashByteArray($algorithm, $array) - { - $string = implode(array_map("chr", $array)); - $string = hash($algorithm, $string, true); - - return unpack('C*', $string); - } } From 703e34137b4fa9147d864fbef09442aa4370509c Mon Sep 17 00:00:00 2001 From: Maria Haubner Date: Fri, 10 Mar 2017 16:24:52 +0100 Subject: [PATCH 044/370] refactored hash function to word settings --- src/PhpWord/Metadata/Protection.php | 191 +---------------- src/PhpWord/Writer/Word2007/Part/Settings.php | 199 +++++++++++++++++- 2 files changed, 204 insertions(+), 186 deletions(-) diff --git a/src/PhpWord/Metadata/Protection.php b/src/PhpWord/Metadata/Protection.php index 5427f570..511503e4 100644 --- a/src/PhpWord/Metadata/Protection.php +++ b/src/PhpWord/Metadata/Protection.php @@ -25,59 +25,6 @@ namespace PhpOffice\PhpWord\Metadata; */ class Protection { - static $algorithmMapping = [ - 1 => 'md2', - 2 => 'md4', - 3 => 'md5', - 4 => 'sha1', - 5 => '', // 'mac' -> not possible with hash() - 6 => 'ripemd', - 7 => 'ripemd160', - 8 => '', - 9 => '', //'hmac' -> not possible with hash() - 10 => '', - 11 => '', - 12 => 'sha256', - 13 => 'sha384', - 14 => 'sha512', - ]; - static $initialCodeArray = [ - 0xE1F0, - 0x1D0F, - 0xCC9C, - 0x84C0, - 0x110C, - 0x0E10, - 0xF1CE, - 0x313E, - 0x1872, - 0xE139, - 0xD40F, - 0x84F9, - 0x280C, - 0xA96A, - 0x4EC3 - ]; - static $encryptionMatrix = - [ - [0xAEFC, 0x4DD9, 0x9BB2, 0x2745, 0x4E8A, 0x9D14, 0x2A09], - [0x7B61, 0xF6C2, 0xFDA5, 0xEB6B, 0xC6F7, 0x9DCF, 0x2BBF], - [0x4563, 0x8AC6, 0x05AD, 0x0B5A, 0x16B4, 0x2D68, 0x5AD0], - [0x0375, 0x06EA, 0x0DD4, 0x1BA8, 0x3750, 0x6EA0, 0xDD40], - [0xD849, 0xA0B3, 0x5147, 0xA28E, 0x553D, 0xAA7A, 0x44D5], - [0x6F45, 0xDE8A, 0xAD35, 0x4A4B, 0x9496, 0x390D, 0x721A], - [0xEB23, 0xC667, 0x9CEF, 0x29FF, 0x53FE, 0xA7FC, 0x5FD9], - [0x47D3, 0x8FA6, 0x0F6D, 0x1EDA, 0x3DB4, 0x7B68, 0xF6D0], - [0xB861, 0x60E3, 0xC1C6, 0x93AD, 0x377B, 0x6EF6, 0xDDEC], - [0x45A0, 0x8B40, 0x06A1, 0x0D42, 0x1A84, 0x3508, 0x6A10], - [0xAA51, 0x4483, 0x8906, 0x022D, 0x045A, 0x08B4, 0x1168], - [0x76B4, 0xED68, 0xCAF1, 0x85C3, 0x1BA7, 0x374E, 0x6E9C], - [0x3730, 0x6E60, 0xDCC0, 0xA9A1, 0x4363, 0x86C6, 0x1DAD], - [0x3331, 0x6662, 0xCCC4, 0x89A9, 0x0373, 0x06E6, 0x0DCC], - [0x1021, 0x2042, 0x4084, 0x8108, 0x1231, 0x2462, 0x48C4] - ]; - static $passwordMaxLength = 15; - /** * Editing restriction none|readOnly|comments|trackedChanges|forms * @@ -91,28 +38,28 @@ class Protection * * @var string */ - private $password; + private $password = ''; /** * Number of hashing iterations * * @var int */ - private $spinCount = 100000; + private $spinCount = 0; /** - * Algorithm-SID according to self::$algorithmMapping + * Algorithm-SID (see to \PhpOffice\PhpWord\Writer\Word2007\Part\Settings::$algorithmMapping) * * @var int */ - private $algorithmSid = 4; + private $algorithmSid = 0; /** * Hashed salt * * @var string */ - private $salt; + private $salt = ''; /** * Create a new instance @@ -165,7 +112,7 @@ class Protection */ public function setPassword($password) { - $this->password = $this->getPasswordHash($password); + $this->password = $password; return $this; } @@ -204,7 +151,7 @@ class Protection } /** - * Set algorithm-sid (see self::$algorithmMapping) + * Set algorithm-sid (see \PhpOffice\PhpWord\Writer\Word2007\Part\Settings::$algorithmMapping) * * @param $algorithmSid * @return self @@ -238,128 +185,4 @@ class Protection return $this; } - - /** - * Get algorithm from self::$algorithmMapping - * - * @return string - */ - private function getAlgorithm() - { - $algorithm = self::$algorithmMapping[$this->algorithmSid]; - if ($algorithm == '') { - $algorithm = 'sha1'; - } - - return $algorithm; - } - - /** - * Create a hashed password that MS Word will be able to work with - * - * @param string $password - * @return string - */ - private function getPasswordHash($password) - { - $orig_encoding = mb_internal_encoding(); - mb_internal_encoding("UTF-8"); - - if (empty($password)) { - return ''; - } - - $password = mb_substr($password, 0, min(self::$passwordMaxLength, mb_strlen($password))); - - // Construct a new NULL-terminated string consisting of single-byte characters: - // Get the single-byte values by iterating through the Unicode characters of the truncated password. - // For each character, if the low byte is not equal to 0, take it. Otherwise, take the high byte. - $pass_utf8 = mb_convert_encoding($password, 'UCS-2LE', 'UTF-8'); - $byteChars = []; - for ($i = 0; $i < mb_strlen($password); $i++) { - $byteChars[$i] = ord(substr($pass_utf8, $i * 2, 1)); - if ($byteChars[$i] == 0) { - $byteChars[$i] = ord(substr($pass_utf8, $i * 2 + 1, 1)); - } - } - - // build low-order word and hig-order word and combine them - $combinedKey = $this->buildCombinedKey($byteChars); - // build reversed hexadecimal string - $hex = strtoupper(dechex($combinedKey & 0xFFFFFFFF)); - $reversedHex = $hex[6].$hex[7].$hex[4].$hex[5].$hex[2].$hex[3].$hex[0].$hex[1]; - - $generatedKey = mb_convert_encoding($reversedHex, 'UCS-2LE', 'UTF-8'); - - // Implementation Notes List: - // Word requires that the initial hash of the password with the salt not be considered in the count. - // The initial hash of salt + key is not included in the iteration count. - $generatedKey = hash($this->getAlgorithm(), base64_decode($this->getSalt()) . $generatedKey, true); - for ($i = 0; $i < $this->getSpinCount(); $i++) { - $generatedKey = hash($this->getAlgorithm(), $generatedKey . pack("CCCC", $i, $i>>8, $i>>16, $i>>24), true); - } - $generatedKey = base64_encode($generatedKey); - - mb_internal_encoding($orig_encoding); - - return $generatedKey; - } - - /** - * Build combined key from low-order word and high-order word - * - * @param array $byteChars -> byte array representation of password - * @return int - */ - private function buildCombinedKey($byteChars) - { - // Compute the high-order word - // Initialize from the initial code array (see above), depending on the passwords length. - $highOrderWord = self::$initialCodeArray[sizeof($byteChars) - 1]; - - // For each character in the password: - // For every bit in the character, starting with the least significant and progressing to (but excluding) - // the most significant, if the bit is set, XOR the key’s high-order word with the corresponding word from - // the Encryption Matrix - for ($i = 0; $i < sizeof($byteChars); $i++) { - $tmp = self::$passwordMaxLength - sizeof($byteChars) + $i; - $matrixRow = self::$encryptionMatrix[$tmp]; - for ($intBit = 0; $intBit < 7; $intBit++) { - if (($byteChars[$i] & (0x0001 << $intBit)) != 0) { - $highOrderWord = ($highOrderWord ^ $matrixRow[$intBit]); - } - } - } - - // Compute low-order word - // Initialize with 0 - $lowOrderWord = 0; - // For each character in the password, going backwards - for ($i = sizeof($byteChars) - 1; $i >= 0; $i--) { - // low-order word = (((low-order word SHR 14) AND 0x0001) OR (low-order word SHL 1) AND 0x7FFF)) XOR character - $lowOrderWord = (((($lowOrderWord >> 14) & 0x0001) | (($lowOrderWord << 1) & 0x7FFF)) ^ $byteChars[$i]); - } - // Lastly, low-order word = (((low-order word SHR 14) AND 0x0001) OR (low-order word SHL 1) AND 0x7FFF)) XOR strPassword length XOR 0xCE4B. - $lowOrderWord = (((($lowOrderWord >> 14) & 0x0001) | (($lowOrderWord << 1) & 0x7FFF)) ^ sizeof($byteChars) ^ 0xCE4B); - - // Combine the Low and High Order Word - return $this->int32(($highOrderWord << 16) + $lowOrderWord); - } - - /** - * simulate behaviour of int32 - * - * @param int $value - * @return int - */ - private function int32($value) - { - $value = ($value & 0xFFFFFFFF); - - if ($value & 0x80000000) { - $value = -((~$value & 0xFFFFFFFF) + 1); - } - - return $value; - } } diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index 11549e08..ed9c07d3 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -24,6 +24,59 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Part; */ class Settings extends AbstractPart { + static $algorithmMapping = [ + 1 => 'md2', + 2 => 'md4', + 3 => 'md5', + 4 => 'sha1', + 5 => '', // 'mac' -> not possible with hash() + 6 => 'ripemd', + 7 => 'ripemd160', + 8 => '', + 9 => '', //'hmac' -> not possible with hash() + 10 => '', + 11 => '', + 12 => 'sha256', + 13 => 'sha384', + 14 => 'sha512', + ]; + static $initialCodeArray = [ + 0xE1F0, + 0x1D0F, + 0xCC9C, + 0x84C0, + 0x110C, + 0x0E10, + 0xF1CE, + 0x313E, + 0x1872, + 0xE139, + 0xD40F, + 0x84F9, + 0x280C, + 0xA96A, + 0x4EC3 + ]; + static $encryptionMatrix = + [ + [0xAEFC, 0x4DD9, 0x9BB2, 0x2745, 0x4E8A, 0x9D14, 0x2A09], + [0x7B61, 0xF6C2, 0xFDA5, 0xEB6B, 0xC6F7, 0x9DCF, 0x2BBF], + [0x4563, 0x8AC6, 0x05AD, 0x0B5A, 0x16B4, 0x2D68, 0x5AD0], + [0x0375, 0x06EA, 0x0DD4, 0x1BA8, 0x3750, 0x6EA0, 0xDD40], + [0xD849, 0xA0B3, 0x5147, 0xA28E, 0x553D, 0xAA7A, 0x44D5], + [0x6F45, 0xDE8A, 0xAD35, 0x4A4B, 0x9496, 0x390D, 0x721A], + [0xEB23, 0xC667, 0x9CEF, 0x29FF, 0x53FE, 0xA7FC, 0x5FD9], + [0x47D3, 0x8FA6, 0x0F6D, 0x1EDA, 0x3DB4, 0x7B68, 0xF6D0], + [0xB861, 0x60E3, 0xC1C6, 0x93AD, 0x377B, 0x6EF6, 0xDDEC], + [0x45A0, 0x8B40, 0x06A1, 0x0D42, 0x1A84, 0x3508, 0x6A10], + [0xAA51, 0x4483, 0x8906, 0x022D, 0x045A, 0x08B4, 0x1168], + [0x76B4, 0xED68, 0xCAF1, 0x85C3, 0x1BA7, 0x374E, 0x6E9C], + [0x3730, 0x6E60, 0xDCC0, 0xA9A1, 0x4363, 0x86C6, 0x1DAD], + [0x3331, 0x6662, 0xCCC4, 0x89A9, 0x0373, 0x06E6, 0x0DCC], + [0x1021, 0x2042, 0x4084, 0x8108, 0x1231, 0x2462, 0x48C4] + ]; + static $passwordMaxLength = 15; + /** * Settings value * @@ -169,8 +222,8 @@ class Settings extends AbstractPart 'w:cryptAlgorithmType' => 'typeAny', 'w:cryptAlgorithmSid' => $protection->getAlgorithmSid(), 'w:cryptSpinCount' => $protection->getSpinCount(), - 'w:hash' => $protection->getPassword(), - 'w:salt' => $protection->getSalt(), + 'w:hash' => $this->getPasswordHash($protection), + 'w:salt' => $this->getSaltHash($protection->getSalt()), ) ); } @@ -193,4 +246,146 @@ class Settings extends AbstractPart )); } } + + + /** + * Create a hashed password that MS Word will be able to work with + * + * @param \PhpOffice\PhpWord\Metadata\Protection $protection + * @return string + */ + private function getPasswordHash($protection) + { + $orig_encoding = mb_internal_encoding(); + mb_internal_encoding("UTF-8"); + + $password = $protection->getPassword(); + $password = mb_substr($password, 0, min(self::$passwordMaxLength, mb_strlen($password))); + + // Construct a new NULL-terminated string consisting of single-byte characters: + // Get the single-byte values by iterating through the Unicode characters of the truncated password. + // For each character, if the low byte is not equal to 0, take it. Otherwise, take the high byte. + $pass_utf8 = mb_convert_encoding($password, 'UCS-2LE', 'UTF-8'); + $byteChars = []; + for ($i = 0; $i < mb_strlen($password); $i++) { + $byteChars[$i] = ord(substr($pass_utf8, $i * 2, 1)); + if ($byteChars[$i] == 0) { + $byteChars[$i] = ord(substr($pass_utf8, $i * 2 + 1, 1)); + } + } + + // build low-order word and hig-order word and combine them + $combinedKey = $this->buildCombinedKey($byteChars); + // build reversed hexadecimal string + $hex = strtoupper(dechex($combinedKey & 0xFFFFFFFF)); + $reversedHex = $hex[6].$hex[7].$hex[4].$hex[5].$hex[2].$hex[3].$hex[0].$hex[1]; + + $generatedKey = mb_convert_encoding($reversedHex, 'UCS-2LE', 'UTF-8'); + + // Implementation Notes List: + // Word requires that the initial hash of the password with the salt not be considered in the count. + // The initial hash of salt + key is not included in the iteration count. + $algorithm = $this->getAlgorithm($protection->getAlgorithmSid()); + $generatedKey = hash($algorithm, base64_decode($this->getSaltHash($protection->getSalt())) . $generatedKey, true); + + $spinCount = (!empty($protection->getSpinCount())) ? $protection->getSpinCount() : 100000; + + for ($i = 0; $i < $spinCount; $i++) { + $generatedKey = hash($algorithm, $generatedKey . pack("CCCC", $i, $i>>8, $i>>16, $i>>24), true); + } + $generatedKey = base64_encode($generatedKey); + + mb_internal_encoding($orig_encoding); + + return $generatedKey; + } + + /** + * Get algorithm from self::$algorithmMapping + * + * @param int $sid + * @return string + */ + private function getAlgorithm($sid) + { + if (empty($sid)) { + $sid = 4; + } + + $algorithm = self::$algorithmMapping[$sid]; + if ($algorithm == '') { + $algorithm = 'sha1'; + } + + return $algorithm; + } + + /** + * Get salt hash + * + * @param string $salt + * @return string + */ + private function getSaltHash($salt) + { + return $salt; + } + + /** + * Build combined key from low-order word and high-order word + * + * @param array $byteChars -> byte array representation of password + * @return int + */ + private function buildCombinedKey($byteChars) + { + // Compute the high-order word + // Initialize from the initial code array (see above), depending on the passwords length. + $highOrderWord = self::$initialCodeArray[sizeof($byteChars) - 1]; + + // For each character in the password: + // For every bit in the character, starting with the least significant and progressing to (but excluding) + // the most significant, if the bit is set, XOR the key’s high-order word with the corresponding word from + // the Encryption Matrix + for ($i = 0; $i < sizeof($byteChars); $i++) { + $tmp = self::$passwordMaxLength - sizeof($byteChars) + $i; + $matrixRow = self::$encryptionMatrix[$tmp]; + for ($intBit = 0; $intBit < 7; $intBit++) { + if (($byteChars[$i] & (0x0001 << $intBit)) != 0) { + $highOrderWord = ($highOrderWord ^ $matrixRow[$intBit]); + } + } + } + + // Compute low-order word + // Initialize with 0 + $lowOrderWord = 0; + // For each character in the password, going backwards + for ($i = sizeof($byteChars) - 1; $i >= 0; $i--) { + // low-order word = (((low-order word SHR 14) AND 0x0001) OR (low-order word SHL 1) AND 0x7FFF)) XOR character + $lowOrderWord = (((($lowOrderWord >> 14) & 0x0001) | (($lowOrderWord << 1) & 0x7FFF)) ^ $byteChars[$i]); + } + // Lastly, low-order word = (((low-order word SHR 14) AND 0x0001) OR (low-order word SHL 1) AND 0x7FFF)) XOR strPassword length XOR 0xCE4B. + $lowOrderWord = (((($lowOrderWord >> 14) & 0x0001) | (($lowOrderWord << 1) & 0x7FFF)) ^ sizeof($byteChars) ^ 0xCE4B); + + // Combine the Low and High Order Word + return $this->int32(($highOrderWord << 16) + $lowOrderWord); + } + + /** + * Simulate behaviour of int32 + * + * @param int $value + * @return int + */ + private function int32($value) + { + $value = ($value & 0xFFFFFFFF); + + if ($value & 0x80000000) { + $value = -((~$value & 0xFFFFFFFF) + 1); + } + + return $value; + } } From 0221414ee0855612b6a5f09412790fb2bf2dfd1e Mon Sep 17 00:00:00 2001 From: Maria Haubner Date: Fri, 10 Mar 2017 16:57:42 +0100 Subject: [PATCH 045/370] randomly genereate salt for word password protection --- src/PhpWord/Metadata/Protection.php | 14 ++++---- src/PhpWord/Writer/Word2007/Part/Settings.php | 35 +++++++++---------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/PhpWord/Metadata/Protection.php b/src/PhpWord/Metadata/Protection.php index 511503e4..a25a8f31 100644 --- a/src/PhpWord/Metadata/Protection.php +++ b/src/PhpWord/Metadata/Protection.php @@ -45,14 +45,14 @@ class Protection * * @var int */ - private $spinCount = 0; + private $spinCount = 100000; /** * Algorithm-SID (see to \PhpOffice\PhpWord\Writer\Word2007\Part\Settings::$algorithmMapping) * * @var int */ - private $algorithmSid = 0; + private $mswordAlgorithmSid = 4; /** * Hashed salt @@ -145,20 +145,20 @@ class Protection * * @return int */ - public function getAlgorithmSid() + public function getMswordAlgorithmSid() { - return $this->algorithmSid; + return $this->mswordAlgorithmSid; } /** * Set algorithm-sid (see \PhpOffice\PhpWord\Writer\Word2007\Part\Settings::$algorithmMapping) * - * @param $algorithmSid + * @param $mswordAlgorithmSid * @return self */ - public function setAlgorithmSid($algorithmSid) + public function setMswordAlgorithmSid($mswordAlgorithmSid) { - $this->algorithmSid = $algorithmSid; + $this->mswordAlgorithmSid = $mswordAlgorithmSid; return $this; } diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index ed9c07d3..c709ee62 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -213,6 +213,9 @@ class Settings extends AbstractPart ) ); } else { + if ($protection->getSalt() == null) { + $protection->setSalt(openssl_random_pseudo_bytes(16)); + } $this->settings['w:documentProtection'] = array( '@attributes' => array( 'w:enforcement' => 1, @@ -220,7 +223,7 @@ class Settings extends AbstractPart 'w:cryptProviderType' => 'rsaFull', 'w:cryptAlgorithmClass' => 'hash', 'w:cryptAlgorithmType' => 'typeAny', - 'w:cryptAlgorithmSid' => $protection->getAlgorithmSid(), + 'w:cryptAlgorithmSid' => $protection->getMswordAlgorithmSid(), 'w:cryptSpinCount' => $protection->getSpinCount(), 'w:hash' => $this->getPasswordHash($protection), 'w:salt' => $this->getSaltHash($protection->getSalt()), @@ -239,11 +242,13 @@ class Settings extends AbstractPart { $compatibility = $this->getParentWriter()->getPhpWord()->getCompatibility(); if ($compatibility->getOoxmlVersion() !== null) { - $this->settings['w:compat']['w:compatSetting'] = array('@attributes' => array( - 'w:name' => 'compatibilityMode', - 'w:uri' => 'http://schemas.microsoft.com/office/word', - 'w:val' => $compatibility->getOoxmlVersion(), - )); + $this->settings['w:compat']['w:compatSetting'] = array( + '@attributes' => array( + 'w:name' => 'compatibilityMode', + 'w:uri' => 'http://schemas.microsoft.com/office/word', + 'w:val' => $compatibility->getOoxmlVersion(), + ) + ); } } @@ -277,21 +282,19 @@ class Settings extends AbstractPart // build low-order word and hig-order word and combine them $combinedKey = $this->buildCombinedKey($byteChars); // build reversed hexadecimal string - $hex = strtoupper(dechex($combinedKey & 0xFFFFFFFF)); - $reversedHex = $hex[6].$hex[7].$hex[4].$hex[5].$hex[2].$hex[3].$hex[0].$hex[1]; + $hex = strtoupper(dechex($combinedKey & 0xFFFFFFFF)); + $reversedHex = $hex[6] . $hex[7] . $hex[4] . $hex[5] . $hex[2] . $hex[3] . $hex[0] . $hex[1]; $generatedKey = mb_convert_encoding($reversedHex, 'UCS-2LE', 'UTF-8'); // Implementation Notes List: // Word requires that the initial hash of the password with the salt not be considered in the count. // The initial hash of salt + key is not included in the iteration count. - $algorithm = $this->getAlgorithm($protection->getAlgorithmSid()); + $algorithm = $this->getAlgorithm($protection->getMswordAlgorithmSid()); $generatedKey = hash($algorithm, base64_decode($this->getSaltHash($protection->getSalt())) . $generatedKey, true); - $spinCount = (!empty($protection->getSpinCount())) ? $protection->getSpinCount() : 100000; - - for ($i = 0; $i < $spinCount; $i++) { - $generatedKey = hash($algorithm, $generatedKey . pack("CCCC", $i, $i>>8, $i>>16, $i>>24), true); + for ($i = 0; $i < $protection->getSpinCount(); $i++) { + $generatedKey = hash($algorithm, $generatedKey . pack("CCCC", $i, $i >> 8, $i >> 16, $i >> 24), true); } $generatedKey = base64_encode($generatedKey); @@ -308,10 +311,6 @@ class Settings extends AbstractPart */ private function getAlgorithm($sid) { - if (empty($sid)) { - $sid = 4; - } - $algorithm = self::$algorithmMapping[$sid]; if ($algorithm == '') { $algorithm = 'sha1'; @@ -328,7 +327,7 @@ class Settings extends AbstractPart */ private function getSaltHash($salt) { - return $salt; + return base64_encode(str_pad(substr($salt, 0, 16), 16, '1')); } /** From 76246630ce4eac8ba9aac13f8b19cb4b657ca947 Mon Sep 17 00:00:00 2001 From: Maria Haubner Date: Fri, 10 Mar 2017 17:30:51 +0100 Subject: [PATCH 046/370] add test --- src/PhpWord/Writer/Word2007/Part/Settings.php | 2 +- .../Writer/Word2007/Part/SettingsTest.php | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index c709ee62..07d7a90c 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -282,7 +282,7 @@ class Settings extends AbstractPart // build low-order word and hig-order word and combine them $combinedKey = $this->buildCombinedKey($byteChars); // build reversed hexadecimal string - $hex = strtoupper(dechex($combinedKey & 0xFFFFFFFF)); + $hex = str_pad(strtoupper(dechex($combinedKey & 0xFFFFFFFF)), 8, '0', \STR_PAD_LEFT); $reversedHex = $hex[6] . $hex[7] . $hex[4] . $hex[5] . $hex[2] . $hex[3] . $hex[0] . $hex[1]; $generatedKey = mb_convert_encoding($reversedHex, 'UCS-2LE', 'UTF-8'); diff --git a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php index 6ed23e44..110d2aff 100644 --- a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php @@ -50,6 +50,27 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertTrue($doc->elementExists($path, $file)); } + /** + * Test document protection with password + * + * Note: to get comparison values, a docx was generated in Word2010 and the values taken from the settings.xml + */ + public function testDocumentProtectionWithPassword() + { + $phpWord = new PhpWord(); + $phpWord->getProtection()->setEditing('readOnly'); + $phpWord->getProtection()->setPassword('testÄö@€!$&'); + $phpWord->getProtection()->setSalt(base64_decode("uq81pJRRGFIY5U+E9gt8tA==")); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:documentProtection'; + $this->assertTrue($doc->elementExists($path, $file)); + $this->assertEquals($doc->getElement($path, $file)->getAttribute('w:hash'), "RA9jfY/u3DX114PMcl+uSekxsYk="); + } + /** * Test compatibility */ From 71574d1fe2a3638e4bb3f4a888c9a8d4cd815821 Mon Sep 17 00:00:00 2001 From: Lenz Weber Date: Mon, 13 Mar 2017 16:22:04 +0100 Subject: [PATCH 047/370] Code Review; minor changes to salt handling, corrected some comments --- src/PhpWord/Metadata/Protection.php | 15 ++++++++---- src/PhpWord/Writer/Word2007/Part/Settings.php | 23 +++++-------------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/src/PhpWord/Metadata/Protection.php b/src/PhpWord/Metadata/Protection.php index a25a8f31..88cfa99e 100644 --- a/src/PhpWord/Metadata/Protection.php +++ b/src/PhpWord/Metadata/Protection.php @@ -34,7 +34,7 @@ class Protection private $editing; /** - * Hashed password + * password * * @var string */ @@ -55,7 +55,7 @@ class Protection private $mswordAlgorithmSid = 4; /** - * Hashed salt + * salt * * @var string */ @@ -95,7 +95,7 @@ class Protection } /** - * Get password hash + * Get password * * @return string */ @@ -164,7 +164,7 @@ class Protection } /** - * Get salt hash + * Get salt * * @return string */ @@ -174,13 +174,18 @@ class Protection } /** - * Set salt hash + * Set salt. Salt HAS to be 16 characters, or an exception will be thrown. * * @param $salt * @return self + * @throws \InvalidArgumentException */ public function setSalt($salt) { + if ($salt !== null && strlen($salt) !== 16){ + throw new \InvalidArgumentException('salt has to be of exactly 16 bytes length'); + } + $this->salt = $salt; return $this; diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index 07d7a90c..82f8192a 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -225,8 +225,8 @@ class Settings extends AbstractPart 'w:cryptAlgorithmType' => 'typeAny', 'w:cryptAlgorithmSid' => $protection->getMswordAlgorithmSid(), 'w:cryptSpinCount' => $protection->getSpinCount(), - 'w:hash' => $this->getPasswordHash($protection), - 'w:salt' => $this->getSaltHash($protection->getSalt()), + 'w:hash' => $this->getEncodedPasswordHash($protection), + 'w:salt' => base64_encode($protection->getSalt()), ) ); } @@ -255,11 +255,12 @@ class Settings extends AbstractPart /** * Create a hashed password that MS Word will be able to work with + * @link https://blogs.msdn.microsoft.com/vsod/2010/04/05/how-to-set-the-editing-restrictions-in-word-using-open-xml-sdk-2-0/ * * @param \PhpOffice\PhpWord\Metadata\Protection $protection * @return string */ - private function getPasswordHash($protection) + private function getEncodedPasswordHash($protection) { $orig_encoding = mb_internal_encoding(); mb_internal_encoding("UTF-8"); @@ -267,7 +268,6 @@ class Settings extends AbstractPart $password = $protection->getPassword(); $password = mb_substr($password, 0, min(self::$passwordMaxLength, mb_strlen($password))); - // Construct a new NULL-terminated string consisting of single-byte characters: // Get the single-byte values by iterating through the Unicode characters of the truncated password. // For each character, if the low byte is not equal to 0, take it. Otherwise, take the high byte. $pass_utf8 = mb_convert_encoding($password, 'UCS-2LE', 'UTF-8'); @@ -291,7 +291,7 @@ class Settings extends AbstractPart // Word requires that the initial hash of the password with the salt not be considered in the count. // The initial hash of salt + key is not included in the iteration count. $algorithm = $this->getAlgorithm($protection->getMswordAlgorithmSid()); - $generatedKey = hash($algorithm, base64_decode($this->getSaltHash($protection->getSalt())) . $generatedKey, true); + $generatedKey = hash($algorithm, $protection->getSalt() . $generatedKey, true); for ($i = 0; $i < $protection->getSpinCount(); $i++) { $generatedKey = hash($algorithm, $generatedKey . pack("CCCC", $i, $i >> 8, $i >> 16, $i >> 24), true); @@ -319,17 +319,6 @@ class Settings extends AbstractPart return $algorithm; } - /** - * Get salt hash - * - * @param string $salt - * @return string - */ - private function getSaltHash($salt) - { - return base64_encode(str_pad(substr($salt, 0, 16), 16, '1')); - } - /** * Build combined key from low-order word and high-order word * @@ -372,7 +361,7 @@ class Settings extends AbstractPart } /** - * Simulate behaviour of int32 + * Simulate behaviour of (signed) int32 * * @param int $value * @return int From 759794d746a9cc0ee0e9f3275795feac56c9a55d Mon Sep 17 00:00:00 2001 From: antoine Date: Fri, 12 May 2017 00:45:21 +0200 Subject: [PATCH 048/370] fix twig dependency so build can succeed --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index c49eb9cd..faa17c1b 100644 --- a/composer.json +++ b/composer.json @@ -42,6 +42,7 @@ "require-dev": { "phpunit/phpunit": "3.7.*", "phpdocumentor/phpdocumentor":"2.*", + "twig/twig":"1.27", "squizlabs/php_codesniffer": "1.*", "phpmd/phpmd": "2.*", "phploc/phploc": "2.*", From 0e0817c9727160f8243ff04cc742e8200ffaddf8 Mon Sep 17 00:00:00 2001 From: antoine Date: Fri, 12 May 2017 00:45:31 +0200 Subject: [PATCH 049/370] ignore the build directory --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e5deb643..90940594 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ Thumbs.db Desktop.ini .idea _build +/build phpunit.xml composer.lock composer.phar @@ -16,4 +17,4 @@ vendor /.settings phpword.ini /.buildpath -/.project \ No newline at end of file +/.project From 1cfb62de0db71f7c6805c43f7d3ed93688a69f5f Mon Sep 17 00:00:00 2001 From: antoine Date: Mon, 15 May 2017 22:49:02 +0200 Subject: [PATCH 050/370] Add support for comments --- docs/elements.rst | 25 +++- docs/intro.rst | 5 + samples/Sample_37_Comments.php | 63 +++++++++ src/PhpWord/Collection/Comments.php | 27 ++++ src/PhpWord/Element/AbstractContainer.php | 9 +- src/PhpWord/Element/AbstractElement.php | 65 +++++++++- src/PhpWord/Element/Comment.php | 122 ++++++++++++++++++ src/PhpWord/Element/TrackChange.php | 77 +++++++++++ src/PhpWord/PhpWord.php | 6 +- src/PhpWord/Writer/Word2007.php | 26 ++++ .../Word2007/Element/AbstractElement.php | 53 ++++++++ src/PhpWord/Writer/Word2007/Element/Chart.php | 1 + src/PhpWord/Writer/Word2007/Element/Image.php | 1 + src/PhpWord/Writer/Word2007/Element/Line.php | 1 + .../Writer/Word2007/Element/Object.php | 1 + src/PhpWord/Writer/Word2007/Element/Shape.php | 1 + .../Writer/Word2007/Element/TextBox.php | 1 + src/PhpWord/Writer/Word2007/Part/Comments.php | 103 +++++++++++++++ .../Writer/Word2007/Part/ContentTypes.php | 1 + tests/PhpWord/Element/CommentTest.php | 83 ++++++++++++ .../Writer/Word2007/Part/CommentsTest.php | 61 +++++++++ 21 files changed, 724 insertions(+), 8 deletions(-) create mode 100644 samples/Sample_37_Comments.php create mode 100644 src/PhpWord/Collection/Comments.php create mode 100644 src/PhpWord/Element/Comment.php create mode 100644 src/PhpWord/Element/TrackChange.php create mode 100644 src/PhpWord/Writer/Word2007/Part/Comments.php create mode 100644 tests/PhpWord/Element/CommentTest.php create mode 100644 tests/PhpWord/Writer/Word2007/Part/CommentsTest.php diff --git a/docs/elements.rst b/docs/elements.rst index d68ee035..3d7667b2 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -379,4 +379,27 @@ Available line style attributes: - ``endArrow``. End type of arrow: block, open, classic, diamond, oval. - ``width``. Line-object width in pt. - ``height``. Line-object height in pt. -- ``flip``. Flip the line element: true, false. \ No newline at end of file +- ``flip``. Flip the line element: true, false. + +Comments +--------- + +Comments can be added to a document by using ``addComment``. +The comment can contain formatted text. Once the comment has been added, it can be linked to any to any element. + +.. code-block:: php + + // first create a comment + $comment= new \PhpOffice\PhpWord\Element\Comment('Authors name', new \DateTime(), 'my_initials'); + $comment->addText('Test', array('bold' => true)); + + // add it to the document + $phpWord->addComment($comment); + + $textrun = $section->addTextRun(); + $textrun->addText('This '); + $text = $textrun->addText('is'); + // link the comment to the text you just created + $text->setCommentStart($comment); + +If no end is set for a comment using the ``setCommentEnd``, the comment will be ended automatically at the end of the element it is started on. \ No newline at end of file diff --git a/docs/intro.rst b/docs/intro.rst index d1c791cf..d88cd626 100644 --- a/docs/intro.rst +++ b/docs/intro.rst @@ -49,6 +49,7 @@ Features - Insert drawing shapes (arc, curve, line, polyline, rect, oval) - Insert charts (pie, doughnut, bar, line, area, scatter, radar) - Insert form fields (textinput, checkbox, and dropdown) +- Insert comments - Create document from templates - Use XSL 1.0 style sheets to transform headers, main document part, and footers of an OOXML template - ... and many more features on progress @@ -102,6 +103,8 @@ Writers +---------------------------+----------------------+--------+-------+-------+--------+-------+ | | Endnote | ✓ | | | ✓ | | +---------------------------+----------------------+--------+-------+-------+--------+-------+ +| | Comments | ✓ | | | | | ++---------------------------+----------------------+--------+-------+-------+--------+-------+ | **Graphs** | 2D basic graphs | ✓ | | | | | +---------------------------+----------------------+--------+-------+-------+--------+-------+ | | 2D advanced graphs | | | | | | @@ -161,6 +164,8 @@ Readers +---------------------------+----------------------+--------+-------+-------+-------+-------+ | | Endnote | ✓ | | | | | +---------------------------+----------------------+--------+-------+-------+-------+-------+ +| | Comments | | | | | | ++---------------------------+----------------------+--------+-------+-------+-------+-------+ | **Graphs** | 2D basic graphs | | | | | | +---------------------------+----------------------+--------+-------+-------+-------+-------+ | | 2D advanced graphs | | | | | | diff --git a/samples/Sample_37_Comments.php b/samples/Sample_37_Comments.php new file mode 100644 index 00000000..91d353a9 --- /dev/null +++ b/samples/Sample_37_Comments.php @@ -0,0 +1,63 @@ +addText('Test', array('bold' => true)); +$phpWord->addComment($comment); + +$section = $phpWord->addSection(); + +$textrun = $section->addTextRun(); +$textrun->addText('This '); +$text = $textrun->addText('is'); +$text->setCommentStart($comment); +$textrun->addText(' a test'); + +$section->addTextBreak(2); + +// Let's create a comment that we will link to a start element and an end element +$commentWithStartAndEnd = new \PhpOffice\PhpWord\Element\Comment('Foo Bar', new \DateTime(), ''); +$commentWithStartAndEnd->addText('A comment with a start and an end'); +$phpWord->addComment($commentWithStartAndEnd); + +$textrunWithEnd = $section->addTextRun(); +$textrunWithEnd->addText('This '); +$textToStartOn = $textrunWithEnd->addText('is', array('bold' => true)); +$textToStartOn->setCommentStart($commentWithStartAndEnd); +$textrunWithEnd->addText(' another', array('italic' => true)); +$textToEndOn = $textrunWithEnd->addText(' test'); +$textToEndOn->setCommentEnd($commentWithStartAndEnd); + +$section->addTextBreak(2); + +// Let's add a comment on an image +$commentOnImage = new \PhpOffice\PhpWord\Element\Comment('Mr Smart', new \DateTime(), ''); +$imageComment = $commentOnImage->addTextRun(); +$imageComment->addText('Hey, Mars does look '); +$imageComment->addText('red', array('color' => 'FF0000')); +$phpWord->addComment($commentOnImage); +$image = $section->addImage('resources/_mars.jpg'); +$image->setCommentStart($commentOnImage); + +$section->addTextBreak(2); + +// We can also do things the other way round, link the comment to the element +$anotherText = $section->addText("another text"); + +$comment1 = new \PhpOffice\PhpWord\Element\Comment('Authors name', new \DateTime(), 'my_initials'); +$comment1->addText('Test', array('bold' => true)); +$comment1->setStartElement($anotherText); +$comment1->setEndElement($anotherText); +$phpWord->addComment($comment1); + + +// Save file +echo write($phpWord, basename(__FILE__, '.php'), $writers); +if (!CLI) { + include_once 'Sample_Footer.php'; +} diff --git a/src/PhpWord/Collection/Comments.php b/src/PhpWord/Collection/Comments.php new file mode 100644 index 00000000..e0383814 --- /dev/null +++ b/src/PhpWord/Collection/Comments.php @@ -0,0 +1,27 @@ + $generalContainers, 'FormField' => $generalContainers, 'SDT' => $generalContainers, - 'TextRun' => array('Section', 'Header', 'Footer', 'Cell', 'TextBox'), + 'TrackChange' => $generalContainers, + 'TextRun' => array('Section', 'Header', 'Footer', 'Cell', 'TextBox', 'TrackChange'), 'ListItem' => array('Section', 'Header', 'Footer', 'Cell', 'TextBox'), 'ListItemRun' => array('Section', 'Header', 'Footer', 'Cell', 'TextBox'), 'Table' => array('Section', 'Header', 'Footer', 'Cell', 'TextBox'), diff --git a/src/PhpWord/Element/AbstractElement.php b/src/PhpWord/Element/AbstractElement.php index b0ed8ae2..b84211b9 100644 --- a/src/PhpWord/Element/AbstractElement.php +++ b/src/PhpWord/Element/AbstractElement.php @@ -108,12 +108,26 @@ abstract class AbstractElement protected $mediaRelation = false; /** - * Is part of collection; true for Title, Footnote, Endnote, and Chart + * Is part of collection; true for Title, Footnote, Endnote, Chart, and Comment * * @var bool */ protected $collectionRelation = false; + /** + * The start position for the linked comment + * + * @var Comment + */ + protected $commentStart; + + /** + * The end position for the linked comment + * + * @var Comment + */ + protected $commentEnd; + /** * Get PhpWord * @@ -265,6 +279,55 @@ abstract class AbstractElement return $this->nestedLevel; } + /** + * Get comment start + * + * @return Comment + */ + public function getCommentStart() + { + return $this->commentStart; + } + + /** + * Set comment start + * + * @param Comment $value + */ + public function setCommentStart(Comment $value) + { + if ($this instanceof Comment) { + throw new \InvalidArgumentException("Cannot set a Comment on a Comment"); + } + $this->commentStart = $value; + $this->commentStart->setStartElement($this); + } + + /** + * Get comment end + * + * @return Comment + */ + public function getCommentEnd() + { + return $this->commentEnd; + } + + /** + * Set comment end + * + * @param Comment $value + * @return void + */ + public function setCommentEnd(Comment $value) + { + if ($this instanceof Comment) { + throw new \InvalidArgumentException("Cannot set a Comment on a Comment"); + } + $this->commentEnd = $value; + $this->commentEnd->setEndElement($this); + } + /** * Set parent container * diff --git a/src/PhpWord/Element/Comment.php b/src/PhpWord/Element/Comment.php new file mode 100644 index 00000000..df2e4d4d --- /dev/null +++ b/src/PhpWord/Element/Comment.php @@ -0,0 +1,122 @@ +initials = $initials; + return $this; + } + + /** + * Get Initials + * + * @return string + */ + public function getInitials() + { + return $this->initials; + } + + /** + * Sets the element where this comment starts + * + * @param \PhpOffice\PhpWord\Element\AbstractElement $value + */ + public function setStartElement(AbstractElement $value) + { + $this->startElement = $value; + if ($value->getCommentStart() == null) { + $value->setCommentStart($this); + } + } + + /** + * Get the element where this comment starts + * + * @return \PhpOffice\PhpWord\Element\AbstractElement + */ + public function getStartElement() + { + return $this->startElement; + } + + /** + * Sets the element where this comment ends + * + * @param \PhpOffice\PhpWord\Element\AbstractElement $value + */ + public function setEndElement(AbstractElement $value) + { + $this->endElement = $value; + if ($value->getCommentEnd() == null) { + $value->setCommentEnd($this); + } + } + + /** + * Get the element where this comment ends + * + * @return \PhpOffice\PhpWord\Element\AbstractElement + */ + public function getEndElement() + { + return $this->endElement; + } +} diff --git a/src/PhpWord/Element/TrackChange.php b/src/PhpWord/Element/TrackChange.php new file mode 100644 index 00000000..782e6f35 --- /dev/null +++ b/src/PhpWord/Element/TrackChange.php @@ -0,0 +1,77 @@ +author = $author; + $this->date = $date; + return $this; + } + + /** + * Get TrackChange Author + * + * @return string + */ + public function getAuthor() + { + return $this->author; + } + + /** + * Get TrackChange Date + * + * @return \DateTime + */ + public function getDate() + { + return $this->date; + } +} diff --git a/src/PhpWord/PhpWord.php b/src/PhpWord/PhpWord.php index 0fa76b2f..38895e4f 100644 --- a/src/PhpWord/PhpWord.php +++ b/src/PhpWord/PhpWord.php @@ -27,11 +27,13 @@ use PhpOffice\PhpWord\Exception\Exception; * @method Collection\Footnotes getFootnotes() * @method Collection\Endnotes getEndnotes() * @method Collection\Charts getCharts() + * @method Collection\Comments getComments() * @method int addBookmark(Element\Bookmark $bookmark) * @method int addTitle(Element\Title $title) * @method int addFootnote(Element\Footnote $footnote) * @method int addEndnote(Element\Endnote $endnote) * @method int addChart(Element\Chart $chart) + * @method int addComment(Element\Comment $comment) * * @method Style\Paragraph addParagraphStyle(string $styleName, array $styles) * @method Style\Font addFontStyle(string $styleName, mixed $fontStyle, mixed $paragraphStyle = null) @@ -84,7 +86,7 @@ class PhpWord public function __construct() { // Collection - $collections = array('Bookmarks', 'Titles', 'Footnotes', 'Endnotes', 'Charts'); + $collections = array('Bookmarks', 'Titles', 'Footnotes', 'Endnotes', 'Charts', 'Comments'); foreach ($collections as $collection) { $class = 'PhpOffice\\PhpWord\\Collection\\' . $collection; $this->collections[$collection] = new $class(); @@ -118,7 +120,7 @@ class PhpWord $addCollection = array(); $addStyle = array(); - $collections = array('Bookmark', 'Title', 'Footnote', 'Endnote', 'Chart'); + $collections = array('Bookmark', 'Title', 'Footnote', 'Endnote', 'Chart', 'Comment'); foreach ($collections as $collection) { $getCollection[] = strtolower("get{$collection}s"); $addCollection[] = strtolower("add{$collection}"); diff --git a/src/PhpWord/Writer/Word2007.php b/src/PhpWord/Writer/Word2007.php index 8e10f5f6..bb7b521f 100644 --- a/src/PhpWord/Writer/Word2007.php +++ b/src/PhpWord/Writer/Word2007.php @@ -60,6 +60,7 @@ class Word2007 extends AbstractWriter implements WriterInterface 'DocPropsCustom' => 'docProps/custom.xml', 'RelsDocument' => 'word/_rels/document.xml.rels', 'Document' => 'word/document.xml', + 'Comments' => 'word/comments.xml', 'Styles' => 'word/styles.xml', 'Numbering' => 'word/numbering.xml', 'Settings' => 'word/settings.xml', @@ -129,6 +130,7 @@ class Word2007 extends AbstractWriter implements WriterInterface $this->addNotes($zip, $rId, 'footnote'); $this->addNotes($zip, $rId, 'endnote'); + $this->addComments($zip, $rId); $this->addChart($zip, $rId); // Write parts @@ -255,6 +257,30 @@ class Word2007 extends AbstractWriter implements WriterInterface } } + /** + * Add comments + * + * @param \PhpOffice\PhpWord\Shared\ZipArchive $zip + * @param integer &$rId + * @return void + */ + private function addComments(ZipArchive $zip, &$rId) + { + $phpWord = $this->getPhpWord(); + $collection = $phpWord->getComments(); + $partName = "comments"; + + // Add comment relations and contents + /** @var \PhpOffice\PhpWord\Collection\AbstractCollection $collection Type hint */ + if ($collection->countItems() > 0) { + $this->relationships[] = array('target' => "{$partName}.xml", 'type' => $partName, 'rID' => ++$rId); + + // Write content file, e.g. word/comments.xml + $writerPart = $this->getWriterPart($partName)->setElements($collection->getItems()); + $zip->addFromString("word/{$partName}.xml", $writerPart->write()); + } + } + /** * Add chart. * diff --git a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php index f5a454d2..474d40ce 100644 --- a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php +++ b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php @@ -103,6 +103,7 @@ abstract class AbstractElement $this->writeParagraphStyle(); } } + $this->writeCommentRangeStart(); } /** @@ -112,11 +113,63 @@ abstract class AbstractElement */ protected function endElementP() { + $this->writeCommentRangeEnd(); if (!$this->withoutP) { $this->xmlWriter->endElement(); // w:p } } + /** + * Writes the w:commentRangeStart DOM element + * + * @return void + */ + protected function writeCommentRangeStart() + { + if ($this->element->getCommentStart() != null) { + $comment = $this->element->getCommentStart(); + //only set the ID if it is not yet set, otherwise it will overwrite it + if ($comment->getElementId() == null) { + $comment->setElementId(); + } + + $this->xmlWriter->writeElementBlock('w:commentRangeStart', array('w:id' => $comment->getElementId())); + + } + } + + /** + * Writes the w:commentRangeEnd DOM element + * + * @return void + */ + protected function writeCommentRangeEnd() + { + if ($this->element->getCommentEnd() != null) { + $comment = $this->element->getCommentEnd(); + //only set the ID if it is not yet set, otherwise it will overwrite it + if ($comment->getElementId() == null) { + $comment->setElementId(); + } + + $this->xmlWriter->writeElementBlock('w:commentRangeEnd', array('w:id' => $comment->getElementId())); + $this->xmlWriter->startElement('w:r'); + $this->xmlWriter->writeElementBlock('w:commentReference', array('w:id' => $comment->getElementId())); + $this->xmlWriter->endElement(); + } elseif ($this->element->getCommentStart() != null && $this->element->getCommentStart()->getEndElement() == null) { + $comment = $this->element->getCommentStart(); + //only set the ID if it is not yet set, otherwise it will overwrite it + if ($comment->getElementId() == null) { + $comment->setElementId(); + } + + $this->xmlWriter->writeElementBlock('w:commentRangeEnd', array('w:id' => $comment->getElementId())); + $this->xmlWriter->startElement('w:r'); + $this->xmlWriter->writeElementBlock('w:commentReference', array('w:id' => $comment->getElementId())); + $this->xmlWriter->endElement(); + } + } + /** * Write ending. * diff --git a/src/PhpWord/Writer/Word2007/Element/Chart.php b/src/PhpWord/Writer/Word2007/Element/Chart.php index 12602532..ecdde362 100644 --- a/src/PhpWord/Writer/Word2007/Element/Chart.php +++ b/src/PhpWord/Writer/Word2007/Element/Chart.php @@ -45,6 +45,7 @@ class Chart extends AbstractElement if (!$this->withoutP) { $xmlWriter->startElement('w:p'); } + $this->writeCommentRangeStart(); $xmlWriter->startElement('w:r'); $xmlWriter->startElement('w:drawing'); diff --git a/src/PhpWord/Writer/Word2007/Element/Image.php b/src/PhpWord/Writer/Word2007/Element/Image.php index 914c78ea..edf32739 100644 --- a/src/PhpWord/Writer/Word2007/Element/Image.php +++ b/src/PhpWord/Writer/Word2007/Element/Image.php @@ -63,6 +63,7 @@ class Image extends AbstractElement $xmlWriter->startElement('w:p'); $styleWriter->writeAlignment(); } + $this->writeCommentRangeStart(); $xmlWriter->startElement('w:r'); $xmlWriter->startElement('w:pict'); diff --git a/src/PhpWord/Writer/Word2007/Element/Line.php b/src/PhpWord/Writer/Word2007/Element/Line.php index ade91fb8..ebc5d395 100644 --- a/src/PhpWord/Writer/Word2007/Element/Line.php +++ b/src/PhpWord/Writer/Word2007/Element/Line.php @@ -48,6 +48,7 @@ class Line extends AbstractElement $xmlWriter->startElement('w:p'); $styleWriter->writeAlignment(); } + $this->writeCommentRangeStart(); $xmlWriter->startElement('w:r'); $xmlWriter->startElement('w:pict'); diff --git a/src/PhpWord/Writer/Word2007/Element/Object.php b/src/PhpWord/Writer/Word2007/Element/Object.php index 4fdf6fed..fc0532cd 100644 --- a/src/PhpWord/Writer/Word2007/Element/Object.php +++ b/src/PhpWord/Writer/Word2007/Element/Object.php @@ -51,6 +51,7 @@ class Object extends AbstractElement $xmlWriter->startElement('w:p'); $styleWriter->writeAlignment(); } + $this->writeCommentRangeStart(); $xmlWriter->startElement('w:r'); $xmlWriter->startElement('w:object'); diff --git a/src/PhpWord/Writer/Word2007/Element/Shape.php b/src/PhpWord/Writer/Word2007/Element/Shape.php index f282c4a5..a589af6c 100644 --- a/src/PhpWord/Writer/Word2007/Element/Shape.php +++ b/src/PhpWord/Writer/Word2007/Element/Shape.php @@ -55,6 +55,7 @@ class Shape extends AbstractElement if (!$this->withoutP) { $xmlWriter->startElement('w:p'); } + $this->writeCommentRangeStart(); $xmlWriter->startElement('w:r'); $xmlWriter->startElement('w:pict'); diff --git a/src/PhpWord/Writer/Word2007/Element/TextBox.php b/src/PhpWord/Writer/Word2007/Element/TextBox.php index 3c4f48c2..e83fe0c9 100644 --- a/src/PhpWord/Writer/Word2007/Element/TextBox.php +++ b/src/PhpWord/Writer/Word2007/Element/TextBox.php @@ -45,6 +45,7 @@ class TextBox extends Image $xmlWriter->startElement('w:p'); $styleWriter->writeAlignment(); } + $this->writeCommentRangeStart(); $xmlWriter->startElement('w:r'); $xmlWriter->startElement('w:pict'); diff --git a/src/PhpWord/Writer/Word2007/Part/Comments.php b/src/PhpWord/Writer/Word2007/Part/Comments.php new file mode 100644 index 00000000..73314785 --- /dev/null +++ b/src/PhpWord/Writer/Word2007/Part/Comments.php @@ -0,0 +1,103 @@ +getXmlWriter(); + + $xmlWriter->startDocument('1.0', 'UTF-8', 'yes'); + $xmlWriter->startElement('w:comments'); + $xmlWriter->writeAttribute('xmlns:ve', 'http://schemas.openxmlformats.org/markup-compatibility/2006'); + $xmlWriter->writeAttribute('xmlns:o', 'urn:schemas-microsoft-com:office:office'); + $xmlWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'); + $xmlWriter->writeAttribute('xmlns:m', 'http://schemas.openxmlformats.org/officeDocument/2006/math'); + $xmlWriter->writeAttribute('xmlns:v', 'urn:schemas-microsoft-com:vml'); + $xmlWriter->writeAttribute('xmlns:wp', 'http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing'); + $xmlWriter->writeAttribute('xmlns:w10', 'urn:schemas-microsoft-com:office:word'); + $xmlWriter->writeAttribute('xmlns:w', 'http://schemas.openxmlformats.org/wordprocessingml/2006/main'); + $xmlWriter->writeAttribute('xmlns:wne', 'http://schemas.microsoft.com/office/word/2006/wordml'); + + if ($this->elements !== null) { + foreach ($this->elements as $element) { + if ($element instanceof Comment) { + $this->writeComment($xmlWriter, $element); + } + } + } + + $xmlWriter->endElement(); // w:comments + + return $xmlWriter->getData(); + } + + /** + * Write comment item. + * + * @param \PhpOffice\Common\XMLWriter $xmlWriter + * @param \PhpOffice\PhpWord\Element\Comment $comment + * @return void + */ + protected function writeComment(XMLWriter $xmlWriter, Comment $comment) + { + $xmlWriter->startElement('w:comment'); + $xmlWriter->writeAttribute('w:id', $comment->getElementId()); + $xmlWriter->writeAttribute('w:author', $comment->getAuthor()); + $xmlWriter->writeAttribute('w:date', $comment->getDate()->format($this->dateFormat)); + $xmlWriter->writeAttribute('w:initials', $comment->getInitials()); + + $containerWriter = new Container($xmlWriter, $comment); + $containerWriter->write(); + + $xmlWriter->endElement(); // w:comment + } + + /** + * Set element + * + * @param \PhpOffice\PhpWord\Collection\Comments $elements + * @return self + */ + public function setElements($elements) + { + $this->elements = $elements; + + return $this; + } +} diff --git a/src/PhpWord/Writer/Word2007/Part/ContentTypes.php b/src/PhpWord/Writer/Word2007/Part/ContentTypes.php index 1c81f343..7a03243e 100644 --- a/src/PhpWord/Writer/Word2007/Part/ContentTypes.php +++ b/src/PhpWord/Writer/Word2007/Part/ContentTypes.php @@ -49,6 +49,7 @@ class ContentTypes extends AbstractPart '/word/theme/theme1.xml' => $openXMLPrefix . 'officedocument.theme+xml', '/word/webSettings.xml' => $wordMLPrefix . 'webSettings+xml', '/word/fontTable.xml' => $wordMLPrefix . 'fontTable+xml', + '/word/comments.xml' => $wordMLPrefix . 'comments+xml', ); $defaults = $contentTypes['default']; diff --git a/tests/PhpWord/Element/CommentTest.php b/tests/PhpWord/Element/CommentTest.php new file mode 100644 index 00000000..db9ec902 --- /dev/null +++ b/tests/PhpWord/Element/CommentTest.php @@ -0,0 +1,83 @@ +setStartElement($oText); + $oComment->setEndElement($oText); + + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Comment', $oComment); + $this->assertEquals($author, $oComment->getAuthor()); + $this->assertEquals($date, $oComment->getDate()); + $this->assertEquals($initials, $oComment->getInitials()); + $this->assertEquals($oText, $oComment->getStartElement()); + $this->assertEquals($oText, $oComment->getEndElement()); + } + + /** + * Add text + */ + public function testAddText() + { + $oComment = new Comment('Test User', new \DateTime(), 'my_initials'); + $element = $oComment->addText('text'); + + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Text', $element); + $this->assertCount(1, $oComment->getElements()); + $this->assertEquals('text', $element->getText()); + } + + /** + * Get elements + */ + public function testGetElements() + { + $oComment = new Comment('Test User', new \DateTime(), 'my_initials'); + + $this->assertInternalType('array', $oComment->getElements()); + } + + /** + * Set/get relation Id + */ + public function testRelationId() + { + $oComment = new Comment('Test User', new \DateTime(), 'my_initials'); + + $iVal = rand(1, 1000); + $oComment->setRelationId($iVal); + $this->assertEquals($iVal, $oComment->getRelationId()); + } +} diff --git a/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php b/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php new file mode 100644 index 00000000..aac4b15b --- /dev/null +++ b/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php @@ -0,0 +1,61 @@ +addText('Test'); + + $phpWord = new PhpWord(); + $phpWord->addComment($comment); + $doc = TestHelperDOCX::getDocument($phpWord); + + $path = '/w:comments/w:comment'; + $file = 'word/comments.xml'; + + $this->assertTrue($doc->elementExists($path, $file)); + + $element = $doc->getElement($path, $file); + $this->assertNotNull($element->getAttribute('w:id')); + $this->assertEquals("Authors name", $element->getAttribute('w:author')); + $this->assertEquals("my_initials", $element->getAttribute('w:initials')); + } +} From 09e669f9e9de9bcc7b60b8c3224b6c058a69166b Mon Sep 17 00:00:00 2001 From: antoine Date: Tue, 16 May 2017 02:38:15 +0200 Subject: [PATCH 051/370] basedOn not correctly set if FontStyle is based on other FontStyle --- src/PhpWord/Writer/Word2007/Part/Styles.php | 6 +++- .../Writer/Word2007/Part/StylesTest.php | 28 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/PhpWord/Writer/Word2007/Part/Styles.php b/src/PhpWord/Writer/Word2007/Part/Styles.php index 637c60ff..01b84c08 100644 --- a/src/PhpWord/Writer/Word2007/Part/Styles.php +++ b/src/PhpWord/Writer/Word2007/Part/Styles.php @@ -182,7 +182,11 @@ class Styles extends AbstractPart // Parent style if (!is_null($paragraphStyle)) { - $xmlWriter->writeElementBlock('w:basedOn', 'w:val', $paragraphStyle->getStyleName()); + if ($paragraphStyle->getStyleName() != null) { + $xmlWriter->writeElementBlock('w:basedOn', 'w:val', $paragraphStyle->getStyleName()); + } elseif ($paragraphStyle->getBasedOn() != null) { + $xmlWriter->writeElementBlock('w:basedOn', 'w:val', $paragraphStyle->getBasedOn()); + } } // w:pPr diff --git a/tests/PhpWord/Writer/Word2007/Part/StylesTest.php b/tests/PhpWord/Writer/Word2007/Part/StylesTest.php index df20ab3b..9153fe65 100644 --- a/tests/PhpWord/Writer/Word2007/Part/StylesTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/StylesTest.php @@ -114,4 +114,32 @@ class StylesTest extends \PHPUnit_Framework_TestCase $element = $doc->getElement($path, $file); $this->assertNull($element); } + + function testFontStyleBasedOnOtherFontStyle() { + $phpWord = new PhpWord(); + + $styleGenerationP = new Paragraph(); + $styleGenerationP->setAlignment(Jc::BOTH); + + $styleGeneration = new Font(); + $styleGeneration->setParagraph($styleGenerationP); + $styleGeneration->setSize(9.5); + $phpWord->addFontStyle('Generation', $styleGeneration); + + $styleGenerationEteinteP = new Paragraph(); + $styleGenerationEteinteP->setBasedOn('Generation'); + + $styleGenerationEteinte = new Font(); + $styleGenerationEteinte->setParagraph($styleGenerationEteinteP); + $styleGenerationEteinte->setSize(8.5); + $phpWord->addFontStyle('GeneratEteinte', $styleGenerationEteinte); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/styles.xml'; + + $path = '/w:styles/w:style[@w:styleId="GeneratEteinte"]/w:basedOn'; + $element = $doc->getElement($path, $file); + $this->assertEquals('Generation', $element->getAttribute('w:val')); + } } From a55405e6551daa5482ce82f8d40df9d75de9ce7e Mon Sep 17 00:00:00 2001 From: Mord1n Date: Thu, 18 May 2017 16:25:05 +0200 Subject: [PATCH 052/370] Update Styles.php automatic-styles should be closed before opening master-styles. This will prevent issue that styles wont work in future if you implement styling for ODT writer.... --- src/PhpWord/Writer/ODText/Part/Styles.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Writer/ODText/Part/Styles.php b/src/PhpWord/Writer/ODText/Part/Styles.php index b50be0e8..9236a16b 100644 --- a/src/PhpWord/Writer/ODText/Part/Styles.php +++ b/src/PhpWord/Writer/ODText/Part/Styles.php @@ -52,8 +52,8 @@ class Styles extends AbstractPart // Automatic styles $xmlWriter->startElement('office:automatic-styles'); $this->writePageLayout($xmlWriter); - $this->writeMaster($xmlWriter); $xmlWriter->endElement(); + $this->writeMaster($xmlWriter); $xmlWriter->endElement(); // office:document-styles From 68dd3fd576de0d7eafb50176d2db4d199fa03628 Mon Sep 17 00:00:00 2001 From: antoine Date: Wed, 24 May 2017 00:18:17 +0200 Subject: [PATCH 053/370] rename attribute to match generated XML node name --- src/PhpWord/Element/AbstractElement.php | 24 +++++++++---------- src/PhpWord/Element/Comment.php | 8 +++---- .../Word2007/Element/AbstractElement.php | 12 +++++----- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/PhpWord/Element/AbstractElement.php b/src/PhpWord/Element/AbstractElement.php index b84211b9..8ff64194 100644 --- a/src/PhpWord/Element/AbstractElement.php +++ b/src/PhpWord/Element/AbstractElement.php @@ -119,14 +119,14 @@ abstract class AbstractElement * * @var Comment */ - protected $commentStart; + protected $commentRangeStart; /** * The end position for the linked comment * * @var Comment */ - protected $commentEnd; + protected $commentRangeEnd; /** * Get PhpWord @@ -284,9 +284,9 @@ abstract class AbstractElement * * @return Comment */ - public function getCommentStart() + public function getCommentRangeStart() { - return $this->commentStart; + return $this->commentRangeStart; } /** @@ -294,13 +294,13 @@ abstract class AbstractElement * * @param Comment $value */ - public function setCommentStart(Comment $value) + public function setCommentRangeStart(Comment $value) { if ($this instanceof Comment) { throw new \InvalidArgumentException("Cannot set a Comment on a Comment"); } - $this->commentStart = $value; - $this->commentStart->setStartElement($this); + $this->commentRangeStart= $value; + $this->commentRangeStart->setStartElement($this); } /** @@ -308,9 +308,9 @@ abstract class AbstractElement * * @return Comment */ - public function getCommentEnd() + public function getCommentRangeEnd() { - return $this->commentEnd; + return $this->commentRangeEnd; } /** @@ -319,13 +319,13 @@ abstract class AbstractElement * @param Comment $value * @return void */ - public function setCommentEnd(Comment $value) + public function setCommentRangeEnd(Comment $value) { if ($this instanceof Comment) { throw new \InvalidArgumentException("Cannot set a Comment on a Comment"); } - $this->commentEnd = $value; - $this->commentEnd->setEndElement($this); + $this->commentRangeEnd= $value; + $this->commentRangeEnd->setEndElement($this); } /** diff --git a/src/PhpWord/Element/Comment.php b/src/PhpWord/Element/Comment.php index df2e4d4d..def9d5a8 100644 --- a/src/PhpWord/Element/Comment.php +++ b/src/PhpWord/Element/Comment.php @@ -82,8 +82,8 @@ class Comment extends TrackChange public function setStartElement(AbstractElement $value) { $this->startElement = $value; - if ($value->getCommentStart() == null) { - $value->setCommentStart($this); + if ($value->getCommentRangeStart() == null) { + $value->setCommentRangeStart($this); } } @@ -105,8 +105,8 @@ class Comment extends TrackChange public function setEndElement(AbstractElement $value) { $this->endElement = $value; - if ($value->getCommentEnd() == null) { - $value->setCommentEnd($this); + if ($value->getCommentRangeEnd() == null) { + $value->setCommentRangeEnd($this); } } diff --git a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php index 474d40ce..79877b10 100644 --- a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php +++ b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php @@ -126,8 +126,8 @@ abstract class AbstractElement */ protected function writeCommentRangeStart() { - if ($this->element->getCommentStart() != null) { - $comment = $this->element->getCommentStart(); + if ($this->element->getCommentRangeStart() != null) { + $comment = $this->element->getCommentRangeStart(); //only set the ID if it is not yet set, otherwise it will overwrite it if ($comment->getElementId() == null) { $comment->setElementId(); @@ -145,8 +145,8 @@ abstract class AbstractElement */ protected function writeCommentRangeEnd() { - if ($this->element->getCommentEnd() != null) { - $comment = $this->element->getCommentEnd(); + if ($this->element->getCommentRangeEnd() != null) { + $comment = $this->element->getCommentRangeEnd(); //only set the ID if it is not yet set, otherwise it will overwrite it if ($comment->getElementId() == null) { $comment->setElementId(); @@ -156,8 +156,8 @@ abstract class AbstractElement $this->xmlWriter->startElement('w:r'); $this->xmlWriter->writeElementBlock('w:commentReference', array('w:id' => $comment->getElementId())); $this->xmlWriter->endElement(); - } elseif ($this->element->getCommentStart() != null && $this->element->getCommentStart()->getEndElement() == null) { - $comment = $this->element->getCommentStart(); + } elseif ($this->element->getCommentRangeStart() != null && $this->element->getCommentRangeStart()->getEndElement() == null) { + $comment = $this->element->getCommentRangeStart(); //only set the ID if it is not yet set, otherwise it will overwrite it if ($comment->getElementId() == null) { $comment->setElementId(); From f21f79761aaa991a28fb700caddabb80649c4627 Mon Sep 17 00:00:00 2001 From: antoine Date: Thu, 25 May 2017 22:04:23 +0200 Subject: [PATCH 054/370] fix sample --- samples/Sample_37_Comments.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/Sample_37_Comments.php b/samples/Sample_37_Comments.php index 91d353a9..670e914b 100644 --- a/samples/Sample_37_Comments.php +++ b/samples/Sample_37_Comments.php @@ -15,7 +15,7 @@ $section = $phpWord->addSection(); $textrun = $section->addTextRun(); $textrun->addText('This '); $text = $textrun->addText('is'); -$text->setCommentStart($comment); +$text->setCommentRangeStart($comment); $textrun->addText(' a test'); $section->addTextBreak(2); @@ -28,10 +28,10 @@ $phpWord->addComment($commentWithStartAndEnd); $textrunWithEnd = $section->addTextRun(); $textrunWithEnd->addText('This '); $textToStartOn = $textrunWithEnd->addText('is', array('bold' => true)); -$textToStartOn->setCommentStart($commentWithStartAndEnd); +$textToStartOn->setCommentRangeStart($commentWithStartAndEnd); $textrunWithEnd->addText(' another', array('italic' => true)); $textToEndOn = $textrunWithEnd->addText(' test'); -$textToEndOn->setCommentEnd($commentWithStartAndEnd); +$textToEndOn->setCommentRangeEnd($commentWithStartAndEnd); $section->addTextBreak(2); @@ -42,7 +42,7 @@ $imageComment->addText('Hey, Mars does look '); $imageComment->addText('red', array('color' => 'FF0000')); $phpWord->addComment($commentOnImage); $image = $section->addImage('resources/_mars.jpg'); -$image->setCommentStart($commentOnImage); +$image->setCommentRangeStart($commentOnImage); $section->addTextBreak(2); From ac89cc39eaf97f0cb91b9df9b88d161a0fce24b1 Mon Sep 17 00:00:00 2001 From: antoine Date: Tue, 30 May 2017 00:31:32 +0200 Subject: [PATCH 055/370] Add possibility to control the footnote number --- docs/elements.rst | 23 ++- samples/Sample_06_Footnote.php | 8 +- src/PhpWord/Element/Section.php | 28 ++++ src/PhpWord/SimpleType/FootnoteProperties.php | 152 ++++++++++++++++++ src/PhpWord/Writer/Word2007/Part/Document.php | 27 ++++ .../SimpleType/FootnotePropertiesTest.php | 79 +++++++++ .../Writer/Word2007/Part/DocumentTest.php | 31 ++++ 7 files changed, 344 insertions(+), 4 deletions(-) create mode 100644 src/PhpWord/SimpleType/FootnoteProperties.php create mode 100644 tests/PhpWord/SimpleType/FootnotePropertiesTest.php diff --git a/docs/elements.rst b/docs/elements.rst index 27fd76b8..5b671936 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -333,11 +333,28 @@ On text: $footnote = $section->addFootnote(); $footnote->addText('Footnote text.'); -The footnote reference number will be displayed with decimal number -starting from 1. This number use ``FooterReference`` style which you can -redefine by ``addFontStyle`` method. Default value for this style is +By default the footnote reference number will be displayed with decimal number +starting from 1. This number uses the ``FooterReference`` style which you can +redefine with the ``addFontStyle`` method. Default value for this style is ``array('superScript' => true)``; +The footnote numbering can be controlled by setting the FootnoteProperties on the Section. + +.. code-block:: php + + $fp = new PhpWord\SimpleType\FootnoteProperties(); + //sets the position of the footnote (pageBottom (default), beneathText, sectEnd, docEnd) + $fp->setPos(FootnoteProperties::POSITION_DOC_END); + //set the number format to use (decimal (default), upperRoman, upperLetter, ...) + $fp->setNumFmt(FootnoteProperties::NUMBER_FORMAT_LOWER_ROMAN); + //force starting at other than 1 + $fp->setNumStart(2); + //when to restart counting (continuous (default), eachSect, eachPage) + $fp->setNumRestart(FootnoteProperties::RESTART_NUMBER_EACH_PAGE); + + //And finaly, set it on the Section + $section->setFootnoteProperties($properties); + Checkboxes ---------- diff --git a/samples/Sample_06_Footnote.php b/samples/Sample_06_Footnote.php index 30afcf81..f9c6b5f7 100644 --- a/samples/Sample_06_Footnote.php +++ b/samples/Sample_06_Footnote.php @@ -1,4 +1,6 @@ addText('But you can only put footnote in section, not in header or f $section->addText( 'You can also create the footnote directly from the section making it wrap in a paragraph ' - . 'like the footnote below this paragraph. But is is best used from within a textrun.' + . 'like the footnote below this paragraph. But is best used from within a textrun.' ); $footnote = $section->addFootnote(); $footnote->addText('The reference for this is wrapped in its own line'); +$footnoteProperties = new FootnoteProperties(); +$footnoteProperties->setNumFmt(FootnoteProperties::NUMBER_FORMAT_UPPER_ROMAN); +$section->setFootnoteProperties($footnoteProperties); + // Save file echo write($phpWord, basename(__FILE__, '.php'), $writers); if (!CLI) { diff --git a/src/PhpWord/Element/Section.php b/src/PhpWord/Element/Section.php index 1e926d2f..c0bfc3cf 100644 --- a/src/PhpWord/Element/Section.php +++ b/src/PhpWord/Element/Section.php @@ -18,6 +18,7 @@ namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\Style\Section as SectionStyle; +use PhpOffice\PhpWord\SimpleType\FootnoteProperties; class Section extends AbstractContainer { @@ -47,6 +48,13 @@ class Section extends AbstractContainer */ private $footers = array(); + /** + * The properties for the footnote of this section + * + * @var FootnoteProperties + */ + private $footnoteProperties; + /** * Create new instance * @@ -138,6 +146,26 @@ class Section extends AbstractContainer return $this->footers; } + /** + * Get the footnote properties + * + * @return \PhpOffice\PhpWord\Element\FooterProperties + */ + public function getFootnotePropoperties() + { + return $this->footnoteProperties; + } + + /** + * Set the footnote properties + * + * @param FootnoteProperties $footnoteProperties + */ + public function setFootnoteProperties(FootnoteProperties $footnoteProperties = null) + { + $this->footnoteProperties = $footnoteProperties; + } + /** * Is there a header for this section that is for the first page only? * diff --git a/src/PhpWord/SimpleType/FootnoteProperties.php b/src/PhpWord/SimpleType/FootnoteProperties.php new file mode 100644 index 00000000..812c055f --- /dev/null +++ b/src/PhpWord/SimpleType/FootnoteProperties.php @@ -0,0 +1,152 @@ +pos; + } + + public function setPos($pos) + { + if (in_array($pos, self::POSITION)) { + $this->pos = $pos; + } else { + throw new \InvalidArgumentException("Invalid value, on of " . implode(', ', self::POSITION) . " possible"); + } + } + + public function getNumFmt() + { + return $this->numFmt; + } + + public function setNumFmt($numFmt) + { + if (in_array($numFmt, self::NUMBER_FORMAT)) { + $this->numFmt = $numFmt; + } else { + throw new \InvalidArgumentException("Invalid value, on of " . implode(', ', self::NUMBER_FORMAT) . " possible"); + } + } + + public function getNumStart() + { + return $this->numStart; + } + + public function setNumStart($numStart) + { + $this->numStart = $numStart; + } + + public function getNumRestart() + { + return $this->numRestart; + } + + public function setNumRestart($numRestart) + { + if (in_array($numRestart, self::RESTART_NUMBER)) { + $this->numRestart= $numRestart; + } else { + throw new \InvalidArgumentException("Invalid value, on of " . implode(', ', self::RESTART_NUMBER) . " possible"); + } + } +} diff --git a/src/PhpWord/Writer/Word2007/Part/Document.php b/src/PhpWord/Writer/Word2007/Part/Document.php index 411946f5..a2dc999b 100644 --- a/src/PhpWord/Writer/Word2007/Part/Document.php +++ b/src/PhpWord/Writer/Word2007/Part/Document.php @@ -21,6 +21,7 @@ use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Element\Section; use PhpOffice\PhpWord\Writer\Word2007\Element\Container; use PhpOffice\PhpWord\Writer\Word2007\Style\Section as SectionStyleWriter; +use PhpOffice\PhpWord\SimpleType\FootnoteProperties; /** * Word2007 document part writer: word/document.xml @@ -129,6 +130,32 @@ class Document extends AbstractPart $xmlWriter->endElement(); } + //footnote properties + if ($section->getFootnotePropoperties() !== null) { + $xmlWriter->startElement('w:footnotePr'); + if ($section->getFootnotePropoperties()->getPos() != null) { + $xmlWriter->startElement('w:pos'); + $xmlWriter->writeAttribute('w:val', $section->getFootnotePropoperties()->getPos()); + $xmlWriter->endElement(); + } + if ($section->getFootnotePropoperties()->getNumFmt() != null) { + $xmlWriter->startElement('w:numFmt'); + $xmlWriter->writeAttribute('w:val', $section->getFootnotePropoperties()->getNumFmt()); + $xmlWriter->endElement(); + } + if ($section->getFootnotePropoperties()->getNumStart() != null) { + $xmlWriter->startElement('w:numStart'); + $xmlWriter->writeAttribute('w:val', $section->getFootnotePropoperties()->getNumStart()); + $xmlWriter->endElement(); + } + if ($section->getFootnotePropoperties()->getNumRestart() != null) { + $xmlWriter->startElement('w:numRestart'); + $xmlWriter->writeAttribute('w:val', $section->getFootnotePropoperties()->getNumRestart()); + $xmlWriter->endElement(); + } + $xmlWriter->endElement(); + } + // Section settings $styleWriter = new SectionStyleWriter($xmlWriter, $section->getStyle()); $styleWriter->write(); diff --git a/tests/PhpWord/SimpleType/FootnotePropertiesTest.php b/tests/PhpWord/SimpleType/FootnotePropertiesTest.php new file mode 100644 index 00000000..193ad363 --- /dev/null +++ b/tests/PhpWord/SimpleType/FootnotePropertiesTest.php @@ -0,0 +1,79 @@ +setPos(FootnoteProperties::POSITION_DOC_END); + $footnoteProp->setNumFmt(FootnoteProperties::NUMBER_FORMAT_LOWER_ROMAN); + $footnoteProp->setNumStart(2); + $footnoteProp->setNumRestart(FootnoteProperties::RESTART_NUMBER_EACH_PAGE); + + $this->assertEquals(FootnoteProperties::POSITION_DOC_END, $footnoteProp->getPos()); + $this->assertEquals(FootnoteProperties::NUMBER_FORMAT_LOWER_ROMAN, $footnoteProp->getNumFmt()); + $this->assertEquals(2, $footnoteProp->getNumStart()); + $this->assertEquals(FootnoteProperties::RESTART_NUMBER_EACH_PAGE, $footnoteProp->getNumRestart()); + } + + /** + * Test throws exception if wrong position given + * + * @expectedException \InvalidArgumentException + */ + public function testWrongPos() + { + $footnoteProp= new FootnoteProperties(); + $footnoteProp->setPos(FootnoteProperties::NUMBER_FORMAT_LOWER_ROMAN); + } + + /** + * Test throws exception if wrong number format given + * + * @expectedException \InvalidArgumentException + */ + public function testWrongNumFmt() + { + $footnoteProp= new FootnoteProperties(); + $footnoteProp->setNumFmt(FootnoteProperties::POSITION_DOC_END); + } + + /** + * Test throws exception if wrong number restart given + * + * @expectedException \InvalidArgumentException + */ + public function testWrongNumRestart() + { + $footnoteProp= new FootnoteProperties(); + $footnoteProp->setNumRestart(FootnoteProperties::NUMBER_FORMAT_LOWER_ROMAN); + } +} diff --git a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php index a9e6d861..0f64d7a7 100644 --- a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php @@ -20,6 +20,7 @@ use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\SimpleType\Jc; use PhpOffice\PhpWord\Style\Font; use PhpOffice\PhpWord\TestHelperDOCX; +use PhpOffice\PhpWord\SimpleType\FootnoteProperties; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Document @@ -57,6 +58,36 @@ class DocumentTest extends \PHPUnit_Framework_TestCase $this->assertEquals(2, $element->getAttribute('w:start')); } + /** + * Write section footnote properties + */ + public function testSectionFootnoteProperties() + { + $properties = new FootnoteProperties(); + $properties->setPos(FootnoteProperties::POSITION_DOC_END); + $properties->setNumFmt(FootnoteProperties::NUMBER_FORMAT_LOWER_ROMAN); + $properties->setNumStart(1); + $properties->setNumRestart(FootnoteProperties::RESTART_NUMBER_EACH_PAGE); + + $phpWord = new PhpWord(); + $section = $phpWord->addSection(); + $section->setFootnoteProperties($properties); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $element = $doc->getElement('/w:document/w:body/w:sectPr/w:footnotePr/w:pos'); + $this->assertEquals(FootnoteProperties::POSITION_DOC_END, $element->getAttribute('w:val')); + + $element = $doc->getElement('/w:document/w:body/w:sectPr/w:footnotePr/w:numFmt'); + $this->assertEquals(FootnoteProperties::NUMBER_FORMAT_LOWER_ROMAN, $element->getAttribute('w:val')); + + $element = $doc->getElement('/w:document/w:body/w:sectPr/w:footnotePr/w:numStart'); + $this->assertEquals(1, $element->getAttribute('w:val')); + + $element = $doc->getElement('/w:document/w:body/w:sectPr/w:footnotePr/w:numRestart'); + $this->assertEquals(FootnoteProperties::RESTART_NUMBER_EACH_PAGE, $element->getAttribute('w:val')); + } + /** * Write elements */ From 6a84b8ed267eb210a97d3efa92a752b73c7b0fb8 Mon Sep 17 00:00:00 2001 From: antoine Date: Wed, 7 Jun 2017 02:26:59 +0200 Subject: [PATCH 056/370] Add possiblity to add not defined options --- src/PhpWord/Element/Field.php | 10 +++++----- src/PhpWord/Writer/Word2007/Element/Field.php | 4 +++- tests/PhpWord/Element/FieldTest.php | 14 ++++++++++++-- tests/PhpWord/Writer/Word2007/ElementTest.php | 18 ++++++++++++++++++ 4 files changed, 38 insertions(+), 8 deletions(-) diff --git a/src/PhpWord/Element/Field.php b/src/PhpWord/Element/Field.php index b5dec19a..bdfdcb40 100644 --- a/src/PhpWord/Element/Field.php +++ b/src/PhpWord/Element/Field.php @@ -60,7 +60,7 @@ class Field extends AbstractElement ), 'INDEX'=>array( 'properties' => array(), - 'options'=>array('PreserveFormat') + 'options' => array('PreserveFormat') ) ); @@ -122,7 +122,7 @@ class Field extends AbstractElement if (isset($this->fieldsArray[$type])) { $this->type = $type; } else { - throw new \InvalidArgumentException("Invalid type"); + throw new \InvalidArgumentException("Invalid type '$type'"); } } return $this->type; @@ -152,7 +152,7 @@ class Field extends AbstractElement if (is_array($properties)) { foreach (array_keys($properties) as $propkey) { if (!(isset($this->fieldsArray[$this->type]['properties'][$propkey]))) { - throw new \InvalidArgumentException("Invalid property"); + throw new \InvalidArgumentException("Invalid property '$propkey'"); } } $this->properties = array_merge($this->properties, $properties); @@ -183,8 +183,8 @@ class Field extends AbstractElement { if (is_array($options)) { foreach (array_keys($options) as $optionkey) { - if (!(isset($this->fieldsArray[$this->type]['options'][$optionkey]))) { - throw new \InvalidArgumentException("Invalid option"); + if (!(isset($this->fieldsArray[$this->type]['options'][$optionkey])) && substr($optionkey, 0, 1) !== '\\') { + throw new \InvalidArgumentException("Invalid option '$optionkey', possible values are " . implode(', ', $this->fieldsArray[$this->type]['options'])); } } $this->options = array_merge($this->options, $options); diff --git a/src/PhpWord/Writer/Word2007/Element/Field.php b/src/PhpWord/Writer/Word2007/Element/Field.php index ad8032c7..802803db 100644 --- a/src/PhpWord/Writer/Word2007/Element/Field.php +++ b/src/PhpWord/Writer/Word2007/Element/Field.php @@ -77,6 +77,8 @@ class Field extends Text case 'Italic': $instruction .= '\i '; break; + default: + $instruction .= $option .' '; } } @@ -106,7 +108,7 @@ class Field extends Text $xmlWriter->startElement('w:noProof'); $xmlWriter->endElement(); // w:noProof $xmlWriter->endElement(); // w:rPr - $xmlWriter->writeElement('w:t', '1'); + $xmlWriter->writeElement('w:t', $element->getText() == null ? '1' : $element->getText()); $xmlWriter->endElement(); // w:r $xmlWriter->startElement('w:r'); diff --git a/tests/PhpWord/Element/FieldTest.php b/tests/PhpWord/Element/FieldTest.php index d4e47e62..415aaa0b 100644 --- a/tests/PhpWord/Element/FieldTest.php +++ b/tests/PhpWord/Element/FieldTest.php @@ -75,15 +75,25 @@ class FieldTest extends \PHPUnit_Framework_TestCase */ public function testConstructWithTypePropertiesOptionsText() { - $oField = new Field('XE', array(), array('Bold'), 'FieldValue'); + $oField = new Field('XE', array(), array('Bold', 'Italic'), 'FieldValue'); $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Field', $oField); $this->assertEquals('XE', $oField->getType()); $this->assertEquals(array(), $oField->getProperties()); - $this->assertEquals(array('Bold'), $oField->getOptions()); + $this->assertEquals(array('Bold', 'Italic'), $oField->getOptions()); $this->assertEquals('FieldValue', $oField->getText()); } + public function testConstructWithOptionValue() + { + $oField = new Field('INDEX', array(), array('\\c "3" \\h "A"')); + + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Field', $oField); + $this->assertEquals('INDEX', $oField->getType()); + $this->assertEquals(array(), $oField->getProperties()); + $this->assertEquals(array('\\c "3" \\h "A"'), $oField->getOptions()); + } + /** * Test setType exception * diff --git a/tests/PhpWord/Writer/Word2007/ElementTest.php b/tests/PhpWord/Writer/Word2007/ElementTest.php index 027ba86a..7208449d 100644 --- a/tests/PhpWord/Writer/Word2007/ElementTest.php +++ b/tests/PhpWord/Writer/Word2007/ElementTest.php @@ -192,6 +192,24 @@ class ElementTest extends \PHPUnit_Framework_TestCase } } + public function testFieldElement() + { + $phpWord = new PhpWord(); + $section = $phpWord->addSection(); + + $section->addField('INDEX', [], ['\\c "3"']); + $section->addField('XE', [], ['Bold', 'Italic'], 'Index Entry'); + $section->addField('DATE', ['dateformat' => 'd-M-yyyy'], ['PreserveFormat', 'LastUsedFormat']); + $section->addField('DATE', [], ['LunarCalendar']); + $section->addField('DATE', [], ['SakaEraCalendar']); + $section->addField('NUMPAGES', ['format' => 'roman', 'numformat' => '0,00'], ['SakaEraCalendar']); + $doc = TestHelperDOCX::getDocument($phpWord); + + $element = '/w:document/w:body/w:p/w:r/w:instrText'; + $this->assertTrue($doc->elementExists($element)); + $this->assertEquals(' INDEX \\c "3" ', $doc->getElement($element)->textContent); + } + /** * Test form fields */ From 8aabf812f8bd27ba49e251d904f4953b6b91cca5 Mon Sep 17 00:00:00 2001 From: antoine Date: Sun, 11 Jun 2017 12:56:59 +0200 Subject: [PATCH 057/370] update XE field to support formatted text + add documentation --- docs/elements.rst | 30 +++- samples/Sample_27_Field.php | 16 ++- src/PhpWord/Element/AbstractContainer.php | 2 +- src/PhpWord/Element/Field.php | 11 +- src/PhpWord/Writer/Word2007/Element/Field.php | 129 +++++++++++------- tests/PhpWord/Element/FieldTest.php | 17 +++ tests/PhpWord/Writer/Word2007/ElementTest.php | 28 ++++ 7 files changed, 177 insertions(+), 56 deletions(-) diff --git a/docs/elements.rst b/docs/elements.rst index d68ee035..b753ddf7 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -358,7 +358,35 @@ To be completed Fields ------ -To be completed +Currently the following fields are supported: + +- PAGE +- NUMPAGES +- DATE +- XE +- INDEX + +.. code-block:: php + + $section->addField($fieldType, [$properties], [$options], [$fieldText]) + +See ``\PhpOffice\PhpWord\Element\Field`` for list of properties and options available for each field type. +Options which are not specifically defined can be added. Those must start with a ``\``. + +For instance for the INDEX field, you can do the following (See `Index Field for list of available options `_ ): + +.. code-block:: php + + //the $fieldText can be either a simple string + $fieldText = 'The index value'; + + //or a 'TextRun', to be able to format the text you want in the index + $fieldText = new TextRun(); + $fieldText->addText('My '); + $fieldText->addText('bold index', ['bold' => true]); + $fieldText->addText(' entry'); + + $section->addField('INDEX', array(), array('\\e " " \\h "A" \\c "3"'), $fieldText); Line ------ diff --git a/samples/Sample_27_Field.php b/samples/Sample_27_Field.php index 7e2b968e..b5be12ca 100644 --- a/samples/Sample_27_Field.php +++ b/samples/Sample_27_Field.php @@ -1,4 +1,6 @@ addField('NUMPAGES', array('numformat' => '0,00', 'format' => 'Arabic' $textrun = $section->addTextRun(); $textrun->addText('An index field is '); -$textrun->addField('XE', array(), array('Bold'), 'FieldValue'); +$textrun->addField('XE', array(), array('Italic'), 'My first index'); +$textrun->addText('here:'); + +$indexEntryText = new TextRun(); +$indexEntryText->addText('My '); +$indexEntryText->addText('bold index', ['bold' => true]); +$indexEntryText->addText(' entry'); + +$textrun = $section->addTextRun(); +$textrun->addText('A complex index field is '); +$textrun->addField('XE', array(), array('Bold'), $indexEntryText); $textrun->addText('here:'); $section->addText('The actual index:'); -$section->addField('INDEX', array(), array('PreserveFormat')); +$section->addField('INDEX', array(), array('\\e " "'), 'right click to update the index'); $textrun = $section->addTextRun(array('alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER)); $textrun->addText('This is the date of lunar calendar '); diff --git a/src/PhpWord/Element/AbstractContainer.php b/src/PhpWord/Element/AbstractContainer.php index a3872e0b..0107006f 100644 --- a/src/PhpWord/Element/AbstractContainer.php +++ b/src/PhpWord/Element/AbstractContainer.php @@ -39,7 +39,7 @@ namespace PhpOffice\PhpWord\Element; * @method Image addImage(string $source, mixed $style = null, bool $isWatermark = false) * @method Object addObject(string $source, mixed $style = null) * @method TextBox addTextBox(mixed $style = null) - * @method Field addField(string $type = null, array $properties = array(), array $options = array()) + * @method Field addField(string $type = null, array $properties = array(), array $options = array(), mixed $text = null) * @method Line addLine(mixed $lineStyle = null) * @method Shape addShape(string $type, mixed $style = null) * @method Chart addChart(string $type, array $categories, array $values, array $style = null) diff --git a/src/PhpWord/Element/Field.php b/src/PhpWord/Element/Field.php index bdfdcb40..380d7a92 100644 --- a/src/PhpWord/Element/Field.php +++ b/src/PhpWord/Element/Field.php @@ -74,7 +74,7 @@ class Field extends AbstractElement /** * Field text * - * @var string + * @var TextRun | string */ protected $text; @@ -98,6 +98,7 @@ class Field extends AbstractElement * @param string $type * @param array $properties * @param array $options + * @param TextRun | string $text */ public function __construct($type = null, $properties = array(), $options = array(), $text = null) { @@ -205,16 +206,16 @@ class Field extends AbstractElement /** * Set Field text * - * @param string $text + * @param string | TextRun $text * - * @return string + * @return string | TextRun * * @throws \InvalidArgumentException */ public function setText($text) { if (isset($text)) { - if (is_string($text)) { + if (is_string($text) || $text instanceof TextRun) { $this->text = $text; } else { throw new \InvalidArgumentException("Invalid text"); @@ -226,7 +227,7 @@ class Field extends AbstractElement /** * Get Field text * - * @return string + * @return string | TextRun */ public function getText() { diff --git a/src/PhpWord/Writer/Word2007/Element/Field.php b/src/PhpWord/Writer/Word2007/Element/Field.php index 802803db..a79683e2 100644 --- a/src/PhpWord/Writer/Word2007/Element/Field.php +++ b/src/PhpWord/Writer/Word2007/Element/Field.php @@ -17,6 +17,8 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Element; +use PhpOffice\PhpWord\Element\TextRun; + /** * Field element writer * @@ -37,51 +39,6 @@ class Field extends Text return; } - $instruction = ' ' . $element->getType() . ' '; - if ($element->getText() != null) { - $instruction .= '"' . $element->getText() . '" '; - } - $properties = $element->getProperties(); - foreach ($properties as $propkey => $propval) { - switch ($propkey) { - case 'format': - $instruction .= '\* ' . $propval . ' '; - break; - case 'numformat': - $instruction .= '\# ' . $propval . ' '; - break; - case 'dateformat': - $instruction .= '\@ "' . $propval . '" '; - break; - } - } - - $options = $element->getOptions(); - foreach ($options as $option) { - switch ($option) { - case 'PreserveFormat': - $instruction .= '\* MERGEFORMAT '; - break; - case 'LunarCalendar': - $instruction .= '\h '; - break; - case 'SakaEraCalendar': - $instruction .= '\s '; - break; - case 'LastUsedFormat': - $instruction .= '\l '; - break; - case 'Bold': - $instruction .= '\b '; - break; - case 'Italic': - $instruction .= '\i '; - break; - default: - $instruction .= $option .' '; - } - } - $this->startElementP(); $xmlWriter->startElement('w:r'); @@ -90,6 +47,17 @@ class Field extends Text $xmlWriter->endElement(); // w:fldChar $xmlWriter->endElement(); // w:r + $instruction = ' ' . $element->getType() . ' '; + if ($element->getText() != null) { + if (is_string($element->getText())) { + $instruction .= '"' . $element->getText() . '" '; + $instruction .= $this->buildPropertiesAndOptions($element); + } else { + $instruction .= '"'; + } + } else { + $instruction .= $this->buildPropertiesAndOptions($element); + } $xmlWriter->startElement('w:r'); $xmlWriter->startElement('w:instrText'); $xmlWriter->writeAttribute('xml:space', 'preserve'); @@ -97,6 +65,27 @@ class Field extends Text $xmlWriter->endElement(); // w:instrText $xmlWriter->endElement(); // w:r + if ($element->getText() != null) { + if ($element->getText() instanceof TextRun) { + + $containerWriter = new Container($xmlWriter, $element->getText(), true); + $containerWriter->write(); + + $xmlWriter->startElement('w:r'); + $xmlWriter->startElement('w:instrText'); + $xmlWriter->text('"' . $this->buildPropertiesAndOptions($element)); + $xmlWriter->endElement(); // w:instrText + $xmlWriter->endElement(); // w:r + + $xmlWriter->startElement('w:r'); + $xmlWriter->startElement('w:instrText'); + $xmlWriter->writeAttribute('xml:space', 'preserve'); + $xmlWriter->text(' '); + $xmlWriter->endElement(); // w:instrText + $xmlWriter->endElement(); // w:r + } + } + $xmlWriter->startElement('w:r'); $xmlWriter->startElement('w:fldChar'); $xmlWriter->writeAttribute('w:fldCharType', 'separate'); @@ -108,9 +97,9 @@ class Field extends Text $xmlWriter->startElement('w:noProof'); $xmlWriter->endElement(); // w:noProof $xmlWriter->endElement(); // w:rPr - $xmlWriter->writeElement('w:t', $element->getText() == null ? '1' : $element->getText()); + $xmlWriter->writeElement('w:t', $element->getText() != null && is_string($element->getText()) ? $element->getText() : '1'); $xmlWriter->endElement(); // w:r - + $xmlWriter->startElement('w:r'); $xmlWriter->startElement('w:fldChar'); $xmlWriter->writeAttribute('w:fldCharType', 'end'); @@ -119,4 +108,50 @@ class Field extends Text $this->endElementP(); // w:p } + + private function buildPropertiesAndOptions(\PhpOffice\PhpWord\Element\Field $element) + { + $propertiesAndOptions = ''; + $properties = $element->getProperties(); + foreach ($properties as $propkey => $propval) { + switch ($propkey) { + case 'format': + $propertiesAndOptions.= '\* ' . $propval . ' '; + break; + case 'numformat': + $propertiesAndOptions.= '\# ' . $propval . ' '; + break; + case 'dateformat': + $propertiesAndOptions.= '\@ "' . $propval . '" '; + break; + } + } + + $options = $element->getOptions(); + foreach ($options as $option) { + switch ($option) { + case 'PreserveFormat': + $propertiesAndOptions.= '\* MERGEFORMAT '; + break; + case 'LunarCalendar': + $propertiesAndOptions.= '\h '; + break; + case 'SakaEraCalendar': + $propertiesAndOptions.= '\s '; + break; + case 'LastUsedFormat': + $propertiesAndOptions.= '\l '; + break; + case 'Bold': + $propertiesAndOptions.= '\b '; + break; + case 'Italic': + $propertiesAndOptions.= '\i '; + break; + default: + $propertiesAndOptions.= $option .' '; + } + } + return $propertiesAndOptions; + } } diff --git a/tests/PhpWord/Element/FieldTest.php b/tests/PhpWord/Element/FieldTest.php index 415aaa0b..6f5ebbbf 100644 --- a/tests/PhpWord/Element/FieldTest.php +++ b/tests/PhpWord/Element/FieldTest.php @@ -84,6 +84,23 @@ class FieldTest extends \PHPUnit_Framework_TestCase $this->assertEquals('FieldValue', $oField->getText()); } + /** + * New instance with type and properties and options and text as TextRun + */ + public function testConstructWithTypePropertiesOptionsTextAsTextRun() + { + $textRun = new TextRun(); + $textRun->addText('test string'); + + $oField = new Field('XE', array(), array('Bold', 'Italic'), $textRun); + + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Field', $oField); + $this->assertEquals('XE', $oField->getType()); + $this->assertEquals(array(), $oField->getProperties()); + $this->assertEquals(array('Bold', 'Italic'), $oField->getOptions()); + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\TextRun', $oField->getText()); + } + public function testConstructWithOptionValue() { $oField = new Field('INDEX', array(), array('\\c "3" \\h "A"')); diff --git a/tests/PhpWord/Writer/Word2007/ElementTest.php b/tests/PhpWord/Writer/Word2007/ElementTest.php index 7208449d..5a04c25b 100644 --- a/tests/PhpWord/Writer/Word2007/ElementTest.php +++ b/tests/PhpWord/Writer/Word2007/ElementTest.php @@ -19,6 +19,7 @@ namespace PhpOffice\PhpWord\Writer\Word2007; use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\TestHelperDOCX; +use PhpOffice\PhpWord\Element\TextRun; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Element subnamespace @@ -210,6 +211,33 @@ class ElementTest extends \PHPUnit_Framework_TestCase $this->assertEquals(' INDEX \\c "3" ', $doc->getElement($element)->textContent); } + public function testFieldElementWithComplexText() + { + $phpWord = new PhpWord(); + $section = $phpWord->addSection(); + + $text = new TextRun(); + $text->addText('test string', array('bold' => true)); + + $section->addField('XE', [], ['Bold', 'Italic'], $text); + $doc = TestHelperDOCX::getDocument($phpWord); + + $element = '/w:document/w:body/w:p/w:r[2]/w:instrText'; + $this->assertTrue($doc->elementExists($element)); + $this->assertEquals(' XE "', $doc->getElement($element)->textContent); + + $element = '/w:document/w:body/w:p/w:r[3]/w:rPr/w:b'; + $this->assertTrue($doc->elementExists($element)); + + $element = '/w:document/w:body/w:p/w:r[3]/w:t'; + $this->assertTrue($doc->elementExists($element)); + $this->assertEquals('test string', $doc->getElement($element)->textContent); + + $element = '/w:document/w:body/w:p/w:r[4]/w:instrText'; + $this->assertTrue($doc->elementExists($element)); + $this->assertEquals('"\\b \\i ', $doc->getElement($element)->textContent); + } + /** * Test form fields */ From 64f06e111492c4dfe764df9d289b8b91435cf1a6 Mon Sep 17 00:00:00 2001 From: antoine Date: Fri, 16 Jun 2017 17:55:24 +0200 Subject: [PATCH 058/370] use fully qualified name --- src/PhpWord/Writer/Word2007/Element/Field.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/PhpWord/Writer/Word2007/Element/Field.php b/src/PhpWord/Writer/Word2007/Element/Field.php index a79683e2..5f5ae094 100644 --- a/src/PhpWord/Writer/Word2007/Element/Field.php +++ b/src/PhpWord/Writer/Word2007/Element/Field.php @@ -17,8 +17,6 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Element; -use PhpOffice\PhpWord\Element\TextRun; - /** * Field element writer * @@ -66,7 +64,7 @@ class Field extends Text $xmlWriter->endElement(); // w:r if ($element->getText() != null) { - if ($element->getText() instanceof TextRun) { + if ($element->getText() instanceof PhpOffice\PhpWord\Element\TextRun) { $containerWriter = new Container($xmlWriter, $element->getText(), true); $containerWriter->write(); From 11d816f94ddff1799e2275185f45d1c3bce06b93 Mon Sep 17 00:00:00 2001 From: antoine Date: Fri, 16 Jun 2017 22:39:20 +0200 Subject: [PATCH 059/370] php 5.3 compatibility --- tests/PhpWord/Writer/Word2007/ElementTest.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/PhpWord/Writer/Word2007/ElementTest.php b/tests/PhpWord/Writer/Word2007/ElementTest.php index 5a04c25b..b3c7b197 100644 --- a/tests/PhpWord/Writer/Word2007/ElementTest.php +++ b/tests/PhpWord/Writer/Word2007/ElementTest.php @@ -198,12 +198,12 @@ class ElementTest extends \PHPUnit_Framework_TestCase $phpWord = new PhpWord(); $section = $phpWord->addSection(); - $section->addField('INDEX', [], ['\\c "3"']); - $section->addField('XE', [], ['Bold', 'Italic'], 'Index Entry'); - $section->addField('DATE', ['dateformat' => 'd-M-yyyy'], ['PreserveFormat', 'LastUsedFormat']); - $section->addField('DATE', [], ['LunarCalendar']); - $section->addField('DATE', [], ['SakaEraCalendar']); - $section->addField('NUMPAGES', ['format' => 'roman', 'numformat' => '0,00'], ['SakaEraCalendar']); + $section->addField('INDEX', array(), array('\\c "3"')); + $section->addField('XE', array(), array('Bold', 'Italic'), 'Index Entry'); + $section->addField('DATE', array('dateformat' => 'd-M-yyyy'), array('PreserveFormat', 'LastUsedFormat')); + $section->addField('DATE', array(), array('LunarCalendar')); + $section->addField('DATE', array(), array('SakaEraCalendar')); + $section->addField('NUMPAGES', array('format' => 'roman', 'numformat' => '0,00'), array('SakaEraCalendar')); $doc = TestHelperDOCX::getDocument($phpWord); $element = '/w:document/w:body/w:p/w:r/w:instrText'; @@ -219,7 +219,7 @@ class ElementTest extends \PHPUnit_Framework_TestCase $text = new TextRun(); $text->addText('test string', array('bold' => true)); - $section->addField('XE', [], ['Bold', 'Italic'], $text); + $section->addField('XE', array(), array('Bold', 'Italic'), $text); $doc = TestHelperDOCX::getDocument($phpWord); $element = '/w:document/w:body/w:p/w:r[2]/w:instrText'; From 2b4b200e42d324e1b839c073632c2d458543a541 Mon Sep 17 00:00:00 2001 From: antoine Date: Sat, 17 Jun 2017 00:34:02 +0200 Subject: [PATCH 060/370] fix namespace --- src/PhpWord/Writer/Word2007/Element/Field.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Writer/Word2007/Element/Field.php b/src/PhpWord/Writer/Word2007/Element/Field.php index 5f5ae094..9fc45b21 100644 --- a/src/PhpWord/Writer/Word2007/Element/Field.php +++ b/src/PhpWord/Writer/Word2007/Element/Field.php @@ -64,7 +64,7 @@ class Field extends Text $xmlWriter->endElement(); // w:r if ($element->getText() != null) { - if ($element->getText() instanceof PhpOffice\PhpWord\Element\TextRun) { + if ($element->getText() instanceof \PhpOffice\PhpWord\Element\TextRun) { $containerWriter = new Container($xmlWriter, $element->getText(), true); $containerWriter->write(); From eff532e64fe4223dd8dbcb1d4bf2a70031749f4d Mon Sep 17 00:00:00 2001 From: antoine Date: Sat, 17 Jun 2017 01:01:54 +0200 Subject: [PATCH 061/370] make code php 5.3 -> 5.5 compatible --- src/PhpWord/SimpleType/FootnoteProperties.php | 64 +++++++++---------- .../SimpleType/FootnotePropertiesTest.php | 2 +- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/PhpWord/SimpleType/FootnoteProperties.php b/src/PhpWord/SimpleType/FootnoteProperties.php index 812c055f..f98f0a94 100644 --- a/src/PhpWord/SimpleType/FootnoteProperties.php +++ b/src/PhpWord/SimpleType/FootnoteProperties.php @@ -28,12 +28,6 @@ final class FootnoteProperties const RESTART_NUMBER_EACH_SECTION = 'eachSect'; const RESTART_NUMBER_EACH_PAGE = 'eachPage'; - const RESTART_NUMBER = array( - self::RESTART_NUMBER_CONTINUOUS, - self::RESTART_NUMBER_EACH_SECTION, - self::RESTART_NUMBER_EACH_PAGE - ); - const NUMBER_FORMAT_DECIMAL = 'decimal'; const NUMBER_FORMAT_UPPER_ROMAN = 'upperRoman'; const NUMBER_FORMAT_LOWER_ROMAN = 'lowerRoman'; @@ -45,31 +39,11 @@ final class FootnoteProperties const NUMBER_FORMAT_NONE = 'none'; const NUMBER_FORMAT_BULLET = 'bullet'; - const NUMBER_FORMAT = array( - self::NUMBER_FORMAT_DECIMAL, - self::NUMBER_FORMAT_UPPER_ROMAN, - self::NUMBER_FORMAT_LOWER_ROMAN, - self::NUMBER_FORMAT_UPPER_LETTER, - self::NUMBER_FORMAT_LOWER_LETTER, - self::NUMBER_FORMAT_ORDINAL, - self::NUMBER_FORMAT_CARDINAL_TEXT, - self::NUMBER_FORMAT_ORDINAL_TEXT, - self::NUMBER_FORMAT_NONE, - self::NUMBER_FORMAT_BULLET - ); - const POSITION_PAGE_BOTTOM = 'pageBottom'; const POSITION_BENEATH_TEXT = 'beneathText'; const POSITION_SECTION_END = 'sectEnd'; const POSITION_DOC_END = 'docEnd'; - const POSITION = array( - self::POSITION_PAGE_BOTTOM, - self::POSITION_BENEATH_TEXT, - self::POSITION_SECTION_END, - self::POSITION_DOC_END - ); - /** * Footnote Positioning Location * @@ -105,10 +79,17 @@ final class FootnoteProperties public function setPos($pos) { - if (in_array($pos, self::POSITION)) { + $position = array( + self::POSITION_PAGE_BOTTOM, + self::POSITION_BENEATH_TEXT, + self::POSITION_SECTION_END, + self::POSITION_DOC_END + ); + + if (in_array($pos, $position)) { $this->pos = $pos; } else { - throw new \InvalidArgumentException("Invalid value, on of " . implode(', ', self::POSITION) . " possible"); + throw new \InvalidArgumentException("Invalid value, on of " . implode(', ', $position) . " possible"); } } @@ -119,10 +100,23 @@ final class FootnoteProperties public function setNumFmt($numFmt) { - if (in_array($numFmt, self::NUMBER_FORMAT)) { + $numberFormat = array( + self::NUMBER_FORMAT_DECIMAL, + self::NUMBER_FORMAT_UPPER_ROMAN, + self::NUMBER_FORMAT_LOWER_ROMAN, + self::NUMBER_FORMAT_UPPER_LETTER, + self::NUMBER_FORMAT_LOWER_LETTER, + self::NUMBER_FORMAT_ORDINAL, + self::NUMBER_FORMAT_CARDINAL_TEXT, + self::NUMBER_FORMAT_ORDINAL_TEXT, + self::NUMBER_FORMAT_NONE, + self::NUMBER_FORMAT_BULLET + ); + + if (in_array($numFmt, $numberFormat)) { $this->numFmt = $numFmt; } else { - throw new \InvalidArgumentException("Invalid value, on of " . implode(', ', self::NUMBER_FORMAT) . " possible"); + throw new \InvalidArgumentException("Invalid value, on of " . implode(', ', $numberFormat) . " possible"); } } @@ -143,10 +137,16 @@ final class FootnoteProperties public function setNumRestart($numRestart) { - if (in_array($numRestart, self::RESTART_NUMBER)) { + $restartNumbers = array( + self::RESTART_NUMBER_CONTINUOUS, + self::RESTART_NUMBER_EACH_SECTION, + self::RESTART_NUMBER_EACH_PAGE + ); + + if (in_array($numRestart, $restartNumbers)) { $this->numRestart= $numRestart; } else { - throw new \InvalidArgumentException("Invalid value, on of " . implode(', ', self::RESTART_NUMBER) . " possible"); + throw new \InvalidArgumentException("Invalid value, on of " . implode(', ', $restartNumbers) . " possible"); } } } diff --git a/tests/PhpWord/SimpleType/FootnotePropertiesTest.php b/tests/PhpWord/SimpleType/FootnotePropertiesTest.php index 193ad363..f977b32a 100644 --- a/tests/PhpWord/SimpleType/FootnotePropertiesTest.php +++ b/tests/PhpWord/SimpleType/FootnotePropertiesTest.php @@ -15,7 +15,7 @@ * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ -namespace PhpOffice\PhpWord\Style; +namespace PhpOffice\PhpWord\SimpleType; use PhpOffice\PhpWord\SimpleType\FootnoteProperties; From e22ece8c003b428a0c08339dd9ac668d7d3c2c37 Mon Sep 17 00:00:00 2001 From: Hubert Miazek Date: Mon, 19 Jun 2017 11:05:59 +0200 Subject: [PATCH 062/370] #431 --- src/PhpWord/Writer/HTML/Element/Image.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/PhpWord/Writer/HTML/Element/Image.php b/src/PhpWord/Writer/HTML/Element/Image.php index 9c69d41f..646cb9a9 100644 --- a/src/PhpWord/Writer/HTML/Element/Image.php +++ b/src/PhpWord/Writer/HTML/Element/Image.php @@ -41,17 +41,15 @@ class Image extends Text $parentWriter = $this->parentWriter; $content = ''; - if (!$parentWriter->isPdf()) { - $imageData = $this->element->getImageStringData(true); - if ($imageData !== null) { - $styleWriter = new ImageStyleWriter($this->element->getStyle()); - $style = $styleWriter->write(); - $imageData = 'data:' . $this->element->getImageType() . ';base64,' . $imageData; + $imageData = $this->element->getImageStringData(true); + if ($imageData !== null) { + $styleWriter = new ImageStyleWriter($this->element->getStyle()); + $style = $styleWriter->write(); + $imageData = 'data:' . $this->element->getImageType() . ';base64,' . $imageData; - $content .= $this->writeOpening(); - $content .= ""; - $content .= $this->writeClosing(); - } + $content .= $this->writeOpening(); + $content .= ""; + $content .= $this->writeClosing(); } return $content; From aae9ad424947ef58a2f31542324c775a33e5f304 Mon Sep 17 00:00:00 2001 From: Andrey Tyshev Date: Mon, 19 Jun 2017 13:47:47 +0300 Subject: [PATCH 063/370] Fix names of styles --- src/PhpWord/Reader/Word2007/Document.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/PhpWord/Reader/Word2007/Document.php b/src/PhpWord/Reader/Word2007/Document.php index b89a99ad..e5063fd9 100644 --- a/src/PhpWord/Reader/Word2007/Document.php +++ b/src/PhpWord/Reader/Word2007/Document.php @@ -113,10 +113,10 @@ class Document extends AbstractPart 'orientation' => array(self::READ_VALUE, 'w:pgSz', 'w:orient'), 'colsNum' => array(self::READ_VALUE, 'w:cols', 'w:num'), 'colsSpace' => array(self::READ_VALUE, 'w:cols', 'w:space'), - 'topMargin' => array(self::READ_VALUE, 'w:pgMar', 'w:top'), - 'leftMargin' => array(self::READ_VALUE, 'w:pgMar', 'w:left'), - 'bottomMargin' => array(self::READ_VALUE, 'w:pgMar', 'w:bottom'), - 'rightMargin' => array(self::READ_VALUE, 'w:pgMar', 'w:right'), + 'marginTop' => array(self::READ_VALUE, 'w:pgMar', 'w:top'), + 'marginLeft' => array(self::READ_VALUE, 'w:pgMar', 'w:left'), + 'marginBottom' => array(self::READ_VALUE, 'w:pgMar', 'w:bottom'), + 'marginRight' => array(self::READ_VALUE, 'w:pgMar', 'w:right'), 'headerHeight' => array(self::READ_VALUE, 'w:pgMar', 'w:header'), 'footerHeight' => array(self::READ_VALUE, 'w:pgMar', 'w:footer'), 'gutter' => array(self::READ_VALUE, 'w:pgMar', 'w:gutter'), From 2074d35ab035323c27f6642aaa2d6d0ac79d253e Mon Sep 17 00:00:00 2001 From: Andrey Tyshev Date: Mon, 19 Jun 2017 13:51:41 +0300 Subject: [PATCH 064/370] Fix PreserveText in Section #452 --- src/PhpWord/Element/AbstractContainer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Element/AbstractContainer.php b/src/PhpWord/Element/AbstractContainer.php index a3872e0b..9d1267db 100644 --- a/src/PhpWord/Element/AbstractContainer.php +++ b/src/PhpWord/Element/AbstractContainer.php @@ -211,7 +211,7 @@ abstract class AbstractContainer extends AbstractElement 'TextBox' => array('Section', 'Header', 'Footer', 'Cell'), 'Footnote' => array('Section', 'TextRun', 'Cell'), 'Endnote' => array('Section', 'TextRun', 'Cell'), - 'PreserveText' => array('Header', 'Footer', 'Cell'), + 'PreserveText' => array('Section', 'Header', 'Footer', 'Cell'), 'Title' => array('Section'), 'TOC' => array('Section'), 'PageBreak' => array('Section'), From 8c3efa4a514759ac958213d7779c788a8ee4a49f Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 1 Jul 2017 16:56:33 +0200 Subject: [PATCH 065/370] remove unused variable --- src/PhpWord/Writer/HTML/Element/Image.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/PhpWord/Writer/HTML/Element/Image.php b/src/PhpWord/Writer/HTML/Element/Image.php index 646cb9a9..24e35957 100644 --- a/src/PhpWord/Writer/HTML/Element/Image.php +++ b/src/PhpWord/Writer/HTML/Element/Image.php @@ -37,9 +37,6 @@ class Image extends Text if (!$this->element instanceof ImageElement) { return ''; } - /** @var \PhpOffice\PhpWord\Writer\HTML $parentWriter Type hint */ - $parentWriter = $this->parentWriter; - $content = ''; $imageData = $this->element->getImageStringData(true); if ($imageData !== null) { From fd418e074621d035fe7b32664c6590b6156af949 Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 1 Jul 2017 17:15:50 +0200 Subject: [PATCH 066/370] Make sample php 5.3 compliant --- samples/Sample_09_Tables.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/samples/Sample_09_Tables.php b/samples/Sample_09_Tables.php index 53d32e08..e3edc605 100644 --- a/samples/Sample_09_Tables.php +++ b/samples/Sample_09_Tables.php @@ -107,22 +107,22 @@ $table->addCell(null, $cellRowContinue); $section->addPageBreak(); $section->addText('Table with colspan and rowspan', $header); -$styleTable = ['borderSize' => 6, 'borderColor' => '999999']; +$styleTable = array('borderSize' => 6, 'borderColor' => '999999'); $phpWord->addTableStyle('Colspan Rowspan', $styleTable); $table = $section->addTable('Colspan Rowspan'); $row = $table->addRow(); -$row->addCell(null, ['vMerge' => 'restart'])->addText('A'); -$row->addCell(null, ['gridSpan' => 2, 'vMerge' => 'restart',])->addText('B'); +$row->addCell(null, array('vMerge' => 'restart'))->addText('A'); +$row->addCell(null, array('gridSpan' => 2, 'vMerge' => 'restart',))->addText('B'); $row->addCell()->addText('1'); $row = $table->addRow(); -$row->addCell(null, ['vMerge' => 'continue']); -$row->addCell(null, ['vMerge' => 'continue','gridSpan' => 2,]); +$row->addCell(null, array('vMerge' => 'continue')); +$row->addCell(null, array('vMerge' => 'continue','gridSpan' => 2,)); $row->addCell()->addText('2'); $row = $table->addRow(); -$row->addCell(null, ['vMerge' => 'continue']); +$row->addCell(null, array('vMerge' => 'continue')); $row->addCell()->addText('C'); $row->addCell()->addText('D'); $row->addCell()->addText('3'); From d5dbfb98b031b2ddaabaedad2dca97634483a28f Mon Sep 17 00:00:00 2001 From: Maxim Barulin Date: Tue, 4 Apr 2017 11:35:48 +0300 Subject: [PATCH 067/370] add support for contextualSpacing attribute issue #1037 --- src/PhpWord/Style/Paragraph.php | 26 +++++++++++++++++++ .../Writer/Word2007/Style/Paragraph.php | 3 +++ 2 files changed, 29 insertions(+) diff --git a/src/PhpWord/Style/Paragraph.php b/src/PhpWord/Style/Paragraph.php index c6e60efb..ec23dce3 100644 --- a/src/PhpWord/Style/Paragraph.php +++ b/src/PhpWord/Style/Paragraph.php @@ -157,6 +157,13 @@ class Paragraph extends Border * @var \PhpOffice\PhpWord\Style\Shading */ private $shading; + + /** + * Do not add an interval between paragraphs of the same style + * + * @var bool + */ + private $contextualSpacing = true; /** * Set Style value @@ -208,6 +215,7 @@ class Paragraph extends Border ), 'tabs' => $this->getTabs(), 'shading' => $this->getShading(), + 'contextualSpacing' => $this->getContextualSpacing(), ); return $styles; @@ -731,4 +739,22 @@ class Paragraph extends Border return $this; } + + /** + * @return bool + */ + public function getContextualSpacing() + { + return $this->contextualSpacing; + } + + /** + * @param bool $contextualSpacing + */ + public function setContextualSpacing($contextualSpacing) + { + $this->contextualSpacing = $contextualSpacing; + + return $this; + } } diff --git a/src/PhpWord/Writer/Word2007/Style/Paragraph.php b/src/PhpWord/Writer/Word2007/Style/Paragraph.php index 2cb08bee..787f2a5f 100644 --- a/src/PhpWord/Writer/Word2007/Style/Paragraph.php +++ b/src/PhpWord/Writer/Word2007/Style/Paragraph.php @@ -106,6 +106,9 @@ class Paragraph extends AbstractStyle } $xmlWriter->endElement(); } + + //Paragraph contextualSpacing + $xmlWriter->writeElementIf($styles['contextualSpacing'] === true, 'w:contextualSpacing'); // Child style: alignment, indentation, spacing, and shading $this->writeChildStyle($xmlWriter, 'Indentation', $styles['indentation']); From 0f649f3f376cbeff390e21945d6b03cfb0aca7e6 Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 1 Jul 2017 22:51:53 +0200 Subject: [PATCH 068/370] Add test & update documentation --- docs/styles.rst | 1 + src/PhpWord/Style/Paragraph.php | 13 +++++-- tests/PhpWord/Style/ParagraphTest.php | 54 +++++++++++++++++---------- 3 files changed, 44 insertions(+), 24 deletions(-) diff --git a/docs/styles.rst b/docs/styles.rst index b71059a6..4f8a53fe 100644 --- a/docs/styles.rst +++ b/docs/styles.rst @@ -77,6 +77,7 @@ See ``\PhpOffice\PhpWord\SimpleType\Jc`` class for the details. - ``spaceAfter``. Space after paragraph. - ``tabs``. Set of custom tab stops. - ``widowControl``. Allow first/last line to display on a separate page, *true* or *false*. +- ``contextualSpacing``. Ignore Spacing Above and Below When Using Identical Styles, *true* or *false*. .. _table-style: diff --git a/src/PhpWord/Style/Paragraph.php b/src/PhpWord/Style/Paragraph.php index ec23dce3..a9b53b2b 100644 --- a/src/PhpWord/Style/Paragraph.php +++ b/src/PhpWord/Style/Paragraph.php @@ -159,11 +159,11 @@ class Paragraph extends Border private $shading; /** - * Do not add an interval between paragraphs of the same style + * Ignore Spacing Above and Below When Using Identical Styles * * @var bool */ - private $contextualSpacing = true; + private $contextualSpacing = false; /** * Set Style value @@ -215,7 +215,7 @@ class Paragraph extends Border ), 'tabs' => $this->getTabs(), 'shading' => $this->getShading(), - 'contextualSpacing' => $this->getContextualSpacing(), + 'contextualSpacing' => $this->hasContextualSpacing(), ); return $styles; @@ -741,15 +741,20 @@ class Paragraph extends Border } /** + * Get contextualSpacing + * * @return bool */ - public function getContextualSpacing() + public function hasContextualSpacing() { return $this->contextualSpacing; } /** + * Set contextualSpacing + * * @param bool $contextualSpacing + * @return self */ public function setContextualSpacing($contextualSpacing) { diff --git a/tests/PhpWord/Style/ParagraphTest.php b/tests/PhpWord/Style/ParagraphTest.php index c0096b0b..86d6e896 100644 --- a/tests/PhpWord/Style/ParagraphTest.php +++ b/tests/PhpWord/Style/ParagraphTest.php @@ -43,13 +43,14 @@ class ParagraphTest extends \PHPUnit_Framework_TestCase $object = new Paragraph(); $attributes = array( - 'widowControl' => true, - 'keepNext' => false, - 'keepLines' => false, - 'pageBreakBefore' => false, + 'widowControl' => true, + 'keepNext' => false, + 'keepLines' => false, + 'pageBreakBefore' => false, + 'contextualSpacing' => false, ); foreach ($attributes as $key => $default) { - $get = "get{$key}"; + $get = $this->findGetter($key, $default, $object); $object->setStyleValue($key, null); $this->assertEquals($default, $object->$get()); $object->setStyleValue($key, ''); @@ -65,22 +66,23 @@ class ParagraphTest extends \PHPUnit_Framework_TestCase $object = new Paragraph(); $attributes = array( - 'spaceAfter' => 240, - 'spaceBefore' => 240, - 'indent' => 1, - 'hanging' => 1, - 'spacing' => 120, - 'basedOn' => 'Normal', - 'next' => 'Normal', - 'numStyle' => 'numStyle', - 'numLevel' => 1, - 'widowControl' => false, - 'keepNext' => true, - 'keepLines' => true, - 'pageBreakBefore' => true, + 'spaceAfter' => 240, + 'spaceBefore' => 240, + 'indent' => 1, + 'hanging' => 1, + 'spacing' => 120, + 'basedOn' => 'Normal', + 'next' => 'Normal', + 'numStyle' => 'numStyle', + 'numLevel' => 1, + 'widowControl' => false, + 'keepNext' => true, + 'keepLines' => true, + 'pageBreakBefore' => true, + 'contextualSpacing' => true, ); foreach ($attributes as $key => $value) { - $get = "get{$key}"; + $get = $this->findGetter($key, $value, $object); $object->setStyleValue("$key", $value); if ('indent' == $key || 'hanging' == $key) { $value = $value * 720; @@ -91,6 +93,18 @@ class ParagraphTest extends \PHPUnit_Framework_TestCase } } + private function findGetter($key, $value, $object) + { + if (is_bool($value)) { + if (method_exists($object, "is{$key}")) { + return "is{$key}"; + } else if (method_exists($object, "has{$key}")) { + return "has{$key}"; + } + } + return "get{$key}"; + } + /** * Test get null style value */ @@ -100,7 +114,7 @@ class ParagraphTest extends \PHPUnit_Framework_TestCase $attributes = array('spacing', 'indent', 'hanging', 'spaceBefore', 'spaceAfter'); foreach ($attributes as $key) { - $get = "get{$key}"; + $get = $this->findGetter($key, null, $object); $this->assertNull($object->$get()); } } From e7c551a0bfe2b92befebf40a86f4645e540e108e Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 2 Jul 2017 00:37:29 +0200 Subject: [PATCH 069/370] Add possibility to show/hide spelling and grammatical errors (#985) * Add possibility to show/hide spelling and grammatical errors --- .gitignore | 3 +- docs/general.rst | 28 +++++++++- src/PhpWord/Settings.php | 52 +++++++++++++++++++ src/PhpWord/Writer/Word2007/Part/Settings.php | 2 + tests/PhpWord/SettingsTest.php | 14 +++++ .../Writer/Word2007/Part/SettingsTest.php | 45 ++++++++++++++-- 6 files changed, 137 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index e5deb643..98f65dbf 100644 --- a/.gitignore +++ b/.gitignore @@ -11,9 +11,10 @@ composer.lock composer.phar vendor /report +/build /samples/resources /samples/results /.settings phpword.ini /.buildpath -/.project \ No newline at end of file +/.project diff --git a/docs/general.rst b/docs/general.rst index 27d0448a..95340125 100644 --- a/docs/general.rst +++ b/docs/general.rst @@ -109,8 +109,8 @@ Zip class By default, PHPWord uses `Zip extension `__ to deal with ZIP compressed archives and files inside them. If you can't have Zip extension installed on your server, you can use pure PHP library -alternative, `PclZip `__, which -included with PHPWord. +alternative, `PclZip `__, which is +included in PHPWord. .. code-block:: php @@ -130,6 +130,17 @@ To turn it on set ``outputEscapingEnabled`` option to ``true`` in your PHPWord c \PhpOffice\PhpWord\Settings::setOutputEscapingEnabled(true); +Spelling and grammatical checks +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +By default spelling and grammatical errors are shown as soon as you open a word document. +For big documents this can slow down the opening of the document. You can hide the spelling and/or grammatical errors with: + +.. code-block:: php + + \PhpOffice\PhpWord\Settings::setSpellingErrorsHidden(true); + \PhpOffice\PhpWord\Settings::setGrammaticalErrorsHidden(true); + Default font ~~~~~~~~~~~~ @@ -183,3 +194,16 @@ points to twips. $sectionStyle->setMarginLeft(\PhpOffice\PhpWord\Shared\Converter::inchToTwip(.5)); // 2 cm right margin $sectionStyle->setMarginRight(\PhpOffice\PhpWord\Shared\Converter::cmToTwip(2)); + +Language +-------- + +You can hide spelling errors: + +.. code-block:: php + \PhpOffice\PhpWord\Settings::setSpellingErrorsHidden(true); + +And hide grammatical errors: + +.. code-block:: php + \PhpOffice\PhpWord\Settings::setGrammaticalErrorsHidden(true); diff --git a/src/PhpWord/Settings.php b/src/PhpWord/Settings.php index 3fbbb0a6..3da32cbb 100644 --- a/src/PhpWord/Settings.php +++ b/src/PhpWord/Settings.php @@ -119,6 +119,18 @@ class Settings */ private static $defaultFontSize = self::DEFAULT_FONT_SIZE; + /** + * Hide spelling errors + * @var boolean + */ + private static $spellingErrorsHidden = false; + + /** + * Hide grammatical errors + * @var boolean + */ + private static $grammaticalErrorsHidden = false; + /** * The user defined temporary directory. * @@ -416,6 +428,46 @@ class Settings return false; } + /** + * Are spelling errors hidden + * + * @return boolean + */ + public static function isSpellingErrorsHidden() + { + return self::$spellingErrorsHidden; + } + + /** + * Hide spelling errors + * + * @param boolean $spellingErrorsHidden + */ + public static function setSpellingErrorsHidden($spellingErrorsHidden) + { + self::$spellingErrorsHidden = $spellingErrorsHidden; + } + + /** + * Are grammatical errors hidden + * + * @return boolean + */ + public static function isGrammaticalErrorsHidden() + { + return self::$grammaticalErrorsHidden; + } + + /** + * Hide grammatical errors + * + * @param boolean $grammaticalErrorsHidden + */ + public static function setGrammaticalErrorsHidden($grammaticalErrorsHidden) + { + self::$grammaticalErrorsHidden = $grammaticalErrorsHidden; + } + /** * Load setting from phpword.yml or phpword.yml.dist * diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index 82669f91..72406462 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -107,6 +107,8 @@ class Settings extends AbstractPart 'w:characterSpacingControl' => array('@attributes' => array('w:val' => 'doNotCompress')), 'w:evenAndOddHeaders' => array('@attributes' => array('w:val' => DocumentSettings::isEvenAndOddHeaders() ? 'true': 'false')), 'w:themeFontLang' => array('@attributes' => array('w:val' => 'en-US')), + 'w:hideSpellingErrors' => array('@attributes' => array('w:val' => DocumentSettings::isSpellingErrorsHidden() ? 'true' : 'false')), + 'w:hideGrammaticalErrors' => array('@attributes' => array('w:val' => DocumentSettings::isGrammaticalErrorsHidden() ? 'true' : 'false')), 'w:decimalSymbol' => array('@attributes' => array('w:val' => '.')), 'w:listSeparator' => array('@attributes' => array('w:val' => ';')), 'w:compat' => array(), diff --git a/tests/PhpWord/SettingsTest.php b/tests/PhpWord/SettingsTest.php index 764fccd4..6347f424 100644 --- a/tests/PhpWord/SettingsTest.php +++ b/tests/PhpWord/SettingsTest.php @@ -114,6 +114,20 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertFalse(Settings::setDefaultFontSize(null)); } + /** + * Test set/get spelling and grammar + */ + public function testSetGetSpellingGrammar() + { + $this->assertFalse(Settings::isSpellingErrorsHidden()); + Settings::setSpellingErrorsHidden(true); + $this->assertTrue(Settings::isSpellingErrorsHidden()); + + $this->assertFalse(Settings::isGrammaticalErrorsHidden()); + Settings::setGrammaticalErrorsHidden(true); + $this->assertTrue(Settings::isGrammaticalErrorsHidden()); + } + /** * Test set/get even and odd headers */ diff --git a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php index be018f8c..13210fb7 100644 --- a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php @@ -68,6 +68,43 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertEquals($phpWord->getCompatibility()->getOoxmlVersion(), 15); } + /** + * Test language + */ + public function testLanguage() + { + $phpWord = new PhpWord(); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:themeFontLang'; + $this->assertTrue($doc->elementExists($path, $file)); + $element = $doc->getElement($path, $file); + + $this->assertEquals('en-US', $element->getAttribute('w:val')); + } + + /** + * Test spelling + */ + public function testSpelling() + { + $phpWord = new PhpWord(); + Settings::setSpellingErrorsHidden(true); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:hideSpellingErrors'; + $this->assertTrue($doc->elementExists($path, $file)); + $element = $doc->getElement($path, $file); + + $this->assertEquals('true', $element->getAttribute('w:val')); + } + /** * Test even and odd headers */ @@ -75,14 +112,14 @@ class SettingsTest extends \PHPUnit_Framework_TestCase { $phpWord = new PhpWord(); Settings::setEvenAndOddHeaders(true); - + $doc = TestHelperDOCX::getDocument($phpWord); - + $file = 'word/settings.xml'; - + $path = '/w:settings/w:evenAndOddHeaders'; $this->assertTrue($doc->elementExists($path, $file)); - + $element = $doc->getElement($path, $file); $this->assertEquals('true', $element->getAttribute('w:val')); } From ef956112036456a7f3fb22e0a0aba56985706e47 Mon Sep 17 00:00:00 2001 From: troosan Date: Mon, 3 Jul 2017 12:54:18 +0200 Subject: [PATCH 070/370] Fix multiple paragraphs being created --- src/PhpWord/Reader/Word2007/AbstractPart.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index f429ff75..51970a06 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -167,14 +167,11 @@ abstract class AbstractPart $parent->addTextBreak(null, $paragraphStyle); } else { $nodes = $xmlReader->getElements('*', $domNode); + if ($runLinkCount > 1) { + $parent = $parent->addTextRun($paragraphStyle); + } foreach ($nodes as $node) { - $this->readRun( - $xmlReader, - $node, - ($runLinkCount > 1) ? $parent->addTextRun($paragraphStyle) : $parent, - $docPart, - $paragraphStyle - ); + $this->readRun($xmlReader, $node, $parent, $docPart, $paragraphStyle); } } } From 8a5433e5df1f76d2bfa554b99e08e2bd79e05779 Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 4 Jul 2017 15:04:30 +0200 Subject: [PATCH 071/370] add new NumberFormat values and refactor other uses --- samples/Sample_06_Footnote.php | 5 +- .../FootnoteProperties.php | 89 ++++++---- src/PhpWord/Element/Section.php | 2 +- src/PhpWord/Shared/AbstractEnum.php | 35 ++++ src/PhpWord/SimpleType/NumberFormat.php | 153 ++++++++++++++++++ src/PhpWord/Style/NumberingLevel.php | 16 +- src/PhpWord/Writer/Word2007/Part/Document.php | 1 - .../FootnotePropertiesTest.php | 13 +- .../Writer/Word2007/Part/DocumentTest.php | 7 +- .../Writer/Word2007/Part/NumberingTest.php | 3 +- 10 files changed, 271 insertions(+), 53 deletions(-) rename src/PhpWord/{SimpleType => ComplexType}/FootnoteProperties.php (67%) create mode 100644 src/PhpWord/Shared/AbstractEnum.php create mode 100644 src/PhpWord/SimpleType/NumberFormat.php rename tests/PhpWord/{SimpleType => ComplexType}/FootnotePropertiesTest.php (83%) diff --git a/samples/Sample_06_Footnote.php b/samples/Sample_06_Footnote.php index f9c6b5f7..19d6a524 100644 --- a/samples/Sample_06_Footnote.php +++ b/samples/Sample_06_Footnote.php @@ -1,5 +1,6 @@ addFootnote(); $footnote->addText('The reference for this is wrapped in its own line'); $footnoteProperties = new FootnoteProperties(); -$footnoteProperties->setNumFmt(FootnoteProperties::NUMBER_FORMAT_UPPER_ROMAN); +$footnoteProperties->setNumFmt(NumberFormat::DECIMAL_ENCLOSED_CIRCLE); $section->setFootnoteProperties($footnoteProperties); // Save file diff --git a/src/PhpWord/SimpleType/FootnoteProperties.php b/src/PhpWord/ComplexType/FootnoteProperties.php similarity index 67% rename from src/PhpWord/SimpleType/FootnoteProperties.php rename to src/PhpWord/ComplexType/FootnoteProperties.php index f98f0a94..882834d5 100644 --- a/src/PhpWord/SimpleType/FootnoteProperties.php +++ b/src/PhpWord/ComplexType/FootnoteProperties.php @@ -14,7 +14,9 @@ * @copyright 2010-2016 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ -namespace PhpOffice\PhpWord\SimpleType; +namespace PhpOffice\PhpWord\ComplexType; + +use PhpOffice\PhpWord\SimpleType\NumberFormat; /** * Footnote properties @@ -28,17 +30,6 @@ final class FootnoteProperties const RESTART_NUMBER_EACH_SECTION = 'eachSect'; const RESTART_NUMBER_EACH_PAGE = 'eachPage'; - const NUMBER_FORMAT_DECIMAL = 'decimal'; - const NUMBER_FORMAT_UPPER_ROMAN = 'upperRoman'; - const NUMBER_FORMAT_LOWER_ROMAN = 'lowerRoman'; - const NUMBER_FORMAT_UPPER_LETTER = 'upperLetter'; - const NUMBER_FORMAT_LOWER_LETTER = 'lowerLetter'; - const NUMBER_FORMAT_ORDINAL = 'ordinal'; - const NUMBER_FORMAT_CARDINAL_TEXT = 'cardinalText'; - const NUMBER_FORMAT_ORDINAL_TEXT = 'ordinalText'; - const NUMBER_FORMAT_NONE = 'none'; - const NUMBER_FORMAT_BULLET = 'bullet'; - const POSITION_PAGE_BOTTOM = 'pageBottom'; const POSITION_BENEATH_TEXT = 'beneathText'; const POSITION_SECTION_END = 'sectEnd'; @@ -52,7 +43,7 @@ final class FootnoteProperties private $pos; /** - * Footnote Numbering Format + * Footnote Numbering Format w:numFmt, one of PhpOffice\PhpWord\SimpleType\NumberFormat * * @var string */ @@ -61,7 +52,7 @@ final class FootnoteProperties /** * Footnote and Endnote Numbering Starting Value * - * @var decimal + * @var double */ private $numStart; @@ -72,11 +63,23 @@ final class FootnoteProperties */ private $numRestart; + /** + * Get the Footnote Positioning Location + * + * @return string + */ public function getPos() { return $this->pos; } + /** + * Set the Footnote Positioning Location (pageBottom, beneathText, sectEnd, docEnd) + * + * @param string $pos + * @throws \InvalidArgumentException + * @return self + */ public function setPos($pos) { $position = array( @@ -91,50 +94,71 @@ final class FootnoteProperties } else { throw new \InvalidArgumentException("Invalid value, on of " . implode(', ', $position) . " possible"); } + return $this; } + /** + * Get the Footnote Numbering Format + * + * @return string + */ public function getNumFmt() { return $this->numFmt; } + /** + * Set the Footnote Numbering Format + * + * @param string $numFmt One of NumberFormat + * @return self + */ public function setNumFmt($numFmt) { - $numberFormat = array( - self::NUMBER_FORMAT_DECIMAL, - self::NUMBER_FORMAT_UPPER_ROMAN, - self::NUMBER_FORMAT_LOWER_ROMAN, - self::NUMBER_FORMAT_UPPER_LETTER, - self::NUMBER_FORMAT_LOWER_LETTER, - self::NUMBER_FORMAT_ORDINAL, - self::NUMBER_FORMAT_CARDINAL_TEXT, - self::NUMBER_FORMAT_ORDINAL_TEXT, - self::NUMBER_FORMAT_NONE, - self::NUMBER_FORMAT_BULLET - ); - - if (in_array($numFmt, $numberFormat)) { - $this->numFmt = $numFmt; - } else { - throw new \InvalidArgumentException("Invalid value, on of " . implode(', ', $numberFormat) . " possible"); - } + NumberFormat::validate($numFmt); + $this->numFmt = $numFmt; + return $this; } + /** + * Get the Footnote Numbering Format + * + * @return double + */ public function getNumStart() { return $this->numStart; } + /** + * Set the Footnote Numbering Format + * + * @param double $numStart + * @return self + */ public function setNumStart($numStart) { $this->numStart = $numStart; + return $this; } + /** + * Get the Footnote and Endnote Numbering Starting Value + * + * @return string + */ public function getNumRestart() { return $this->numRestart; } + /** + * Set the Footnote and Endnote Numbering Starting Value (continuous, eachSect, eachPage) + * + * @param string $numRestart + * @throws \InvalidArgumentException + * @return self + */ public function setNumRestart($numRestart) { $restartNumbers = array( @@ -148,5 +172,6 @@ final class FootnoteProperties } else { throw new \InvalidArgumentException("Invalid value, on of " . implode(', ', $restartNumbers) . " possible"); } + return $this; } } diff --git a/src/PhpWord/Element/Section.php b/src/PhpWord/Element/Section.php index c0bfc3cf..6e199bb9 100644 --- a/src/PhpWord/Element/Section.php +++ b/src/PhpWord/Element/Section.php @@ -17,8 +17,8 @@ namespace PhpOffice\PhpWord\Element; +use PhpOffice\PhpWord\ComplexType\FootnoteProperties; use PhpOffice\PhpWord\Style\Section as SectionStyle; -use PhpOffice\PhpWord\SimpleType\FootnoteProperties; class Section extends AbstractContainer { diff --git a/src/PhpWord/Shared/AbstractEnum.php b/src/PhpWord/Shared/AbstractEnum.php new file mode 100644 index 00000000..4584c2f9 --- /dev/null +++ b/src/PhpWord/Shared/AbstractEnum.php @@ -0,0 +1,35 @@ +getConstants(); + } + return self::$constCacheArray[$calledClass]; + } + + public static function values() + { + return array_values(self::getConstants()); + } + + public static function validate($value) + { + $values = array_values(self::getConstants()); + if (!in_array($value, $values, true)) { + $calledClass = get_called_class(); + throw new \InvalidArgumentException("$value is not a valid value for $calledClass, possible values are " . implode(', ', $values)); + } + } +} diff --git a/src/PhpWord/SimpleType/NumberFormat.php b/src/PhpWord/SimpleType/NumberFormat.php new file mode 100644 index 00000000..4c98dbef --- /dev/null +++ b/src/PhpWord/SimpleType/NumberFormat.php @@ -0,0 +1,153 @@ +format = $this->setEnumVal($value, $enum, $this->format); + $this->format = $this->setEnumVal($value, NumberFormat::values(), $this->format); return $this; } /** - * Get start + * Get restart * * @return integer */ @@ -201,7 +203,7 @@ class NumberingLevel extends AbstractStyle } /** - * Set start + * Set restart * * @param integer $value * @return self diff --git a/src/PhpWord/Writer/Word2007/Part/Document.php b/src/PhpWord/Writer/Word2007/Part/Document.php index a2dc999b..11e3f510 100644 --- a/src/PhpWord/Writer/Word2007/Part/Document.php +++ b/src/PhpWord/Writer/Word2007/Part/Document.php @@ -21,7 +21,6 @@ use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Element\Section; use PhpOffice\PhpWord\Writer\Word2007\Element\Container; use PhpOffice\PhpWord\Writer\Word2007\Style\Section as SectionStyleWriter; -use PhpOffice\PhpWord\SimpleType\FootnoteProperties; /** * Word2007 document part writer: word/document.xml diff --git a/tests/PhpWord/SimpleType/FootnotePropertiesTest.php b/tests/PhpWord/ComplexType/FootnotePropertiesTest.php similarity index 83% rename from tests/PhpWord/SimpleType/FootnotePropertiesTest.php rename to tests/PhpWord/ComplexType/FootnotePropertiesTest.php index f977b32a..025e8c91 100644 --- a/tests/PhpWord/SimpleType/FootnotePropertiesTest.php +++ b/tests/PhpWord/ComplexType/FootnotePropertiesTest.php @@ -15,9 +15,10 @@ * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ -namespace PhpOffice\PhpWord\SimpleType; +namespace PhpOffice\PhpWord\ComplexType; -use PhpOffice\PhpWord\SimpleType\FootnoteProperties; +use PhpOffice\PhpWord\ComplexType\FootnoteProperties; +use PhpOffice\PhpWord\SimpleType\NumberFormat; /** * Test class for PhpOffice\PhpWord\SimpleType\FootnoteProperties @@ -34,12 +35,12 @@ class FootnotePropertiesTest extends \PHPUnit_Framework_TestCase { $footnoteProp = new FootnoteProperties(); $footnoteProp->setPos(FootnoteProperties::POSITION_DOC_END); - $footnoteProp->setNumFmt(FootnoteProperties::NUMBER_FORMAT_LOWER_ROMAN); + $footnoteProp->setNumFmt(NumberFormat::LOWER_ROMAN); $footnoteProp->setNumStart(2); $footnoteProp->setNumRestart(FootnoteProperties::RESTART_NUMBER_EACH_PAGE); $this->assertEquals(FootnoteProperties::POSITION_DOC_END, $footnoteProp->getPos()); - $this->assertEquals(FootnoteProperties::NUMBER_FORMAT_LOWER_ROMAN, $footnoteProp->getNumFmt()); + $this->assertEquals(NumberFormat::LOWER_ROMAN, $footnoteProp->getNumFmt()); $this->assertEquals(2, $footnoteProp->getNumStart()); $this->assertEquals(FootnoteProperties::RESTART_NUMBER_EACH_PAGE, $footnoteProp->getNumRestart()); } @@ -52,7 +53,7 @@ class FootnotePropertiesTest extends \PHPUnit_Framework_TestCase public function testWrongPos() { $footnoteProp= new FootnoteProperties(); - $footnoteProp->setPos(FootnoteProperties::NUMBER_FORMAT_LOWER_ROMAN); + $footnoteProp->setPos(NumberFormat::LOWER_ROMAN); } /** @@ -74,6 +75,6 @@ class FootnotePropertiesTest extends \PHPUnit_Framework_TestCase public function testWrongNumRestart() { $footnoteProp= new FootnoteProperties(); - $footnoteProp->setNumRestart(FootnoteProperties::NUMBER_FORMAT_LOWER_ROMAN); + $footnoteProp->setNumRestart(NumberFormat::LOWER_ROMAN); } } diff --git a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php index 0f64d7a7..d45cde6b 100644 --- a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php @@ -16,11 +16,12 @@ */ namespace PhpOffice\PhpWord\Writer\Word2007\Part; +use PhpOffice\PhpWord\ComplexType\FootnoteProperties; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\SimpleType\Jc; use PhpOffice\PhpWord\Style\Font; use PhpOffice\PhpWord\TestHelperDOCX; -use PhpOffice\PhpWord\SimpleType\FootnoteProperties; +use PhpOffice\PhpWord\SimpleType\NumberFormat; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Document @@ -65,7 +66,7 @@ class DocumentTest extends \PHPUnit_Framework_TestCase { $properties = new FootnoteProperties(); $properties->setPos(FootnoteProperties::POSITION_DOC_END); - $properties->setNumFmt(FootnoteProperties::NUMBER_FORMAT_LOWER_ROMAN); + $properties->setNumFmt(NumberFormat::LOWER_ROMAN); $properties->setNumStart(1); $properties->setNumRestart(FootnoteProperties::RESTART_NUMBER_EACH_PAGE); @@ -79,7 +80,7 @@ class DocumentTest extends \PHPUnit_Framework_TestCase $this->assertEquals(FootnoteProperties::POSITION_DOC_END, $element->getAttribute('w:val')); $element = $doc->getElement('/w:document/w:body/w:sectPr/w:footnotePr/w:numFmt'); - $this->assertEquals(FootnoteProperties::NUMBER_FORMAT_LOWER_ROMAN, $element->getAttribute('w:val')); + $this->assertEquals(NumberFormat::LOWER_ROMAN, $element->getAttribute('w:val')); $element = $doc->getElement('/w:document/w:body/w:sectPr/w:footnotePr/w:numStart'); $this->assertEquals(1, $element->getAttribute('w:val')); diff --git a/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php b/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php index 9d11e5cb..bca4b562 100644 --- a/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php @@ -19,6 +19,7 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\SimpleType\Jc; use PhpOffice\PhpWord\TestHelperDOCX; +use PhpOffice\PhpWord\SimpleType\NumberFormat; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Numbering @@ -52,7 +53,7 @@ class NumberingTest extends \PHPUnit_Framework_TestCase 'levels' => array( array( 'start' => 1, - 'format' => 'decimal', + 'format' => NumberFormat::DECIMAL, 'restart' => 1, 'suffix' => 'space', 'text' => '%1.', From 21303ed4fb23b16fc8581aa4992ee6d668cbe478 Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 5 Jul 2017 21:39:22 +0200 Subject: [PATCH 072/370] prepare release notes --- .travis.yml | 2 ++ CHANGELOG.md | 22 ++++++++++++++++++++++ README.md | 4 ++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0712f734..06d7ec00 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,11 +6,13 @@ php: - 5.5 - 5.6 - 7.0 + - 7.1 - hhvm matrix: allow_failures: - php: 7.0 + - php: 7.1 - php: hhvm env: diff --git a/CHANGELOG.md b/CHANGELOG.md index 66f38dda..e1e0245f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,28 @@ Change Log All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +v0.14.0 (?? ???? 2017) +---------------------- +This release fixes several bugs and adds some new features + +### Added +- Possibility to control the footnote numbering - @troosan #1068 +- Image creation from string - @troosan #937 +- Introduced the `\PhpOffice\PhpWord\SimpleType\NumberFormat` simple type. - @troosan +- Support for ContextualSpacing - @postHawk #1088 +- Possiblity to hide spelling and/or grammatical errors - @troosan #542 + +### Fixed +- Images are not being printed when generating PDF - @hubertinio #1074 #431 +- Fixed some PHP 7 warnings - @ likeuntomurphy #927 +- Fixed Word 97 reader - @alsofronie @Benpxpx @mario-rivera #912 #920 #892 +- Fixed image loading over https - @troosan #988 +- Impossibility to set different even and odd page headers - @troosan #981 +- Fixed Word2007 reader where unnecessary paragraphs were being created - @donghaobo #1043 #620 +- Fixed Word2007 reader where margins were not being read correctly - @slowprog #885 #1008 +- Impossible to add element PreserveText in Section - @rvanlaak #452 +- Missing options for numbering format - @troosan #1041 + v0.13.0 (31 July 2016) ------------------- This release brings several improvements in `TemplateProcessor`, automatic output escaping feature for OOXML, ODF, HTML, and RTF (turned off, by default). diff --git a/README.md b/README.md index 18f4c55f..6b9f7dfa 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # ![PHPWord](https://rawgit.com/PHPOffice/PHPWord/develop/docs/images/phpword.svg "PHPWord") -## :mag_right: PHPWord is looking for a new maintainer :crown: :pencil: ([#948](https://github.com/PHPOffice/PHPWord/issues/948)) - [![Latest Stable Version](https://poser.pugx.org/phpoffice/phpword/v/stable.png)](https://packagist.org/packages/phpoffice/phpword) [![Build Status](https://travis-ci.org/PHPOffice/PHPWord.svg?branch=master)](https://travis-ci.org/PHPOffice/PHPWord) [![Code Quality](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/badges/quality-score.png?s=b5997ce59ac2816b4514f3a38de9900f6d492c1d)](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/) @@ -14,6 +12,8 @@ PHPWord is a library written in pure PHP that provides a set of classes to write PHPWord is an open source project licensed under the terms of [LGPL version 3](https://github.com/PHPOffice/PHPWord/blob/develop/COPYING.LESSER). PHPWord is aimed to be a high quality software product by incorporating [continuous integration](https://travis-ci.org/PHPOffice/PHPWord) and [unit testing](http://phpoffice.github.io/PHPWord/coverage/develop/). You can learn more about PHPWord by reading the [Developers' Documentation](http://phpword.readthedocs.org/) and the [API Documentation](http://phpoffice.github.io/PHPWord/docs/develop/). +If you have any questions, please ask on [StackOverFlow](https://stackoverflow.com/questions/tagged/phpword) + Read more about PHPWord: - [Features](#features) From e9cc289243a8ebb1891779f7bd88a19affe0d125 Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 5 Jul 2017 21:42:38 +0200 Subject: [PATCH 073/370] refactor Settings to not mix PHPWord settings and document settings --- docs/containers.rst | 6 + docs/general.rst | 4 +- src/PhpWord/Element/Footer.php | 2 +- src/PhpWord/Metadata/Settings.php | 131 ++++++++++++++++++ src/PhpWord/PhpWord.php | 17 ++- src/PhpWord/Settings.php | 75 ---------- src/PhpWord/SimpleType/NumberFormat.php | 2 - src/PhpWord/Writer/Word2007/Part/Settings.php | 33 +++-- tests/PhpWord/Metadata/SettingsTest.php | 69 +++++++++ tests/PhpWord/SettingsTest.php | 24 ---- .../Writer/Word2007/Part/SettingsTest.php | 6 +- 11 files changed, 252 insertions(+), 117 deletions(-) create mode 100644 src/PhpWord/Metadata/Settings.php create mode 100644 tests/PhpWord/Metadata/SettingsTest.php diff --git a/docs/containers.rst b/docs/containers.rst index f165a589..3569cc50 100644 --- a/docs/containers.rst +++ b/docs/containers.rst @@ -98,6 +98,12 @@ that are available for the footer. See "Footer" section for detail. Additionally, only inside of the header reference you can add watermarks or background pictures. See "Watermarks" section. +You can pass an optional parameter to specify where the header/footer should be applied, it can be + +- ``Footer::AUTO`` default, all pages except if overridden by first or even +- ``Footer::FIRST`` each first page of the section +- ``Footer::EVEN`` each even page of the section. Will only be applied if the evenAndOddHeaders is set to true in phpWord->settings + Footers ------- diff --git a/docs/general.rst b/docs/general.rst index 95340125..8e347089 100644 --- a/docs/general.rst +++ b/docs/general.rst @@ -138,8 +138,8 @@ For big documents this can slow down the opening of the document. You can hide t .. code-block:: php - \PhpOffice\PhpWord\Settings::setSpellingErrorsHidden(true); - \PhpOffice\PhpWord\Settings::setGrammaticalErrorsHidden(true); + $phpWord->getSettings()->setHideGrammaticalErrors(true); + $phpWord->getSettings()->setHideSpellingErrors(true); Default font ~~~~~~~~~~~~ diff --git a/src/PhpWord/Element/Footer.php b/src/PhpWord/Element/Footer.php index 01c6d25c..b3196f3f 100644 --- a/src/PhpWord/Element/Footer.php +++ b/src/PhpWord/Element/Footer.php @@ -26,7 +26,7 @@ class Footer extends AbstractContainer * Header/footer types constants * * @var string - * @link http://www.schemacentral.com/sc/ooxml/a-wtype-4.html Header or Footer Type + * @link http://www.datypic.com/sc/ooxml/t-w_ST_HdrFtr.html Header or Footer Type */ const AUTO = 'default'; // default and odd pages const FIRST = 'first'; diff --git a/src/PhpWord/Metadata/Settings.php b/src/PhpWord/Metadata/Settings.php new file mode 100644 index 00000000..ba6931a0 --- /dev/null +++ b/src/PhpWord/Metadata/Settings.php @@ -0,0 +1,131 @@ +documentProtection == null) { + $this->documentProtection = new Protection(); + } + return $this->documentProtection; + } + + /** + * @param Protection $documentProtection + */ + public function setDocumentProtection($documentProtection) + { + $this->documentProtection = $documentProtection; + } + + /** + * Are spelling errors hidden + * + * @return boolean + */ + public function hasHideSpellingErrors() + { + return $this->hideSpellingErrors; + } + + /** + * Hide spelling errors + * + * @param boolean $hideSpellingErrors + */ + public function setHideSpellingErrors($hideSpellingErrors) + { + $this->hideSpellingErrors = $hideSpellingErrors; + } + + /** + * Are grammatical errors hidden + * + * @return boolean + */ + public function hasHideGrammaticalErrors() + { + return $this->hideGrammaticalErrors; + } + + /** + * Hide grammatical errors + * + * @param boolean $hideGrammaticalErrors + */ + public function setHideGrammaticalErrors($hideGrammaticalErrors) + { + $this->hideGrammaticalErrors = $hideGrammaticalErrors; + } + + /** + * @return boolean + */ + public function hasEvenAndOddHeaders() + { + return $this->evenAndOddHeaders; + } + + /** + * @param boolean $evenAndOddHeaders + */ + public function setEvenAndOddHeaders($evenAndOddHeaders) + { + $this->evenAndOddHeaders = $evenAndOddHeaders; + } +} diff --git a/src/PhpWord/PhpWord.php b/src/PhpWord/PhpWord.php index 0fa76b2f..bb5b4956 100644 --- a/src/PhpWord/PhpWord.php +++ b/src/PhpWord/PhpWord.php @@ -91,7 +91,7 @@ class PhpWord } // Metadata - $metadata = array('DocInfo', 'Protection', 'Compatibility'); + $metadata = array('DocInfo', 'Settings', 'Compatibility'); foreach ($metadata as $meta) { $class = 'PhpOffice\\PhpWord\\Metadata\\' . $meta; $this->metadata[$meta] = new $class(); @@ -170,10 +170,12 @@ class PhpWord * * @return \PhpOffice\PhpWord\Metadata\Protection * @since 0.12.0 + * @deprecated Get the Document protection from PhpWord->getSettings()->getDocumentProtection(); + * @codeCoverageIgnore */ public function getProtection() { - return $this->metadata['Protection']; + return $this->getSettings()->getDocumentProtection(); } /** @@ -187,6 +189,17 @@ class PhpWord return $this->metadata['Compatibility']; } + /** + * Get compatibility + * + * @return \PhpOffice\PhpWord\Metadata\Settings + * @since 0.14.0 + */ + public function getSettings() + { + return $this->metadata['Settings']; + } + /** * Get all sections * diff --git a/src/PhpWord/Settings.php b/src/PhpWord/Settings.php index 3da32cbb..70fad3e8 100644 --- a/src/PhpWord/Settings.php +++ b/src/PhpWord/Settings.php @@ -119,18 +119,6 @@ class Settings */ private static $defaultFontSize = self::DEFAULT_FONT_SIZE; - /** - * Hide spelling errors - * @var boolean - */ - private static $spellingErrorsHidden = false; - - /** - * Hide grammatical errors - * @var boolean - */ - private static $grammaticalErrorsHidden = false; - /** * The user defined temporary directory. * @@ -146,13 +134,6 @@ class Settings */ private static $outputEscapingEnabled = false; - /** - * Enables different header for odd and even pages. - * - * @var bool - */ - private static $evenAndOddHeaders = false; - /** * Return the compatibility option used by the XMLWriter * @@ -359,22 +340,6 @@ class Settings self::$outputEscapingEnabled = $outputEscapingEnabled; } - /** - * @return boolean - */ - public static function isEvenAndOddHeaders() - { - return self::$evenAndOddHeaders; - } - - /** - * @param boolean $evenAndOddHeaders - */ - public static function setEvenAndOddHeaders($evenAndOddHeaders) - { - self::$evenAndOddHeaders = $evenAndOddHeaders; - } - /** * Get default font name * @@ -428,46 +393,6 @@ class Settings return false; } - /** - * Are spelling errors hidden - * - * @return boolean - */ - public static function isSpellingErrorsHidden() - { - return self::$spellingErrorsHidden; - } - - /** - * Hide spelling errors - * - * @param boolean $spellingErrorsHidden - */ - public static function setSpellingErrorsHidden($spellingErrorsHidden) - { - self::$spellingErrorsHidden = $spellingErrorsHidden; - } - - /** - * Are grammatical errors hidden - * - * @return boolean - */ - public static function isGrammaticalErrorsHidden() - { - return self::$grammaticalErrorsHidden; - } - - /** - * Hide grammatical errors - * - * @param boolean $grammaticalErrorsHidden - */ - public static function setGrammaticalErrorsHidden($grammaticalErrorsHidden) - { - self::$grammaticalErrorsHidden = $grammaticalErrorsHidden; - } - /** * Load setting from phpword.yml or phpword.yml.dist * diff --git a/src/PhpWord/SimpleType/NumberFormat.php b/src/PhpWord/SimpleType/NumberFormat.php index 4c98dbef..9d24a2b3 100644 --- a/src/PhpWord/SimpleType/NumberFormat.php +++ b/src/PhpWord/SimpleType/NumberFormat.php @@ -25,8 +25,6 @@ use PhpOffice\PhpWord\Shared\AbstractEnum; * @since 0.14.0 * * @see http://www.datypic.com/sc/ooxml/t-w_ST_NumberFormat.html. - * - * @codeCoverageIgnore */ final class NumberFormat extends AbstractEnum { diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index 72406462..602205e9 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -105,10 +105,7 @@ class Settings extends AbstractPart 'w:defaultTabStop' => array('@attributes' => array('w:val' => '708')), 'w:hyphenationZone' => array('@attributes' => array('w:val' => '425')), 'w:characterSpacingControl' => array('@attributes' => array('w:val' => 'doNotCompress')), - 'w:evenAndOddHeaders' => array('@attributes' => array('w:val' => DocumentSettings::isEvenAndOddHeaders() ? 'true': 'false')), 'w:themeFontLang' => array('@attributes' => array('w:val' => 'en-US')), - 'w:hideSpellingErrors' => array('@attributes' => array('w:val' => DocumentSettings::isSpellingErrorsHidden() ? 'true' : 'false')), - 'w:hideGrammaticalErrors' => array('@attributes' => array('w:val' => DocumentSettings::isGrammaticalErrorsHidden() ? 'true' : 'false')), 'w:decimalSymbol' => array('@attributes' => array('w:val' => '.')), 'w:listSeparator' => array('@attributes' => array('w:val' => ';')), 'w:compat' => array(), @@ -143,24 +140,44 @@ class Settings extends AbstractPart ), ); + /** @var \PhpOffice\PhpWord\Metadata\Settings $documentSettings */ + $documentSettings = $this->getParentWriter()->getPhpWord()->getSettings(); + + $this->setOnOffValue('w:hideSpellingErrors', $documentSettings->hasHideSpellingErrors()); + $this->setOnOffValue('w:hideGrammaticalErrors', $documentSettings->hasHideGrammaticalErrors()); + $this->setOnOffValue('w:evenAndOddHeaders', $documentSettings->hasEvenAndOddHeaders()); + // Other settings - $this->getProtection(); + $this->setDocumentProtection($documentSettings->getDocumentProtection()); $this->getCompatibility(); } + /** + * Adds a boolean attribute to the settings array + * + * @param string $settingName + * @param boolean $booleanValue + */ + private function setOnOffValue($settingName, $booleanValue) + { + if ($booleanValue !== null && is_bool($booleanValue)) { + $this->settings[$settingName] = array('@attributes' => array('w:val' => $booleanValue ? 'true': 'false')); + } + } + /** * Get protection settings. * + * @param \PhpOffice\PhpWord\Metadata\Settings $documentProtection * @return void */ - private function getProtection() + private function setDocumentProtection($documentProtection) { - $protection = $this->getParentWriter()->getPhpWord()->getProtection(); - if ($protection->getEditing() !== null) { + if ($documentProtection != null && $documentProtection->getEditing() !== null) { $this->settings['w:documentProtection'] = array( '@attributes' => array( 'w:enforcement' => 1, - 'w:edit' => $protection->getEditing(), + 'w:edit' => $documentProtection->getEditing(), ) ); } diff --git a/tests/PhpWord/Metadata/SettingsTest.php b/tests/PhpWord/Metadata/SettingsTest.php new file mode 100644 index 00000000..35c15edd --- /dev/null +++ b/tests/PhpWord/Metadata/SettingsTest.php @@ -0,0 +1,69 @@ +setEvenAndOddHeaders(true); + $this->assertEquals(true, $oSettings->hasEvenAndOddHeaders()); + } + + /** + * HideGrammaticalErrors + */ + public function testHideGrammaticalErrors() + { + $oSettings = new Settings(); + $oSettings->setHideGrammaticalErrors(true); + $this->assertEquals(true, $oSettings->hasHideGrammaticalErrors()); + } + + /** + * HideSpellingErrors + */ + public function testHideSpellingErrors() + { + $oSettings = new Settings(); + $oSettings->setHideSpellingErrors(true); + $this->assertEquals(true, $oSettings->hasHideSpellingErrors()); + } + + /** + * DocumentProtection + */ + public function testDocumentProtection() + { + $oSettings = new Settings(); + $oSettings->setDocumentProtection(new Protection()); + $this->assertNotNull($oSettings->getDocumentProtection()); + + $oSettings->getDocumentProtection()->setEditing('trackedChanges'); + $this->assertEquals('trackedChanges', $oSettings->getDocumentProtection()->getEditing()); + } +} diff --git a/tests/PhpWord/SettingsTest.php b/tests/PhpWord/SettingsTest.php index 6347f424..f5ac3ed6 100644 --- a/tests/PhpWord/SettingsTest.php +++ b/tests/PhpWord/SettingsTest.php @@ -114,30 +114,6 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertFalse(Settings::setDefaultFontSize(null)); } - /** - * Test set/get spelling and grammar - */ - public function testSetGetSpellingGrammar() - { - $this->assertFalse(Settings::isSpellingErrorsHidden()); - Settings::setSpellingErrorsHidden(true); - $this->assertTrue(Settings::isSpellingErrorsHidden()); - - $this->assertFalse(Settings::isGrammaticalErrorsHidden()); - Settings::setGrammaticalErrorsHidden(true); - $this->assertTrue(Settings::isGrammaticalErrorsHidden()); - } - - /** - * Test set/get even and odd headers - */ - public function testSetGetEvenAndOddHeaders() - { - $this->assertFalse(Settings::isEvenAndOddHeaders()); - Settings::setEvenAndOddHeaders(true); - $this->assertTrue(Settings::isEvenAndOddHeaders()); - } - /** * Test load config */ diff --git a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php index 13210fb7..fe6ea61c 100644 --- a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php @@ -41,7 +41,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase public function testDocumentProtection() { $phpWord = new PhpWord(); - $phpWord->getProtection()->setEditing('forms'); + $phpWord->getSettings()->getDocumentProtection()->setEditing('forms'); $doc = TestHelperDOCX::getDocument($phpWord); @@ -92,7 +92,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase public function testSpelling() { $phpWord = new PhpWord(); - Settings::setSpellingErrorsHidden(true); + $phpWord->getSettings()->setHideSpellingErrors(true); $doc = TestHelperDOCX::getDocument($phpWord); @@ -111,7 +111,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase public function testEvenAndOddHeaders() { $phpWord = new PhpWord(); - Settings::setEvenAndOddHeaders(true); + $phpWord->getSettings()->setEvenAndOddHeaders(true); $doc = TestHelperDOCX::getDocument($phpWord); From b919d58bac19be02cc7dc60bb6e1e51dcb667f8e Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 6 Jul 2017 22:41:04 +0200 Subject: [PATCH 074/370] add reader for settings --- src/PhpWord/Metadata/Settings.php | 6 +- src/PhpWord/Reader/Word2007.php | 1 + src/PhpWord/Reader/Word2007/Settings.php | 76 ++++++++++++++++++++++++ 3 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 src/PhpWord/Reader/Word2007/Settings.php diff --git a/src/PhpWord/Metadata/Settings.php b/src/PhpWord/Metadata/Settings.php index ba6931a0..d1d1f0ce 100644 --- a/src/PhpWord/Metadata/Settings.php +++ b/src/PhpWord/Metadata/Settings.php @@ -90,7 +90,7 @@ class Settings */ public function setHideSpellingErrors($hideSpellingErrors) { - $this->hideSpellingErrors = $hideSpellingErrors; + $this->hideSpellingErrors = $hideSpellingErrors === null ? true : $hideSpellingErrors; } /** @@ -110,7 +110,7 @@ class Settings */ public function setHideGrammaticalErrors($hideGrammaticalErrors) { - $this->hideGrammaticalErrors = $hideGrammaticalErrors; + $this->hideGrammaticalErrors = $hideGrammaticalErrors === null ? true : $hideGrammaticalErrors; } /** @@ -126,6 +126,6 @@ class Settings */ public function setEvenAndOddHeaders($evenAndOddHeaders) { - $this->evenAndOddHeaders = $evenAndOddHeaders; + $this->evenAndOddHeaders = $evenAndOddHeaders === null ? true : $evenAndOddHeaders; } } diff --git a/src/PhpWord/Reader/Word2007.php b/src/PhpWord/Reader/Word2007.php index da20eb87..875415a3 100644 --- a/src/PhpWord/Reader/Word2007.php +++ b/src/PhpWord/Reader/Word2007.php @@ -55,6 +55,7 @@ class Word2007 extends AbstractReader implements ReaderInterface array('stepPart' => 'document', 'stepItems' => array( 'endnotes' => 'Endnotes', 'footnotes' => 'Footnotes', + 'settings' => 'Settings', )), ); diff --git a/src/PhpWord/Reader/Word2007/Settings.php b/src/PhpWord/Reader/Word2007/Settings.php new file mode 100644 index 00000000..9ab8ee40 --- /dev/null +++ b/src/PhpWord/Reader/Word2007/Settings.php @@ -0,0 +1,76 @@ +getDomFromZip($this->docFile, $this->xmlFile); + + $docSettings = $phpWord->getSettings(); + + $nodes = $xmlReader->getElements('*'); + if ($nodes->length > 0) { + foreach ($nodes as $node) { + $name = str_replace('w:', '', $node->nodeName); + $value = $xmlReader->getAttribute('w:val', $node); + $method = 'set' . $name; + + if (in_array($name, $this::$booleanProperties)) { + if ($value == 'false') { + $docSettings->$method(false); + } else { + $docSettings->$method(true); + } + } else if (method_exists($this, $method)) { + $this->$method($xmlReader, $phpWord, $node); + } else if (method_exists($this, $method)) { + $docSettings->$method($value); + } + } + } + } + + private function setDocumentProtection(XMLReader $xmlReader, PhpWord $phpWord, \DOMNode $node) { + $documentProtection = $phpWord->getSettings()->getDocumentProtection(); + + $edit = $xmlReader->getAttribute('w:edit', $node); + $documentProtection->setEditing($edit); + } +} From 24c440b0abd5a9729f4e6a20dc0ca78b75915c4e Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 6 Jul 2017 22:54:28 +0200 Subject: [PATCH 075/370] disable 7.1 and hhvm build as they currently do not work --- .travis.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 06d7ec00..1a36b21b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,14 +6,12 @@ php: - 5.5 - 5.6 - 7.0 - - 7.1 - - hhvm +## - hhvm matrix: allow_failures: - php: 7.0 - - php: 7.1 - - php: hhvm +## - php: hhvm env: global: From 722c81d89defb9c8ac789daed511392538da31d2 Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 6 Jul 2017 23:03:07 +0200 Subject: [PATCH 076/370] fix md remarks --- src/PhpWord/Reader/Word2007/Settings.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/PhpWord/Reader/Word2007/Settings.php b/src/PhpWord/Reader/Word2007/Settings.php index 9ab8ee40..91153d70 100644 --- a/src/PhpWord/Reader/Word2007/Settings.php +++ b/src/PhpWord/Reader/Word2007/Settings.php @@ -19,7 +19,6 @@ namespace PhpOffice\PhpWord\Reader\Word2007; use PhpOffice\Common\XMLReader; use PhpOffice\PhpWord\PhpWord; -use PhpOffice\PhpWord\Metadata\Protection; /** * Settings reader @@ -30,7 +29,6 @@ class Settings extends AbstractPart { private static $booleanProperties = array('hideSpellingErrors', 'hideGrammaticalErrors', 'evenAndOddHeaders'); - private static $decimalProperties = array('zoom'); /** * Read settings.xml. @@ -67,7 +65,14 @@ class Settings extends AbstractPart } } - private function setDocumentProtection(XMLReader $xmlReader, PhpWord $phpWord, \DOMNode $node) { + /** + * Sets the document protection + * + * @param XMLReader $xmlReader + * @param PhpWord $phpWord + * @param \DOMNode $node + */ + protected function setDocumentProtection(XMLReader $xmlReader, PhpWord $phpWord, \DOMNode $node) { $documentProtection = $phpWord->getSettings()->getDocumentProtection(); $edit = $xmlReader->getAttribute('w:edit', $node); From 88cc13dd85d24e36a7f47e33779ba9b0a1a9976f Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 7 Jul 2017 08:02:31 +0200 Subject: [PATCH 077/370] fix --- src/PhpWord/Reader/Word2007/Settings.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/PhpWord/Reader/Word2007/Settings.php b/src/PhpWord/Reader/Word2007/Settings.php index 91153d70..df0d6dcf 100644 --- a/src/PhpWord/Reader/Word2007/Settings.php +++ b/src/PhpWord/Reader/Word2007/Settings.php @@ -72,7 +72,8 @@ class Settings extends AbstractPart * @param PhpWord $phpWord * @param \DOMNode $node */ - protected function setDocumentProtection(XMLReader $xmlReader, PhpWord $phpWord, \DOMNode $node) { + protected function setDocumentProtection(XMLReader $xmlReader, PhpWord $phpWord, \DOMNode $node) + { $documentProtection = $phpWord->getSettings()->getDocumentProtection(); $edit = $xmlReader->getAttribute('w:edit', $node); From 4c7c84b17e4a9f4a08b7d5080cfc8b41c670614e Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 9 Jul 2017 22:21:34 +0200 Subject: [PATCH 078/370] fix pclzip compatibility issues --- src/PhpWord/Shared/PCLZip/pclzip.lib.php | 10562 ++++++++++----------- 1 file changed, 5143 insertions(+), 5419 deletions(-) diff --git a/src/PhpWord/Shared/PCLZip/pclzip.lib.php b/src/PhpWord/Shared/PCLZip/pclzip.lib.php index 4e2a496f..0a69f687 100644 --- a/src/PhpWord/Shared/PCLZip/pclzip.lib.php +++ b/src/PhpWord/Shared/PCLZip/pclzip.lib.php @@ -25,4926 +25,2241 @@ // $Id: pclzip.lib.php,v 1.60 2009/09/30 21:01:04 vblavet Exp $ // -------------------------------------------------------------------------------- - // ----- Constants - if (!defined('PCLZIP_READ_BLOCK_SIZE')) { - define( 'PCLZIP_READ_BLOCK_SIZE', 2048 ); - } +// ----- Constants +if (!defined('PCLZIP_READ_BLOCK_SIZE')) { + define('PCLZIP_READ_BLOCK_SIZE', 2048); +} - // ----- File list separator - // In version 1.x of PclZip, the separator for file list is a space - // (which is not a very smart choice, specifically for windows paths !). - // A better separator should be a comma (,). This constant gives you the - // abilty to change that. - // However notice that changing this value, may have impact on existing - // scripts, using space separated filenames. - // Recommanded values for compatibility with older versions : - //define( 'PCLZIP_SEPARATOR', ' ' ); - // Recommanded values for smart separation of filenames. - if (!defined('PCLZIP_SEPARATOR')) { - define( 'PCLZIP_SEPARATOR', ',' ); - } +// ----- File list separator +// In version 1.x of PclZip, the separator for file list is a space +// (which is not a very smart choice, specifically for windows paths !). +// A better separator should be a comma (,). This constant gives you the +// abilty to change that. +// However notice that changing this value, may have impact on existing +// scripts, using space separated filenames. +// Recommanded values for compatibility with older versions : +//define( 'PCLZIP_SEPARATOR', ' ' ); +// Recommanded values for smart separation of filenames. +if (!defined('PCLZIP_SEPARATOR')) { + define('PCLZIP_SEPARATOR', ','); +} - // ----- Error configuration - // 0 : PclZip Class integrated error handling - // 1 : PclError external library error handling. By enabling this - // you must ensure that you have included PclError library. - // [2,...] : reserved for futur use - if (!defined('PCLZIP_ERROR_EXTERNAL')) { - define( 'PCLZIP_ERROR_EXTERNAL', 0 ); - } +// ----- Error configuration +// 0 : PclZip Class integrated error handling +// 1 : PclError external library error handling. By enabling this +// you must ensure that you have included PclError library. +// [2,...] : reserved for futur use +if (!defined('PCLZIP_ERROR_EXTERNAL')) { + define('PCLZIP_ERROR_EXTERNAL', 0); +} - // ----- Optional static temporary directory - // By default temporary files are generated in the script current - // path. - // If defined : - // - MUST BE terminated by a '/'. - // - MUST be a valid, already created directory - // Samples : - // define( 'PCLZIP_TEMPORARY_DIR', '/temp/' ); - // define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' ); - if (!defined('PCLZIP_TEMPORARY_DIR')) { - define( 'PCLZIP_TEMPORARY_DIR', '' ); - } +// ----- Optional static temporary directory +// By default temporary files are generated in the script current +// path. +// If defined : +// - MUST BE terminated by a '/'. +// - MUST be a valid, already created directory +// Samples : +// define( 'PCLZIP_TEMPORARY_DIR', '/temp/' ); +// define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' ); +if (!defined('PCLZIP_TEMPORARY_DIR')) { + define('PCLZIP_TEMPORARY_DIR', ''); +} - // ----- Optional threshold ratio for use of temporary files - // Pclzip sense the size of the file to add/extract and decide to - // use or not temporary file. The algorythm is looking for - // memory_limit of PHP and apply a ratio. - // threshold = memory_limit * ratio. - // Recommended values are under 0.5. Default 0.47. - // Samples : - // define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.5 ); - if (!defined('PCLZIP_TEMPORARY_FILE_RATIO')) { - define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.47 ); - } +// ----- Optional threshold ratio for use of temporary files +// Pclzip sense the size of the file to add/extract and decide to +// use or not temporary file. The algorythm is looking for +// memory_limit of PHP and apply a ratio. +// threshold = memory_limit * ratio. +// Recommended values are under 0.5. Default 0.47. +// Samples : +// define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.5 ); +if (!defined('PCLZIP_TEMPORARY_FILE_RATIO')) { + define('PCLZIP_TEMPORARY_FILE_RATIO', 0.47); +} // -------------------------------------------------------------------------------- // ***** UNDER THIS LINE NOTHING NEEDS TO BE MODIFIED ***** // -------------------------------------------------------------------------------- - // ----- Global variables - $g_pclzip_version = "2.8.2"; +// ----- Global variables +$g_pclzip_version = "2.8.2"; - // ----- Error codes - // -1 : Unable to open file in binary write mode - // -2 : Unable to open file in binary read mode - // -3 : Invalid parameters - // -4 : File does not exist - // -5 : Filename is too long (max. 255) - // -6 : Not a valid zip file - // -7 : Invalid extracted file size - // -8 : Unable to create directory - // -9 : Invalid archive extension - // -10 : Invalid archive format - // -11 : Unable to delete file (unlink) - // -12 : Unable to rename file (rename) - // -13 : Invalid header checksum - // -14 : Invalid archive size - define( 'PCLZIP_ERR_USER_ABORTED', 2 ); - define( 'PCLZIP_ERR_NO_ERROR', 0 ); - define( 'PCLZIP_ERR_WRITE_OPEN_FAIL', -1 ); - define( 'PCLZIP_ERR_READ_OPEN_FAIL', -2 ); - define( 'PCLZIP_ERR_INVALID_PARAMETER', -3 ); - define( 'PCLZIP_ERR_MISSING_FILE', -4 ); - define( 'PCLZIP_ERR_FILENAME_TOO_LONG', -5 ); - define( 'PCLZIP_ERR_INVALID_ZIP', -6 ); - define( 'PCLZIP_ERR_BAD_EXTRACTED_FILE', -7 ); - define( 'PCLZIP_ERR_DIR_CREATE_FAIL', -8 ); - define( 'PCLZIP_ERR_BAD_EXTENSION', -9 ); - define( 'PCLZIP_ERR_BAD_FORMAT', -10 ); - define( 'PCLZIP_ERR_DELETE_FILE_FAIL', -11 ); - define( 'PCLZIP_ERR_RENAME_FILE_FAIL', -12 ); - define( 'PCLZIP_ERR_BAD_CHECKSUM', -13 ); - define( 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14 ); - define( 'PCLZIP_ERR_MISSING_OPTION_VALUE', -15 ); - define( 'PCLZIP_ERR_INVALID_OPTION_VALUE', -16 ); - define( 'PCLZIP_ERR_ALREADY_A_DIRECTORY', -17 ); - define( 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', -18 ); - define( 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', -19 ); - define( 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', -20 ); - define( 'PCLZIP_ERR_DIRECTORY_RESTRICTION', -21 ); +// ----- Error codes +// -1 : Unable to open file in binary write mode +// -2 : Unable to open file in binary read mode +// -3 : Invalid parameters +// -4 : File does not exist +// -5 : Filename is too long (max. 255) +// -6 : Not a valid zip file +// -7 : Invalid extracted file size +// -8 : Unable to create directory +// -9 : Invalid archive extension +// -10 : Invalid archive format +// -11 : Unable to delete file (unlink) +// -12 : Unable to rename file (rename) +// -13 : Invalid header checksum +// -14 : Invalid archive size +define('PCLZIP_ERR_USER_ABORTED', 2); +define('PCLZIP_ERR_NO_ERROR', 0); +define('PCLZIP_ERR_WRITE_OPEN_FAIL', -1); +define('PCLZIP_ERR_READ_OPEN_FAIL', -2); +define('PCLZIP_ERR_INVALID_PARAMETER', -3); +define('PCLZIP_ERR_MISSING_FILE', -4); +define('PCLZIP_ERR_FILENAME_TOO_LONG', -5); +define('PCLZIP_ERR_INVALID_ZIP', -6); +define('PCLZIP_ERR_BAD_EXTRACTED_FILE', -7); +define('PCLZIP_ERR_DIR_CREATE_FAIL', -8); +define('PCLZIP_ERR_BAD_EXTENSION', -9); +define('PCLZIP_ERR_BAD_FORMAT', -10); +define('PCLZIP_ERR_DELETE_FILE_FAIL', -11); +define('PCLZIP_ERR_RENAME_FILE_FAIL', -12); +define('PCLZIP_ERR_BAD_CHECKSUM', -13); +define('PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14); +define('PCLZIP_ERR_MISSING_OPTION_VALUE', -15); +define('PCLZIP_ERR_INVALID_OPTION_VALUE', -16); +define('PCLZIP_ERR_ALREADY_A_DIRECTORY', -17); +define('PCLZIP_ERR_UNSUPPORTED_COMPRESSION', -18); +define('PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', -19); +define('PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', -20); +define('PCLZIP_ERR_DIRECTORY_RESTRICTION', -21); - // ----- Options values - define( 'PCLZIP_OPT_PATH', 77001 ); - define( 'PCLZIP_OPT_ADD_PATH', 77002 ); - define( 'PCLZIP_OPT_REMOVE_PATH', 77003 ); - define( 'PCLZIP_OPT_REMOVE_ALL_PATH', 77004 ); - define( 'PCLZIP_OPT_SET_CHMOD', 77005 ); - define( 'PCLZIP_OPT_EXTRACT_AS_STRING', 77006 ); - define( 'PCLZIP_OPT_NO_COMPRESSION', 77007 ); - define( 'PCLZIP_OPT_BY_NAME', 77008 ); - define( 'PCLZIP_OPT_BY_INDEX', 77009 ); - define( 'PCLZIP_OPT_BY_EREG', 77010 ); - define( 'PCLZIP_OPT_BY_PREG', 77011 ); - define( 'PCLZIP_OPT_COMMENT', 77012 ); - define( 'PCLZIP_OPT_ADD_COMMENT', 77013 ); - define( 'PCLZIP_OPT_PREPEND_COMMENT', 77014 ); - define( 'PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015 ); - define( 'PCLZIP_OPT_REPLACE_NEWER', 77016 ); - define( 'PCLZIP_OPT_STOP_ON_ERROR', 77017 ); - // Having big trouble with crypt. Need to multiply 2 long int - // which is not correctly supported by PHP ... - //define( 'PCLZIP_OPT_CRYPT', 77018 ); - define( 'PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019 ); - define( 'PCLZIP_OPT_TEMP_FILE_THRESHOLD', 77020 ); - define( 'PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD', 77020 ); // alias - define( 'PCLZIP_OPT_TEMP_FILE_ON', 77021 ); - define( 'PCLZIP_OPT_ADD_TEMP_FILE_ON', 77021 ); // alias - define( 'PCLZIP_OPT_TEMP_FILE_OFF', 77022 ); - define( 'PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022 ); // alias +// ----- Options values +define('PCLZIP_OPT_PATH', 77001); +define('PCLZIP_OPT_ADD_PATH', 77002); +define('PCLZIP_OPT_REMOVE_PATH', 77003); +define('PCLZIP_OPT_REMOVE_ALL_PATH', 77004); +define('PCLZIP_OPT_SET_CHMOD', 77005); +define('PCLZIP_OPT_EXTRACT_AS_STRING', 77006); +define('PCLZIP_OPT_NO_COMPRESSION', 77007); +define('PCLZIP_OPT_BY_NAME', 77008); +define('PCLZIP_OPT_BY_INDEX', 77009); +define('PCLZIP_OPT_BY_EREG', 77010); +define('PCLZIP_OPT_BY_PREG', 77011); +define('PCLZIP_OPT_COMMENT', 77012); +define('PCLZIP_OPT_ADD_COMMENT', 77013); +define('PCLZIP_OPT_PREPEND_COMMENT', 77014); +define('PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015); +define('PCLZIP_OPT_REPLACE_NEWER', 77016); +define('PCLZIP_OPT_STOP_ON_ERROR', 77017); +// Having big trouble with crypt. Need to multiply 2 long int +// which is not correctly supported by PHP ... +//define( 'PCLZIP_OPT_CRYPT', 77018 ); +define('PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019); +define('PCLZIP_OPT_TEMP_FILE_THRESHOLD', 77020); +define('PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD', 77020); // alias +define('PCLZIP_OPT_TEMP_FILE_ON', 77021); +define('PCLZIP_OPT_ADD_TEMP_FILE_ON', 77021); // alias +define('PCLZIP_OPT_TEMP_FILE_OFF', 77022); +define('PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022); // alias - // ----- File description attributes - define( 'PCLZIP_ATT_FILE_NAME', 79001 ); - define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 ); - define( 'PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003 ); - define( 'PCLZIP_ATT_FILE_MTIME', 79004 ); - define( 'PCLZIP_ATT_FILE_CONTENT', 79005 ); - define( 'PCLZIP_ATT_FILE_COMMENT', 79006 ); +// ----- File description attributes +define('PCLZIP_ATT_FILE_NAME', 79001); +define('PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002); +define('PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003); +define('PCLZIP_ATT_FILE_MTIME', 79004); +define('PCLZIP_ATT_FILE_CONTENT', 79005); +define('PCLZIP_ATT_FILE_COMMENT', 79006); - // ----- Call backs values - define( 'PCLZIP_CB_PRE_EXTRACT', 78001 ); - define( 'PCLZIP_CB_POST_EXTRACT', 78002 ); - define( 'PCLZIP_CB_PRE_ADD', 78003 ); - define( 'PCLZIP_CB_POST_ADD', 78004 ); - /* For futur use - define( 'PCLZIP_CB_PRE_LIST', 78005 ); - define( 'PCLZIP_CB_POST_LIST', 78006 ); - define( 'PCLZIP_CB_PRE_DELETE', 78007 ); - define( 'PCLZIP_CB_POST_DELETE', 78008 ); - */ +// ----- Call backs values +define('PCLZIP_CB_PRE_EXTRACT', 78001); +define('PCLZIP_CB_POST_EXTRACT', 78002); +define('PCLZIP_CB_PRE_ADD', 78003); +define('PCLZIP_CB_POST_ADD', 78004); +/* For futur use +define( 'PCLZIP_CB_PRE_LIST', 78005 ); +define( 'PCLZIP_CB_POST_LIST', 78006 ); +define( 'PCLZIP_CB_PRE_DELETE', 78007 ); +define( 'PCLZIP_CB_POST_DELETE', 78008 ); +*/ - // -------------------------------------------------------------------------------- - // Class : PclZip - // Description : - // PclZip is the class that represent a Zip archive. - // The public methods allow the manipulation of the archive. - // Attributes : - // Attributes must not be accessed directly. - // Methods : - // PclZip() : Object creator - // create() : Creates the Zip archive - // listContent() : List the content of the Zip archive - // extract() : Extract the content of the archive - // properties() : List the properties of the archive - // -------------------------------------------------------------------------------- - class PclZip - { +// -------------------------------------------------------------------------------- +// Class : PclZip +// Description : +// PclZip is the class that represent a Zip archive. +// The public methods allow the manipulation of the archive. +// Attributes : +// Attributes must not be accessed directly. +// Methods : +// PclZip() : Object creator +// create() : Creates the Zip archive +// listContent() : List the content of the Zip archive +// extract() : Extract the content of the archive +// properties() : List the properties of the archive +// -------------------------------------------------------------------------------- +class PclZip +{ // ----- Filename of the zip file - var $zipname = ''; + public $zipname = ''; // ----- File descriptor of the zip file - var $zip_fd = 0; + public $zip_fd = 0; // ----- Internal error handling - var $error_code = 1; - var $error_string = ''; + public $error_code = 1; + public $error_string = ''; // ----- Current status of the magic_quotes_runtime // This value store the php configuration for magic_quotes // The class can then disable the magic_quotes and reset it after - var $magic_quotes_status; + public $magic_quotes_status; - // -------------------------------------------------------------------------------- - // Function : PclZip() - // Description : - // Creates a PclZip object and set the name of the associated Zip archive - // filename. - // Note that no real action is taken, if the archive does not exist it is not - // created. Use create() for that. - // -------------------------------------------------------------------------------- - function PclZip($p_zipname) - { - - // ----- Tests the zlib - if (!function_exists('gzopen')) + // -------------------------------------------------------------------------------- + // Function : PclZip() + // Description : + // Creates a PclZip object and set the name of the associated Zip archive + // filename. + // Note that no real action is taken, if the archive does not exist it is not + // created. Use create() for that. + // -------------------------------------------------------------------------------- + public function __construct($p_zipname) { - die('Abort '.basename(__FILE__).' : Missing zlib extensions'); - } - // ----- Set the attributes - $this->zipname = $p_zipname; - $this->zip_fd = 0; - $this->magic_quotes_status = -1; - - // ----- Return - return; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : - // create($p_filelist, $p_add_dir="", $p_remove_dir="") - // create($p_filelist, $p_option, $p_option_value, ...) - // Description : - // This method supports two different synopsis. The first one is historical. - // This method creates a Zip Archive. The Zip file is created in the - // filesystem. The files and directories indicated in $p_filelist - // are added in the archive. See the parameters description for the - // supported format of $p_filelist. - // When a directory is in the list, the directory and its content is added - // in the archive. - // In this synopsis, the function takes an optional variable list of - // options. See bellow the supported options. - // Parameters : - // $p_filelist : An array containing file or directory names, or - // a string containing one filename or one directory name, or - // a string containing a list of filenames and/or directory - // names separated by spaces. - // $p_add_dir : A path to add before the real path of the archived file, - // in order to have it memorized in the archive. - // $p_remove_dir : A path to remove from the real path of the file to archive, - // in order to have a shorter path memorized in the archive. - // When $p_add_dir and $p_remove_dir are set, $p_remove_dir - // is removed first, before $p_add_dir is added. - // Options : - // PCLZIP_OPT_ADD_PATH : - // PCLZIP_OPT_REMOVE_PATH : - // PCLZIP_OPT_REMOVE_ALL_PATH : - // PCLZIP_OPT_COMMENT : - // PCLZIP_CB_PRE_ADD : - // PCLZIP_CB_POST_ADD : - // Return Values : - // 0 on failure, - // The list of the added files, with a status of the add action. - // (see PclZip::listContent() for list entry format) - // -------------------------------------------------------------------------------- - function create($p_filelist) - { - $v_result=1; - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Set default values - $v_options = array(); - $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE; - - // ----- Look for variable options arguments - $v_size = func_num_args(); - - // ----- Look for arguments - if ($v_size > 1) { - // ----- Get the arguments - $v_arg_list = func_get_args(); - - // ----- Remove from the options list the first argument - array_shift($v_arg_list); - $v_size--; - - // ----- Look for first arg - if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { - - // ----- Parse the options - $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, - array (PCLZIP_OPT_REMOVE_PATH => 'optional', - PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', - PCLZIP_OPT_ADD_PATH => 'optional', - PCLZIP_CB_PRE_ADD => 'optional', - PCLZIP_CB_POST_ADD => 'optional', - PCLZIP_OPT_NO_COMPRESSION => 'optional', - PCLZIP_OPT_COMMENT => 'optional', - PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', - PCLZIP_OPT_TEMP_FILE_ON => 'optional', - PCLZIP_OPT_TEMP_FILE_OFF => 'optional' - //, PCLZIP_OPT_CRYPT => 'optional' - )); - if ($v_result != 1) { - return 0; - } - } - - // ----- Look for 2 args - // Here we need to support the first historic synopsis of the - // method. - else { - - // ----- Get the first argument - $v_options[PCLZIP_OPT_ADD_PATH] = $v_arg_list[0]; - - // ----- Look for the optional second argument - if ($v_size == 2) { - $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1]; - } - else if ($v_size > 2) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, - "Invalid number / type of arguments"); - return 0; - } - } - } - - // ----- Look for default option values - $this->privOptionDefaultThreshold($v_options); - - // ----- Init - $v_string_list = array(); - $v_att_list = array(); - $v_filedescr_list = array(); - $p_result_list = array(); - - // ----- Look if the $p_filelist is really an array - if (is_array($p_filelist)) { - - // ----- Look if the first element is also an array - // This will mean that this is a file description entry - if (isset($p_filelist[0]) && is_array($p_filelist[0])) { - $v_att_list = $p_filelist; - } - - // ----- The list is a list of string names - else { - $v_string_list = $p_filelist; - } - } - - // ----- Look if the $p_filelist is a string - else if (is_string($p_filelist)) { - // ----- Create a list from the string - $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist); - } - - // ----- Invalid variable type for $p_filelist - else { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist"); - return 0; - } - - // ----- Reformat the string list - if (sizeof($v_string_list) != 0) { - foreach ($v_string_list as $v_string) { - if ($v_string != '') { - $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string; - } - else { - } - } - } - - // ----- For each file in the list check the attributes - $v_supported_attributes - = array ( PCLZIP_ATT_FILE_NAME => 'mandatory' - ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional' - ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional' - ,PCLZIP_ATT_FILE_MTIME => 'optional' - ,PCLZIP_ATT_FILE_CONTENT => 'optional' - ,PCLZIP_ATT_FILE_COMMENT => 'optional' - ); - foreach ($v_att_list as $v_entry) { - $v_result = $this->privFileDescrParseAtt($v_entry, - $v_filedescr_list[], - $v_options, - $v_supported_attributes); - if ($v_result != 1) { - return 0; - } - } - - // ----- Expand the filelist (expand directories) - $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options); - if ($v_result != 1) { - return 0; - } - - // ----- Call the create fct - $v_result = $this->privCreate($v_filedescr_list, $p_result_list, $v_options); - if ($v_result != 1) { - return 0; - } - - // ----- Return - return $p_result_list; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : - // add($p_filelist, $p_add_dir="", $p_remove_dir="") - // add($p_filelist, $p_option, $p_option_value, ...) - // Description : - // This method supports two synopsis. The first one is historical. - // This methods add the list of files in an existing archive. - // If a file with the same name already exists, it is added at the end of the - // archive, the first one is still present. - // If the archive does not exist, it is created. - // Parameters : - // $p_filelist : An array containing file or directory names, or - // a string containing one filename or one directory name, or - // a string containing a list of filenames and/or directory - // names separated by spaces. - // $p_add_dir : A path to add before the real path of the archived file, - // in order to have it memorized in the archive. - // $p_remove_dir : A path to remove from the real path of the file to archive, - // in order to have a shorter path memorized in the archive. - // When $p_add_dir and $p_remove_dir are set, $p_remove_dir - // is removed first, before $p_add_dir is added. - // Options : - // PCLZIP_OPT_ADD_PATH : - // PCLZIP_OPT_REMOVE_PATH : - // PCLZIP_OPT_REMOVE_ALL_PATH : - // PCLZIP_OPT_COMMENT : - // PCLZIP_OPT_ADD_COMMENT : - // PCLZIP_OPT_PREPEND_COMMENT : - // PCLZIP_CB_PRE_ADD : - // PCLZIP_CB_POST_ADD : - // Return Values : - // 0 on failure, - // The list of the added files, with a status of the add action. - // (see PclZip::listContent() for list entry format) - // -------------------------------------------------------------------------------- - function add($p_filelist) - { - $v_result=1; - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Set default values - $v_options = array(); - $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE; - - // ----- Look for variable options arguments - $v_size = func_num_args(); - - // ----- Look for arguments - if ($v_size > 1) { - // ----- Get the arguments - $v_arg_list = func_get_args(); - - // ----- Remove form the options list the first argument - array_shift($v_arg_list); - $v_size--; - - // ----- Look for first arg - if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { - - // ----- Parse the options - $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, - array (PCLZIP_OPT_REMOVE_PATH => 'optional', - PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', - PCLZIP_OPT_ADD_PATH => 'optional', - PCLZIP_CB_PRE_ADD => 'optional', - PCLZIP_CB_POST_ADD => 'optional', - PCLZIP_OPT_NO_COMPRESSION => 'optional', - PCLZIP_OPT_COMMENT => 'optional', - PCLZIP_OPT_ADD_COMMENT => 'optional', - PCLZIP_OPT_PREPEND_COMMENT => 'optional', - PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', - PCLZIP_OPT_TEMP_FILE_ON => 'optional', - PCLZIP_OPT_TEMP_FILE_OFF => 'optional' - //, PCLZIP_OPT_CRYPT => 'optional' - )); - if ($v_result != 1) { - return 0; - } - } - - // ----- Look for 2 args - // Here we need to support the first historic synopsis of the - // method. - else { - - // ----- Get the first argument - $v_options[PCLZIP_OPT_ADD_PATH] = $v_add_path = $v_arg_list[0]; - - // ----- Look for the optional second argument - if ($v_size == 2) { - $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1]; - } - else if ($v_size > 2) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); - - // ----- Return - return 0; - } - } - } - - // ----- Look for default option values - $this->privOptionDefaultThreshold($v_options); - - // ----- Init - $v_string_list = array(); - $v_att_list = array(); - $v_filedescr_list = array(); - $p_result_list = array(); - - // ----- Look if the $p_filelist is really an array - if (is_array($p_filelist)) { - - // ----- Look if the first element is also an array - // This will mean that this is a file description entry - if (isset($p_filelist[0]) && is_array($p_filelist[0])) { - $v_att_list = $p_filelist; - } - - // ----- The list is a list of string names - else { - $v_string_list = $p_filelist; - } - } - - // ----- Look if the $p_filelist is a string - else if (is_string($p_filelist)) { - // ----- Create a list from the string - $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist); - } - - // ----- Invalid variable type for $p_filelist - else { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '".gettype($p_filelist)."' for p_filelist"); - return 0; - } - - // ----- Reformat the string list - if (sizeof($v_string_list) != 0) { - foreach ($v_string_list as $v_string) { - $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string; - } - } - - // ----- For each file in the list check the attributes - $v_supported_attributes - = array ( PCLZIP_ATT_FILE_NAME => 'mandatory' - ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional' - ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional' - ,PCLZIP_ATT_FILE_MTIME => 'optional' - ,PCLZIP_ATT_FILE_CONTENT => 'optional' - ,PCLZIP_ATT_FILE_COMMENT => 'optional' - ); - foreach ($v_att_list as $v_entry) { - $v_result = $this->privFileDescrParseAtt($v_entry, - $v_filedescr_list[], - $v_options, - $v_supported_attributes); - if ($v_result != 1) { - return 0; - } - } - - // ----- Expand the filelist (expand directories) - $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options); - if ($v_result != 1) { - return 0; - } - - // ----- Call the create fct - $v_result = $this->privAdd($v_filedescr_list, $p_result_list, $v_options); - if ($v_result != 1) { - return 0; - } - - // ----- Return - return $p_result_list; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : listContent() - // Description : - // This public method, gives the list of the files and directories, with their - // properties. - // The properties of each entries in the list are (used also in other functions) : - // filename : Name of the file. For a create or add action it is the filename - // given by the user. For an extract function it is the filename - // of the extracted file. - // stored_filename : Name of the file / directory stored in the archive. - // size : Size of the stored file. - // compressed_size : Size of the file's data compressed in the archive - // (without the headers overhead) - // mtime : Last known modification date of the file (UNIX timestamp) - // comment : Comment associated with the file - // folder : true | false - // index : index of the file in the archive - // status : status of the action (depending of the action) : - // Values are : - // ok : OK ! - // filtered : the file / dir is not extracted (filtered by user) - // already_a_directory : the file can not be extracted because a - // directory with the same name already exists - // write_protected : the file can not be extracted because a file - // with the same name already exists and is - // write protected - // newer_exist : the file was not extracted because a newer file exists - // path_creation_fail : the file is not extracted because the folder - // does not exist and can not be created - // write_error : the file was not extracted because there was a - // error while writing the file - // read_error : the file was not extracted because there was a error - // while reading the file - // invalid_header : the file was not extracted because of an archive - // format error (bad file header) - // Note that each time a method can continue operating when there - // is an action error on a file, the error is only logged in the file status. - // Return Values : - // 0 on an unrecoverable failure, - // The list of the files in the archive. - // -------------------------------------------------------------------------------- - function listContent() - { - $v_result=1; - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Check archive - if (!$this->privCheckFormat()) { - return(0); - } - - // ----- Call the extracting fct - $p_list = array(); - if (($v_result = $this->privList($p_list)) != 1) - { - unset($p_list); - return(0); - } - - // ----- Return - return $p_list; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : - // extract($p_path="./", $p_remove_path="") - // extract([$p_option, $p_option_value, ...]) - // Description : - // This method supports two synopsis. The first one is historical. - // This method extract all the files / directories from the archive to the - // folder indicated in $p_path. - // If you want to ignore the 'root' part of path of the memorized files - // you can indicate this in the optional $p_remove_path parameter. - // By default, if a newer file with the same name already exists, the - // file is not extracted. - // - // If both PCLZIP_OPT_PATH and PCLZIP_OPT_ADD_PATH aoptions - // are used, the path indicated in PCLZIP_OPT_ADD_PATH is append - // at the end of the path value of PCLZIP_OPT_PATH. - // Parameters : - // $p_path : Path where the files and directories are to be extracted - // $p_remove_path : First part ('root' part) of the memorized path - // (if any similar) to remove while extracting. - // Options : - // PCLZIP_OPT_PATH : - // PCLZIP_OPT_ADD_PATH : - // PCLZIP_OPT_REMOVE_PATH : - // PCLZIP_OPT_REMOVE_ALL_PATH : - // PCLZIP_CB_PRE_EXTRACT : - // PCLZIP_CB_POST_EXTRACT : - // Return Values : - // 0 or a negative value on failure, - // The list of the extracted files, with a status of the action. - // (see PclZip::listContent() for list entry format) - // -------------------------------------------------------------------------------- - function extract() - { - $v_result=1; - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Check archive - if (!$this->privCheckFormat()) { - return(0); - } - - // ----- Set default values - $v_options = array(); -// $v_path = "./"; - $v_path = ''; - $v_remove_path = ""; - $v_remove_all_path = false; - - // ----- Look for variable options arguments - $v_size = func_num_args(); - - // ----- Default values for option - $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE; - - // ----- Look for arguments - if ($v_size > 0) { - // ----- Get the arguments - $v_arg_list = func_get_args(); - - // ----- Look for first arg - if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { - - // ----- Parse the options - $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, - array (PCLZIP_OPT_PATH => 'optional', - PCLZIP_OPT_REMOVE_PATH => 'optional', - PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', - PCLZIP_OPT_ADD_PATH => 'optional', - PCLZIP_CB_PRE_EXTRACT => 'optional', - PCLZIP_CB_POST_EXTRACT => 'optional', - PCLZIP_OPT_SET_CHMOD => 'optional', - PCLZIP_OPT_BY_NAME => 'optional', - PCLZIP_OPT_BY_EREG => 'optional', - PCLZIP_OPT_BY_PREG => 'optional', - PCLZIP_OPT_BY_INDEX => 'optional', - PCLZIP_OPT_EXTRACT_AS_STRING => 'optional', - PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional', - PCLZIP_OPT_REPLACE_NEWER => 'optional' - ,PCLZIP_OPT_STOP_ON_ERROR => 'optional' - ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional', - PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', - PCLZIP_OPT_TEMP_FILE_ON => 'optional', - PCLZIP_OPT_TEMP_FILE_OFF => 'optional' - )); - if ($v_result != 1) { - return 0; + // ----- Tests the zlib + if (!function_exists('gzopen')) { + die('Abort ' . basename(__FILE__) . ' : Missing zlib extensions'); } - // ----- Set the arguments - if (isset($v_options[PCLZIP_OPT_PATH])) { - $v_path = $v_options[PCLZIP_OPT_PATH]; - } - if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) { - $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH]; - } - if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) { - $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH]; - } - if (isset($v_options[PCLZIP_OPT_ADD_PATH])) { - // ----- Check for '/' in last path char - if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) { - $v_path .= '/'; - } - $v_path .= $v_options[PCLZIP_OPT_ADD_PATH]; - } - } - - // ----- Look for 2 args - // Here we need to support the first historic synopsis of the - // method. - else { - - // ----- Get the first argument - $v_path = $v_arg_list[0]; - - // ----- Look for the optional second argument - if ($v_size == 2) { - $v_remove_path = $v_arg_list[1]; - } - else if ($v_size > 2) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); - - // ----- Return - return 0; - } - } - } - - // ----- Look for default option values - $this->privOptionDefaultThreshold($v_options); - - // ----- Trace - - // ----- Call the extracting fct - $p_list = array(); - $v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, - $v_remove_all_path, $v_options); - if ($v_result < 1) { - unset($p_list); - return(0); - } - - // ----- Return - return $p_list; - } - // -------------------------------------------------------------------------------- - - - // -------------------------------------------------------------------------------- - // Function : - // extractByIndex($p_index, $p_path="./", $p_remove_path="") - // extractByIndex($p_index, [$p_option, $p_option_value, ...]) - // Description : - // This method supports two synopsis. The first one is historical. - // This method is doing a partial extract of the archive. - // The extracted files or folders are identified by their index in the - // archive (from 0 to n). - // Note that if the index identify a folder, only the folder entry is - // extracted, not all the files included in the archive. - // Parameters : - // $p_index : A single index (integer) or a string of indexes of files to - // extract. The form of the string is "0,4-6,8-12" with only numbers - // and '-' for range or ',' to separate ranges. No spaces or ';' - // are allowed. - // $p_path : Path where the files and directories are to be extracted - // $p_remove_path : First part ('root' part) of the memorized path - // (if any similar) to remove while extracting. - // Options : - // PCLZIP_OPT_PATH : - // PCLZIP_OPT_ADD_PATH : - // PCLZIP_OPT_REMOVE_PATH : - // PCLZIP_OPT_REMOVE_ALL_PATH : - // PCLZIP_OPT_EXTRACT_AS_STRING : The files are extracted as strings and - // not as files. - // The resulting content is in a new field 'content' in the file - // structure. - // This option must be used alone (any other options are ignored). - // PCLZIP_CB_PRE_EXTRACT : - // PCLZIP_CB_POST_EXTRACT : - // Return Values : - // 0 on failure, - // The list of the extracted files, with a status of the action. - // (see PclZip::listContent() for list entry format) - // -------------------------------------------------------------------------------- - //function extractByIndex($p_index, options...) - function extractByIndex($p_index) - { - $v_result=1; - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Check archive - if (!$this->privCheckFormat()) { - return(0); - } - - // ----- Set default values - $v_options = array(); -// $v_path = "./"; - $v_path = ''; - $v_remove_path = ""; - $v_remove_all_path = false; - - // ----- Look for variable options arguments - $v_size = func_num_args(); - - // ----- Default values for option - $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE; - - // ----- Look for arguments - if ($v_size > 1) { - // ----- Get the arguments - $v_arg_list = func_get_args(); - - // ----- Remove form the options list the first argument - array_shift($v_arg_list); - $v_size--; - - // ----- Look for first arg - if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { - - // ----- Parse the options - $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, - array (PCLZIP_OPT_PATH => 'optional', - PCLZIP_OPT_REMOVE_PATH => 'optional', - PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', - PCLZIP_OPT_EXTRACT_AS_STRING => 'optional', - PCLZIP_OPT_ADD_PATH => 'optional', - PCLZIP_CB_PRE_EXTRACT => 'optional', - PCLZIP_CB_POST_EXTRACT => 'optional', - PCLZIP_OPT_SET_CHMOD => 'optional', - PCLZIP_OPT_REPLACE_NEWER => 'optional' - ,PCLZIP_OPT_STOP_ON_ERROR => 'optional' - ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional', - PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', - PCLZIP_OPT_TEMP_FILE_ON => 'optional', - PCLZIP_OPT_TEMP_FILE_OFF => 'optional' - )); - if ($v_result != 1) { - return 0; - } - - // ----- Set the arguments - if (isset($v_options[PCLZIP_OPT_PATH])) { - $v_path = $v_options[PCLZIP_OPT_PATH]; - } - if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) { - $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH]; - } - if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) { - $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH]; - } - if (isset($v_options[PCLZIP_OPT_ADD_PATH])) { - // ----- Check for '/' in last path char - if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) { - $v_path .= '/'; - } - $v_path .= $v_options[PCLZIP_OPT_ADD_PATH]; - } - if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) { - $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE; - } - else { - } - } - - // ----- Look for 2 args - // Here we need to support the first historic synopsis of the - // method. - else { - - // ----- Get the first argument - $v_path = $v_arg_list[0]; - - // ----- Look for the optional second argument - if ($v_size == 2) { - $v_remove_path = $v_arg_list[1]; - } - else if ($v_size > 2) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); - - // ----- Return - return 0; - } - } - } - - // ----- Trace - - // ----- Trick - // Here I want to reuse extractByRule(), so I need to parse the $p_index - // with privParseOptions() - $v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index); - $v_options_trick = array(); - $v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick, - array (PCLZIP_OPT_BY_INDEX => 'optional' )); - if ($v_result != 1) { - return 0; - } - $v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX]; - - // ----- Look for default option values - $this->privOptionDefaultThreshold($v_options); - - // ----- Call the extracting fct - if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) { - return(0); - } - - // ----- Return - return $p_list; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : - // delete([$p_option, $p_option_value, ...]) - // Description : - // This method removes files from the archive. - // If no parameters are given, then all the archive is emptied. - // Parameters : - // None or optional arguments. - // Options : - // PCLZIP_OPT_BY_INDEX : - // PCLZIP_OPT_BY_NAME : - // PCLZIP_OPT_BY_EREG : - // PCLZIP_OPT_BY_PREG : - // Return Values : - // 0 on failure, - // The list of the files which are still present in the archive. - // (see PclZip::listContent() for list entry format) - // -------------------------------------------------------------------------------- - function delete() - { - $v_result=1; - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Check archive - if (!$this->privCheckFormat()) { - return(0); - } - - // ----- Set default values - $v_options = array(); - - // ----- Look for variable options arguments - $v_size = func_num_args(); - - // ----- Look for arguments - if ($v_size > 0) { - // ----- Get the arguments - $v_arg_list = func_get_args(); - - // ----- Parse the options - $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, - array (PCLZIP_OPT_BY_NAME => 'optional', - PCLZIP_OPT_BY_EREG => 'optional', - PCLZIP_OPT_BY_PREG => 'optional', - PCLZIP_OPT_BY_INDEX => 'optional' )); - if ($v_result != 1) { - return 0; - } - } - - // ----- Magic quotes trick - $this->privDisableMagicQuotes(); - - // ----- Call the delete fct - $v_list = array(); - if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1) { - $this->privSwapBackMagicQuotes(); - unset($v_list); - return(0); - } - - // ----- Magic quotes trick - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_list; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : deleteByIndex() - // Description : - // ***** Deprecated ***** - // delete(PCLZIP_OPT_BY_INDEX, $p_index) should be prefered. - // -------------------------------------------------------------------------------- - function deleteByIndex($p_index) - { - - $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index); - - // ----- Return - return $p_list; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : properties() - // Description : - // This method gives the properties of the archive. - // The properties are : - // nb : Number of files in the archive - // comment : Comment associated with the archive file - // status : not_exist, ok - // Parameters : - // None - // Return Values : - // 0 on failure, - // An array with the archive properties. - // -------------------------------------------------------------------------------- - function properties() - { - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Magic quotes trick - $this->privDisableMagicQuotes(); - - // ----- Check archive - if (!$this->privCheckFormat()) { - $this->privSwapBackMagicQuotes(); - return(0); - } - - // ----- Default properties - $v_prop = array(); - $v_prop['comment'] = ''; - $v_prop['nb'] = 0; - $v_prop['status'] = 'not_exist'; - - // ----- Look if file exists - if (@is_file($this->zipname)) - { - // ----- Open the zip file - if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0) - { - $this->privSwapBackMagicQuotes(); - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode'); + // ----- Set the attributes + $this->zipname = $p_zipname; + $this->zip_fd = 0; + $this->magic_quotes_status = -1; // ----- Return - return 0; - } - - // ----- Read the central directory informations - $v_central_dir = array(); - if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) - { - $this->privSwapBackMagicQuotes(); - return 0; - } - - // ----- Close the zip file - $this->privCloseFd(); - - // ----- Set the user attributes - $v_prop['comment'] = $v_central_dir['comment']; - $v_prop['nb'] = $v_central_dir['entries']; - $v_prop['status'] = 'ok'; + return; } + // -------------------------------------------------------------------------------- - // ----- Magic quotes trick - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_prop; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : duplicate() - // Description : - // This method creates an archive by copying the content of an other one. If - // the archive already exist, it is replaced by the new one without any warning. - // Parameters : - // $p_archive : The filename of a valid archive, or - // a valid PclZip object. - // Return Values : - // 1 on success. - // 0 or a negative value on error (error code). - // -------------------------------------------------------------------------------- - function duplicate($p_archive) - { - $v_result = 1; - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Look if the $p_archive is a PclZip object - if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip')) + // -------------------------------------------------------------------------------- + // Function : + // create($p_filelist, $p_add_dir="", $p_remove_dir="") + // create($p_filelist, $p_option, $p_option_value, ...) + // Description : + // This method supports two different synopsis. The first one is historical. + // This method creates a Zip Archive. The Zip file is created in the + // filesystem. The files and directories indicated in $p_filelist + // are added in the archive. See the parameters description for the + // supported format of $p_filelist. + // When a directory is in the list, the directory and its content is added + // in the archive. + // In this synopsis, the function takes an optional variable list of + // options. See bellow the supported options. + // Parameters : + // $p_filelist : An array containing file or directory names, or + // a string containing one filename or one directory name, or + // a string containing a list of filenames and/or directory + // names separated by spaces. + // $p_add_dir : A path to add before the real path of the archived file, + // in order to have it memorized in the archive. + // $p_remove_dir : A path to remove from the real path of the file to archive, + // in order to have a shorter path memorized in the archive. + // When $p_add_dir and $p_remove_dir are set, $p_remove_dir + // is removed first, before $p_add_dir is added. + // Options : + // PCLZIP_OPT_ADD_PATH : + // PCLZIP_OPT_REMOVE_PATH : + // PCLZIP_OPT_REMOVE_ALL_PATH : + // PCLZIP_OPT_COMMENT : + // PCLZIP_CB_PRE_ADD : + // PCLZIP_CB_POST_ADD : + // Return Values : + // 0 on failure, + // The list of the added files, with a status of the add action. + // (see PclZip::listContent() for list entry format) + // -------------------------------------------------------------------------------- + public function create($p_filelist) { - - // ----- Duplicate the archive - $v_result = $this->privDuplicate($p_archive->zipname); - } - - // ----- Look if the $p_archive is a string (so a filename) - else if (is_string($p_archive)) - { - - // ----- Check that $p_archive is a valid zip file - // TBC : Should also check the archive format - if (!is_file($p_archive)) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '".$p_archive."'"); - $v_result = PCLZIP_ERR_MISSING_FILE; - } - else { - // ----- Duplicate the archive - $v_result = $this->privDuplicate($p_archive); - } - } - - // ----- Invalid variable - else - { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add"); - $v_result = PCLZIP_ERR_INVALID_PARAMETER; - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : merge() - // Description : - // This method merge the $p_archive_to_add archive at the end of the current - // one ($this). - // If the archive ($this) does not exist, the merge becomes a duplicate. - // If the $p_archive_to_add archive does not exist, the merge is a success. - // Parameters : - // $p_archive_to_add : It can be directly the filename of a valid zip archive, - // or a PclZip object archive. - // Return Values : - // 1 on success, - // 0 or negative values on error (see below). - // -------------------------------------------------------------------------------- - function merge($p_archive_to_add) - { - $v_result = 1; - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Check archive - if (!$this->privCheckFormat()) { - return(0); - } - - // ----- Look if the $p_archive_to_add is a PclZip object - if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip')) - { - - // ----- Merge the archive - $v_result = $this->privMerge($p_archive_to_add); - } - - // ----- Look if the $p_archive_to_add is a string (so a filename) - else if (is_string($p_archive_to_add)) - { - - // ----- Create a temporary archive - $v_object_archive = new PclZip($p_archive_to_add); - - // ----- Merge the archive - $v_result = $this->privMerge($v_object_archive); - } - - // ----- Invalid variable - else - { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add"); - $v_result = PCLZIP_ERR_INVALID_PARAMETER; - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - - - // -------------------------------------------------------------------------------- - // Function : errorCode() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - function errorCode() - { - if (PCLZIP_ERROR_EXTERNAL == 1) { - return(PclErrorCode()); - } - else { - return($this->error_code); - } - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : errorName() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - function errorName($p_with_code=false) - { - $v_name = array ( PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR', - PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL', - PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL', - PCLZIP_ERR_INVALID_PARAMETER => 'PCLZIP_ERR_INVALID_PARAMETER', - PCLZIP_ERR_MISSING_FILE => 'PCLZIP_ERR_MISSING_FILE', - PCLZIP_ERR_FILENAME_TOO_LONG => 'PCLZIP_ERR_FILENAME_TOO_LONG', - PCLZIP_ERR_INVALID_ZIP => 'PCLZIP_ERR_INVALID_ZIP', - PCLZIP_ERR_BAD_EXTRACTED_FILE => 'PCLZIP_ERR_BAD_EXTRACTED_FILE', - PCLZIP_ERR_DIR_CREATE_FAIL => 'PCLZIP_ERR_DIR_CREATE_FAIL', - PCLZIP_ERR_BAD_EXTENSION => 'PCLZIP_ERR_BAD_EXTENSION', - PCLZIP_ERR_BAD_FORMAT => 'PCLZIP_ERR_BAD_FORMAT', - PCLZIP_ERR_DELETE_FILE_FAIL => 'PCLZIP_ERR_DELETE_FILE_FAIL', - PCLZIP_ERR_RENAME_FILE_FAIL => 'PCLZIP_ERR_RENAME_FILE_FAIL', - PCLZIP_ERR_BAD_CHECKSUM => 'PCLZIP_ERR_BAD_CHECKSUM', - PCLZIP_ERR_INVALID_ARCHIVE_ZIP => 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', - PCLZIP_ERR_MISSING_OPTION_VALUE => 'PCLZIP_ERR_MISSING_OPTION_VALUE', - PCLZIP_ERR_INVALID_OPTION_VALUE => 'PCLZIP_ERR_INVALID_OPTION_VALUE', - PCLZIP_ERR_UNSUPPORTED_COMPRESSION => 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', - PCLZIP_ERR_UNSUPPORTED_ENCRYPTION => 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION' - ,PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE => 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE' - ,PCLZIP_ERR_DIRECTORY_RESTRICTION => 'PCLZIP_ERR_DIRECTORY_RESTRICTION' - ); - - if (isset($v_name[$this->error_code])) { - $v_value = $v_name[$this->error_code]; - } - else { - $v_value = 'NoName'; - } - - if ($p_with_code) { - return($v_value.' ('.$this->error_code.')'); - } - else { - return($v_value); - } - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : errorInfo() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - function errorInfo($p_full=false) - { - if (PCLZIP_ERROR_EXTERNAL == 1) { - return(PclErrorString()); - } - else { - if ($p_full) { - return($this->errorName(true)." : ".$this->error_string); - } - else { - return($this->error_string." [code ".$this->error_code."]"); - } - } - } - // -------------------------------------------------------------------------------- - - -// -------------------------------------------------------------------------------- -// ***** UNDER THIS LINE ARE DEFINED PRIVATE INTERNAL FUNCTIONS ***** -// ***** ***** -// ***** THESES FUNCTIONS MUST NOT BE USED DIRECTLY ***** -// -------------------------------------------------------------------------------- - - - - // -------------------------------------------------------------------------------- - // Function : privCheckFormat() - // Description : - // This method check that the archive exists and is a valid zip archive. - // Several level of check exists. (futur) - // Parameters : - // $p_level : Level of check. Default 0. - // 0 : Check the first bytes (magic codes) (default value)) - // 1 : 0 + Check the central directory (futur) - // 2 : 1 + Check each file header (futur) - // Return Values : - // true on success, - // false on error, the error code is set. - // -------------------------------------------------------------------------------- - function privCheckFormat($p_level=0) - { - $v_result = true; - - // ----- Reset the file system cache - clearstatcache(); - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Look if the file exits - if (!is_file($this->zipname)) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '".$this->zipname."'"); - return(false); - } - - // ----- Check that the file is readeable - if (!is_readable($this->zipname)) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '".$this->zipname."'"); - return(false); - } - - // ----- Check the magic code - // TBC - - // ----- Check the central header - // TBC - - // ----- Check each file header - // TBC - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privParseOptions() - // Description : - // This internal methods reads the variable list of arguments ($p_options_list, - // $p_size) and generate an array with the options and values ($v_result_list). - // $v_requested_options contains the options that can be present and those that - // must be present. - // $v_requested_options is an array, with the option value as key, and 'optional', - // or 'mandatory' as value. - // Parameters : - // See above. - // Return Values : - // 1 on success. - // 0 on failure. - // -------------------------------------------------------------------------------- - function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options=false) - { - $v_result=1; - - // ----- Read the options - $i=0; - while ($i<$p_size) { - - // ----- Check if the option is supported - if (!isset($v_requested_options[$p_options_list[$i]])) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '".$p_options_list[$i]."' for this method"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Look for next option - switch ($p_options_list[$i]) { - // ----- Look for options that request a path value - case PCLZIP_OPT_PATH : - case PCLZIP_OPT_REMOVE_PATH : - case PCLZIP_OPT_ADD_PATH : - // ----- Check the number of parameters - if (($i+1) >= $p_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Get the value - $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE); - $i++; - break; - - case PCLZIP_OPT_TEMP_FILE_THRESHOLD : - // ----- Check the number of parameters - if (($i+1) >= $p_size) { - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - return PclZip::errorCode(); - } - - // ----- Check for incompatible options - if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'"); - return PclZip::errorCode(); - } - - // ----- Check the value - $v_value = $p_options_list[$i+1]; - if ((!is_integer($v_value)) || ($v_value<0)) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - return PclZip::errorCode(); - } - - // ----- Get the value (and convert it in bytes) - $v_result_list[$p_options_list[$i]] = $v_value*1048576; - $i++; - break; - - case PCLZIP_OPT_TEMP_FILE_ON : - // ----- Check for incompatible options - if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'"); - return PclZip::errorCode(); - } - - $v_result_list[$p_options_list[$i]] = true; - break; - - case PCLZIP_OPT_TEMP_FILE_OFF : - // ----- Check for incompatible options - if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_ON])) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_ON'"); - return PclZip::errorCode(); - } - // ----- Check for incompatible options - if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_THRESHOLD'"); - return PclZip::errorCode(); - } - - $v_result_list[$p_options_list[$i]] = true; - break; - - case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION : - // ----- Check the number of parameters - if (($i+1) >= $p_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Get the value - if ( is_string($p_options_list[$i+1]) - && ($p_options_list[$i+1] != '')) { - $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE); - $i++; - } - else { - } - break; - - // ----- Look for options that request an array of string for value - case PCLZIP_OPT_BY_NAME : - // ----- Check the number of parameters - if (($i+1) >= $p_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Get the value - if (is_string($p_options_list[$i+1])) { - $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1]; - } - else if (is_array($p_options_list[$i+1])) { - $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; - } - else { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - - // ----- Return - return PclZip::errorCode(); - } - $i++; - break; - - // ----- Look for options that request an EREG or PREG expression - case PCLZIP_OPT_BY_EREG : - // ereg() is deprecated starting with PHP 5.3. Move PCLZIP_OPT_BY_EREG - // to PCLZIP_OPT_BY_PREG - $p_options_list[$i] = PCLZIP_OPT_BY_PREG; - case PCLZIP_OPT_BY_PREG : - //case PCLZIP_OPT_CRYPT : - // ----- Check the number of parameters - if (($i+1) >= $p_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Get the value - if (is_string($p_options_list[$i+1])) { - $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; - } - else { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - - // ----- Return - return PclZip::errorCode(); - } - $i++; - break; - - // ----- Look for options that takes a string - case PCLZIP_OPT_COMMENT : - case PCLZIP_OPT_ADD_COMMENT : - case PCLZIP_OPT_PREPEND_COMMENT : - // ----- Check the number of parameters - if (($i+1) >= $p_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, - "Missing parameter value for option '" - .PclZipUtilOptionText($p_options_list[$i]) - ."'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Get the value - if (is_string($p_options_list[$i+1])) { - $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; - } - else { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, - "Wrong parameter value for option '" - .PclZipUtilOptionText($p_options_list[$i]) - ."'"); - - // ----- Return - return PclZip::errorCode(); - } - $i++; - break; - - // ----- Look for options that request an array of index - case PCLZIP_OPT_BY_INDEX : - // ----- Check the number of parameters - if (($i+1) >= $p_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Get the value - $v_work_list = array(); - if (is_string($p_options_list[$i+1])) { - - // ----- Remove spaces - $p_options_list[$i+1] = strtr($p_options_list[$i+1], ' ', ''); - - // ----- Parse items - $v_work_list = explode(",", $p_options_list[$i+1]); - } - else if (is_integer($p_options_list[$i+1])) { - $v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1]; - } - else if (is_array($p_options_list[$i+1])) { - $v_work_list = $p_options_list[$i+1]; - } - else { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Reduce the index list - // each index item in the list must be a couple with a start and - // an end value : [0,3], [5-5], [8-10], ... - // ----- Check the format of each item - $v_sort_flag=false; - $v_sort_value=0; - for ($j=0; $j= $p_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Get the value - $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; - $i++; - break; - - // ----- Look for options that request a call-back - case PCLZIP_CB_PRE_EXTRACT : - case PCLZIP_CB_POST_EXTRACT : - case PCLZIP_CB_PRE_ADD : - case PCLZIP_CB_POST_ADD : - /* for futur use - case PCLZIP_CB_PRE_DELETE : - case PCLZIP_CB_POST_DELETE : - case PCLZIP_CB_PRE_LIST : - case PCLZIP_CB_POST_LIST : - */ - // ----- Check the number of parameters - if (($i+1) >= $p_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Get the value - $v_function_name = $p_options_list[$i+1]; - - // ----- Check that the value is a valid existing function - if (!function_exists($v_function_name)) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '".$v_function_name."()' is not an existing function for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Set the attribute - $v_result_list[$p_options_list[$i]] = $v_function_name; - $i++; - break; - - default : - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, - "Unknown parameter '" - .$p_options_list[$i]."'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Next options - $i++; - } - - // ----- Look for mandatory options - if ($v_requested_options !== false) { - for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) { - // ----- Look for mandatory option - if ($v_requested_options[$key] == 'mandatory') { - // ----- Look if present - if (!isset($v_result_list[$key])) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")"); - - // ----- Return - return PclZip::errorCode(); - } - } - } - } - - // ----- Look for default values - if (!isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) { - - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privOptionDefaultThreshold() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privOptionDefaultThreshold(&$p_options) - { - $v_result=1; - - if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) - || isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) { - return $v_result; - } - - // ----- Get 'memory_limit' configuration value - $v_memory_limit = ini_get('memory_limit'); - $v_memory_limit = trim($v_memory_limit); - $last = strtolower(substr($v_memory_limit, -1)); - - if($last == 'g') - //$v_memory_limit = $v_memory_limit*1024*1024*1024; - $v_memory_limit = $v_memory_limit*1073741824; - if($last == 'm') - //$v_memory_limit = $v_memory_limit*1024*1024; - $v_memory_limit = $v_memory_limit*1048576; - if($last == 'k') - $v_memory_limit = $v_memory_limit*1024; - - $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO); - - - // ----- Sanity check : No threshold if value lower than 1M - if ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] < 1048576) { - unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]); - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privFileDescrParseAtt() - // Description : - // Parameters : - // Return Values : - // 1 on success. - // 0 on failure. - // -------------------------------------------------------------------------------- - function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options=false) - { - $v_result=1; - - // ----- For each file in the list check the attributes - foreach ($p_file_list as $v_key => $v_value) { - - // ----- Check if the option is supported - if (!isset($v_requested_options[$v_key])) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file attribute '".$v_key."' for this file"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Look for attribute - switch ($v_key) { - case PCLZIP_ATT_FILE_NAME : - if (!is_string($v_value)) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'"); - return PclZip::errorCode(); - } - - $p_filedescr['filename'] = PclZipUtilPathReduction($v_value); - - if ($p_filedescr['filename'] == '') { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'"); - return PclZip::errorCode(); - } - - break; - - case PCLZIP_ATT_FILE_NEW_SHORT_NAME : - if (!is_string($v_value)) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'"); - return PclZip::errorCode(); - } - - $p_filedescr['new_short_name'] = PclZipUtilPathReduction($v_value); - - if ($p_filedescr['new_short_name'] == '') { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty short filename for attribute '".PclZipUtilOptionText($v_key)."'"); - return PclZip::errorCode(); - } - break; - - case PCLZIP_ATT_FILE_NEW_FULL_NAME : - if (!is_string($v_value)) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'"); - return PclZip::errorCode(); - } - - $p_filedescr['new_full_name'] = PclZipUtilPathReduction($v_value); - - if ($p_filedescr['new_full_name'] == '') { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty full filename for attribute '".PclZipUtilOptionText($v_key)."'"); - return PclZip::errorCode(); - } - break; - - // ----- Look for options that takes a string - case PCLZIP_ATT_FILE_COMMENT : - if (!is_string($v_value)) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'"); - return PclZip::errorCode(); - } - - $p_filedescr['comment'] = $v_value; - break; - - case PCLZIP_ATT_FILE_MTIME : - if (!is_integer($v_value)) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". Integer expected for attribute '".PclZipUtilOptionText($v_key)."'"); - return PclZip::errorCode(); - } - - $p_filedescr['mtime'] = $v_value; - break; - - case PCLZIP_ATT_FILE_CONTENT : - $p_filedescr['content'] = $v_value; - break; - - default : - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, - "Unknown parameter '".$v_key."'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Look for mandatory options - if ($v_requested_options !== false) { - for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) { - // ----- Look for mandatory option - if ($v_requested_options[$key] == 'mandatory') { - // ----- Look if present - if (!isset($p_file_list[$key])) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")"); - return PclZip::errorCode(); - } - } - } - } - - // end foreach - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privFileDescrExpand() - // Description : - // This method look for each item of the list to see if its a file, a folder - // or a string to be added as file. For any other type of files (link, other) - // just ignore the item. - // Then prepare the information that will be stored for that file. - // When its a folder, expand the folder with all the files that are in that - // folder (recursively). - // Parameters : - // Return Values : - // 1 on success. - // 0 on failure. - // -------------------------------------------------------------------------------- - function privFileDescrExpand(&$p_filedescr_list, &$p_options) - { - $v_result=1; - - // ----- Create a result list - $v_result_list = array(); - - // ----- Look each entry - for ($i=0; $iprivCalculateStoredFilename($v_descr, $p_options); - - // ----- Add the descriptor in result list - $v_result_list[sizeof($v_result_list)] = $v_descr; - - // ----- Look for folder - if ($v_descr['type'] == 'folder') { - // ----- List of items in folder - $v_dirlist_descr = array(); - $v_dirlist_nb = 0; - if ($v_folder_handler = @opendir($v_descr['filename'])) { - while (($v_item_handler = @readdir($v_folder_handler)) !== false) { - - // ----- Skip '.' and '..' - if (($v_item_handler == '.') || ($v_item_handler == '..')) { - continue; - } - - // ----- Compose the full filename - $v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler; - - // ----- Look for different stored filename - // Because the name of the folder was changed, the name of the - // files/sub-folders also change - if (($v_descr['stored_filename'] != $v_descr['filename']) - && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) { - if ($v_descr['stored_filename'] != '') { - $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler; - } - else { - $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_item_handler; - } - } - - $v_dirlist_nb++; - } - - @closedir($v_folder_handler); - } - else { - // TBC : unable to open folder in read mode - } - - // ----- Expand each element of the list - if ($v_dirlist_nb != 0) { - // ----- Expand - if (($v_result = $this->privFileDescrExpand($v_dirlist_descr, $p_options)) != 1) { - return $v_result; - } - - // ----- Concat the resulting list - $v_result_list = array_merge($v_result_list, $v_dirlist_descr); - } - else { - } - - // ----- Free local array - unset($v_dirlist_descr); - } - } - - // ----- Get the result list - $p_filedescr_list = $v_result_list; - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privCreate() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privCreate($p_filedescr_list, &$p_result_list, &$p_options) - { - $v_result=1; - $v_list_detail = array(); - - // ----- Magic quotes trick - $this->privDisableMagicQuotes(); - - // ----- Open the file in write mode - if (($v_result = $this->privOpenFd('wb')) != 1) - { - // ----- Return - return $v_result; - } - - // ----- Add the list of files - $v_result = $this->privAddList($p_filedescr_list, $p_result_list, $p_options); - - // ----- Close - $this->privCloseFd(); - - // ----- Magic quotes trick - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privAdd() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privAdd($p_filedescr_list, &$p_result_list, &$p_options) - { - $v_result=1; - $v_list_detail = array(); - - // ----- Look if the archive exists or is empty - if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0)) - { - - // ----- Do a create - $v_result = $this->privCreate($p_filedescr_list, $p_result_list, $p_options); - - // ----- Return - return $v_result; - } - // ----- Magic quotes trick - $this->privDisableMagicQuotes(); - - // ----- Open the zip file - if (($v_result=$this->privOpenFd('rb')) != 1) - { - // ----- Magic quotes trick - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_result; - } - - // ----- Read the central directory informations - $v_central_dir = array(); - if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) - { - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - return $v_result; - } - - // ----- Go to beginning of File - @rewind($this->zip_fd); - - // ----- Creates a temporay file - $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp'; - - // ----- Open the temporary file in write mode - if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0) - { - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Copy the files from the archive to the temporary file - // TBC : Here I should better append the file and go back to erase the central dir - $v_size = $v_central_dir['offset']; - while ($v_size != 0) - { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = fread($this->zip_fd, $v_read_size); - @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Swap the file descriptor - // Here is a trick : I swap the temporary fd with the zip fd, in order to use - // the following methods on the temporary fil and not the real archive - $v_swap = $this->zip_fd; - $this->zip_fd = $v_zip_temp_fd; - $v_zip_temp_fd = $v_swap; - - // ----- Add the files - $v_header_list = array(); - if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1) - { - fclose($v_zip_temp_fd); - $this->privCloseFd(); - @unlink($v_zip_temp_name); - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_result; - } - - // ----- Store the offset of the central dir - $v_offset = @ftell($this->zip_fd); - - // ----- Copy the block of file headers from the old archive - $v_size = $v_central_dir['size']; - while ($v_size != 0) - { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($v_zip_temp_fd, $v_read_size); - @fwrite($this->zip_fd, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Create the Central Dir files header - for ($i=0, $v_count=0; $iprivWriteCentralFileHeader($v_header_list[$i])) != 1) { - fclose($v_zip_temp_fd); - $this->privCloseFd(); - @unlink($v_zip_temp_name); - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_result; - } - $v_count++; - } - - // ----- Transform the header to a 'usable' info - $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); - } - - // ----- Zip file comment - $v_comment = $v_central_dir['comment']; - if (isset($p_options[PCLZIP_OPT_COMMENT])) { - $v_comment = $p_options[PCLZIP_OPT_COMMENT]; - } - if (isset($p_options[PCLZIP_OPT_ADD_COMMENT])) { - $v_comment = $v_comment.$p_options[PCLZIP_OPT_ADD_COMMENT]; - } - if (isset($p_options[PCLZIP_OPT_PREPEND_COMMENT])) { - $v_comment = $p_options[PCLZIP_OPT_PREPEND_COMMENT].$v_comment; - } - - // ----- Calculate the size of the central header - $v_size = @ftell($this->zip_fd)-$v_offset; - - // ----- Create the central dir footer - if (($v_result = $this->privWriteCentralHeader($v_count+$v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1) - { - // ----- Reset the file list - unset($v_header_list); - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_result; - } - - // ----- Swap back the file descriptor - $v_swap = $this->zip_fd; - $this->zip_fd = $v_zip_temp_fd; - $v_zip_temp_fd = $v_swap; - - // ----- Close - $this->privCloseFd(); - - // ----- Close the temporary file - @fclose($v_zip_temp_fd); - - // ----- Magic quotes trick - $this->privSwapBackMagicQuotes(); - - // ----- Delete the zip file - // TBC : I should test the result ... - @unlink($this->zipname); - - // ----- Rename the temporary file - // TBC : I should test the result ... - //@rename($v_zip_temp_name, $this->zipname); - PclZipUtilRename($v_zip_temp_name, $this->zipname); - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privOpenFd() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - function privOpenFd($p_mode) - { - $v_result=1; - - // ----- Look if already open - if ($this->zip_fd != 0) - { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Zip file \''.$this->zipname.'\' already open'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Open the zip file - if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0) - { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in '.$p_mode.' mode'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privCloseFd() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - function privCloseFd() - { - $v_result=1; - - if ($this->zip_fd != 0) - @fclose($this->zip_fd); - $this->zip_fd = 0; - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privAddList() - // Description : - // $p_add_dir and $p_remove_dir will give the ability to memorize a path which is - // different from the real path of the file. This is usefull if you want to have PclTar - // running in any directory, and memorize relative path from an other directory. - // Parameters : - // $p_list : An array containing the file or directory names to add in the tar - // $p_result_list : list of added files with their properties (specially the status field) - // $p_add_dir : Path to add in the filename path archived - // $p_remove_dir : Path to remove in the filename path archived - // Return Values : - // -------------------------------------------------------------------------------- -// function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options) - function privAddList($p_filedescr_list, &$p_result_list, &$p_options) - { - $v_result=1; - - // ----- Add the files - $v_header_list = array(); - if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1) - { - // ----- Return - return $v_result; - } - - // ----- Store the offset of the central dir - $v_offset = @ftell($this->zip_fd); - - // ----- Create the Central Dir files header - for ($i=0,$v_count=0; $iprivWriteCentralFileHeader($v_header_list[$i])) != 1) { - // ----- Return - return $v_result; - } - $v_count++; - } - - // ----- Transform the header to a 'usable' info - $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); - } - - // ----- Zip file comment - $v_comment = ''; - if (isset($p_options[PCLZIP_OPT_COMMENT])) { - $v_comment = $p_options[PCLZIP_OPT_COMMENT]; - } - - // ----- Calculate the size of the central header - $v_size = @ftell($this->zip_fd)-$v_offset; - - // ----- Create the central dir footer - if (($v_result = $this->privWriteCentralHeader($v_count, $v_size, $v_offset, $v_comment)) != 1) - { - // ----- Reset the file list - unset($v_header_list); - - // ----- Return - return $v_result; - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privAddFileList() - // Description : - // Parameters : - // $p_filedescr_list : An array containing the file description - // or directory names to add in the zip - // $p_result_list : list of added files with their properties (specially the status field) - // Return Values : - // -------------------------------------------------------------------------------- - function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options) - { - $v_result=1; - $v_header = array(); - - // ----- Recuperate the current number of elt in list - $v_nb = sizeof($p_result_list); - - // ----- Loop on the files - for ($j=0; ($jprivAddFile($p_filedescr_list[$j], $v_header, - $p_options); - if ($v_result != 1) { - return $v_result; - } - - // ----- Store the file infos - $p_result_list[$v_nb++] = $v_header; - } - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privAddFile() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privAddFile($p_filedescr, &$p_header, &$p_options) - { - $v_result=1; - - // ----- Working variable - $p_filename = $p_filedescr['filename']; - - // TBC : Already done in the fileAtt check ... ? - if ($p_filename == "") { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file list parameter (invalid or empty list)"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Look for a stored different filename - /* TBC : Removed - if (isset($p_filedescr['stored_filename'])) { - $v_stored_filename = $p_filedescr['stored_filename']; - } - else { - $v_stored_filename = $p_filedescr['stored_filename']; - } - */ - - // ----- Set the file properties - clearstatcache(); - $p_header['version'] = 20; - $p_header['version_extracted'] = 10; - $p_header['flag'] = 0; - $p_header['compression'] = 0; - $p_header['crc'] = 0; - $p_header['compressed_size'] = 0; - $p_header['filename_len'] = strlen($p_filename); - $p_header['extra_len'] = 0; - $p_header['disk'] = 0; - $p_header['internal'] = 0; - $p_header['offset'] = 0; - $p_header['filename'] = $p_filename; -// TBC : Removed $p_header['stored_filename'] = $v_stored_filename; - $p_header['stored_filename'] = $p_filedescr['stored_filename']; - $p_header['extra'] = ''; - $p_header['status'] = 'ok'; - $p_header['index'] = -1; - - // ----- Look for regular file - if ($p_filedescr['type']=='file') { - $p_header['external'] = 0x00000000; - $p_header['size'] = filesize($p_filename); - } - - // ----- Look for regular folder - else if ($p_filedescr['type']=='folder') { - $p_header['external'] = 0x00000010; - $p_header['mtime'] = filemtime($p_filename); - $p_header['size'] = filesize($p_filename); - } - - // ----- Look for virtual file - else if ($p_filedescr['type'] == 'virtual_file') { - $p_header['external'] = 0x00000000; - $p_header['size'] = strlen($p_filedescr['content']); - } - - - // ----- Look for filetime - if (isset($p_filedescr['mtime'])) { - $p_header['mtime'] = $p_filedescr['mtime']; - } - else if ($p_filedescr['type'] == 'virtual_file') { - $p_header['mtime'] = time(); - } - else { - $p_header['mtime'] = filemtime($p_filename); - } - - // ------ Look for file comment - if (isset($p_filedescr['comment'])) { - $p_header['comment_len'] = strlen($p_filedescr['comment']); - $p_header['comment'] = $p_filedescr['comment']; - } - else { - $p_header['comment_len'] = 0; - $p_header['comment'] = ''; - } - - // ----- Look for pre-add callback - if (isset($p_options[PCLZIP_CB_PRE_ADD])) { - - // ----- Generate a local information - $v_local_header = array(); - $this->privConvertHeader2FileInfo($p_header, $v_local_header); - - // ----- Call the callback - // Here I do not use call_user_func() because I need to send a reference to the - // header. -// eval('$v_result = '.$p_options[PCLZIP_CB_PRE_ADD].'(PCLZIP_CB_PRE_ADD, $v_local_header);'); - $v_result = $p_options[PCLZIP_CB_PRE_ADD](PCLZIP_CB_PRE_ADD, $v_local_header); - if ($v_result == 0) { - // ----- Change the file status - $p_header['status'] = "skipped"; $v_result = 1; - } - // ----- Update the informations - // Only some fields can be modified - if ($p_header['stored_filename'] != $v_local_header['stored_filename']) { - $p_header['stored_filename'] = PclZipUtilPathReduction($v_local_header['stored_filename']); - } - } + // ----- Reset the error handler + $this->privErrorReset(); - // ----- Look for empty stored filename - if ($p_header['stored_filename'] == "") { - $p_header['status'] = "filtered"; - } + // ----- Set default values + $v_options = array(); + $v_options[PCLZIP_OPT_NO_COMPRESSION] = false; - // ----- Check the path length - if (strlen($p_header['stored_filename']) > 0xFF) { - $p_header['status'] = 'filename_too_long'; - } + // ----- Look for variable options arguments + $v_size = func_num_args(); - // ----- Look if no error, or file not skipped - if ($p_header['status'] == 'ok') { + // ----- Look for arguments + if ($v_size > 1) { + // ----- Get the arguments + $v_arg_list = func_get_args(); - // ----- Look for a file - if ($p_filedescr['type'] == 'file') { - // ----- Look for using temporary file to zip - if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) - && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) - || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) - && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])) ) ) { - $v_result = $this->privAddFileUsingTempFile($p_filedescr, $p_header, $p_options); - if ($v_result < PCLZIP_ERR_NO_ERROR) { - return $v_result; - } + // ----- Remove from the options list the first argument + array_shift($v_arg_list); + $v_size--; + + // ----- Look for first arg + if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { + + // ----- Parse the options + $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array( + PCLZIP_OPT_REMOVE_PATH => 'optional', + PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', + PCLZIP_OPT_ADD_PATH => 'optional', + PCLZIP_CB_PRE_ADD => 'optional', + PCLZIP_CB_POST_ADD => 'optional', + PCLZIP_OPT_NO_COMPRESSION => 'optional', + PCLZIP_OPT_COMMENT => 'optional', + PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', + PCLZIP_OPT_TEMP_FILE_ON => 'optional', + PCLZIP_OPT_TEMP_FILE_OFF => 'optional' + //, PCLZIP_OPT_CRYPT => 'optional' + )); + if ($v_result != 1) { + return 0; + } + + // ----- Look for 2 args + // Here we need to support the first historic synopsis of the + // method. + } else { + + // ----- Get the first argument + $v_options[PCLZIP_OPT_ADD_PATH] = $v_arg_list[0]; + + // ----- Look for the optional second argument + if ($v_size == 2) { + $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1]; + } elseif ($v_size > 2) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); + + return 0; + } + } } - // ----- Use "in memory" zip algo - else { + // ----- Look for default option values + $this->privOptionDefaultThreshold($v_options); - // ----- Open the source file - if (($v_file = @fopen($p_filename, "rb")) == 0) { - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode"); - return PclZip::errorCode(); + // ----- Init + $v_string_list = array(); + $v_att_list = array(); + $v_filedescr_list = array(); + $p_result_list = array(); + + // ----- Look if the $p_filelist is really an array + if (is_array($p_filelist)) { + + // ----- Look if the first element is also an array + // This will mean that this is a file description entry + if (isset($p_filelist[0]) && is_array($p_filelist[0])) { + $v_att_list = $p_filelist; + + // ----- The list is a list of string names + } else { + $v_string_list = $p_filelist; + } + + // ----- Look if the $p_filelist is a string + } elseif (is_string($p_filelist)) { + // ----- Create a list from the string + $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist); + + // ----- Invalid variable type for $p_filelist + } else { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist"); + + return 0; } - // ----- Read the file content - $v_content = @fread($v_file, $p_header['size']); - - // ----- Close the file - @fclose($v_file); - - // ----- Calculate the CRC - $p_header['crc'] = @crc32($v_content); - - // ----- Look for no compression - if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) { - // ----- Set header parameters - $p_header['compressed_size'] = $p_header['size']; - $p_header['compression'] = 0; + // ----- Reformat the string list + if (sizeof($v_string_list) != 0) { + foreach ($v_string_list as $v_string) { + if ($v_string != '') { + $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string; + } else { + } + } } - // ----- Look for normal compression - else { - // ----- Compress the content - $v_content = @gzdeflate($v_content); - - // ----- Set header parameters - $p_header['compressed_size'] = strlen($v_content); - $p_header['compression'] = 8; + // ----- For each file in the list check the attributes + $v_supported_attributes = array( + PCLZIP_ATT_FILE_NAME => 'mandatory', + PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional', + PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional', + PCLZIP_ATT_FILE_MTIME => 'optional', + PCLZIP_ATT_FILE_CONTENT => 'optional', + PCLZIP_ATT_FILE_COMMENT => 'optional' + ); + foreach ($v_att_list as $v_entry) { + $v_result = $this->privFileDescrParseAtt($v_entry, $v_filedescr_list[], $v_options, $v_supported_attributes); + if ($v_result != 1) { + return 0; + } } - // ----- Call the header generation - if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { - @fclose($v_file); - return $v_result; + // ----- Expand the filelist (expand directories) + $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options); + if ($v_result != 1) { + return 0; } - // ----- Write the compressed (or not) content - @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']); - + // ----- Call the create fct + $v_result = $this->privCreate($v_filedescr_list, $p_result_list, $v_options); + if ($v_result != 1) { + return 0; } - } - - // ----- Look for a virtual file (a file from string) - else if ($p_filedescr['type'] == 'virtual_file') { - - $v_content = $p_filedescr['content']; - - // ----- Calculate the CRC - $p_header['crc'] = @crc32($v_content); - - // ----- Look for no compression - if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) { - // ----- Set header parameters - $p_header['compressed_size'] = $p_header['size']; - $p_header['compression'] = 0; - } - - // ----- Look for normal compression - else { - // ----- Compress the content - $v_content = @gzdeflate($v_content); - - // ----- Set header parameters - $p_header['compressed_size'] = strlen($v_content); - $p_header['compression'] = 8; - } - - // ----- Call the header generation - if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { - @fclose($v_file); - return $v_result; - } - - // ----- Write the compressed (or not) content - @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']); - } - - // ----- Look for a directory - else if ($p_filedescr['type'] == 'folder') { - // ----- Look for directory last '/' - if (@substr($p_header['stored_filename'], -1) != '/') { - $p_header['stored_filename'] .= '/'; - } - - // ----- Set the file properties - $p_header['size'] = 0; - //$p_header['external'] = 0x41FF0010; // Value for a folder : to be checked - $p_header['external'] = 0x00000010; // Value for a folder : to be checked - - // ----- Call the header generation - if (($v_result = $this->privWriteFileHeader($p_header)) != 1) - { - return $v_result; - } - } - } - - // ----- Look for post-add callback - if (isset($p_options[PCLZIP_CB_POST_ADD])) { - - // ----- Generate a local information - $v_local_header = array(); - $this->privConvertHeader2FileInfo($p_header, $v_local_header); - - // ----- Call the callback - // Here I do not use call_user_func() because I need to send a reference to the - // header. -// eval('$v_result = '.$p_options[PCLZIP_CB_POST_ADD].'(PCLZIP_CB_POST_ADD, $v_local_header);'); - $v_result = $p_options[PCLZIP_CB_POST_ADD](PCLZIP_CB_POST_ADD, $v_local_header); - if ($v_result == 0) { - // ----- Ignored - $v_result = 1; - } - - // ----- Update the informations - // Nothing can be modified - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privAddFileUsingTempFile() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privAddFileUsingTempFile($p_filedescr, &$p_header, &$p_options) - { - $v_result=PCLZIP_ERR_NO_ERROR; - - // ----- Working variable - $p_filename = $p_filedescr['filename']; - - - // ----- Open the source file - if (($v_file = @fopen($p_filename, "rb")) == 0) { - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode"); - return PclZip::errorCode(); - } - - // ----- Creates a compressed temporary file - $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz'; - if (($v_file_compressed = @gzopen($v_gzip_temp_name, "wb")) == 0) { - fclose($v_file); - PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode'); - return PclZip::errorCode(); - } - - // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks - $v_size = filesize($p_filename); - while ($v_size != 0) { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($v_file, $v_read_size); - //$v_binary_data = pack('a'.$v_read_size, $v_buffer); - @gzputs($v_file_compressed, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Close the file - @fclose($v_file); - @gzclose($v_file_compressed); - - // ----- Check the minimum file size - if (filesize($v_gzip_temp_name) < 18) { - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'gzip temporary file \''.$v_gzip_temp_name.'\' has invalid filesize - should be minimum 18 bytes'); - return PclZip::errorCode(); - } - - // ----- Extract the compressed attributes - if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) { - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode'); - return PclZip::errorCode(); - } - - // ----- Read the gzip file header - $v_binary_data = @fread($v_file_compressed, 10); - $v_data_header = unpack('a1id1/a1id2/a1cm/a1flag/Vmtime/a1xfl/a1os', $v_binary_data); - - // ----- Check some parameters - $v_data_header['os'] = bin2hex($v_data_header['os']); - - // ----- Read the gzip file footer - @fseek($v_file_compressed, filesize($v_gzip_temp_name)-8); - $v_binary_data = @fread($v_file_compressed, 8); - $v_data_footer = unpack('Vcrc/Vcompressed_size', $v_binary_data); - - // ----- Set the attributes - $p_header['compression'] = ord($v_data_header['cm']); - //$p_header['mtime'] = $v_data_header['mtime']; - $p_header['crc'] = $v_data_footer['crc']; - $p_header['compressed_size'] = filesize($v_gzip_temp_name)-18; - - // ----- Close the file - @fclose($v_file_compressed); - - // ----- Call the header generation - if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { - return $v_result; - } - - // ----- Add the compressed data - if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) - { - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode'); - return PclZip::errorCode(); - } - - // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks - fseek($v_file_compressed, 10); - $v_size = $p_header['compressed_size']; - while ($v_size != 0) - { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($v_file_compressed, $v_read_size); - //$v_binary_data = pack('a'.$v_read_size, $v_buffer); - @fwrite($this->zip_fd, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Close the file - @fclose($v_file_compressed); - - // ----- Unlink the temporary file - @unlink($v_gzip_temp_name); - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privCalculateStoredFilename() - // Description : - // Based on file descriptor properties and global options, this method - // calculate the filename that will be stored in the archive. - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privCalculateStoredFilename(&$p_filedescr, &$p_options) - { - $v_result=1; - - // ----- Working variables - $p_filename = $p_filedescr['filename']; - if (isset($p_options[PCLZIP_OPT_ADD_PATH])) { - $p_add_dir = $p_options[PCLZIP_OPT_ADD_PATH]; - } - else { - $p_add_dir = ''; - } - if (isset($p_options[PCLZIP_OPT_REMOVE_PATH])) { - $p_remove_dir = $p_options[PCLZIP_OPT_REMOVE_PATH]; - } - else { - $p_remove_dir = ''; - } - if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) { - $p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH]; - } - else { - $p_remove_all_dir = 0; - } - - - // ----- Look for full name change - if (isset($p_filedescr['new_full_name'])) { - // ----- Remove drive letter if any - $v_stored_filename = PclZipUtilTranslateWinPath($p_filedescr['new_full_name']); - } - - // ----- Look for path and/or short name change - else { - - // ----- Look for short name change - // Its when we cahnge just the filename but not the path - if (isset($p_filedescr['new_short_name'])) { - $v_path_info = pathinfo($p_filename); - $v_dir = ''; - if ($v_path_info['dirname'] != '') { - $v_dir = $v_path_info['dirname'].'/'; - } - $v_stored_filename = $v_dir.$p_filedescr['new_short_name']; - } - else { - // ----- Calculate the stored filename - $v_stored_filename = $p_filename; - } - - // ----- Look for all path to remove - if ($p_remove_all_dir) { - $v_stored_filename = basename($p_filename); - } - // ----- Look for partial path remove - else if ($p_remove_dir != "") { - if (substr($p_remove_dir, -1) != '/') - $p_remove_dir .= "/"; - - if ( (substr($p_filename, 0, 2) == "./") - || (substr($p_remove_dir, 0, 2) == "./")) { - - if ( (substr($p_filename, 0, 2) == "./") - && (substr($p_remove_dir, 0, 2) != "./")) { - $p_remove_dir = "./".$p_remove_dir; - } - if ( (substr($p_filename, 0, 2) != "./") - && (substr($p_remove_dir, 0, 2) == "./")) { - $p_remove_dir = substr($p_remove_dir, 2); - } - } - - $v_compare = PclZipUtilPathInclusion($p_remove_dir, - $v_stored_filename); - if ($v_compare > 0) { - if ($v_compare == 2) { - $v_stored_filename = ""; - } - else { - $v_stored_filename = substr($v_stored_filename, - strlen($p_remove_dir)); - } - } - } - - // ----- Remove drive letter if any - $v_stored_filename = PclZipUtilTranslateWinPath($v_stored_filename); - - // ----- Look for path to add - if ($p_add_dir != "") { - if (substr($p_add_dir, -1) == "/") - $v_stored_filename = $p_add_dir.$v_stored_filename; - else - $v_stored_filename = $p_add_dir."/".$v_stored_filename; - } - } - - // ----- Filename (reduce the path of stored name) - $v_stored_filename = PclZipUtilPathReduction($v_stored_filename); - $p_filedescr['stored_filename'] = $v_stored_filename; - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privWriteFileHeader() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privWriteFileHeader(&$p_header) - { - $v_result=1; - - // ----- Store the offset position of the file - $p_header['offset'] = ftell($this->zip_fd); - - // ----- Transform UNIX mtime to DOS format mdate/mtime - $v_date = getdate($p_header['mtime']); - $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2; - $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; - - // ----- Packed data - $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50, - $p_header['version_extracted'], $p_header['flag'], - $p_header['compression'], $v_mtime, $v_mdate, - $p_header['crc'], $p_header['compressed_size'], - $p_header['size'], - strlen($p_header['stored_filename']), - $p_header['extra_len']); - - // ----- Write the first 148 bytes of the header in the archive - fputs($this->zip_fd, $v_binary_data, 30); - - // ----- Write the variable fields - if (strlen($p_header['stored_filename']) != 0) - { - fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); - } - if ($p_header['extra_len'] != 0) - { - fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']); - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privWriteCentralFileHeader() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privWriteCentralFileHeader(&$p_header) - { - $v_result=1; - - // TBC - //for(reset($p_header); $key = key($p_header); next($p_header)) { - //} - - // ----- Transform UNIX mtime to DOS format mdate/mtime - $v_date = getdate($p_header['mtime']); - $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2; - $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; - - - // ----- Packed data - $v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50, - $p_header['version'], $p_header['version_extracted'], - $p_header['flag'], $p_header['compression'], - $v_mtime, $v_mdate, $p_header['crc'], - $p_header['compressed_size'], $p_header['size'], - strlen($p_header['stored_filename']), - $p_header['extra_len'], $p_header['comment_len'], - $p_header['disk'], $p_header['internal'], - $p_header['external'], $p_header['offset']); - - // ----- Write the 42 bytes of the header in the zip file - fputs($this->zip_fd, $v_binary_data, 46); - - // ----- Write the variable fields - if (strlen($p_header['stored_filename']) != 0) - { - fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); - } - if ($p_header['extra_len'] != 0) - { - fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']); - } - if ($p_header['comment_len'] != 0) - { - fputs($this->zip_fd, $p_header['comment'], $p_header['comment_len']); - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privWriteCentralHeader() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment) - { - $v_result=1; - - // ----- Packed data - $v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries, - $p_nb_entries, $p_size, - $p_offset, strlen($p_comment)); - - // ----- Write the 22 bytes of the header in the zip file - fputs($this->zip_fd, $v_binary_data, 22); - - // ----- Write the variable fields - if (strlen($p_comment) != 0) - { - fputs($this->zip_fd, $p_comment, strlen($p_comment)); - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privList() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privList(&$p_list) - { - $v_result=1; - - // ----- Magic quotes trick - $this->privDisableMagicQuotes(); - - // ----- Open the zip file - if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0) - { - // ----- Magic quotes trick - $this->privSwapBackMagicQuotes(); - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read the central directory informations - $v_central_dir = array(); - if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) - { - $this->privSwapBackMagicQuotes(); - return $v_result; - } - - // ----- Go to beginning of Central Dir - @rewind($this->zip_fd); - if (@fseek($this->zip_fd, $v_central_dir['offset'])) - { - $this->privSwapBackMagicQuotes(); - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read each entry - for ($i=0; $i<$v_central_dir['entries']; $i++) - { - // ----- Read the file header - if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1) - { - $this->privSwapBackMagicQuotes(); - return $v_result; - } - $v_header['index'] = $i; - - // ----- Get the only interesting attributes - $this->privConvertHeader2FileInfo($v_header, $p_list[$i]); - unset($v_header); - } - - // ----- Close the zip file - $this->privCloseFd(); - - // ----- Magic quotes trick - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privConvertHeader2FileInfo() - // Description : - // This function takes the file informations from the central directory - // entries and extract the interesting parameters that will be given back. - // The resulting file infos are set in the array $p_info - // $p_info['filename'] : Filename with full path. Given by user (add), - // extracted in the filesystem (extract). - // $p_info['stored_filename'] : Stored filename in the archive. - // $p_info['size'] = Size of the file. - // $p_info['compressed_size'] = Compressed size of the file. - // $p_info['mtime'] = Last modification date of the file. - // $p_info['comment'] = Comment associated with the file. - // $p_info['folder'] = true/false : indicates if the entry is a folder or not. - // $p_info['status'] = status of the action on the file. - // $p_info['crc'] = CRC of the file content. - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privConvertHeader2FileInfo($p_header, &$p_info) - { - $v_result=1; - - // ----- Get the interesting attributes - $v_temp_path = PclZipUtilPathReduction($p_header['filename']); - $p_info['filename'] = $v_temp_path; - $v_temp_path = PclZipUtilPathReduction($p_header['stored_filename']); - $p_info['stored_filename'] = $v_temp_path; - $p_info['size'] = $p_header['size']; - $p_info['compressed_size'] = $p_header['compressed_size']; - $p_info['mtime'] = $p_header['mtime']; - $p_info['comment'] = $p_header['comment']; - $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010); - $p_info['index'] = $p_header['index']; - $p_info['status'] = $p_header['status']; - $p_info['crc'] = $p_header['crc']; - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privExtractByRule() - // Description : - // Extract a file or directory depending of rules (by index, by name, ...) - // Parameters : - // $p_file_list : An array where will be placed the properties of each - // extracted file - // $p_path : Path to add while writing the extracted files - // $p_remove_path : Path to remove (from the file memorized path) while writing the - // extracted files. If the path does not match the file path, - // the file is extracted with its memorized path. - // $p_remove_path does not apply to 'list' mode. - // $p_path and $p_remove_path are commulative. - // Return Values : - // 1 on success,0 or less on error (see error code list) - // -------------------------------------------------------------------------------- - function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options) - { - $v_result=1; - - // ----- Magic quotes trick - $this->privDisableMagicQuotes(); - - // ----- Check the path - if ( ($p_path == "") - || ( (substr($p_path, 0, 1) != "/") - && (substr($p_path, 0, 3) != "../") - && (substr($p_path,1,2)!=":/"))) - $p_path = "./".$p_path; - - // ----- Reduce the path last (and duplicated) '/' - if (($p_path != "./") && ($p_path != "/")) - { - // ----- Look for the path end '/' - while (substr($p_path, -1) == "/") - { - $p_path = substr($p_path, 0, strlen($p_path)-1); - } - } - - // ----- Look for path to remove format (should end by /) - if (($p_remove_path != "") && (substr($p_remove_path, -1) != '/')) - { - $p_remove_path .= '/'; - } - $p_remove_path_size = strlen($p_remove_path); - - // ----- Open the zip file - if (($v_result = $this->privOpenFd('rb')) != 1) - { - $this->privSwapBackMagicQuotes(); - return $v_result; - } - - // ----- Read the central directory informations - $v_central_dir = array(); - if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) - { - // ----- Close the zip file - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - return $v_result; - } - - // ----- Start at beginning of Central Dir - $v_pos_entry = $v_central_dir['offset']; - - // ----- Read each entry - $j_start = 0; - for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) - { - - // ----- Read next Central dir entry - @rewind($this->zip_fd); - if (@fseek($this->zip_fd, $v_pos_entry)) - { - // ----- Close the zip file - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read the file header - $v_header = array(); - if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1) - { - // ----- Close the zip file - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - return $v_result; - } - - // ----- Store the index - $v_header['index'] = $i; - - // ----- Store the file position - $v_pos_entry = ftell($this->zip_fd); - - // ----- Look for the specific extract rules - $v_extract = false; - - // ----- Look for extract by name rule - if ( (isset($p_options[PCLZIP_OPT_BY_NAME])) - && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { - - // ----- Look if the filename is in the list - for ($j=0; ($j strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) - && (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) { - $v_extract = true; - } - } - // ----- Look for a filename - elseif ($v_header['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) { - $v_extract = true; - } - } - } - - // ----- Look for extract by ereg rule - // ereg() is deprecated with PHP 5.3 - /* - else if ( (isset($p_options[PCLZIP_OPT_BY_EREG])) - && ($p_options[PCLZIP_OPT_BY_EREG] != "")) { - - if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header['stored_filename'])) { - $v_extract = true; - } - } - */ - - // ----- Look for extract by preg rule - else if ( (isset($p_options[PCLZIP_OPT_BY_PREG])) - && ($p_options[PCLZIP_OPT_BY_PREG] != "")) { - - if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) { - $v_extract = true; - } - } - - // ----- Look for extract by index rule - else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX])) - && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { - - // ----- Look if the index is in the list - for ($j=$j_start; ($j=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { - $v_extract = true; - } - if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { - $j_start = $j+1; - } - - if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) { - break; - } - } - } - - // ----- Look for no rule, which means extract all the archive - else { - $v_extract = true; - } - - // ----- Check compression method - if ( ($v_extract) - && ( ($v_header['compression'] != 8) - && ($v_header['compression'] != 0))) { - $v_header['status'] = 'unsupported_compression'; - - // ----- Look for PCLZIP_OPT_STOP_ON_ERROR - if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { - - $this->privSwapBackMagicQuotes(); - - PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION, - "Filename '".$v_header['stored_filename']."' is " - ."compressed by an unsupported compression " - ."method (".$v_header['compression'].") "); - - return PclZip::errorCode(); - } - } - - // ----- Check encrypted files - if (($v_extract) && (($v_header['flag'] & 1) == 1)) { - $v_header['status'] = 'unsupported_encryption'; - - // ----- Look for PCLZIP_OPT_STOP_ON_ERROR - if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { - - $this->privSwapBackMagicQuotes(); - - PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, - "Unsupported encryption for " - ." filename '".$v_header['stored_filename'] - ."'"); - - return PclZip::errorCode(); - } + return $p_result_list; } + // -------------------------------------------------------------------------------- - // ----- Look for real extraction - if (($v_extract) && ($v_header['status'] != 'ok')) { - $v_result = $this->privConvertHeader2FileInfo($v_header, - $p_file_list[$v_nb_extracted++]); - if ($v_result != 1) { - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - return $v_result; - } - - $v_extract = false; - } - - // ----- Look for real extraction - if ($v_extract) - { - - // ----- Go to the file position - @rewind($this->zip_fd); - if (@fseek($this->zip_fd, $v_header['offset'])) - { - // ----- Close the zip file - $this->privCloseFd(); - - $this->privSwapBackMagicQuotes(); - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Look for extraction as string - if ($p_options[PCLZIP_OPT_EXTRACT_AS_STRING]) { - - $v_string = ''; - - // ----- Extracting the file - $v_result1 = $this->privExtractFileAsString($v_header, $v_string, $p_options); - if ($v_result1 < 1) { - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - return $v_result1; - } - - // ----- Get the only interesting attributes - if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted])) != 1) - { - // ----- Close the zip file - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - return $v_result; - } - - // ----- Set the file content - $p_file_list[$v_nb_extracted]['content'] = $v_string; - - // ----- Next extracted file - $v_nb_extracted++; - - // ----- Look for user callback abort - if ($v_result1 == 2) { - break; - } - } - // ----- Look for extraction in standard output - elseif ( (isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) - && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) { - // ----- Extracting the file in standard output - $v_result1 = $this->privExtractFileInOutput($v_header, $p_options); - if ($v_result1 < 1) { - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - return $v_result1; - } - - // ----- Get the only interesting attributes - if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) { - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - return $v_result; - } - - // ----- Look for user callback abort - if ($v_result1 == 2) { - break; - } - } - // ----- Look for normal extraction - else { - // ----- Extracting the file - $v_result1 = $this->privExtractFile($v_header, - $p_path, $p_remove_path, - $p_remove_all_path, - $p_options); - if ($v_result1 < 1) { - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - return $v_result1; - } - - // ----- Get the only interesting attributes - if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) - { - // ----- Close the zip file - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - return $v_result; - } - - // ----- Look for user callback abort - if ($v_result1 == 2) { - break; - } - } - } - } - - // ----- Close the zip file - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privExtractFile() - // Description : - // Parameters : - // Return Values : - // - // 1 : ... ? - // PCLZIP_ERR_USER_ABORTED(2) : User ask for extraction stop in callback - // -------------------------------------------------------------------------------- - function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options) - { - $v_result=1; - - // ----- Read the file header - if (($v_result = $this->privReadFileHeader($v_header)) != 1) + // -------------------------------------------------------------------------------- + // Function : + // add($p_filelist, $p_add_dir="", $p_remove_dir="") + // add($p_filelist, $p_option, $p_option_value, ...) + // Description : + // This method supports two synopsis. The first one is historical. + // This methods add the list of files in an existing archive. + // If a file with the same name already exists, it is added at the end of the + // archive, the first one is still present. + // If the archive does not exist, it is created. + // Parameters : + // $p_filelist : An array containing file or directory names, or + // a string containing one filename or one directory name, or + // a string containing a list of filenames and/or directory + // names separated by spaces. + // $p_add_dir : A path to add before the real path of the archived file, + // in order to have it memorized in the archive. + // $p_remove_dir : A path to remove from the real path of the file to archive, + // in order to have a shorter path memorized in the archive. + // When $p_add_dir and $p_remove_dir are set, $p_remove_dir + // is removed first, before $p_add_dir is added. + // Options : + // PCLZIP_OPT_ADD_PATH : + // PCLZIP_OPT_REMOVE_PATH : + // PCLZIP_OPT_REMOVE_ALL_PATH : + // PCLZIP_OPT_COMMENT : + // PCLZIP_OPT_ADD_COMMENT : + // PCLZIP_OPT_PREPEND_COMMENT : + // PCLZIP_CB_PRE_ADD : + // PCLZIP_CB_POST_ADD : + // Return Values : + // 0 on failure, + // The list of the added files, with a status of the add action. + // (see PclZip::listContent() for list entry format) + // -------------------------------------------------------------------------------- + public function add($p_filelist) { - // ----- Return - return $v_result; - } + $v_result = 1; + // ----- Reset the error handler + $this->privErrorReset(); - // ----- Check that the file header is coherent with $p_entry info - if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { - // TBC - } + // ----- Set default values + $v_options = array(); + $v_options[PCLZIP_OPT_NO_COMPRESSION] = false; - // ----- Look for all path to remove - if ($p_remove_all_path == true) { - // ----- Look for folder entry that not need to be extracted - if (($p_entry['external']&0x00000010)==0x00000010) { + // ----- Look for variable options arguments + $v_size = func_num_args(); - $p_entry['status'] = "filtered"; + // ----- Look for arguments + if ($v_size > 1) { + // ----- Get the arguments + $v_arg_list = func_get_args(); - return $v_result; + // ----- Remove form the options list the first argument + array_shift($v_arg_list); + $v_size--; + + // ----- Look for first arg + if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { + + // ----- Parse the options + $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array( + PCLZIP_OPT_REMOVE_PATH => 'optional', + PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', + PCLZIP_OPT_ADD_PATH => 'optional', + PCLZIP_CB_PRE_ADD => 'optional', + PCLZIP_CB_POST_ADD => 'optional', + PCLZIP_OPT_NO_COMPRESSION => 'optional', + PCLZIP_OPT_COMMENT => 'optional', + PCLZIP_OPT_ADD_COMMENT => 'optional', + PCLZIP_OPT_PREPEND_COMMENT => 'optional', + PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', + PCLZIP_OPT_TEMP_FILE_ON => 'optional', + PCLZIP_OPT_TEMP_FILE_OFF => 'optional' + //, PCLZIP_OPT_CRYPT => 'optional' + )); + if ($v_result != 1) { + return 0; + } + + // ----- Look for 2 args + // Here we need to support the first historic synopsis of the + // method. + } else { + + // ----- Get the first argument + $v_options[PCLZIP_OPT_ADD_PATH] = $v_add_path = $v_arg_list[0]; + + // ----- Look for the optional second argument + if ($v_size == 2) { + $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1]; + } elseif ($v_size > 2) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); + + // ----- Return + return 0; + } + } } - // ----- Get the basename of the path - $p_entry['filename'] = basename($p_entry['filename']); - } + // ----- Look for default option values + $this->privOptionDefaultThreshold($v_options); - // ----- Look for path to remove - else if ($p_remove_path != "") - { - if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2) - { + // ----- Init + $v_string_list = array(); + $v_att_list = array(); + $v_filedescr_list = array(); + $p_result_list = array(); - // ----- Change the file status - $p_entry['status'] = "filtered"; + // ----- Look if the $p_filelist is really an array + if (is_array($p_filelist)) { + + // ----- Look if the first element is also an array + // This will mean that this is a file description entry + if (isset($p_filelist[0]) && is_array($p_filelist[0])) { + $v_att_list = $p_filelist; + + // ----- The list is a list of string names + } else { + $v_string_list = $p_filelist; + } + + // ----- Look if the $p_filelist is a string + } elseif (is_string($p_filelist)) { + // ----- Create a list from the string + $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist); + + // ----- Invalid variable type for $p_filelist + } else { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '" . gettype($p_filelist) . "' for p_filelist"); + + return 0; + } + + // ----- Reformat the string list + if (sizeof($v_string_list) != 0) { + foreach ($v_string_list as $v_string) { + $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string; + } + } + + // ----- For each file in the list check the attributes + $v_supported_attributes = array( + PCLZIP_ATT_FILE_NAME => 'mandatory', + PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional', + PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional', + PCLZIP_ATT_FILE_MTIME => 'optional', + PCLZIP_ATT_FILE_CONTENT => 'optional', + PCLZIP_ATT_FILE_COMMENT => 'optional' + ); + foreach ($v_att_list as $v_entry) { + $v_result = $this->privFileDescrParseAtt($v_entry, $v_filedescr_list[], $v_options, $v_supported_attributes); + if ($v_result != 1) { + return 0; + } + } + + // ----- Expand the filelist (expand directories) + $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options); + if ($v_result != 1) { + return 0; + } + + // ----- Call the create fct + $v_result = $this->privAdd($v_filedescr_list, $p_result_list, $v_options); + if ($v_result != 1) { + return 0; + } // ----- Return - return $v_result; - } - - $p_remove_path_size = strlen($p_remove_path); - if (substr($p_entry['filename'], 0, $p_remove_path_size) == $p_remove_path) - { - - // ----- Remove the path - $p_entry['filename'] = substr($p_entry['filename'], $p_remove_path_size); - - } + return $p_result_list; } + // -------------------------------------------------------------------------------- - // ----- Add the path - if ($p_path != '') { - $p_entry['filename'] = $p_path."/".$p_entry['filename']; - } - - // ----- Check a base_dir_restriction - if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) { - $v_inclusion - = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION], - $p_entry['filename']); - if ($v_inclusion == 0) { - - PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION, - "Filename '".$p_entry['filename']."' is " - ."outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION"); - - return PclZip::errorCode(); - } - } - - // ----- Look for pre-extract callback - if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) { - - // ----- Generate a local information - $v_local_header = array(); - $this->privConvertHeader2FileInfo($p_entry, $v_local_header); - - // ----- Call the callback - // Here I do not use call_user_func() because I need to send a reference to the - // header. -// eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);'); - $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header); - if ($v_result == 0) { - // ----- Change the file status - $p_entry['status'] = "skipped"; - $v_result = 1; - } - - // ----- Look for abort result - if ($v_result == 2) { - // ----- This status is internal and will be changed in 'skipped' - $p_entry['status'] = "aborted"; - $v_result = PCLZIP_ERR_USER_ABORTED; - } - - // ----- Update the informations - // Only some fields can be modified - $p_entry['filename'] = $v_local_header['filename']; - } - - - // ----- Look if extraction should be done - if ($p_entry['status'] == 'ok') { - - // ----- Look for specific actions while the file exist - if (file_exists($p_entry['filename'])) + // -------------------------------------------------------------------------------- + // Function : listContent() + // Description : + // This public method, gives the list of the files and directories, with their + // properties. + // The properties of each entries in the list are (used also in other functions) : + // filename : Name of the file. For a create or add action it is the filename + // given by the user. For an extract function it is the filename + // of the extracted file. + // stored_filename : Name of the file / directory stored in the archive. + // size : Size of the stored file. + // compressed_size : Size of the file's data compressed in the archive + // (without the headers overhead) + // mtime : Last known modification date of the file (UNIX timestamp) + // comment : Comment associated with the file + // folder : true | false + // index : index of the file in the archive + // status : status of the action (depending of the action) : + // Values are : + // ok : OK ! + // filtered : the file / dir is not extracted (filtered by user) + // already_a_directory : the file can not be extracted because a + // directory with the same name already exists + // write_protected : the file can not be extracted because a file + // with the same name already exists and is + // write protected + // newer_exist : the file was not extracted because a newer file exists + // path_creation_fail : the file is not extracted because the folder + // does not exist and can not be created + // write_error : the file was not extracted because there was a + // error while writing the file + // read_error : the file was not extracted because there was a error + // while reading the file + // invalid_header : the file was not extracted because of an archive + // format error (bad file header) + // Note that each time a method can continue operating when there + // is an action error on a file, the error is only logged in the file status. + // Return Values : + // 0 on an unrecoverable failure, + // The list of the files in the archive. + // -------------------------------------------------------------------------------- + public function listContent() { - - // ----- Look if file is a directory - if (is_dir($p_entry['filename'])) - { - - // ----- Change the file status - $p_entry['status'] = "already_a_directory"; - - // ----- Look for PCLZIP_OPT_STOP_ON_ERROR - // For historical reason first PclZip implementation does not stop - // when this kind of error occurs. - if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { - - PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY, - "Filename '".$p_entry['filename']."' is " - ."already used by an existing directory"); - - return PclZip::errorCode(); - } - } - // ----- Look if file is write protected - else if (!is_writeable($p_entry['filename'])) - { - - // ----- Change the file status - $p_entry['status'] = "write_protected"; - - // ----- Look for PCLZIP_OPT_STOP_ON_ERROR - // For historical reason first PclZip implementation does not stop - // when this kind of error occurs. - if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { - - PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, - "Filename '".$p_entry['filename']."' exists " - ."and is write protected"); - - return PclZip::errorCode(); - } - } - - // ----- Look if the extracted file is older - else if (filemtime($p_entry['filename']) > $p_entry['mtime']) - { - // ----- Change the file status - if ( (isset($p_options[PCLZIP_OPT_REPLACE_NEWER])) - && ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) { - } - else { - $p_entry['status'] = "newer_exist"; - - // ----- Look for PCLZIP_OPT_STOP_ON_ERROR - // For historical reason first PclZip implementation does not stop - // when this kind of error occurs. - if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { - - PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, - "Newer version of '".$p_entry['filename']."' exists " - ."and option PCLZIP_OPT_REPLACE_NEWER is not selected"); - - return PclZip::errorCode(); - } - } - } - else { - } - } - - // ----- Check the directory availability and create it if necessary - else { - if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/')) - $v_dir_to_check = $p_entry['filename']; - else if (!strstr($p_entry['filename'], "/")) - $v_dir_to_check = ""; - else - $v_dir_to_check = dirname($p_entry['filename']); - - if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) { - - // ----- Change the file status - $p_entry['status'] = "path_creation_fail"; - - // ----- Return - //return $v_result; - $v_result = 1; - } - } - } - - // ----- Look if extraction should be done - if ($p_entry['status'] == 'ok') { - - // ----- Do the extraction (if not a folder) - if (!(($p_entry['external']&0x00000010)==0x00000010)) - { - // ----- Look for not compressed file - if ($p_entry['compression'] == 0) { - - // ----- Opening destination file - if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) - { - - // ----- Change the file status - $p_entry['status'] = "write_error"; - - // ----- Return - return $v_result; - } - - - // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks - $v_size = $p_entry['compressed_size']; - while ($v_size != 0) - { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($this->zip_fd, $v_read_size); - /* Try to speed up the code - $v_binary_data = pack('a'.$v_read_size, $v_buffer); - @fwrite($v_dest_file, $v_binary_data, $v_read_size); - */ - @fwrite($v_dest_file, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Closing the destination file - fclose($v_dest_file); - - // ----- Change the file mtime - touch($p_entry['filename'], $p_entry['mtime']); - - - } - else { - // ----- TBC - // Need to be finished - if (($p_entry['flag'] & 1) == 1) { - PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, 'File \''.$p_entry['filename'].'\' is encrypted. Encrypted files are not supported.'); - return PclZip::errorCode(); - } - - - // ----- Look for using temporary file to unzip - if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) - && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) - || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) - && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])) ) ) { - $v_result = $this->privExtractFileUsingTempFile($p_entry, $p_options); - if ($v_result < PCLZIP_ERR_NO_ERROR) { - return $v_result; - } - } - - // ----- Look for extract in memory - else { - - - // ----- Read the compressed file in a buffer (one shot) - $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); - - // ----- Decompress the file - $v_file_content = @gzinflate($v_buffer); - unset($v_buffer); - if ($v_file_content === FALSE) { - - // ----- Change the file status - // TBC - $p_entry['status'] = "error"; - - return $v_result; - } - - // ----- Opening destination file - if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { - - // ----- Change the file status - $p_entry['status'] = "write_error"; - - return $v_result; - } - - // ----- Write the uncompressed data - @fwrite($v_dest_file, $v_file_content, $p_entry['size']); - unset($v_file_content); - - // ----- Closing the destination file - @fclose($v_dest_file); - - } - - // ----- Change the file mtime - @touch($p_entry['filename'], $p_entry['mtime']); - } - - // ----- Look for chmod option - if (isset($p_options[PCLZIP_OPT_SET_CHMOD])) { - - // ----- Change the mode of the file - @chmod($p_entry['filename'], $p_options[PCLZIP_OPT_SET_CHMOD]); - } - - } - } - - // ----- Change abort status - if ($p_entry['status'] == "aborted") { - $p_entry['status'] = "skipped"; - } - - // ----- Look for post-extract callback - elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { - - // ----- Generate a local information - $v_local_header = array(); - $this->privConvertHeader2FileInfo($p_entry, $v_local_header); - - // ----- Call the callback - // Here I do not use call_user_func() because I need to send a reference to the - // header. -// eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);'); - $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header); - - // ----- Look for abort result - if ($v_result == 2) { - $v_result = PCLZIP_ERR_USER_ABORTED; - } - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privExtractFileUsingTempFile() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privExtractFileUsingTempFile(&$p_entry, &$p_options) - { - $v_result=1; - - // ----- Creates a temporary file - $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz'; - if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) { - fclose($v_file); - PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode'); - return PclZip::errorCode(); - } - - - // ----- Write gz file format header - $v_binary_data = pack('va1a1Va1a1', 0x8b1f, Chr($p_entry['compression']), Chr(0x00), time(), Chr(0x00), Chr(3)); - @fwrite($v_dest_file, $v_binary_data, 10); - - // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks - $v_size = $p_entry['compressed_size']; - while ($v_size != 0) - { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($this->zip_fd, $v_read_size); - //$v_binary_data = pack('a'.$v_read_size, $v_buffer); - @fwrite($v_dest_file, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Write gz file format footer - $v_binary_data = pack('VV', $p_entry['crc'], $p_entry['size']); - @fwrite($v_dest_file, $v_binary_data, 8); - - // ----- Close the temporary file - @fclose($v_dest_file); - - // ----- Opening destination file - if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { - $p_entry['status'] = "write_error"; - return $v_result; - } - - // ----- Open the temporary gz file - if (($v_src_file = @gzopen($v_gzip_temp_name, 'rb')) == 0) { - @fclose($v_dest_file); - $p_entry['status'] = "read_error"; - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode'); - return PclZip::errorCode(); - } - - - // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks - $v_size = $p_entry['size']; - while ($v_size != 0) { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @gzread($v_src_file, $v_read_size); - //$v_binary_data = pack('a'.$v_read_size, $v_buffer); - @fwrite($v_dest_file, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - @fclose($v_dest_file); - @gzclose($v_src_file); - - // ----- Delete the temporary file - @unlink($v_gzip_temp_name); - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privExtractFileInOutput() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privExtractFileInOutput(&$p_entry, &$p_options) - { - $v_result=1; - - // ----- Read the file header - if (($v_result = $this->privReadFileHeader($v_header)) != 1) { - return $v_result; - } - - - // ----- Check that the file header is coherent with $p_entry info - if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { - // TBC - } - - // ----- Look for pre-extract callback - if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) { - - // ----- Generate a local information - $v_local_header = array(); - $this->privConvertHeader2FileInfo($p_entry, $v_local_header); - - // ----- Call the callback - // Here I do not use call_user_func() because I need to send a reference to the - // header. -// eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);'); - $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header); - if ($v_result == 0) { - // ----- Change the file status - $p_entry['status'] = "skipped"; $v_result = 1; - } - // ----- Look for abort result - if ($v_result == 2) { - // ----- This status is internal and will be changed in 'skipped' - $p_entry['status'] = "aborted"; - $v_result = PCLZIP_ERR_USER_ABORTED; - } + // ----- Reset the error handler + $this->privErrorReset(); - // ----- Update the informations - // Only some fields can be modified - $p_entry['filename'] = $v_local_header['filename']; - } - - // ----- Trace - - // ----- Look if extraction should be done - if ($p_entry['status'] == 'ok') { - - // ----- Do the extraction (if not a folder) - if (!(($p_entry['external']&0x00000010)==0x00000010)) { - // ----- Look for not compressed file - if ($p_entry['compressed_size'] == $p_entry['size']) { - - // ----- Read the file in a buffer (one shot) - $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); - - // ----- Send the file to the output - echo $v_buffer; - unset($v_buffer); + // ----- Check archive + if (!$this->privCheckFormat()) { + return (0); } - else { - // ----- Read the compressed file in a buffer (one shot) - $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); + // ----- Call the extracting fct + $p_list = array(); + if (($v_result = $this->privList($p_list)) != 1) { + unset($p_list); - // ----- Decompress the file - $v_file_content = gzinflate($v_buffer); - unset($v_buffer); - - // ----- Send the file to the output - echo $v_file_content; - unset($v_file_content); + return (0); } - } + + // ----- Return + return $p_list; } + // -------------------------------------------------------------------------------- - // ----- Change abort status - if ($p_entry['status'] == "aborted") { - $p_entry['status'] = "skipped"; - } - - // ----- Look for post-extract callback - elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { - - // ----- Generate a local information - $v_local_header = array(); - $this->privConvertHeader2FileInfo($p_entry, $v_local_header); - - // ----- Call the callback - // Here I do not use call_user_func() because I need to send a reference to the - // header. -// eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);'); - $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header); - - // ----- Look for abort result - if ($v_result == 2) { - $v_result = PCLZIP_ERR_USER_ABORTED; - } - } - - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privExtractFileAsString() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privExtractFileAsString(&$p_entry, &$p_string, &$p_options) - { - $v_result=1; - - // ----- Read the file header - $v_header = array(); - if (($v_result = $this->privReadFileHeader($v_header)) != 1) + // -------------------------------------------------------------------------------- + // Function : + // extract($p_path="./", $p_remove_path="") + // extract([$p_option, $p_option_value, ...]) + // Description : + // This method supports two synopsis. The first one is historical. + // This method extract all the files / directories from the archive to the + // folder indicated in $p_path. + // If you want to ignore the 'root' part of path of the memorized files + // you can indicate this in the optional $p_remove_path parameter. + // By default, if a newer file with the same name already exists, the + // file is not extracted. + // + // If both PCLZIP_OPT_PATH and PCLZIP_OPT_ADD_PATH aoptions + // are used, the path indicated in PCLZIP_OPT_ADD_PATH is append + // at the end of the path value of PCLZIP_OPT_PATH. + // Parameters : + // $p_path : Path where the files and directories are to be extracted + // $p_remove_path : First part ('root' part) of the memorized path + // (if any similar) to remove while extracting. + // Options : + // PCLZIP_OPT_PATH : + // PCLZIP_OPT_ADD_PATH : + // PCLZIP_OPT_REMOVE_PATH : + // PCLZIP_OPT_REMOVE_ALL_PATH : + // PCLZIP_CB_PRE_EXTRACT : + // PCLZIP_CB_POST_EXTRACT : + // Return Values : + // 0 or a negative value on failure, + // The list of the extracted files, with a status of the action. + // (see PclZip::listContent() for list entry format) + // -------------------------------------------------------------------------------- + public function extract() { - // ----- Return - return $v_result; - } - - - // ----- Check that the file header is coherent with $p_entry info - if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { - // TBC - } - - // ----- Look for pre-extract callback - if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) { - - // ----- Generate a local information - $v_local_header = array(); - $this->privConvertHeader2FileInfo($p_entry, $v_local_header); - - // ----- Call the callback - // Here I do not use call_user_func() because I need to send a reference to the - // header. -// eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);'); - $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header); - if ($v_result == 0) { - // ----- Change the file status - $p_entry['status'] = "skipped"; $v_result = 1; - } - // ----- Look for abort result - if ($v_result == 2) { - // ----- This status is internal and will be changed in 'skipped' - $p_entry['status'] = "aborted"; - $v_result = PCLZIP_ERR_USER_ABORTED; - } + // ----- Reset the error handler + $this->privErrorReset(); - // ----- Update the informations - // Only some fields can be modified - $p_entry['filename'] = $v_local_header['filename']; - } - - - // ----- Look if extraction should be done - if ($p_entry['status'] == 'ok') { - - // ----- Do the extraction (if not a folder) - if (!(($p_entry['external']&0x00000010)==0x00000010)) { - // ----- Look for not compressed file - // if ($p_entry['compressed_size'] == $p_entry['size']) - if ($p_entry['compression'] == 0) { - - // ----- Reading the file - $p_string = @fread($this->zip_fd, $p_entry['compressed_size']); + // ----- Check archive + if (!$this->privCheckFormat()) { + return (0); } - else { - // ----- Reading the file - $v_data = @fread($this->zip_fd, $p_entry['compressed_size']); + // ----- Set default values + $v_options = array(); + // $v_path = "./"; + $v_path = ''; + $v_remove_path = ""; + $v_remove_all_path = false; - // ----- Decompress the file - if (($p_string = @gzinflate($v_data)) === FALSE) { - // TBC - } + // ----- Look for variable options arguments + $v_size = func_num_args(); + + // ----- Default values for option + $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = false; + + // ----- Look for arguments + if ($v_size > 0) { + // ----- Get the arguments + $v_arg_list = func_get_args(); + + // ----- Look for first arg + if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { + + // ----- Parse the options + $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array( + PCLZIP_OPT_PATH => 'optional', + PCLZIP_OPT_REMOVE_PATH => 'optional', + PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', + PCLZIP_OPT_ADD_PATH => 'optional', + PCLZIP_CB_PRE_EXTRACT => 'optional', + PCLZIP_CB_POST_EXTRACT => 'optional', + PCLZIP_OPT_SET_CHMOD => 'optional', + PCLZIP_OPT_BY_NAME => 'optional', + PCLZIP_OPT_BY_EREG => 'optional', + PCLZIP_OPT_BY_PREG => 'optional', + PCLZIP_OPT_BY_INDEX => 'optional', + PCLZIP_OPT_EXTRACT_AS_STRING => 'optional', + PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional', + PCLZIP_OPT_REPLACE_NEWER => 'optional', + PCLZIP_OPT_STOP_ON_ERROR => 'optional', + PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional', + PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', + PCLZIP_OPT_TEMP_FILE_ON => 'optional', + PCLZIP_OPT_TEMP_FILE_OFF => 'optional' + )); + if ($v_result != 1) { + return 0; + } + + // ----- Set the arguments + if (isset($v_options[PCLZIP_OPT_PATH])) { + $v_path = $v_options[PCLZIP_OPT_PATH]; + } + if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) { + $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH]; + } + if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) { + $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH]; + } + if (isset($v_options[PCLZIP_OPT_ADD_PATH])) { + // ----- Check for '/' in last path char + if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) { + $v_path .= '/'; + } + $v_path .= $v_options[PCLZIP_OPT_ADD_PATH]; + } + + // ----- Look for 2 args + // Here we need to support the first historic synopsis of the + // method. + } else { + + // ----- Get the first argument + $v_path = $v_arg_list[0]; + + // ----- Look for the optional second argument + if ($v_size == 2) { + $v_remove_path = $v_arg_list[1]; + } elseif ($v_size > 2) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); + + // ----- Return + return 0; + } + } + } + + // ----- Look for default option values + $this->privOptionDefaultThreshold($v_options); + + // ----- Trace + + // ----- Call the extracting fct + $p_list = array(); + $v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options); + if ($v_result < 1) { + unset($p_list); + + return (0); + } + + // ----- Return + return $p_list; + } + // -------------------------------------------------------------------------------- + + + // -------------------------------------------------------------------------------- + // Function : + // extractByIndex($p_index, $p_path="./", $p_remove_path="") + // extractByIndex($p_index, [$p_option, $p_option_value, ...]) + // Description : + // This method supports two synopsis. The first one is historical. + // This method is doing a partial extract of the archive. + // The extracted files or folders are identified by their index in the + // archive (from 0 to n). + // Note that if the index identify a folder, only the folder entry is + // extracted, not all the files included in the archive. + // Parameters : + // $p_index : A single index (integer) or a string of indexes of files to + // extract. The form of the string is "0,4-6,8-12" with only numbers + // and '-' for range or ',' to separate ranges. No spaces or ';' + // are allowed. + // $p_path : Path where the files and directories are to be extracted + // $p_remove_path : First part ('root' part) of the memorized path + // (if any similar) to remove while extracting. + // Options : + // PCLZIP_OPT_PATH : + // PCLZIP_OPT_ADD_PATH : + // PCLZIP_OPT_REMOVE_PATH : + // PCLZIP_OPT_REMOVE_ALL_PATH : + // PCLZIP_OPT_EXTRACT_AS_STRING : The files are extracted as strings and + // not as files. + // The resulting content is in a new field 'content' in the file + // structure. + // This option must be used alone (any other options are ignored). + // PCLZIP_CB_PRE_EXTRACT : + // PCLZIP_CB_POST_EXTRACT : + // Return Values : + // 0 on failure, + // The list of the extracted files, with a status of the action. + // (see PclZip::listContent() for list entry format) + // -------------------------------------------------------------------------------- + //function extractByIndex($p_index, options...) + public function extractByIndex($p_index) + { + $v_result = 1; + + // ----- Reset the error handler + $this->privErrorReset(); + + // ----- Check archive + if (!$this->privCheckFormat()) { + return (0); + } + + // ----- Set default values + $v_options = array(); + // $v_path = "./"; + $v_path = ''; + $v_remove_path = ""; + $v_remove_all_path = false; + + // ----- Look for variable options arguments + $v_size = func_num_args(); + + // ----- Default values for option + $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = false; + + // ----- Look for arguments + if ($v_size > 1) { + // ----- Get the arguments + $v_arg_list = func_get_args(); + + // ----- Remove form the options list the first argument + array_shift($v_arg_list); + $v_size--; + + // ----- Look for first arg + if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { + + // ----- Parse the options + $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array( + PCLZIP_OPT_PATH => 'optional', + PCLZIP_OPT_REMOVE_PATH => 'optional', + PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', + PCLZIP_OPT_EXTRACT_AS_STRING => 'optional', + PCLZIP_OPT_ADD_PATH => 'optional', + PCLZIP_CB_PRE_EXTRACT => 'optional', + PCLZIP_CB_POST_EXTRACT => 'optional', + PCLZIP_OPT_SET_CHMOD => 'optional', + PCLZIP_OPT_REPLACE_NEWER => 'optional', + PCLZIP_OPT_STOP_ON_ERROR => 'optional', + PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional', + PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', + PCLZIP_OPT_TEMP_FILE_ON => 'optional', + PCLZIP_OPT_TEMP_FILE_OFF => 'optional' + )); + if ($v_result != 1) { + return 0; + } + + // ----- Set the arguments + if (isset($v_options[PCLZIP_OPT_PATH])) { + $v_path = $v_options[PCLZIP_OPT_PATH]; + } + if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) { + $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH]; + } + if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) { + $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH]; + } + if (isset($v_options[PCLZIP_OPT_ADD_PATH])) { + // ----- Check for '/' in last path char + if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) { + $v_path .= '/'; + } + $v_path .= $v_options[PCLZIP_OPT_ADD_PATH]; + } + if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) { + $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = false; + } else { + } + + // ----- Look for 2 args + // Here we need to support the first historic synopsis of the + // method. + } else { + + // ----- Get the first argument + $v_path = $v_arg_list[0]; + + // ----- Look for the optional second argument + if ($v_size == 2) { + $v_remove_path = $v_arg_list[1]; + } elseif ($v_size > 2) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); + + // ----- Return + return 0; + } + } } // ----- Trace - } - else { - // TBC : error : can not extract a folder in a string - } - } - - // ----- Change abort status - if ($p_entry['status'] == "aborted") { - $p_entry['status'] = "skipped"; - } - - // ----- Look for post-extract callback - elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { - - // ----- Generate a local information - $v_local_header = array(); - $this->privConvertHeader2FileInfo($p_entry, $v_local_header); - - // ----- Swap the content to header - $v_local_header['content'] = $p_string; - $p_string = ''; - - // ----- Call the callback - // Here I do not use call_user_func() because I need to send a reference to the - // header. -// eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);'); - $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header); - - // ----- Swap back the content to header - $p_string = $v_local_header['content']; - unset($v_local_header['content']); - - // ----- Look for abort result - if ($v_result == 2) { - $v_result = PCLZIP_ERR_USER_ABORTED; - } - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privReadFileHeader() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privReadFileHeader(&$p_header) - { - $v_result=1; - - // ----- Read the 4 bytes signature - $v_binary_data = @fread($this->zip_fd, 4); - $v_data = unpack('Vid', $v_binary_data); - - // ----- Check signature - if ($v_data['id'] != 0x04034b50) - { - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read the first 42 bytes of the header - $v_binary_data = fread($this->zip_fd, 26); - - // ----- Look for invalid block size - if (strlen($v_binary_data) != 26) - { - $p_header['filename'] = ""; - $p_header['status'] = "invalid_header"; - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data)); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Extract the values - $v_data = unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $v_binary_data); - - // ----- Get filename - $p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']); - - // ----- Get extra_fields - if ($v_data['extra_len'] != 0) { - $p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']); - } - else { - $p_header['extra'] = ''; - } - - // ----- Extract properties - $p_header['version_extracted'] = $v_data['version']; - $p_header['compression'] = $v_data['compression']; - $p_header['size'] = $v_data['size']; - $p_header['compressed_size'] = $v_data['compressed_size']; - $p_header['crc'] = $v_data['crc']; - $p_header['flag'] = $v_data['flag']; - $p_header['filename_len'] = $v_data['filename_len']; - - // ----- Recuperate date in UNIX format - $p_header['mdate'] = $v_data['mdate']; - $p_header['mtime'] = $v_data['mtime']; - if ($p_header['mdate'] && $p_header['mtime']) - { - // ----- Extract time - $v_hour = ($p_header['mtime'] & 0xF800) >> 11; - $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; - $v_seconde = ($p_header['mtime'] & 0x001F)*2; - - // ----- Extract date - $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; - $v_month = ($p_header['mdate'] & 0x01E0) >> 5; - $v_day = $p_header['mdate'] & 0x001F; - - // ----- Get UNIX date format - $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year); - - } - else - { - $p_header['mtime'] = time(); - } - - // TBC - //for(reset($v_data); $key = key($v_data); next($v_data)) { - //} - - // ----- Set the stored filename - $p_header['stored_filename'] = $p_header['filename']; - - // ----- Set the status field - $p_header['status'] = "ok"; - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privReadCentralFileHeader() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privReadCentralFileHeader(&$p_header) - { - $v_result=1; - - // ----- Read the 4 bytes signature - $v_binary_data = @fread($this->zip_fd, 4); - $v_data = unpack('Vid', $v_binary_data); - - // ----- Check signature - if ($v_data['id'] != 0x02014b50) - { - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read the first 42 bytes of the header - $v_binary_data = fread($this->zip_fd, 42); - - // ----- Look for invalid block size - if (strlen($v_binary_data) != 42) - { - $p_header['filename'] = ""; - $p_header['status'] = "invalid_header"; - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data)); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Extract the values - $p_header = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v_binary_data); - - // ----- Get filename - if ($p_header['filename_len'] != 0) - $p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']); - else - $p_header['filename'] = ''; - - // ----- Get extra - if ($p_header['extra_len'] != 0) - $p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']); - else - $p_header['extra'] = ''; - - // ----- Get comment - if ($p_header['comment_len'] != 0) - $p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']); - else - $p_header['comment'] = ''; - - // ----- Extract properties - - // ----- Recuperate date in UNIX format - //if ($p_header['mdate'] && $p_header['mtime']) - // TBC : bug : this was ignoring time with 0/0/0 - if (1) - { - // ----- Extract time - $v_hour = ($p_header['mtime'] & 0xF800) >> 11; - $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; - $v_seconde = ($p_header['mtime'] & 0x001F)*2; - - // ----- Extract date - $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; - $v_month = ($p_header['mdate'] & 0x01E0) >> 5; - $v_day = $p_header['mdate'] & 0x001F; - - // ----- Get UNIX date format - $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year); - - } - else - { - $p_header['mtime'] = time(); - } - - // ----- Set the stored filename - $p_header['stored_filename'] = $p_header['filename']; - - // ----- Set default status to ok - $p_header['status'] = 'ok'; - - // ----- Look if it is a directory - if (substr($p_header['filename'], -1) == '/') { - //$p_header['external'] = 0x41FF0010; - $p_header['external'] = 0x00000010; - } - - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privCheckFileHeaders() - // Description : - // Parameters : - // Return Values : - // 1 on success, - // 0 on error; - // -------------------------------------------------------------------------------- - function privCheckFileHeaders(&$p_local_header, &$p_central_header) - { - $v_result=1; - - // ----- Check the static values - // TBC - if ($p_local_header['filename'] != $p_central_header['filename']) { - } - if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) { - } - if ($p_local_header['flag'] != $p_central_header['flag']) { - } - if ($p_local_header['compression'] != $p_central_header['compression']) { - } - if ($p_local_header['mtime'] != $p_central_header['mtime']) { - } - if ($p_local_header['filename_len'] != $p_central_header['filename_len']) { - } - - // ----- Look for flag bit 3 - if (($p_local_header['flag'] & 8) == 8) { - $p_local_header['size'] = $p_central_header['size']; - $p_local_header['compressed_size'] = $p_central_header['compressed_size']; - $p_local_header['crc'] = $p_central_header['crc']; - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privReadEndCentralDir() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privReadEndCentralDir(&$p_central_dir) - { - $v_result=1; - - // ----- Go to the end of the zip file - $v_size = filesize($this->zipname); - @fseek($this->zip_fd, $v_size); - if (@ftell($this->zip_fd) != $v_size) - { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of the archive \''.$this->zipname.'\''); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- First try : look if this is an archive with no commentaries (most of the time) - // in this case the end of central dir is at 22 bytes of the file end - $v_found = 0; - if ($v_size > 26) { - @fseek($this->zip_fd, $v_size-22); - if (($v_pos = @ftell($this->zip_fd)) != ($v_size-22)) - { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\''); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read for bytes - $v_binary_data = @fread($this->zip_fd, 4); - $v_data = @unpack('Vid', $v_binary_data); - - // ----- Check signature - if ($v_data['id'] == 0x06054b50) { - $v_found = 1; - } - - $v_pos = ftell($this->zip_fd); - } - - // ----- Go back to the maximum possible size of the Central Dir End Record - if (!$v_found) { - $v_maximum_size = 65557; // 0xFFFF + 22; - if ($v_maximum_size > $v_size) - $v_maximum_size = $v_size; - @fseek($this->zip_fd, $v_size-$v_maximum_size); - if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size)) - { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\''); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read byte per byte in order to find the signature - $v_pos = ftell($this->zip_fd); - $v_bytes = 0x00000000; - while ($v_pos < $v_size) - { - // ----- Read a byte - $v_byte = @fread($this->zip_fd, 1); - - // ----- Add the byte - //$v_bytes = ($v_bytes << 8) | Ord($v_byte); - // Note we mask the old value down such that once shifted we can never end up with more than a 32bit number - // Otherwise on systems where we have 64bit integers the check below for the magic number will fail. - $v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); - - // ----- Compare the bytes - if ($v_bytes == 0x504b0506) - { - $v_pos++; - break; + // ----- Trick + // Here I want to reuse extractByRule(), so I need to parse the $p_index + // with privParseOptions() + $v_arg_trick = array( + PCLZIP_OPT_BY_INDEX, + $p_index + ); + $v_options_trick = array(); + $v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick, array( + PCLZIP_OPT_BY_INDEX => 'optional' + )); + if ($v_result != 1) { + return 0; + } + $v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX]; + + // ----- Look for default option values + $this->privOptionDefaultThreshold($v_options); + + // ----- Call the extracting fct + if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) { + return (0); } - $v_pos++; - } - - // ----- Look if not found end of central dir - if ($v_pos == $v_size) - { - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Unable to find End of Central Dir Record signature"); - // ----- Return - return PclZip::errorCode(); - } + return $p_list; } + // -------------------------------------------------------------------------------- - // ----- Read the first 18 bytes of the header - $v_binary_data = fread($this->zip_fd, 18); - - // ----- Look for invalid block size - if (strlen($v_binary_data) != 18) + // -------------------------------------------------------------------------------- + // Function : + // delete([$p_option, $p_option_value, ...]) + // Description : + // This method removes files from the archive. + // If no parameters are given, then all the archive is emptied. + // Parameters : + // None or optional arguments. + // Options : + // PCLZIP_OPT_BY_INDEX : + // PCLZIP_OPT_BY_NAME : + // PCLZIP_OPT_BY_EREG : + // PCLZIP_OPT_BY_PREG : + // Return Values : + // 0 on failure, + // The list of the files which are still present in the archive. + // (see PclZip::listContent() for list entry format) + // -------------------------------------------------------------------------------- + public function delete() { + $v_result = 1; - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Central Dir Record size : ".strlen($v_binary_data)); + // ----- Reset the error handler + $this->privErrorReset(); - // ----- Return - return PclZip::errorCode(); - } - - // ----- Extract the values - $v_data = unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', $v_binary_data); - - // ----- Check the global size - if (($v_pos + $v_data['comment_size'] + 18) != $v_size) { - - // ----- Removed in release 2.2 see readme file - // The check of the file size is a little too strict. - // Some bugs where found when a zip is encrypted/decrypted with 'crypt'. - // While decrypted, zip has training 0 bytes - if (0) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, - 'The central dir is not at the end of the archive.' - .' Some trailing bytes exists after the archive.'); - - // ----- Return - return PclZip::errorCode(); - } - } - - // ----- Get comment - if ($v_data['comment_size'] != 0) { - $p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']); - } - else - $p_central_dir['comment'] = ''; - - $p_central_dir['entries'] = $v_data['entries']; - $p_central_dir['disk_entries'] = $v_data['disk_entries']; - $p_central_dir['offset'] = $v_data['offset']; - $p_central_dir['size'] = $v_data['size']; - $p_central_dir['disk'] = $v_data['disk']; - $p_central_dir['disk_start'] = $v_data['disk_start']; - - // TBC - //for(reset($p_central_dir); $key = key($p_central_dir); next($p_central_dir)) { - //} - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privDeleteByRule() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privDeleteByRule(&$p_result_list, &$p_options) - { - $v_result=1; - $v_list_detail = array(); - - // ----- Open the zip file - if (($v_result=$this->privOpenFd('rb')) != 1) - { - // ----- Return - return $v_result; - } - - // ----- Read the central directory informations - $v_central_dir = array(); - if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) - { - $this->privCloseFd(); - return $v_result; - } - - // ----- Go to beginning of File - @rewind($this->zip_fd); - - // ----- Scan all the files - // ----- Start at beginning of Central Dir - $v_pos_entry = $v_central_dir['offset']; - @rewind($this->zip_fd); - if (@fseek($this->zip_fd, $v_pos_entry)) - { - // ----- Close the zip file - $this->privCloseFd(); - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read each entry - $v_header_list = array(); - $j_start = 0; - for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) - { - - // ----- Read the file header - $v_header_list[$v_nb_extracted] = array(); - if (($v_result = $this->privReadCentralFileHeader($v_header_list[$v_nb_extracted])) != 1) - { - // ----- Close the zip file - $this->privCloseFd(); - - return $v_result; - } - - - // ----- Store the index - $v_header_list[$v_nb_extracted]['index'] = $i; - - // ----- Look for the specific extract rules - $v_found = false; - - // ----- Look for extract by name rule - if ( (isset($p_options[PCLZIP_OPT_BY_NAME])) - && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { - - // ----- Look if the filename is in the list - for ($j=0; ($j strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) - && (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) { - $v_found = true; - } - elseif ( (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */ - && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) { - $v_found = true; - } - } - // ----- Look for a filename - elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) { - $v_found = true; - } - } - } - - // ----- Look for extract by ereg rule - // ereg() is deprecated with PHP 5.3 - /* - else if ( (isset($p_options[PCLZIP_OPT_BY_EREG])) - && ($p_options[PCLZIP_OPT_BY_EREG] != "")) { - - if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header_list[$v_nb_extracted]['stored_filename'])) { - $v_found = true; - } - } - */ - - // ----- Look for extract by preg rule - else if ( (isset($p_options[PCLZIP_OPT_BY_PREG])) - && ($p_options[PCLZIP_OPT_BY_PREG] != "")) { - - if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) { - $v_found = true; - } - } - - // ----- Look for extract by index rule - else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX])) - && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { - - // ----- Look if the index is in the list - for ($j=$j_start; ($j=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { - $v_found = true; - } - if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { - $j_start = $j+1; - } - - if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) { - break; - } - } - } - else { - $v_found = true; - } - - // ----- Look for deletion - if ($v_found) - { - unset($v_header_list[$v_nb_extracted]); - } - else - { - $v_nb_extracted++; - } - } - - // ----- Look if something need to be deleted - if ($v_nb_extracted > 0) { - - // ----- Creates a temporay file - $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp'; - - // ----- Creates a temporary zip archive - $v_temp_zip = new PclZip($v_zip_temp_name); - - // ----- Open the temporary zip file in write mode - if (($v_result = $v_temp_zip->privOpenFd('wb')) != 1) { - $this->privCloseFd(); - - // ----- Return - return $v_result; + // ----- Check archive + if (!$this->privCheckFormat()) { + return (0); } - // ----- Look which file need to be kept - for ($i=0; $izip_fd); - if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) { - // ----- Close the zip file - $this->privCloseFd(); - $v_temp_zip->privCloseFd(); - @unlink($v_zip_temp_name); + // ----- Look for variable options arguments + $v_size = func_num_args(); + + // ----- Look for arguments + if ($v_size > 0) { + // ----- Get the arguments + $v_arg_list = func_get_args(); + + // ----- Parse the options + $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array( + PCLZIP_OPT_BY_NAME => 'optional', + PCLZIP_OPT_BY_EREG => 'optional', + PCLZIP_OPT_BY_PREG => 'optional', + PCLZIP_OPT_BY_INDEX => 'optional' + )); + if ($v_result != 1) { + return 0; + } + } + + // ----- Magic quotes trick + $this->privDisableMagicQuotes(); + + // ----- Call the delete fct + $v_list = array(); + if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1) { + $this->privSwapBackMagicQuotes(); + unset($v_list); + + return (0); + } + + // ----- Magic quotes trick + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_list; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : deleteByIndex() + // Description : + // ***** Deprecated ***** + // delete(PCLZIP_OPT_BY_INDEX, $p_index) should be prefered. + // -------------------------------------------------------------------------------- + public function deleteByIndex($p_index) + { + + $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index); + + // ----- Return + return $p_list; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : properties() + // Description : + // This method gives the properties of the archive. + // The properties are : + // nb : Number of files in the archive + // comment : Comment associated with the archive file + // status : not_exist, ok + // Parameters : + // None + // Return Values : + // 0 on failure, + // An array with the archive properties. + // -------------------------------------------------------------------------------- + public function properties() + { + + // ----- Reset the error handler + $this->privErrorReset(); + + // ----- Magic quotes trick + $this->privDisableMagicQuotes(); + + // ----- Check archive + if (!$this->privCheckFormat()) { + $this->privSwapBackMagicQuotes(); + + return (0); + } + + // ----- Default properties + $v_prop = array(); + $v_prop['comment'] = ''; + $v_prop['nb'] = 0; + $v_prop['status'] = 'not_exist'; + + // ----- Look if file exists + if (@is_file($this->zipname)) { + // ----- Open the zip file + if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0) { + $this->privSwapBackMagicQuotes(); // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \'' . $this->zipname . '\' in binary read mode'); + + // ----- Return + return 0; + } + + // ----- Read the central directory informations + $v_central_dir = array(); + if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { + $this->privSwapBackMagicQuotes(); + + return 0; + } + + // ----- Close the zip file + $this->privCloseFd(); + + // ----- Set the user attributes + $v_prop['comment'] = $v_central_dir['comment']; + $v_prop['nb'] = $v_central_dir['entries']; + $v_prop['status'] = 'ok'; + } + + // ----- Magic quotes trick + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_prop; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : duplicate() + // Description : + // This method creates an archive by copying the content of an other one. If + // the archive already exist, it is replaced by the new one without any warning. + // Parameters : + // $p_archive : The filename of a valid archive, or + // a valid PclZip object. + // Return Values : + // 1 on success. + // 0 or a negative value on error (error code). + // -------------------------------------------------------------------------------- + public function duplicate($p_archive) + { + $v_result = 1; + + // ----- Reset the error handler + $this->privErrorReset(); + + // ----- Look if the $p_archive is a PclZip object + if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip')) { + + // ----- Duplicate the archive + $v_result = $this->privDuplicate($p_archive->zipname); + + // ----- Look if the $p_archive is a string (so a filename) + } elseif (is_string($p_archive)) { + + // ----- Check that $p_archive is a valid zip file + // TBC : Should also check the archive format + if (!is_file($p_archive)) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '" . $p_archive . "'"); + $v_result = PCLZIP_ERR_MISSING_FILE; + } else { + // ----- Duplicate the archive + $v_result = $this->privDuplicate($p_archive); + } + + // ----- Invalid variable + } else { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add"); + $v_result = PCLZIP_ERR_INVALID_PARAMETER; + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : merge() + // Description : + // This method merge the $p_archive_to_add archive at the end of the current + // one ($this). + // If the archive ($this) does not exist, the merge becomes a duplicate. + // If the $p_archive_to_add archive does not exist, the merge is a success. + // Parameters : + // $p_archive_to_add : It can be directly the filename of a valid zip archive, + // or a PclZip object archive. + // Return Values : + // 1 on success, + // 0 or negative values on error (see below). + // -------------------------------------------------------------------------------- + public function merge($p_archive_to_add) + { + $v_result = 1; + + // ----- Reset the error handler + $this->privErrorReset(); + + // ----- Check archive + if (!$this->privCheckFormat()) { + return (0); + } + + // ----- Look if the $p_archive_to_add is a PclZip object + if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip')) { + + // ----- Merge the archive + $v_result = $this->privMerge($p_archive_to_add); + + // ----- Look if the $p_archive_to_add is a string (so a filename) + } elseif (is_string($p_archive_to_add)) { + + // ----- Create a temporary archive + $v_object_archive = new PclZip($p_archive_to_add); + + // ----- Merge the archive + $v_result = $this->privMerge($v_object_archive); + + // ----- Invalid variable + } else { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add"); + $v_result = PCLZIP_ERR_INVALID_PARAMETER; + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : errorCode() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + public function errorCode() + { + if (PCLZIP_ERROR_EXTERNAL == 1) { + return (PclErrorCode()); + } else { + return ($this->error_code); + } + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : errorName() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + public function errorName($p_with_code = false) + { + $v_name = array( + PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR', + PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL', + PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL', + PCLZIP_ERR_INVALID_PARAMETER => 'PCLZIP_ERR_INVALID_PARAMETER', + PCLZIP_ERR_MISSING_FILE => 'PCLZIP_ERR_MISSING_FILE', + PCLZIP_ERR_FILENAME_TOO_LONG => 'PCLZIP_ERR_FILENAME_TOO_LONG', + PCLZIP_ERR_INVALID_ZIP => 'PCLZIP_ERR_INVALID_ZIP', + PCLZIP_ERR_BAD_EXTRACTED_FILE => 'PCLZIP_ERR_BAD_EXTRACTED_FILE', + PCLZIP_ERR_DIR_CREATE_FAIL => 'PCLZIP_ERR_DIR_CREATE_FAIL', + PCLZIP_ERR_BAD_EXTENSION => 'PCLZIP_ERR_BAD_EXTENSION', + PCLZIP_ERR_BAD_FORMAT => 'PCLZIP_ERR_BAD_FORMAT', + PCLZIP_ERR_DELETE_FILE_FAIL => 'PCLZIP_ERR_DELETE_FILE_FAIL', + PCLZIP_ERR_RENAME_FILE_FAIL => 'PCLZIP_ERR_RENAME_FILE_FAIL', + PCLZIP_ERR_BAD_CHECKSUM => 'PCLZIP_ERR_BAD_CHECKSUM', + PCLZIP_ERR_INVALID_ARCHIVE_ZIP => 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', + PCLZIP_ERR_MISSING_OPTION_VALUE => 'PCLZIP_ERR_MISSING_OPTION_VALUE', + PCLZIP_ERR_INVALID_OPTION_VALUE => 'PCLZIP_ERR_INVALID_OPTION_VALUE', + PCLZIP_ERR_UNSUPPORTED_COMPRESSION => 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', + PCLZIP_ERR_UNSUPPORTED_ENCRYPTION => 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', + PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE => 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', + PCLZIP_ERR_DIRECTORY_RESTRICTION => 'PCLZIP_ERR_DIRECTORY_RESTRICTION' + ); + + if (isset($v_name[$this->error_code])) { + $v_value = $v_name[$this->error_code]; + } else { + $v_value = 'NoName'; + } + + if ($p_with_code) { + return ($v_value . ' (' . $this->error_code . ')'); + } else { + return ($v_value); + } + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : errorInfo() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + public function errorInfo($p_full = false) + { + if (PCLZIP_ERROR_EXTERNAL == 1) { + return (PclErrorString()); + } else { + if ($p_full) { + return ($this->errorName(true) . " : " . $this->error_string); + } else { + return ($this->error_string . " [code " . $this->error_code . "]"); + } + } + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // ***** UNDER THIS LINE ARE DEFINED PRIVATE INTERNAL FUNCTIONS ***** + // ***** ***** + // ***** THESES FUNCTIONS MUST NOT BE USED DIRECTLY ***** + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privCheckFormat() + // Description : + // This method check that the archive exists and is a valid zip archive. + // Several level of check exists. (futur) + // Parameters : + // $p_level : Level of check. Default 0. + // 0 : Check the first bytes (magic codes) (default value)) + // 1 : 0 + Check the central directory (futur) + // 2 : 1 + Check each file header (futur) + // Return Values : + // true on success, + // false on error, the error code is set. + // -------------------------------------------------------------------------------- + public function privCheckFormat($p_level = 0) + { + $v_result = true; + + // ----- Reset the file system cache + clearstatcache(); + + // ----- Reset the error handler + $this->privErrorReset(); + + // ----- Look if the file exits + if (!is_file($this->zipname)) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '" . $this->zipname . "'"); + + return (false); + } + + // ----- Check that the file is readeable + if (!is_readable($this->zipname)) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '" . $this->zipname . "'"); + + return (false); + } + + // ----- Check the magic code + // TBC + + // ----- Check the central header + // TBC + + // ----- Check each file header + // TBC + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privParseOptions() + // Description : + // This internal methods reads the variable list of arguments ($p_options_list, + // $p_size) and generate an array with the options and values ($v_result_list). + // $v_requested_options contains the options that can be present and those that + // must be present. + // $v_requested_options is an array, with the option value as key, and 'optional', + // or 'mandatory' as value. + // Parameters : + // See above. + // Return Values : + // 1 on success. + // 0 on failure. + // -------------------------------------------------------------------------------- + public function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options = false) + { + $v_result = 1; + + // ----- Read the options + $i = 0; + while ($i < $p_size) { + + // ----- Check if the option is supported + if (!isset($v_requested_options[$p_options_list[$i]])) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '" . $p_options_list[$i] . "' for this method"); // ----- Return return PclZip::errorCode(); } - // ----- Read the file header - $v_local_header = array(); - if (($v_result = $this->privReadFileHeader($v_local_header)) != 1) { - // ----- Close the zip file - $this->privCloseFd(); - $v_temp_zip->privCloseFd(); - @unlink($v_zip_temp_name); + // ----- Look for next option + switch ($p_options_list[$i]) { + // ----- Look for options that request a path value + case PCLZIP_OPT_PATH: + case PCLZIP_OPT_REMOVE_PATH: + case PCLZIP_OPT_ADD_PATH: + // ----- Check the number of parameters + if (($i + 1) >= $p_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); - // ----- Return - return $v_result; + // ----- Return + return PclZip::errorCode(); + } + + // ----- Get the value + $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i + 1], false); + $i++; + break; + + case PCLZIP_OPT_TEMP_FILE_THRESHOLD: + // ----- Check the number of parameters + if (($i + 1) >= $p_size) { + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + return PclZip::errorCode(); + } + + // ----- Check for incompatible options + if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '" . PclZipUtilOptionText($p_options_list[$i]) . "' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'"); + + return PclZip::errorCode(); + } + + // ----- Check the value + $v_value = $p_options_list[$i + 1]; + if ((!is_integer($v_value)) || ($v_value < 0)) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + return PclZip::errorCode(); + } + + // ----- Get the value (and convert it in bytes) + $v_result_list[$p_options_list[$i]] = $v_value * 1048576; + $i++; + break; + + case PCLZIP_OPT_TEMP_FILE_ON: + // ----- Check for incompatible options + if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '" . PclZipUtilOptionText($p_options_list[$i]) . "' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'"); + + return PclZip::errorCode(); + } + + $v_result_list[$p_options_list[$i]] = true; + break; + + case PCLZIP_OPT_TEMP_FILE_OFF: + // ----- Check for incompatible options + if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_ON])) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '" . PclZipUtilOptionText($p_options_list[$i]) . "' can not be used with option 'PCLZIP_OPT_TEMP_FILE_ON'"); + + return PclZip::errorCode(); + } + // ----- Check for incompatible options + if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '" . PclZipUtilOptionText($p_options_list[$i]) . "' can not be used with option 'PCLZIP_OPT_TEMP_FILE_THRESHOLD'"); + + return PclZip::errorCode(); + } + + $v_result_list[$p_options_list[$i]] = true; + break; + + case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION: + // ----- Check the number of parameters + if (($i + 1) >= $p_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Get the value + if (is_string($p_options_list[$i + 1]) && ($p_options_list[$i + 1] != '')) { + $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i + 1], false); + $i++; + } else { + } + break; + + // ----- Look for options that request an array of string for value + case PCLZIP_OPT_BY_NAME: + // ----- Check the number of parameters + if (($i + 1) >= $p_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Get the value + if (is_string($p_options_list[$i + 1])) { + $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i + 1]; + } elseif (is_array($p_options_list[$i + 1])) { + $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; + } else { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + $i++; + break; + + // ----- Look for options that request an EREG or PREG expression + case PCLZIP_OPT_BY_EREG: + $p_options_list[$i] = PCLZIP_OPT_BY_PREG; + // ereg() is deprecated starting with PHP 5.3. Move PCLZIP_OPT_BY_EREG + // to PCLZIP_OPT_BY_PREG + case PCLZIP_OPT_BY_PREG: + //case PCLZIP_OPT_CRYPT : + // ----- Check the number of parameters + if (($i + 1) >= $p_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Get the value + if (is_string($p_options_list[$i + 1])) { + $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; + } else { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + $i++; + break; + + // ----- Look for options that takes a string + case PCLZIP_OPT_COMMENT: + case PCLZIP_OPT_ADD_COMMENT: + case PCLZIP_OPT_PREPEND_COMMENT: + // ----- Check the number of parameters + if (($i + 1) >= $p_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Get the value + if (is_string($p_options_list[$i + 1])) { + $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; + } else { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + $i++; + break; + + // ----- Look for options that request an array of index + case PCLZIP_OPT_BY_INDEX: + // ----- Check the number of parameters + if (($i + 1) >= $p_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Get the value + $v_work_list = array(); + if (is_string($p_options_list[$i + 1])) { + + // ----- Remove spaces + $p_options_list[$i + 1] = strtr($p_options_list[$i + 1], ' ', ''); + + // ----- Parse items + $v_work_list = explode(",", $p_options_list[$i + 1]); + } elseif (is_integer($p_options_list[$i + 1])) { + $v_work_list[0] = $p_options_list[$i + 1] . '-' . $p_options_list[$i + 1]; + } elseif (is_array($p_options_list[$i + 1])) { + $v_work_list = $p_options_list[$i + 1]; + } else { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Reduce the index list + // each index item in the list must be a couple with a start and + // an end value : [0,3], [5-5], [8-10], ... + // ----- Check the format of each item + $v_sort_flag = false; + $v_sort_value = 0; + for ($j = 0; $j < sizeof($v_work_list); $j++) { + // ----- Explode the item + $v_item_list = explode("-", $v_work_list[$j]); + $v_size_item_list = sizeof($v_item_list); + + // ----- TBC : Here we might check that each item is a + // real integer ... + + // ----- Look for single value + if ($v_size_item_list == 1) { + // ----- Set the option value + $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0]; + $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[0]; + } elseif ($v_size_item_list == 2) { + // ----- Set the option value + $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0]; + $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[1]; + } else { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Too many values in index range for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Look for list sort + if ($v_result_list[$p_options_list[$i]][$j]['start'] < $v_sort_value) { + $v_sort_flag = true; + + // ----- TBC : An automatic sort should be writen ... + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Invalid order of index range for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + $v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start']; + } + + // ----- Sort the items + if ($v_sort_flag) { + // TBC : To Be Completed + } + + // ----- Next option + $i++; + break; + + // ----- Look for options that request no value + case PCLZIP_OPT_REMOVE_ALL_PATH: + case PCLZIP_OPT_EXTRACT_AS_STRING: + case PCLZIP_OPT_NO_COMPRESSION: + case PCLZIP_OPT_EXTRACT_IN_OUTPUT: + case PCLZIP_OPT_REPLACE_NEWER: + case PCLZIP_OPT_STOP_ON_ERROR: + $v_result_list[$p_options_list[$i]] = true; + break; + + // ----- Look for options that request an octal value + case PCLZIP_OPT_SET_CHMOD: + // ----- Check the number of parameters + if (($i + 1) >= $p_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Get the value + $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; + $i++; + break; + + // ----- Look for options that request a call-back + case PCLZIP_CB_PRE_EXTRACT: + case PCLZIP_CB_POST_EXTRACT: + case PCLZIP_CB_PRE_ADD: + case PCLZIP_CB_POST_ADD: + /* for futur use + case PCLZIP_CB_PRE_DELETE : + case PCLZIP_CB_POST_DELETE : + case PCLZIP_CB_PRE_LIST : + case PCLZIP_CB_POST_LIST : + */ + // ----- Check the number of parameters + if (($i + 1) >= $p_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Get the value + $v_function_name = $p_options_list[$i + 1]; + + // ----- Check that the value is a valid existing function + if (!function_exists($v_function_name)) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '" . $v_function_name . "()' is not an existing function for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Set the attribute + $v_result_list[$p_options_list[$i]] = $v_function_name; + $i++; + break; + + default: + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Unknown parameter '" . $p_options_list[$i] . "'"); + + // ----- Return + return PclZip::errorCode(); } - // ----- Check that local file header is same as central file header - if ($this->privCheckFileHeaders($v_local_header, - $v_header_list[$i]) != 1) { - // TBC - } - unset($v_local_header); + // ----- Next options + $i++; + } - // ----- Write the file header - if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) { - // ----- Close the zip file - $this->privCloseFd(); - $v_temp_zip->privCloseFd(); - @unlink($v_zip_temp_name); + // ----- Look for mandatory options + if ($v_requested_options !== false) { + for ($key = reset($v_requested_options); $key = key($v_requested_options); $key = next($v_requested_options)) { + // ----- Look for mandatory option + if ($v_requested_options[$key] == 'mandatory') { + // ----- Look if present + if (!isset($v_result_list[$key])) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter " . PclZipUtilOptionText($key) . "(" . $key . ")"); - // ----- Return - return $v_result; - } - - // ----- Read/write the data block - if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) { - // ----- Close the zip file - $this->privCloseFd(); - $v_temp_zip->privCloseFd(); - @unlink($v_zip_temp_name); - - // ----- Return - return $v_result; + // ----- Return + return PclZip::errorCode(); + } + } } } - // ----- Store the offset of the central dir - $v_offset = @ftell($v_temp_zip->zip_fd); + // ----- Look for default values + if (!isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) { - // ----- Re-Create the Central Dir files header - for ($i=0; $iprivWriteCentralFileHeader($v_header_list[$i])) != 1) { - $v_temp_zip->privCloseFd(); - $this->privCloseFd(); - @unlink($v_zip_temp_name); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privOptionDefaultThreshold() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privOptionDefaultThreshold(&$p_options) + { + $v_result = 1; + + if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) || isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) { + return $v_result; + } + + // ----- Get 'memory_limit' configuration value + $v_memory_limit = ini_get('memory_limit'); + $v_memory_limit = trim($v_memory_limit); + $last = strtolower(substr($v_memory_limit, -1)); + $v_memory_limit = preg_replace('/[^0-9,.]/', '', $v_memory_limit); + + if ($last == 'g') { + //$v_memory_limit = $v_memory_limit*1024*1024*1024; + $v_memory_limit = $v_memory_limit * 1073741824; + } + if ($last == 'm') { + //$v_memory_limit = $v_memory_limit*1024*1024; + $v_memory_limit = $v_memory_limit * 1048576; + } + if ($last == 'k') { + $v_memory_limit = $v_memory_limit * 1024; + } + + $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit * PCLZIP_TEMPORARY_FILE_RATIO); + + // ----- Sanity check : No threshold if value lower than 1M + if ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] < 1048576) { + unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privFileDescrParseAtt() + // Description : + // Parameters : + // Return Values : + // 1 on success. + // 0 on failure. + // -------------------------------------------------------------------------------- + public function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options = false) + { + $v_result = 1; + + // ----- For each file in the list check the attributes + foreach ($p_file_list as $v_key => $v_value) { + + // ----- Check if the option is supported + if (!isset($v_requested_options[$v_key])) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file attribute '" . $v_key . "' for this file"); // ----- Return - return $v_result; + return PclZip::errorCode(); } - // ----- Transform the header to a 'usable' info - $v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); + // ----- Look for attribute + switch ($v_key) { + case PCLZIP_ATT_FILE_NAME: + if (!is_string($v_value)) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type " . gettype($v_value) . ". String expected for attribute '" . PclZipUtilOptionText($v_key) . "'"); + + return PclZip::errorCode(); + } + + $p_filedescr['filename'] = PclZipUtilPathReduction($v_value); + + if ($p_filedescr['filename'] == '') { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '" . PclZipUtilOptionText($v_key) . "'"); + + return PclZip::errorCode(); + } + + break; + + case PCLZIP_ATT_FILE_NEW_SHORT_NAME: + if (!is_string($v_value)) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type " . gettype($v_value) . ". String expected for attribute '" . PclZipUtilOptionText($v_key) . "'"); + + return PclZip::errorCode(); + } + + $p_filedescr['new_short_name'] = PclZipUtilPathReduction($v_value); + + if ($p_filedescr['new_short_name'] == '') { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty short filename for attribute '" . PclZipUtilOptionText($v_key) . "'"); + + return PclZip::errorCode(); + } + break; + + case PCLZIP_ATT_FILE_NEW_FULL_NAME: + if (!is_string($v_value)) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type " . gettype($v_value) . ". String expected for attribute '" . PclZipUtilOptionText($v_key) . "'"); + + return PclZip::errorCode(); + } + + $p_filedescr['new_full_name'] = PclZipUtilPathReduction($v_value); + + if ($p_filedescr['new_full_name'] == '') { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty full filename for attribute '" . PclZipUtilOptionText($v_key) . "'"); + + return PclZip::errorCode(); + } + break; + + // ----- Look for options that takes a string + case PCLZIP_ATT_FILE_COMMENT: + if (!is_string($v_value)) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type " . gettype($v_value) . ". String expected for attribute '" . PclZipUtilOptionText($v_key) . "'"); + + return PclZip::errorCode(); + } + + $p_filedescr['comment'] = $v_value; + break; + + case PCLZIP_ATT_FILE_MTIME: + if (!is_integer($v_value)) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type " . gettype($v_value) . ". Integer expected for attribute '" . PclZipUtilOptionText($v_key) . "'"); + + return PclZip::errorCode(); + } + + $p_filedescr['mtime'] = $v_value; + break; + + case PCLZIP_ATT_FILE_CONTENT: + $p_filedescr['content'] = $v_value; + break; + + default: + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Unknown parameter '" . $v_key . "'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Look for mandatory options + if ($v_requested_options !== false) { + for ($key = reset($v_requested_options); $key = key($v_requested_options); $key = next($v_requested_options)) { + // ----- Look for mandatory option + if ($v_requested_options[$key] == 'mandatory') { + // ----- Look if present + if (!isset($p_file_list[$key])) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter " . PclZipUtilOptionText($key) . "(" . $key . ")"); + + return PclZip::errorCode(); + } + } + } + } + + // end foreach } + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- - // ----- Zip file comment - $v_comment = ''; - if (isset($p_options[PCLZIP_OPT_COMMENT])) { - $v_comment = $p_options[PCLZIP_OPT_COMMENT]; + // -------------------------------------------------------------------------------- + // Function : privFileDescrExpand() + // Description : + // This method look for each item of the list to see if its a file, a folder + // or a string to be added as file. For any other type of files (link, other) + // just ignore the item. + // Then prepare the information that will be stored for that file. + // When its a folder, expand the folder with all the files that are in that + // folder (recursively). + // Parameters : + // Return Values : + // 1 on success. + // 0 on failure. + // -------------------------------------------------------------------------------- + public function privFileDescrExpand(&$p_filedescr_list, &$p_options) + { + $v_result = 1; + + // ----- Create a result list + $v_result_list = array(); + + // ----- Look each entry + for ($i = 0; $i < sizeof($p_filedescr_list); $i++) { + + // ----- Get filedescr + $v_descr = $p_filedescr_list[$i]; + + // ----- Reduce the filename + $v_descr['filename'] = PclZipUtilTranslateWinPath($v_descr['filename'], false); + $v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']); + + // ----- Look for real file or folder + if (file_exists($v_descr['filename'])) { + if (@is_file($v_descr['filename'])) { + $v_descr['type'] = 'file'; + } elseif (@is_dir($v_descr['filename'])) { + $v_descr['type'] = 'folder'; + } elseif (@is_link($v_descr['filename'])) { + // skip + continue; + } else { + // skip + continue; + } + + // ----- Look for string added as file + } elseif (isset($v_descr['content'])) { + $v_descr['type'] = 'virtual_file'; + + // ----- Missing file + } else { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '" . $v_descr['filename'] . "' does not exist"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Calculate the stored filename + $this->privCalculateStoredFilename($v_descr, $p_options); + + // ----- Add the descriptor in result list + $v_result_list[sizeof($v_result_list)] = $v_descr; + + // ----- Look for folder + if ($v_descr['type'] == 'folder') { + // ----- List of items in folder + $v_dirlist_descr = array(); + $v_dirlist_nb = 0; + if ($v_folder_handler = @opendir($v_descr['filename'])) { + while (($v_item_handler = @readdir($v_folder_handler)) !== false) { + + // ----- Skip '.' and '..' + if (($v_item_handler == '.') || ($v_item_handler == '..')) { + continue; + } + + // ----- Compose the full filename + $v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'] . '/' . $v_item_handler; + + // ----- Look for different stored filename + // Because the name of the folder was changed, the name of the + // files/sub-folders also change + if (($v_descr['stored_filename'] != $v_descr['filename']) && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) { + if ($v_descr['stored_filename'] != '') { + $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'] . '/' . $v_item_handler; + } else { + $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_item_handler; + } + } + + $v_dirlist_nb++; + } + + @closedir($v_folder_handler); + } else { + // TBC : unable to open folder in read mode + } + + // ----- Expand each element of the list + if ($v_dirlist_nb != 0) { + // ----- Expand + if (($v_result = $this->privFileDescrExpand($v_dirlist_descr, $p_options)) != 1) { + return $v_result; + } + + // ----- Concat the resulting list + $v_result_list = array_merge($v_result_list, $v_dirlist_descr); + } else { + } + + // ----- Free local array + unset($v_dirlist_descr); + } } - // ----- Calculate the size of the central header - $v_size = @ftell($v_temp_zip->zip_fd)-$v_offset; + // ----- Get the result list + $p_filedescr_list = $v_result_list; - // ----- Create the central dir footer - if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) { - // ----- Reset the file list - unset($v_header_list); - $v_temp_zip->privCloseFd(); - $this->privCloseFd(); - @unlink($v_zip_temp_name); + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privCreate() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privCreate($p_filedescr_list, &$p_result_list, &$p_options) + { + $v_result = 1; + $v_list_detail = array(); + + // ----- Magic quotes trick + $this->privDisableMagicQuotes(); + + // ----- Open the file in write mode + if (($v_result = $this->privOpenFd('wb')) != 1) { + // ----- Return + return $v_result; + } + + // ----- Add the list of files + $v_result = $this->privAddList($p_filedescr_list, $p_result_list, $p_options); + + // ----- Close + $this->privCloseFd(); + + // ----- Magic quotes trick + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privAdd() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privAdd($p_filedescr_list, &$p_result_list, &$p_options) + { + $v_result = 1; + $v_list_detail = array(); + + // ----- Look if the archive exists or is empty + if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0)) { + + // ----- Do a create + $v_result = $this->privCreate($p_filedescr_list, $p_result_list, $p_options); + + // ----- Return + return $v_result; + } + // ----- Magic quotes trick + $this->privDisableMagicQuotes(); + + // ----- Open the zip file + if (($v_result = $this->privOpenFd('rb')) != 1) { + // ----- Magic quotes trick + $this->privSwapBackMagicQuotes(); // ----- Return return $v_result; } + // ----- Read the central directory informations + $v_central_dir = array(); + if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + return $v_result; + } + + // ----- Go to beginning of File + @rewind($this->zip_fd); + + // ----- Creates a temporay file + $v_zip_temp_name = PCLZIP_TEMPORARY_DIR . uniqid('pclzip-') . '.tmp'; + + // ----- Open the temporary file in write mode + if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0) { + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \'' . $v_zip_temp_name . '\' in binary write mode'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Copy the files from the archive to the temporary file + // TBC : Here I should better append the file and go back to erase the central dir + $v_size = $v_central_dir['offset']; + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = fread($this->zip_fd, $v_read_size); + @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Swap the file descriptor + // Here is a trick : I swap the temporary fd with the zip fd, in order to use + // the following methods on the temporary fil and not the real archive + $v_swap = $this->zip_fd; + $this->zip_fd = $v_zip_temp_fd; + $v_zip_temp_fd = $v_swap; + + // ----- Add the files + $v_header_list = array(); + if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1) { + fclose($v_zip_temp_fd); + $this->privCloseFd(); + @unlink($v_zip_temp_name); + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_result; + } + + // ----- Store the offset of the central dir + $v_offset = @ftell($this->zip_fd); + + // ----- Copy the block of file headers from the old archive + $v_size = $v_central_dir['size']; + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($v_zip_temp_fd, $v_read_size); + @fwrite($this->zip_fd, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Create the Central Dir files header + for ($i = 0, $v_count = 0; $i < sizeof($v_header_list); $i++) { + // ----- Create the file header + if ($v_header_list[$i]['status'] == 'ok') { + if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) { + fclose($v_zip_temp_fd); + $this->privCloseFd(); + @unlink($v_zip_temp_name); + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_result; + } + $v_count++; + } + + // ----- Transform the header to a 'usable' info + $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); + } + + // ----- Zip file comment + $v_comment = $v_central_dir['comment']; + if (isset($p_options[PCLZIP_OPT_COMMENT])) { + $v_comment = $p_options[PCLZIP_OPT_COMMENT]; + } + if (isset($p_options[PCLZIP_OPT_ADD_COMMENT])) { + $v_comment = $v_comment . $p_options[PCLZIP_OPT_ADD_COMMENT]; + } + if (isset($p_options[PCLZIP_OPT_PREPEND_COMMENT])) { + $v_comment = $p_options[PCLZIP_OPT_PREPEND_COMMENT] . $v_comment; + } + + // ----- Calculate the size of the central header + $v_size = @ftell($this->zip_fd) - $v_offset; + + // ----- Create the central dir footer + if (($v_result = $this->privWriteCentralHeader($v_count + $v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1) { + // ----- Reset the file list + unset($v_header_list); + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_result; + } + + // ----- Swap back the file descriptor + $v_swap = $this->zip_fd; + $this->zip_fd = $v_zip_temp_fd; + $v_zip_temp_fd = $v_swap; + // ----- Close - $v_temp_zip->privCloseFd(); $this->privCloseFd(); + // ----- Close the temporary file + @fclose($v_zip_temp_fd); + + // ----- Magic quotes trick + $this->privSwapBackMagicQuotes(); + // ----- Delete the zip file // TBC : I should test the result ... @unlink($this->zipname); @@ -4954,544 +2269,2964 @@ //@rename($v_zip_temp_name, $this->zipname); PclZipUtilRename($v_zip_temp_name, $this->zipname); - // ----- Destroy the temporary archive - unset($v_temp_zip); + // ----- Return + return $v_result; } + // -------------------------------------------------------------------------------- - // ----- Remove every files : reset the file - else if ($v_central_dir['entries'] != 0) { + // -------------------------------------------------------------------------------- + // Function : privOpenFd() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + public function privOpenFd($p_mode) + { + $v_result = 1; + + // ----- Look if already open + if ($this->zip_fd != 0) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Zip file \'' . $this->zipname . '\' already open'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Open the zip file + if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \'' . $this->zipname . '\' in ' . $p_mode . ' mode'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privCloseFd() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + public function privCloseFd() + { + $v_result = 1; + + if ($this->zip_fd != 0) { + @fclose($this->zip_fd); + } + $this->zip_fd = 0; + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privAddList() + // Description : + // $p_add_dir and $p_remove_dir will give the ability to memorize a path which is + // different from the real path of the file. This is usefull if you want to have PclTar + // running in any directory, and memorize relative path from an other directory. + // Parameters : + // $p_list : An array containing the file or directory names to add in the tar + // $p_result_list : list of added files with their properties (specially the status field) + // $p_add_dir : Path to add in the filename path archived + // $p_remove_dir : Path to remove in the filename path archived + // Return Values : + // -------------------------------------------------------------------------------- + // function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options) + public function privAddList($p_filedescr_list, &$p_result_list, &$p_options) + { + $v_result = 1; + + // ----- Add the files + $v_header_list = array(); + if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1) { + // ----- Return + return $v_result; + } + + // ----- Store the offset of the central dir + $v_offset = @ftell($this->zip_fd); + + // ----- Create the Central Dir files header + for ($i = 0, $v_count = 0; $i < sizeof($v_header_list); $i++) { + // ----- Create the file header + if ($v_header_list[$i]['status'] == 'ok') { + if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) { + // ----- Return + return $v_result; + } + $v_count++; + } + + // ----- Transform the header to a 'usable' info + $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); + } + + // ----- Zip file comment + $v_comment = ''; + if (isset($p_options[PCLZIP_OPT_COMMENT])) { + $v_comment = $p_options[PCLZIP_OPT_COMMENT]; + } + + // ----- Calculate the size of the central header + $v_size = @ftell($this->zip_fd) - $v_offset; + + // ----- Create the central dir footer + if (($v_result = $this->privWriteCentralHeader($v_count, $v_size, $v_offset, $v_comment)) != 1) { + // ----- Reset the file list + unset($v_header_list); + + // ----- Return + return $v_result; + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privAddFileList() + // Description : + // Parameters : + // $p_filedescr_list : An array containing the file description + // or directory names to add in the zip + // $p_result_list : list of added files with their properties (specially the status field) + // Return Values : + // -------------------------------------------------------------------------------- + public function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options) + { + $v_result = 1; + $v_header = array(); + + // ----- Recuperate the current number of elt in list + $v_nb = sizeof($p_result_list); + + // ----- Loop on the files + for ($j = 0; ($j < sizeof($p_filedescr_list)) && ($v_result == 1); $j++) { + // ----- Format the filename + $p_filedescr_list[$j]['filename'] = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false); + + // ----- Skip empty file names + // TBC : Can this be possible ? not checked in DescrParseAtt ? + if ($p_filedescr_list[$j]['filename'] == "") { + continue; + } + + // ----- Check the filename + if (($p_filedescr_list[$j]['type'] != 'virtual_file') && (!file_exists($p_filedescr_list[$j]['filename']))) { + PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '" . $p_filedescr_list[$j]['filename'] . "' does not exist"); + + return PclZip::errorCode(); + } + + // ----- Look if it is a file or a dir with no all path remove option + // or a dir with all its path removed + // if ( (is_file($p_filedescr_list[$j]['filename'])) + // || ( is_dir($p_filedescr_list[$j]['filename']) + if (($p_filedescr_list[$j]['type'] == 'file') || ($p_filedescr_list[$j]['type'] == 'virtual_file') || (($p_filedescr_list[$j]['type'] == 'folder') && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]) || !$p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) { + + // ----- Add the file + $v_result = $this->privAddFile($p_filedescr_list[$j], $v_header, $p_options); + if ($v_result != 1) { + return $v_result; + } + + // ----- Store the file infos + $p_result_list[$v_nb++] = $v_header; + } + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privAddFile() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privAddFile($p_filedescr, &$p_header, &$p_options) + { + $v_result = 1; + + // ----- Working variable + $p_filename = $p_filedescr['filename']; + + // TBC : Already done in the fileAtt check ... ? + if ($p_filename == "") { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file list parameter (invalid or empty list)"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Look for a stored different filename + /* TBC : Removed + if (isset($p_filedescr['stored_filename'])) { + $v_stored_filename = $p_filedescr['stored_filename']; + } else { + $v_stored_filename = $p_filedescr['stored_filename']; + } + */ + + // ----- Set the file properties + clearstatcache(); + $p_header['version'] = 20; + $p_header['version_extracted'] = 10; + $p_header['flag'] = 0; + $p_header['compression'] = 0; + $p_header['crc'] = 0; + $p_header['compressed_size'] = 0; + $p_header['filename_len'] = strlen($p_filename); + $p_header['extra_len'] = 0; + $p_header['disk'] = 0; + $p_header['internal'] = 0; + $p_header['offset'] = 0; + $p_header['filename'] = $p_filename; + // TBC : Removed $p_header['stored_filename'] = $v_stored_filename; + $p_header['stored_filename'] = $p_filedescr['stored_filename']; + $p_header['extra'] = ''; + $p_header['status'] = 'ok'; + $p_header['index'] = -1; + + // ----- Look for regular file + if ($p_filedescr['type'] == 'file') { + $p_header['external'] = 0x00000000; + $p_header['size'] = filesize($p_filename); + + // ----- Look for regular folder + } elseif ($p_filedescr['type'] == 'folder') { + $p_header['external'] = 0x00000010; + $p_header['mtime'] = filemtime($p_filename); + $p_header['size'] = filesize($p_filename); + + // ----- Look for virtual file + } elseif ($p_filedescr['type'] == 'virtual_file') { + $p_header['external'] = 0x00000000; + $p_header['size'] = strlen($p_filedescr['content']); + } + + // ----- Look for filetime + if (isset($p_filedescr['mtime'])) { + $p_header['mtime'] = $p_filedescr['mtime']; + } elseif ($p_filedescr['type'] == 'virtual_file') { + $p_header['mtime'] = time(); + } else { + $p_header['mtime'] = filemtime($p_filename); + } + + // ------ Look for file comment + if (isset($p_filedescr['comment'])) { + $p_header['comment_len'] = strlen($p_filedescr['comment']); + $p_header['comment'] = $p_filedescr['comment']; + } else { + $p_header['comment_len'] = 0; + $p_header['comment'] = ''; + } + + // ----- Look for pre-add callback + if (isset($p_options[PCLZIP_CB_PRE_ADD])) { + + // ----- Generate a local information + $v_local_header = array(); + $this->privConvertHeader2FileInfo($p_header, $v_local_header); + + // ----- Call the callback + // Here I do not use call_user_func() because I need to send a reference to the + // header. + // eval('$v_result = '.$p_options[PCLZIP_CB_PRE_ADD].'(PCLZIP_CB_PRE_ADD, $v_local_header);'); + $v_result = $p_options[PCLZIP_CB_PRE_ADD](PCLZIP_CB_PRE_ADD, $v_local_header); + if ($v_result == 0) { + // ----- Change the file status + $p_header['status'] = "skipped"; + $v_result = 1; + } + + // ----- Update the informations + // Only some fields can be modified + if ($p_header['stored_filename'] != $v_local_header['stored_filename']) { + $p_header['stored_filename'] = PclZipUtilPathReduction($v_local_header['stored_filename']); + } + } + + // ----- Look for empty stored filename + if ($p_header['stored_filename'] == "") { + $p_header['status'] = "filtered"; + } + + // ----- Check the path length + if (strlen($p_header['stored_filename']) > 0xFF) { + $p_header['status'] = 'filename_too_long'; + } + + // ----- Look if no error, or file not skipped + if ($p_header['status'] == 'ok') { + + // ----- Look for a file + if ($p_filedescr['type'] == 'file') { + // ----- Look for using temporary file to zip + if ((!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])))) { + $v_result = $this->privAddFileUsingTempFile($p_filedescr, $p_header, $p_options); + if ($v_result < PCLZIP_ERR_NO_ERROR) { + return $v_result; + } + + // ----- Use "in memory" zip algo + } else { + + // ----- Open the source file + if (($v_file = @fopen($p_filename, "rb")) == 0) { + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode"); + + return PclZip::errorCode(); + } + + // ----- Read the file content + $v_content = @fread($v_file, $p_header['size']); + + // ----- Close the file + @fclose($v_file); + + // ----- Calculate the CRC + $p_header['crc'] = @crc32($v_content); + + // ----- Look for no compression + if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) { + // ----- Set header parameters + $p_header['compressed_size'] = $p_header['size']; + $p_header['compression'] = 0; + + // ----- Look for normal compression + } else { + // ----- Compress the content + $v_content = @gzdeflate($v_content); + + // ----- Set header parameters + $p_header['compressed_size'] = strlen($v_content); + $p_header['compression'] = 8; + } + + // ----- Call the header generation + if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { + @fclose($v_file); + + return $v_result; + } + + // ----- Write the compressed (or not) content + @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']); + + } + + // ----- Look for a virtual file (a file from string) + } elseif ($p_filedescr['type'] == 'virtual_file') { + + $v_content = $p_filedescr['content']; + + // ----- Calculate the CRC + $p_header['crc'] = @crc32($v_content); + + // ----- Look for no compression + if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) { + // ----- Set header parameters + $p_header['compressed_size'] = $p_header['size']; + $p_header['compression'] = 0; + + // ----- Look for normal compression + } else { + // ----- Compress the content + $v_content = @gzdeflate($v_content); + + // ----- Set header parameters + $p_header['compressed_size'] = strlen($v_content); + $p_header['compression'] = 8; + } + + // ----- Call the header generation + if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { + @fclose($v_file); + + return $v_result; + } + + // ----- Write the compressed (or not) content + @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']); + + // ----- Look for a directory + } elseif ($p_filedescr['type'] == 'folder') { + // ----- Look for directory last '/' + if (@substr($p_header['stored_filename'], -1) != '/') { + $p_header['stored_filename'] .= '/'; + } + + // ----- Set the file properties + $p_header['size'] = 0; + //$p_header['external'] = 0x41FF0010; // Value for a folder : to be checked + $p_header['external'] = 0x00000010; // Value for a folder : to be checked + + // ----- Call the header generation + if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { + return $v_result; + } + } + } + + // ----- Look for post-add callback + if (isset($p_options[PCLZIP_CB_POST_ADD])) { + + // ----- Generate a local information + $v_local_header = array(); + $this->privConvertHeader2FileInfo($p_header, $v_local_header); + + // ----- Call the callback + // Here I do not use call_user_func() because I need to send a reference to the + // header. + // eval('$v_result = '.$p_options[PCLZIP_CB_POST_ADD].'(PCLZIP_CB_POST_ADD, $v_local_header);'); + $v_result = $p_options[PCLZIP_CB_POST_ADD](PCLZIP_CB_POST_ADD, $v_local_header); + if ($v_result == 0) { + // ----- Ignored + $v_result = 1; + } + + // ----- Update the informations + // Nothing can be modified + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privAddFileUsingTempFile() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privAddFileUsingTempFile($p_filedescr, &$p_header, &$p_options) + { + $v_result = PCLZIP_ERR_NO_ERROR; + + // ----- Working variable + $p_filename = $p_filedescr['filename']; + + // ----- Open the source file + if (($v_file = @fopen($p_filename, "rb")) == 0) { + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode"); + + return PclZip::errorCode(); + } + + // ----- Creates a compressed temporary file + $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR . uniqid('pclzip-') . '.gz'; + if (($v_file_compressed = @gzopen($v_gzip_temp_name, "wb")) == 0) { + fclose($v_file); + PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary write mode'); + + return PclZip::errorCode(); + } + + // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks + $v_size = filesize($p_filename); + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($v_file, $v_read_size); + //$v_binary_data = pack('a'.$v_read_size, $v_buffer); + @gzputs($v_file_compressed, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Close the file + @fclose($v_file); + @gzclose($v_file_compressed); + + // ----- Check the minimum file size + if (filesize($v_gzip_temp_name) < 18) { + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'gzip temporary file \'' . $v_gzip_temp_name . '\' has invalid filesize - should be minimum 18 bytes'); + + return PclZip::errorCode(); + } + + // ----- Extract the compressed attributes + if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) { + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary read mode'); + + return PclZip::errorCode(); + } + + // ----- Read the gzip file header + $v_binary_data = @fread($v_file_compressed, 10); + $v_data_header = unpack('a1id1/a1id2/a1cm/a1flag/Vmtime/a1xfl/a1os', $v_binary_data); + + // ----- Check some parameters + $v_data_header['os'] = bin2hex($v_data_header['os']); + + // ----- Read the gzip file footer + @fseek($v_file_compressed, filesize($v_gzip_temp_name) - 8); + $v_binary_data = @fread($v_file_compressed, 8); + $v_data_footer = unpack('Vcrc/Vcompressed_size', $v_binary_data); + + // ----- Set the attributes + $p_header['compression'] = ord($v_data_header['cm']); + //$p_header['mtime'] = $v_data_header['mtime']; + $p_header['crc'] = $v_data_footer['crc']; + $p_header['compressed_size'] = filesize($v_gzip_temp_name) - 18; + + // ----- Close the file + @fclose($v_file_compressed); + + // ----- Call the header generation + if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { + return $v_result; + } + + // ----- Add the compressed data + if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) { + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary read mode'); + + return PclZip::errorCode(); + } + + // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks + fseek($v_file_compressed, 10); + $v_size = $p_header['compressed_size']; + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($v_file_compressed, $v_read_size); + //$v_binary_data = pack('a'.$v_read_size, $v_buffer); + @fwrite($this->zip_fd, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Close the file + @fclose($v_file_compressed); + + // ----- Unlink the temporary file + @unlink($v_gzip_temp_name); + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privCalculateStoredFilename() + // Description : + // Based on file descriptor properties and global options, this method + // calculate the filename that will be stored in the archive. + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privCalculateStoredFilename(&$p_filedescr, &$p_options) + { + $v_result = 1; + + // ----- Working variables + $p_filename = $p_filedescr['filename']; + if (isset($p_options[PCLZIP_OPT_ADD_PATH])) { + $p_add_dir = $p_options[PCLZIP_OPT_ADD_PATH]; + } else { + $p_add_dir = ''; + } + if (isset($p_options[PCLZIP_OPT_REMOVE_PATH])) { + $p_remove_dir = $p_options[PCLZIP_OPT_REMOVE_PATH]; + } else { + $p_remove_dir = ''; + } + if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) { + $p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH]; + } else { + $p_remove_all_dir = 0; + } + + // ----- Look for full name change + if (isset($p_filedescr['new_full_name'])) { + // ----- Remove drive letter if any + $v_stored_filename = PclZipUtilTranslateWinPath($p_filedescr['new_full_name']); + + // ----- Look for path and/or short name change + } else { + + // ----- Look for short name change + // Its when we cahnge just the filename but not the path + if (isset($p_filedescr['new_short_name'])) { + $v_path_info = pathinfo($p_filename); + $v_dir = ''; + if ($v_path_info['dirname'] != '') { + $v_dir = $v_path_info['dirname'] . '/'; + } + $v_stored_filename = $v_dir . $p_filedescr['new_short_name']; + } else { + // ----- Calculate the stored filename + $v_stored_filename = $p_filename; + } + + // ----- Look for all path to remove + if ($p_remove_all_dir) { + $v_stored_filename = basename($p_filename); + + // ----- Look for partial path remove + } elseif ($p_remove_dir != "") { + if (substr($p_remove_dir, -1) != '/') { + $p_remove_dir .= "/"; + } + + if ((substr($p_filename, 0, 2) == "./") || (substr($p_remove_dir, 0, 2) == "./")) { + + if ((substr($p_filename, 0, 2) == "./") && (substr($p_remove_dir, 0, 2) != "./")) { + $p_remove_dir = "./" . $p_remove_dir; + } + if ((substr($p_filename, 0, 2) != "./") && (substr($p_remove_dir, 0, 2) == "./")) { + $p_remove_dir = substr($p_remove_dir, 2); + } + } + + $v_compare = PclZipUtilPathInclusion($p_remove_dir, $v_stored_filename); + if ($v_compare > 0) { + if ($v_compare == 2) { + $v_stored_filename = ""; + } else { + $v_stored_filename = substr($v_stored_filename, strlen($p_remove_dir)); + } + } + } + + // ----- Remove drive letter if any + $v_stored_filename = PclZipUtilTranslateWinPath($v_stored_filename); + + // ----- Look for path to add + if ($p_add_dir != "") { + if (substr($p_add_dir, -1) == "/") { + $v_stored_filename = $p_add_dir . $v_stored_filename; + } else { + $v_stored_filename = $p_add_dir . "/" . $v_stored_filename; + } + } + } + + // ----- Filename (reduce the path of stored name) + $v_stored_filename = PclZipUtilPathReduction($v_stored_filename); + $p_filedescr['stored_filename'] = $v_stored_filename; + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privWriteFileHeader() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privWriteFileHeader(&$p_header) + { + $v_result = 1; + + // ----- Store the offset position of the file + $p_header['offset'] = ftell($this->zip_fd); + + // ----- Transform UNIX mtime to DOS format mdate/mtime + $v_date = getdate($p_header['mtime']); + $v_mtime = ($v_date['hours'] << 11) + ($v_date['minutes'] << 5) + $v_date['seconds'] / 2; + $v_mdate = (($v_date['year'] - 1980) << 9) + ($v_date['mon'] << 5) + $v_date['mday']; + + // ----- Packed data + $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50, $p_header['version_extracted'], $p_header['flag'], $p_header['compression'], $v_mtime, $v_mdate, $p_header['crc'], $p_header['compressed_size'], $p_header['size'], strlen($p_header['stored_filename']), $p_header['extra_len']); + + // ----- Write the first 148 bytes of the header in the archive + fputs($this->zip_fd, $v_binary_data, 30); + + // ----- Write the variable fields + if (strlen($p_header['stored_filename']) != 0) { + fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); + } + if ($p_header['extra_len'] != 0) { + fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privWriteCentralFileHeader() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privWriteCentralFileHeader(&$p_header) + { + $v_result = 1; + + // TBC + //for (reset($p_header); $key = key($p_header); next($p_header)) { + //} + + // ----- Transform UNIX mtime to DOS format mdate/mtime + $v_date = getdate($p_header['mtime']); + $v_mtime = ($v_date['hours'] << 11) + ($v_date['minutes'] << 5) + $v_date['seconds'] / 2; + $v_mdate = (($v_date['year'] - 1980) << 9) + ($v_date['mon'] << 5) + $v_date['mday']; + + // ----- Packed data + $v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50, $p_header['version'], $p_header['version_extracted'], $p_header['flag'], $p_header['compression'], $v_mtime, $v_mdate, $p_header['crc'], $p_header['compressed_size'], $p_header['size'], strlen($p_header['stored_filename']), $p_header['extra_len'], $p_header['comment_len'], $p_header['disk'], $p_header['internal'], $p_header['external'], $p_header['offset']); + + // ----- Write the 42 bytes of the header in the zip file + fputs($this->zip_fd, $v_binary_data, 46); + + // ----- Write the variable fields + if (strlen($p_header['stored_filename']) != 0) { + fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); + } + if ($p_header['extra_len'] != 0) { + fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']); + } + if ($p_header['comment_len'] != 0) { + fputs($this->zip_fd, $p_header['comment'], $p_header['comment_len']); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privWriteCentralHeader() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment) + { + $v_result = 1; + + // ----- Packed data + $v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries, $p_nb_entries, $p_size, $p_offset, strlen($p_comment)); + + // ----- Write the 22 bytes of the header in the zip file + fputs($this->zip_fd, $v_binary_data, 22); + + // ----- Write the variable fields + if (strlen($p_comment) != 0) { + fputs($this->zip_fd, $p_comment, strlen($p_comment)); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privList() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privList(&$p_list) + { + $v_result = 1; + + // ----- Magic quotes trick + $this->privDisableMagicQuotes(); + + // ----- Open the zip file + if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0) { + // ----- Magic quotes trick + $this->privSwapBackMagicQuotes(); + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \'' . $this->zipname . '\' in binary read mode'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read the central directory informations + $v_central_dir = array(); + if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { + $this->privSwapBackMagicQuotes(); + + return $v_result; + } + + // ----- Go to beginning of Central Dir + @rewind($this->zip_fd); + if (@fseek($this->zip_fd, $v_central_dir['offset'])) { + $this->privSwapBackMagicQuotes(); + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read each entry + for ($i = 0; $i < $v_central_dir['entries']; $i++) { + // ----- Read the file header + if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1) { + $this->privSwapBackMagicQuotes(); + + return $v_result; + } + $v_header['index'] = $i; + + // ----- Get the only interesting attributes + $this->privConvertHeader2FileInfo($v_header, $p_list[$i]); + unset($v_header); + } + + // ----- Close the zip file $this->privCloseFd(); + // ----- Magic quotes trick + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privConvertHeader2FileInfo() + // Description : + // This function takes the file informations from the central directory + // entries and extract the interesting parameters that will be given back. + // The resulting file infos are set in the array $p_info + // $p_info['filename'] : Filename with full path. Given by user (add), + // extracted in the filesystem (extract). + // $p_info['stored_filename'] : Stored filename in the archive. + // $p_info['size'] = Size of the file. + // $p_info['compressed_size'] = Compressed size of the file. + // $p_info['mtime'] = Last modification date of the file. + // $p_info['comment'] = Comment associated with the file. + // $p_info['folder'] = true/false : indicates if the entry is a folder or not. + // $p_info['status'] = status of the action on the file. + // $p_info['crc'] = CRC of the file content. + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privConvertHeader2FileInfo($p_header, &$p_info) + { + $v_result = 1; + + // ----- Get the interesting attributes + $v_temp_path = PclZipUtilPathReduction($p_header['filename']); + $p_info['filename'] = $v_temp_path; + $v_temp_path = PclZipUtilPathReduction($p_header['stored_filename']); + $p_info['stored_filename'] = $v_temp_path; + $p_info['size'] = $p_header['size']; + $p_info['compressed_size'] = $p_header['compressed_size']; + $p_info['mtime'] = $p_header['mtime']; + $p_info['comment'] = $p_header['comment']; + $p_info['folder'] = (($p_header['external'] & 0x00000010) == 0x00000010); + $p_info['index'] = $p_header['index']; + $p_info['status'] = $p_header['status']; + $p_info['crc'] = $p_header['crc']; + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privExtractByRule() + // Description : + // Extract a file or directory depending of rules (by index, by name, ...) + // Parameters : + // $p_file_list : An array where will be placed the properties of each + // extracted file + // $p_path : Path to add while writing the extracted files + // $p_remove_path : Path to remove (from the file memorized path) while writing the + // extracted files. If the path does not match the file path, + // the file is extracted with its memorized path. + // $p_remove_path does not apply to 'list' mode. + // $p_path and $p_remove_path are commulative. + // Return Values : + // 1 on success,0 or less on error (see error code list) + // -------------------------------------------------------------------------------- + public function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options) + { + $v_result = 1; + + // ----- Magic quotes trick + $this->privDisableMagicQuotes(); + + // ----- Check the path + if (($p_path == "") || ((substr($p_path, 0, 1) != "/") && (substr($p_path, 0, 3) != "../") && (substr($p_path, 1, 2) != ":/"))) { + $p_path = "./" . $p_path; + } + + // ----- Reduce the path last (and duplicated) '/' + if (($p_path != "./") && ($p_path != "/")) { + // ----- Look for the path end '/' + while (substr($p_path, -1) == "/") { + $p_path = substr($p_path, 0, strlen($p_path) - 1); + } + } + + // ----- Look for path to remove format (should end by /) + if (($p_remove_path != "") && (substr($p_remove_path, -1) != '/')) { + $p_remove_path .= '/'; + } + $p_remove_path_size = strlen($p_remove_path); + + // ----- Open the zip file + if (($v_result = $this->privOpenFd('rb')) != 1) { + $this->privSwapBackMagicQuotes(); + + return $v_result; + } + + // ----- Read the central directory informations + $v_central_dir = array(); + if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { + // ----- Close the zip file + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + return $v_result; + } + + // ----- Start at beginning of Central Dir + $v_pos_entry = $v_central_dir['offset']; + + // ----- Read each entry + $j_start = 0; + for ($i = 0, $v_nb_extracted = 0; $i < $v_central_dir['entries']; $i++) { + + // ----- Read next Central dir entry + @rewind($this->zip_fd); + if (@fseek($this->zip_fd, $v_pos_entry)) { + // ----- Close the zip file + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read the file header + $v_header = array(); + if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1) { + // ----- Close the zip file + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + return $v_result; + } + + // ----- Store the index + $v_header['index'] = $i; + + // ----- Store the file position + $v_pos_entry = ftell($this->zip_fd); + + // ----- Look for the specific extract rules + $v_extract = false; + + // ----- Look for extract by name rule + if ((isset($p_options[PCLZIP_OPT_BY_NAME])) && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { + + // ----- Look if the filename is in the list + for ($j = 0; ($j < sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); $j++) { + + // ----- Look for a directory + if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") { + + // ----- Look if the directory is in the filename path + if ((strlen($v_header['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) && (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) { + $v_extract = true; + } + + // ----- Look for a filename + } elseif ($v_header['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) { + $v_extract = true; + } + } + // ----- Look for extract by ereg rule + // ereg() is deprecated with PHP 5.3 + /* + elseif ( (isset($p_options[PCLZIP_OPT_BY_EREG])) + && ($p_options[PCLZIP_OPT_BY_EREG] != "")) { + + if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header['stored_filename'])) { + $v_extract = true; + } + } + */ + + // ----- Look for extract by preg rule + } elseif ((isset($p_options[PCLZIP_OPT_BY_PREG])) && ($p_options[PCLZIP_OPT_BY_PREG] != "")) { + + if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) { + $v_extract = true; + } + + // ----- Look for extract by index rule + } elseif ((isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { + + // ----- Look if the index is in the list + for ($j = $j_start; ($j < sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) { + + if (($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i <= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { + $v_extract = true; + } + if ($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { + $j_start = $j + 1; + } + + if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start'] > $i) { + break; + } + } + + // ----- Look for no rule, which means extract all the archive + } else { + $v_extract = true; + } + + // ----- Check compression method + if (($v_extract) && (($v_header['compression'] != 8) && ($v_header['compression'] != 0))) { + $v_header['status'] = 'unsupported_compression'; + + // ----- Look for PCLZIP_OPT_STOP_ON_ERROR + if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { + + $this->privSwapBackMagicQuotes(); + + PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION, "Filename '" . $v_header['stored_filename'] . "' is " . "compressed by an unsupported compression " . "method (" . $v_header['compression'] . ") "); + + return PclZip::errorCode(); + } + } + + // ----- Check encrypted files + if (($v_extract) && (($v_header['flag'] & 1) == 1)) { + $v_header['status'] = 'unsupported_encryption'; + + // ----- Look for PCLZIP_OPT_STOP_ON_ERROR + if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { + + $this->privSwapBackMagicQuotes(); + + PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, "Unsupported encryption for " . " filename '" . $v_header['stored_filename'] . "'"); + + return PclZip::errorCode(); + } + } + + // ----- Look for real extraction + if (($v_extract) && ($v_header['status'] != 'ok')) { + $v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++]); + if ($v_result != 1) { + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + return $v_result; + } + + $v_extract = false; + } + + // ----- Look for real extraction + if ($v_extract) { + + // ----- Go to the file position + @rewind($this->zip_fd); + if (@fseek($this->zip_fd, $v_header['offset'])) { + // ----- Close the zip file + $this->privCloseFd(); + + $this->privSwapBackMagicQuotes(); + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Look for extraction as string + if ($p_options[PCLZIP_OPT_EXTRACT_AS_STRING]) { + + $v_string = ''; + + // ----- Extracting the file + $v_result1 = $this->privExtractFileAsString($v_header, $v_string, $p_options); + if ($v_result1 < 1) { + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + return $v_result1; + } + + // ----- Get the only interesting attributes + if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted])) != 1) { + // ----- Close the zip file + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + return $v_result; + } + + // ----- Set the file content + $p_file_list[$v_nb_extracted]['content'] = $v_string; + + // ----- Next extracted file + $v_nb_extracted++; + + // ----- Look for user callback abort + if ($v_result1 == 2) { + break; + } + + // ----- Look for extraction in standard output + } elseif ((isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) { + // ----- Extracting the file in standard output + $v_result1 = $this->privExtractFileInOutput($v_header, $p_options); + if ($v_result1 < 1) { + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + return $v_result1; + } + + // ----- Get the only interesting attributes + if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) { + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + return $v_result; + } + + // ----- Look for user callback abort + if ($v_result1 == 2) { + break; + } + + // ----- Look for normal extraction + } else { + // ----- Extracting the file + $v_result1 = $this->privExtractFile($v_header, $p_path, $p_remove_path, $p_remove_all_path, $p_options); + if ($v_result1 < 1) { + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + return $v_result1; + } + + // ----- Get the only interesting attributes + if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) { + // ----- Close the zip file + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + return $v_result; + } + + // ----- Look for user callback abort + if ($v_result1 == 2) { + break; + } + } + } + } + + // ----- Close the zip file + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privExtractFile() + // Description : + // Parameters : + // Return Values : + // + // 1 : ... ? + // PCLZIP_ERR_USER_ABORTED(2) : User ask for extraction stop in callback + // -------------------------------------------------------------------------------- + public function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options) + { + $v_result = 1; + + // ----- Read the file header + if (($v_result = $this->privReadFileHeader($v_header)) != 1) { + // ----- Return + return $v_result; + } + + // ----- Check that the file header is coherent with $p_entry info + if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { + // TBC + } + + // ----- Look for all path to remove + if ($p_remove_all_path == true) { + // ----- Look for folder entry that not need to be extracted + if (($p_entry['external'] & 0x00000010) == 0x00000010) { + + $p_entry['status'] = "filtered"; + + return $v_result; + } + + // ----- Get the basename of the path + $p_entry['filename'] = basename($p_entry['filename']); + + // ----- Look for path to remove + } elseif ($p_remove_path != "") { + if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2) { + + // ----- Change the file status + $p_entry['status'] = "filtered"; + + // ----- Return + return $v_result; + } + + $p_remove_path_size = strlen($p_remove_path); + if (substr($p_entry['filename'], 0, $p_remove_path_size) == $p_remove_path) { + + // ----- Remove the path + $p_entry['filename'] = substr($p_entry['filename'], $p_remove_path_size); + + } + } + + // ----- Add the path + if ($p_path != '') { + $p_entry['filename'] = $p_path . "/" . $p_entry['filename']; + } + + // ----- Check a base_dir_restriction + if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) { + $v_inclusion = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION], $p_entry['filename']); + if ($v_inclusion == 0) { + + PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION, "Filename '" . $p_entry['filename'] . "' is " . "outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION"); + + return PclZip::errorCode(); + } + } + + // ----- Look for pre-extract callback + if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) { + + // ----- Generate a local information + $v_local_header = array(); + $this->privConvertHeader2FileInfo($p_entry, $v_local_header); + + // ----- Call the callback + // Here I do not use call_user_func() because I need to send a reference to the + // header. + // eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);'); + $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header); + if ($v_result == 0) { + // ----- Change the file status + $p_entry['status'] = "skipped"; + $v_result = 1; + } + + // ----- Look for abort result + if ($v_result == 2) { + // ----- This status is internal and will be changed in 'skipped' + $p_entry['status'] = "aborted"; + $v_result = PCLZIP_ERR_USER_ABORTED; + } + + // ----- Update the informations + // Only some fields can be modified + $p_entry['filename'] = $v_local_header['filename']; + } + + // ----- Look if extraction should be done + if ($p_entry['status'] == 'ok') { + + // ----- Look for specific actions while the file exist + if (file_exists($p_entry['filename'])) { + + // ----- Look if file is a directory + if (is_dir($p_entry['filename'])) { + + // ----- Change the file status + $p_entry['status'] = "already_a_directory"; + + // ----- Look for PCLZIP_OPT_STOP_ON_ERROR + // For historical reason first PclZip implementation does not stop + // when this kind of error occurs. + if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { + + PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY, "Filename '" . $p_entry['filename'] . "' is " . "already used by an existing directory"); + + return PclZip::errorCode(); + } + + // ----- Look if file is write protected + } elseif (!is_writeable($p_entry['filename'])) { + + // ----- Change the file status + $p_entry['status'] = "write_protected"; + + // ----- Look for PCLZIP_OPT_STOP_ON_ERROR + // For historical reason first PclZip implementation does not stop + // when this kind of error occurs. + if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { + + PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, "Filename '" . $p_entry['filename'] . "' exists " . "and is write protected"); + + return PclZip::errorCode(); + } + + // ----- Look if the extracted file is older + } elseif (filemtime($p_entry['filename']) > $p_entry['mtime']) { + // ----- Change the file status + if ((isset($p_options[PCLZIP_OPT_REPLACE_NEWER])) && ($p_options[PCLZIP_OPT_REPLACE_NEWER] === true)) { + } else { + $p_entry['status'] = "newer_exist"; + + // ----- Look for PCLZIP_OPT_STOP_ON_ERROR + // For historical reason first PclZip implementation does not stop + // when this kind of error occurs. + if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { + + PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, "Newer version of '" . $p_entry['filename'] . "' exists " . "and option PCLZIP_OPT_REPLACE_NEWER is not selected"); + + return PclZip::errorCode(); + } + } + } else { + } + + // ----- Check the directory availability and create it if necessary + } else { + if ((($p_entry['external'] & 0x00000010) == 0x00000010) || (substr($p_entry['filename'], -1) == '/')) { + $v_dir_to_check = $p_entry['filename']; + } elseif (!strstr($p_entry['filename'], "/")) { + $v_dir_to_check = ""; + } else { + $v_dir_to_check = dirname($p_entry['filename']); + } + + if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external'] & 0x00000010) == 0x00000010))) != 1) { + + // ----- Change the file status + $p_entry['status'] = "path_creation_fail"; + + // ----- Return + //return $v_result; + $v_result = 1; + } + } + } + + // ----- Look if extraction should be done + if ($p_entry['status'] == 'ok') { + + // ----- Do the extraction (if not a folder) + if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) { + // ----- Look for not compressed file + if ($p_entry['compression'] == 0) { + + // ----- Opening destination file + if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { + + // ----- Change the file status + $p_entry['status'] = "write_error"; + + // ----- Return + return $v_result; + } + + // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks + $v_size = $p_entry['compressed_size']; + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($this->zip_fd, $v_read_size); + /* Try to speed up the code + $v_binary_data = pack('a'.$v_read_size, $v_buffer); + @fwrite($v_dest_file, $v_binary_data, $v_read_size); + */ + @fwrite($v_dest_file, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Closing the destination file + fclose($v_dest_file); + + // ----- Change the file mtime + touch($p_entry['filename'], $p_entry['mtime']); + + } else { + // ----- TBC + // Need to be finished + if (($p_entry['flag'] & 1) == 1) { + PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, 'File \'' . $p_entry['filename'] . '\' is encrypted. Encrypted files are not supported.'); + + return PclZip::errorCode(); + } + + // ----- Look for using temporary file to unzip + if ((!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])))) { + $v_result = $this->privExtractFileUsingTempFile($p_entry, $p_options); + if ($v_result < PCLZIP_ERR_NO_ERROR) { + return $v_result; + } + + // ----- Look for extract in memory + } else { + + // ----- Read the compressed file in a buffer (one shot) + $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); + + // ----- Decompress the file + $v_file_content = @gzinflate($v_buffer); + unset($v_buffer); + if ($v_file_content === false) { + + // ----- Change the file status + // TBC + $p_entry['status'] = "error"; + + return $v_result; + } + + // ----- Opening destination file + if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { + + // ----- Change the file status + $p_entry['status'] = "write_error"; + + return $v_result; + } + + // ----- Write the uncompressed data + @fwrite($v_dest_file, $v_file_content, $p_entry['size']); + unset($v_file_content); + + // ----- Closing the destination file + @fclose($v_dest_file); + + } + + // ----- Change the file mtime + @touch($p_entry['filename'], $p_entry['mtime']); + } + + // ----- Look for chmod option + if (isset($p_options[PCLZIP_OPT_SET_CHMOD])) { + + // ----- Change the mode of the file + @chmod($p_entry['filename'], $p_options[PCLZIP_OPT_SET_CHMOD]); + } + + } + } + + // ----- Change abort status + if ($p_entry['status'] == "aborted") { + $p_entry['status'] = "skipped"; + + // ----- Look for post-extract callback + } elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { + + // ----- Generate a local information + $v_local_header = array(); + $this->privConvertHeader2FileInfo($p_entry, $v_local_header); + + // ----- Call the callback + // Here I do not use call_user_func() because I need to send a reference to the + // header. + // eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);'); + $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header); + + // ----- Look for abort result + if ($v_result == 2) { + $v_result = PCLZIP_ERR_USER_ABORTED; + } + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privExtractFileUsingTempFile() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privExtractFileUsingTempFile(&$p_entry, &$p_options) + { + $v_result = 1; + + // ----- Creates a temporary file + $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR . uniqid('pclzip-') . '.gz'; + if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) { + fclose($v_file); + PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary write mode'); + + return PclZip::errorCode(); + } + + // ----- Write gz file format header + $v_binary_data = pack('va1a1Va1a1', 0x8b1f, Chr($p_entry['compression']), Chr(0x00), time(), Chr(0x00), Chr(3)); + @fwrite($v_dest_file, $v_binary_data, 10); + + // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks + $v_size = $p_entry['compressed_size']; + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($this->zip_fd, $v_read_size); + //$v_binary_data = pack('a'.$v_read_size, $v_buffer); + @fwrite($v_dest_file, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Write gz file format footer + $v_binary_data = pack('VV', $p_entry['crc'], $p_entry['size']); + @fwrite($v_dest_file, $v_binary_data, 8); + + // ----- Close the temporary file + @fclose($v_dest_file); + + // ----- Opening destination file + if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { + $p_entry['status'] = "write_error"; + + return $v_result; + } + + // ----- Open the temporary gz file + if (($v_src_file = @gzopen($v_gzip_temp_name, 'rb')) == 0) { + @fclose($v_dest_file); + $p_entry['status'] = "read_error"; + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary read mode'); + + return PclZip::errorCode(); + } + + // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks + $v_size = $p_entry['size']; + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @gzread($v_src_file, $v_read_size); + //$v_binary_data = pack('a'.$v_read_size, $v_buffer); + @fwrite($v_dest_file, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + @fclose($v_dest_file); + @gzclose($v_src_file); + + // ----- Delete the temporary file + @unlink($v_gzip_temp_name); + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privExtractFileInOutput() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privExtractFileInOutput(&$p_entry, &$p_options) + { + $v_result = 1; + + // ----- Read the file header + if (($v_result = $this->privReadFileHeader($v_header)) != 1) { + return $v_result; + } + + // ----- Check that the file header is coherent with $p_entry info + if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { + // TBC + } + + // ----- Look for pre-extract callback + if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) { + + // ----- Generate a local information + $v_local_header = array(); + $this->privConvertHeader2FileInfo($p_entry, $v_local_header); + + // ----- Call the callback + // Here I do not use call_user_func() because I need to send a reference to the + // header. + // eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);'); + $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header); + if ($v_result == 0) { + // ----- Change the file status + $p_entry['status'] = "skipped"; + $v_result = 1; + } + + // ----- Look for abort result + if ($v_result == 2) { + // ----- This status is internal and will be changed in 'skipped' + $p_entry['status'] = "aborted"; + $v_result = PCLZIP_ERR_USER_ABORTED; + } + + // ----- Update the informations + // Only some fields can be modified + $p_entry['filename'] = $v_local_header['filename']; + } + + // ----- Trace + + // ----- Look if extraction should be done + if ($p_entry['status'] == 'ok') { + + // ----- Do the extraction (if not a folder) + if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) { + // ----- Look for not compressed file + if ($p_entry['compressed_size'] == $p_entry['size']) { + + // ----- Read the file in a buffer (one shot) + $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); + + // ----- Send the file to the output + echo $v_buffer; + unset($v_buffer); + } else { + + // ----- Read the compressed file in a buffer (one shot) + $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); + + // ----- Decompress the file + $v_file_content = gzinflate($v_buffer); + unset($v_buffer); + + // ----- Send the file to the output + echo $v_file_content; + unset($v_file_content); + } + } + } + + // ----- Change abort status + if ($p_entry['status'] == "aborted") { + $p_entry['status'] = "skipped"; + + // ----- Look for post-extract callback + } elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { + + // ----- Generate a local information + $v_local_header = array(); + $this->privConvertHeader2FileInfo($p_entry, $v_local_header); + + // ----- Call the callback + // Here I do not use call_user_func() because I need to send a reference to the + // header. + // eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);'); + $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header); + + // ----- Look for abort result + if ($v_result == 2) { + $v_result = PCLZIP_ERR_USER_ABORTED; + } + } + + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privExtractFileAsString() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privExtractFileAsString(&$p_entry, &$p_string, &$p_options) + { + $v_result = 1; + + // ----- Read the file header + $v_header = array(); + if (($v_result = $this->privReadFileHeader($v_header)) != 1) { + // ----- Return + return $v_result; + } + + // ----- Check that the file header is coherent with $p_entry info + if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { + // TBC + } + + // ----- Look for pre-extract callback + if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) { + + // ----- Generate a local information + $v_local_header = array(); + $this->privConvertHeader2FileInfo($p_entry, $v_local_header); + + // ----- Call the callback + // Here I do not use call_user_func() because I need to send a reference to the + // header. + // eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);'); + $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header); + if ($v_result == 0) { + // ----- Change the file status + $p_entry['status'] = "skipped"; + $v_result = 1; + } + + // ----- Look for abort result + if ($v_result == 2) { + // ----- This status is internal and will be changed in 'skipped' + $p_entry['status'] = "aborted"; + $v_result = PCLZIP_ERR_USER_ABORTED; + } + + // ----- Update the informations + // Only some fields can be modified + $p_entry['filename'] = $v_local_header['filename']; + } + + // ----- Look if extraction should be done + if ($p_entry['status'] == 'ok') { + + // ----- Do the extraction (if not a folder) + if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) { + // ----- Look for not compressed file + // if ($p_entry['compressed_size'] == $p_entry['size']) + if ($p_entry['compression'] == 0) { + + // ----- Reading the file + $p_string = @fread($this->zip_fd, $p_entry['compressed_size']); + } else { + + // ----- Reading the file + $v_data = @fread($this->zip_fd, $p_entry['compressed_size']); + + // ----- Decompress the file + if (($p_string = @gzinflate($v_data)) === false) { + // TBC + } + } + + // ----- Trace + } else { + // TBC : error : can not extract a folder in a string + } + + } + + // ----- Change abort status + if ($p_entry['status'] == "aborted") { + $p_entry['status'] = "skipped"; + + // ----- Look for post-extract callback + } elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { + + // ----- Generate a local information + $v_local_header = array(); + $this->privConvertHeader2FileInfo($p_entry, $v_local_header); + + // ----- Swap the content to header + $v_local_header['content'] = $p_string; + $p_string = ''; + + // ----- Call the callback + // Here I do not use call_user_func() because I need to send a reference to the + // header. + // eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);'); + $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header); + + // ----- Swap back the content to header + $p_string = $v_local_header['content']; + unset($v_local_header['content']); + + // ----- Look for abort result + if ($v_result == 2) { + $v_result = PCLZIP_ERR_USER_ABORTED; + } + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privReadFileHeader() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privReadFileHeader(&$p_header) + { + $v_result = 1; + + // ----- Read the 4 bytes signature + $v_binary_data = @fread($this->zip_fd, 4); + $v_data = unpack('Vid', $v_binary_data); + + // ----- Check signature + if ($v_data['id'] != 0x04034b50) { + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read the first 42 bytes of the header + $v_binary_data = fread($this->zip_fd, 26); + + // ----- Look for invalid block size + if (strlen($v_binary_data) != 26) { + $p_header['filename'] = ""; + $p_header['status'] = "invalid_header"; + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : " . strlen($v_binary_data)); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Extract the values + $v_data = unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $v_binary_data); + + // ----- Get filename + $p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']); + + // ----- Get extra_fields + if ($v_data['extra_len'] != 0) { + $p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']); + } else { + $p_header['extra'] = ''; + } + + // ----- Extract properties + $p_header['version_extracted'] = $v_data['version']; + $p_header['compression'] = $v_data['compression']; + $p_header['size'] = $v_data['size']; + $p_header['compressed_size'] = $v_data['compressed_size']; + $p_header['crc'] = $v_data['crc']; + $p_header['flag'] = $v_data['flag']; + $p_header['filename_len'] = $v_data['filename_len']; + + // ----- Recuperate date in UNIX format + $p_header['mdate'] = $v_data['mdate']; + $p_header['mtime'] = $v_data['mtime']; + if ($p_header['mdate'] && $p_header['mtime']) { + // ----- Extract time + $v_hour = ($p_header['mtime'] & 0xF800) >> 11; + $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; + $v_seconde = ($p_header['mtime'] & 0x001F) * 2; + + // ----- Extract date + $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; + $v_month = ($p_header['mdate'] & 0x01E0) >> 5; + $v_day = $p_header['mdate'] & 0x001F; + + // ----- Get UNIX date format + $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year); + + } else { + $p_header['mtime'] = time(); + } + + // TBC + //for (reset($v_data); $key = key($v_data); next($v_data)) { + //} + + // ----- Set the stored filename + $p_header['stored_filename'] = $p_header['filename']; + + // ----- Set the status field + $p_header['status'] = "ok"; + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privReadCentralFileHeader() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privReadCentralFileHeader(&$p_header) + { + $v_result = 1; + + // ----- Read the 4 bytes signature + $v_binary_data = @fread($this->zip_fd, 4); + $v_data = unpack('Vid', $v_binary_data); + + // ----- Check signature + if ($v_data['id'] != 0x02014b50) { + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read the first 42 bytes of the header + $v_binary_data = fread($this->zip_fd, 42); + + // ----- Look for invalid block size + if (strlen($v_binary_data) != 42) { + $p_header['filename'] = ""; + $p_header['status'] = "invalid_header"; + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : " . strlen($v_binary_data)); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Extract the values + $p_header = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v_binary_data); + + // ----- Get filename + if ($p_header['filename_len'] != 0) { + $p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']); + } else { + $p_header['filename'] = ''; + } + + // ----- Get extra + if ($p_header['extra_len'] != 0) { + $p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']); + } else { + $p_header['extra'] = ''; + } + + // ----- Get comment + if ($p_header['comment_len'] != 0) { + $p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']); + } else { + $p_header['comment'] = ''; + } + + // ----- Extract properties + + // ----- Recuperate date in UNIX format + //if ($p_header['mdate'] && $p_header['mtime']) + // TBC : bug : this was ignoring time with 0/0/0 + if (1) { + // ----- Extract time + $v_hour = ($p_header['mtime'] & 0xF800) >> 11; + $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; + $v_seconde = ($p_header['mtime'] & 0x001F) * 2; + + // ----- Extract date + $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; + $v_month = ($p_header['mdate'] & 0x01E0) >> 5; + $v_day = $p_header['mdate'] & 0x001F; + + // ----- Get UNIX date format + $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year); + + } else { + $p_header['mtime'] = time(); + } + + // ----- Set the stored filename + $p_header['stored_filename'] = $p_header['filename']; + + // ----- Set default status to ok + $p_header['status'] = 'ok'; + + // ----- Look if it is a directory + if (substr($p_header['filename'], -1) == '/') { + //$p_header['external'] = 0x41FF0010; + $p_header['external'] = 0x00000010; + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privCheckFileHeaders() + // Description : + // Parameters : + // Return Values : + // 1 on success, + // 0 on error; + // -------------------------------------------------------------------------------- + public function privCheckFileHeaders(&$p_local_header, &$p_central_header) + { + $v_result = 1; + + // ----- Check the static values + // TBC + if ($p_local_header['filename'] != $p_central_header['filename']) { + } + if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) { + } + if ($p_local_header['flag'] != $p_central_header['flag']) { + } + if ($p_local_header['compression'] != $p_central_header['compression']) { + } + if ($p_local_header['mtime'] != $p_central_header['mtime']) { + } + if ($p_local_header['filename_len'] != $p_central_header['filename_len']) { + } + + // ----- Look for flag bit 3 + if (($p_local_header['flag'] & 8) == 8) { + $p_local_header['size'] = $p_central_header['size']; + $p_local_header['compressed_size'] = $p_central_header['compressed_size']; + $p_local_header['crc'] = $p_central_header['crc']; + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privReadEndCentralDir() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privReadEndCentralDir(&$p_central_dir) + { + $v_result = 1; + + // ----- Go to the end of the zip file + $v_size = filesize($this->zipname); + @fseek($this->zip_fd, $v_size); + if (@ftell($this->zip_fd) != $v_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of the archive \'' . $this->zipname . '\''); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- First try : look if this is an archive with no commentaries (most of the time) + // in this case the end of central dir is at 22 bytes of the file end + $v_found = 0; + if ($v_size > 26) { + @fseek($this->zip_fd, $v_size - 22); + if (($v_pos = @ftell($this->zip_fd)) != ($v_size - 22)) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \'' . $this->zipname . '\''); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read for bytes + $v_binary_data = @fread($this->zip_fd, 4); + $v_data = @unpack('Vid', $v_binary_data); + + // ----- Check signature + if ($v_data['id'] == 0x06054b50) { + $v_found = 1; + } + + $v_pos = ftell($this->zip_fd); + } + + // ----- Go back to the maximum possible size of the Central Dir End Record + if (!$v_found) { + $v_maximum_size = 65557; // 0xFFFF + 22; + if ($v_maximum_size > $v_size) { + $v_maximum_size = $v_size; + } + @fseek($this->zip_fd, $v_size - $v_maximum_size); + if (@ftell($this->zip_fd) != ($v_size - $v_maximum_size)) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \'' . $this->zipname . '\''); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read byte per byte in order to find the signature + $v_pos = ftell($this->zip_fd); + $v_bytes = 0x00000000; + while ($v_pos < $v_size) { + // ----- Read a byte + $v_byte = @fread($this->zip_fd, 1); + + // ----- Add the byte + //$v_bytes = ($v_bytes << 8) | Ord($v_byte); + // Note we mask the old value down such that once shifted we can never end up with more than a 32bit number + // Otherwise on systems where we have 64bit integers the check below for the magic number will fail. + $v_bytes = (($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); + + // ----- Compare the bytes + if ($v_bytes == 0x504b0506) { + $v_pos++; + break; + } + + $v_pos++; + } + + // ----- Look if not found end of central dir + if ($v_pos == $v_size) { + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Unable to find End of Central Dir Record signature"); + + // ----- Return + return PclZip::errorCode(); + } + } + + // ----- Read the first 18 bytes of the header + $v_binary_data = fread($this->zip_fd, 18); + + // ----- Look for invalid block size + if (strlen($v_binary_data) != 18) { + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Central Dir Record size : " . strlen($v_binary_data)); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Extract the values + $v_data = unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', $v_binary_data); + + // ----- Check the global size + if (($v_pos + $v_data['comment_size'] + 18) != $v_size) { + + // ----- Removed in release 2.2 see readme file + // The check of the file size is a little too strict. + // Some bugs where found when a zip is encrypted/decrypted with 'crypt'. + // While decrypted, zip has training 0 bytes + if (0) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'The central dir is not at the end of the archive.' . ' Some trailing bytes exists after the archive.'); + + // ----- Return + return PclZip::errorCode(); + } + } + + // ----- Get comment + if ($v_data['comment_size'] != 0) { + $p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']); + } else { + $p_central_dir['comment'] = ''; + } + + $p_central_dir['entries'] = $v_data['entries']; + $p_central_dir['disk_entries'] = $v_data['disk_entries']; + $p_central_dir['offset'] = $v_data['offset']; + $p_central_dir['size'] = $v_data['size']; + $p_central_dir['disk'] = $v_data['disk']; + $p_central_dir['disk_start'] = $v_data['disk_start']; + + // TBC + //for (reset($p_central_dir); $key = key($p_central_dir); next($p_central_dir)) { + //} + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privDeleteByRule() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privDeleteByRule(&$p_result_list, &$p_options) + { + $v_result = 1; + $v_list_detail = array(); + + // ----- Open the zip file + if (($v_result = $this->privOpenFd('rb')) != 1) { + // ----- Return + return $v_result; + } + + // ----- Read the central directory informations + $v_central_dir = array(); + if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { + $this->privCloseFd(); + + return $v_result; + } + + // ----- Go to beginning of File + @rewind($this->zip_fd); + + // ----- Scan all the files + // ----- Start at beginning of Central Dir + $v_pos_entry = $v_central_dir['offset']; + @rewind($this->zip_fd); + if (@fseek($this->zip_fd, $v_pos_entry)) { + // ----- Close the zip file + $this->privCloseFd(); + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read each entry + $v_header_list = array(); + $j_start = 0; + for ($i = 0, $v_nb_extracted = 0; $i < $v_central_dir['entries']; $i++) { + + // ----- Read the file header + $v_header_list[$v_nb_extracted] = array(); + if (($v_result = $this->privReadCentralFileHeader($v_header_list[$v_nb_extracted])) != 1) { + // ----- Close the zip file + $this->privCloseFd(); + + return $v_result; + } + + // ----- Store the index + $v_header_list[$v_nb_extracted]['index'] = $i; + + // ----- Look for the specific extract rules + $v_found = false; + + // ----- Look for extract by name rule + if ((isset($p_options[PCLZIP_OPT_BY_NAME])) && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { + + // ----- Look if the filename is in the list + for ($j = 0; ($j < sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); $j++) { + + // ----- Look for a directory + if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") { + + // ----- Look if the directory is in the filename path + if ((strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) && (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) { + $v_found = true; + } elseif ((($v_header_list[$v_nb_extracted]['external'] & 0x00000010) == 0x00000010) /* Indicates a folder */ && ($v_header_list[$v_nb_extracted]['stored_filename'] . '/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) { + $v_found = true; + } + + // ----- Look for a filename + } elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) { + $v_found = true; + } + } + + // ----- Look for extract by ereg rule + // ereg() is deprecated with PHP 5.3 + /* + elseif ( (isset($p_options[PCLZIP_OPT_BY_EREG])) + && ($p_options[PCLZIP_OPT_BY_EREG] != "")) { + + if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header_list[$v_nb_extracted]['stored_filename'])) { + $v_found = true; + } + } + */ + + // ----- Look for extract by preg rule + } elseif ((isset($p_options[PCLZIP_OPT_BY_PREG])) && ($p_options[PCLZIP_OPT_BY_PREG] != "")) { + + if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) { + $v_found = true; + } + + // ----- Look for extract by index rule + } elseif ((isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { + + // ----- Look if the index is in the list + for ($j = $j_start; ($j < sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) { + + if (($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i <= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { + $v_found = true; + } + if ($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { + $j_start = $j + 1; + } + + if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start'] > $i) { + break; + } + } + } else { + $v_found = true; + } + + // ----- Look for deletion + if ($v_found) { + unset($v_header_list[$v_nb_extracted]); + } else { + $v_nb_extracted++; + } + } + + // ----- Look if something need to be deleted + if ($v_nb_extracted > 0) { + + // ----- Creates a temporay file + $v_zip_temp_name = PCLZIP_TEMPORARY_DIR . uniqid('pclzip-') . '.tmp'; + + // ----- Creates a temporary zip archive + $v_temp_zip = new PclZip($v_zip_temp_name); + + // ----- Open the temporary zip file in write mode + if (($v_result = $v_temp_zip->privOpenFd('wb')) != 1) { + $this->privCloseFd(); + + // ----- Return + return $v_result; + } + + // ----- Look which file need to be kept + for ($i = 0; $i < sizeof($v_header_list); $i++) { + + // ----- Calculate the position of the header + @rewind($this->zip_fd); + if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) { + // ----- Close the zip file + $this->privCloseFd(); + $v_temp_zip->privCloseFd(); + @unlink($v_zip_temp_name); + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read the file header + $v_local_header = array(); + if (($v_result = $this->privReadFileHeader($v_local_header)) != 1) { + // ----- Close the zip file + $this->privCloseFd(); + $v_temp_zip->privCloseFd(); + @unlink($v_zip_temp_name); + + // ----- Return + return $v_result; + } + + // ----- Check that local file header is same as central file header + if ($this->privCheckFileHeaders($v_local_header, $v_header_list[$i]) != 1) { + // TBC + } + unset($v_local_header); + + // ----- Write the file header + if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) { + // ----- Close the zip file + $this->privCloseFd(); + $v_temp_zip->privCloseFd(); + @unlink($v_zip_temp_name); + + // ----- Return + return $v_result; + } + + // ----- Read/write the data block + if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) { + // ----- Close the zip file + $this->privCloseFd(); + $v_temp_zip->privCloseFd(); + @unlink($v_zip_temp_name); + + // ----- Return + return $v_result; + } + } + + // ----- Store the offset of the central dir + $v_offset = @ftell($v_temp_zip->zip_fd); + + // ----- Re-Create the Central Dir files header + for ($i = 0; $i < sizeof($v_header_list); $i++) { + // ----- Create the file header + if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) { + $v_temp_zip->privCloseFd(); + $this->privCloseFd(); + @unlink($v_zip_temp_name); + + // ----- Return + return $v_result; + } + + // ----- Transform the header to a 'usable' info + $v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); + } + + // ----- Zip file comment + $v_comment = ''; + if (isset($p_options[PCLZIP_OPT_COMMENT])) { + $v_comment = $p_options[PCLZIP_OPT_COMMENT]; + } + + // ----- Calculate the size of the central header + $v_size = @ftell($v_temp_zip->zip_fd) - $v_offset; + + // ----- Create the central dir footer + if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) { + // ----- Reset the file list + unset($v_header_list); + $v_temp_zip->privCloseFd(); + $this->privCloseFd(); + @unlink($v_zip_temp_name); + + // ----- Return + return $v_result; + } + + // ----- Close + $v_temp_zip->privCloseFd(); + $this->privCloseFd(); + + // ----- Delete the zip file + // TBC : I should test the result ... + @unlink($this->zipname); + + // ----- Rename the temporary file + // TBC : I should test the result ... + //@rename($v_zip_temp_name, $this->zipname); + PclZipUtilRename($v_zip_temp_name, $this->zipname); + + // ----- Destroy the temporary archive + unset($v_temp_zip); + + // ----- Remove every files : reset the file + } elseif ($v_central_dir['entries'] != 0) { + $this->privCloseFd(); + + if (($v_result = $this->privOpenFd('wb')) != 1) { + return $v_result; + } + + if (($v_result = $this->privWriteCentralHeader(0, 0, 0, '')) != 1) { + return $v_result; + } + + $this->privCloseFd(); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privDirCheck() + // Description : + // Check if a directory exists, if not it creates it and all the parents directory + // which may be useful. + // Parameters : + // $p_dir : Directory path to check. + // Return Values : + // 1 : OK + // -1 : Unable to create directory + // -------------------------------------------------------------------------------- + public function privDirCheck($p_dir, $p_is_dir = false) + { + $v_result = 1; + + // ----- Remove the final '/' + if (($p_is_dir) && (substr($p_dir, -1) == '/')) { + $p_dir = substr($p_dir, 0, strlen($p_dir) - 1); + } + + // ----- Check the directory availability + if ((is_dir($p_dir)) || ($p_dir == "")) { + return 1; + } + + // ----- Extract parent directory + $p_parent_dir = dirname($p_dir); + + // ----- Just a check + if ($p_parent_dir != $p_dir) { + // ----- Look for parent directory + if ($p_parent_dir != "") { + if (($v_result = $this->privDirCheck($p_parent_dir)) != 1) { + return $v_result; + } + } + } + + // ----- Create the directory + if (!@mkdir($p_dir, 0777)) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '$p_dir'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privMerge() + // Description : + // If $p_archive_to_add does not exist, the function exit with a success result. + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privMerge(&$p_archive_to_add) + { + $v_result = 1; + + // ----- Look if the archive_to_add exists + if (!is_file($p_archive_to_add->zipname)) { + + // ----- Nothing to merge, so merge is a success + $v_result = 1; + + // ----- Return + return $v_result; + } + + // ----- Look if the archive exists + if (!is_file($this->zipname)) { + + // ----- Do a duplicate + $v_result = $this->privDuplicate($p_archive_to_add->zipname); + + // ----- Return + return $v_result; + } + + // ----- Open the zip file + if (($v_result = $this->privOpenFd('rb')) != 1) { + // ----- Return + return $v_result; + } + + // ----- Read the central directory informations + $v_central_dir = array(); + if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { + $this->privCloseFd(); + + return $v_result; + } + + // ----- Go to beginning of File + @rewind($this->zip_fd); + + // ----- Open the archive_to_add file + if (($v_result = $p_archive_to_add->privOpenFd('rb')) != 1) { + $this->privCloseFd(); + + // ----- Return + return $v_result; + } + + // ----- Read the central directory informations + $v_central_dir_to_add = array(); + if (($v_result = $p_archive_to_add->privReadEndCentralDir($v_central_dir_to_add)) != 1) { + $this->privCloseFd(); + $p_archive_to_add->privCloseFd(); + + return $v_result; + } + + // ----- Go to beginning of File + @rewind($p_archive_to_add->zip_fd); + + // ----- Creates a temporay file + $v_zip_temp_name = PCLZIP_TEMPORARY_DIR . uniqid('pclzip-') . '.tmp'; + + // ----- Open the temporary file in write mode + if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0) { + $this->privCloseFd(); + $p_archive_to_add->privCloseFd(); + + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \'' . $v_zip_temp_name . '\' in binary write mode'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Copy the files from the archive to the temporary file + // TBC : Here I should better append the file and go back to erase the central dir + $v_size = $v_central_dir['offset']; + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = fread($this->zip_fd, $v_read_size); + @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Copy the files from the archive_to_add into the temporary file + $v_size = $v_central_dir_to_add['offset']; + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = fread($p_archive_to_add->zip_fd, $v_read_size); + @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Store the offset of the central dir + $v_offset = @ftell($v_zip_temp_fd); + + // ----- Copy the block of file headers from the old archive + $v_size = $v_central_dir['size']; + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($this->zip_fd, $v_read_size); + @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Copy the block of file headers from the archive_to_add + $v_size = $v_central_dir_to_add['size']; + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($p_archive_to_add->zip_fd, $v_read_size); + @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Merge the file comments + $v_comment = $v_central_dir['comment'] . ' ' . $v_central_dir_to_add['comment']; + + // ----- Calculate the size of the (new) central header + $v_size = @ftell($v_zip_temp_fd) - $v_offset; + + // ----- Swap the file descriptor + // Here is a trick : I swap the temporary fd with the zip fd, in order to use + // the following methods on the temporary fil and not the real archive fd + $v_swap = $this->zip_fd; + $this->zip_fd = $v_zip_temp_fd; + $v_zip_temp_fd = $v_swap; + + // ----- Create the central dir footer + if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries'] + $v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1) { + $this->privCloseFd(); + $p_archive_to_add->privCloseFd(); + @fclose($v_zip_temp_fd); + $this->zip_fd = null; + + // ----- Reset the file list + unset($v_header_list); + + // ----- Return + return $v_result; + } + + // ----- Swap back the file descriptor + $v_swap = $this->zip_fd; + $this->zip_fd = $v_zip_temp_fd; + $v_zip_temp_fd = $v_swap; + + // ----- Close + $this->privCloseFd(); + $p_archive_to_add->privCloseFd(); + + // ----- Close the temporary file + @fclose($v_zip_temp_fd); + + // ----- Delete the zip file + // TBC : I should test the result ... + @unlink($this->zipname); + + // ----- Rename the temporary file + // TBC : I should test the result ... + //@rename($v_zip_temp_name, $this->zipname); + PclZipUtilRename($v_zip_temp_name, $this->zipname); + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privDuplicate() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privDuplicate($p_archive_filename) + { + $v_result = 1; + + // ----- Look if the $p_archive_filename exists + if (!is_file($p_archive_filename)) { + + // ----- Nothing to duplicate, so duplicate is a success. + $v_result = 1; + + // ----- Return + return $v_result; + } + + // ----- Open the zip file if (($v_result = $this->privOpenFd('wb')) != 1) { - return $v_result; + // ----- Return + return $v_result; } - if (($v_result = $this->privWriteCentralHeader(0, 0, 0, '')) != 1) { - return $v_result; + // ----- Open the temporary file in write mode + if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0) { + $this->privCloseFd(); + + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \'' . $p_archive_filename . '\' in binary write mode'); + + // ----- Return + return PclZip::errorCode(); } + // ----- Copy the files from the archive to the temporary file + // TBC : Here I should better append the file and go back to erase the central dir + $v_size = filesize($p_archive_filename); + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = fread($v_zip_temp_fd, $v_read_size); + @fwrite($this->zip_fd, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Close $this->privCloseFd(); + + // ----- Close the temporary file + @fclose($v_zip_temp_fd); + + // ----- Return + return $v_result; } + // -------------------------------------------------------------------------------- - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privDirCheck() - // Description : - // Check if a directory exists, if not it creates it and all the parents directory - // which may be useful. - // Parameters : - // $p_dir : Directory path to check. - // Return Values : - // 1 : OK - // -1 : Unable to create directory - // -------------------------------------------------------------------------------- - function privDirCheck($p_dir, $p_is_dir=false) - { - $v_result = 1; - - - // ----- Remove the final '/' - if (($p_is_dir) && (substr($p_dir, -1)=='/')) + // -------------------------------------------------------------------------------- + // Function : privErrorLog() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + public function privErrorLog($p_error_code = 0, $p_error_string = '') { - $p_dir = substr($p_dir, 0, strlen($p_dir)-1); - } - - // ----- Check the directory availability - if ((is_dir($p_dir)) || ($p_dir == "")) - { - return 1; - } - - // ----- Extract parent directory - $p_parent_dir = dirname($p_dir); - - // ----- Just a check - if ($p_parent_dir != $p_dir) - { - // ----- Look for parent directory - if ($p_parent_dir != "") - { - if (($v_result = $this->privDirCheck($p_parent_dir)) != 1) - { - return $v_result; + if (PCLZIP_ERROR_EXTERNAL == 1) { + PclError($p_error_code, $p_error_string); + } else { + $this->error_code = $p_error_code; + $this->error_string = $p_error_string; } - } } + // -------------------------------------------------------------------------------- - // ----- Create the directory - if (!@mkdir($p_dir, 0777)) + // -------------------------------------------------------------------------------- + // Function : privErrorReset() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + public function privErrorReset() { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '$p_dir'"); - - // ----- Return - return PclZip::errorCode(); + if (PCLZIP_ERROR_EXTERNAL == 1) { + PclErrorReset(); + } else { + $this->error_code = 0; + $this->error_string = ''; + } } + // -------------------------------------------------------------------------------- - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privMerge() - // Description : - // If $p_archive_to_add does not exist, the function exit with a success result. - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privMerge(&$p_archive_to_add) - { - $v_result=1; - - // ----- Look if the archive_to_add exists - if (!is_file($p_archive_to_add->zipname)) + // -------------------------------------------------------------------------------- + // Function : privDisableMagicQuotes() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privDisableMagicQuotes() { + $v_result = 1; - // ----- Nothing to merge, so merge is a success - $v_result = 1; + // ----- Look if function exists + if ((!function_exists("get_magic_quotes_runtime")) || (!function_exists("set_magic_quotes_runtime"))) { + return $v_result; + } - // ----- Return - return $v_result; + // ----- Look if already done + if ($this->magic_quotes_status != -1) { + return $v_result; + } + + // ----- Get and memorize the magic_quote value + $this->magic_quotes_status = @get_magic_quotes_runtime(); + + // ----- Disable magic_quotes + if ($this->magic_quotes_status == 1) { + @set_magic_quotes_runtime(0); + } + + // ----- Return + return $v_result; } + // -------------------------------------------------------------------------------- - // ----- Look if the archive exists - if (!is_file($this->zipname)) + // -------------------------------------------------------------------------------- + // Function : privSwapBackMagicQuotes() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privSwapBackMagicQuotes() { + $v_result = 1; - // ----- Do a duplicate - $v_result = $this->privDuplicate($p_archive_to_add->zipname); + // ----- Look if function exists + if ((!function_exists("get_magic_quotes_runtime")) || (!function_exists("set_magic_quotes_runtime"))) { + return $v_result; + } - // ----- Return - return $v_result; + // ----- Look if something to do + if ($this->magic_quotes_status != -1) { + return $v_result; + } + + // ----- Swap back magic_quotes + if ($this->magic_quotes_status == 1) { + @set_magic_quotes_runtime($this->magic_quotes_status); + } + + // ----- Return + return $v_result; } + // -------------------------------------------------------------------------------- +} - // ----- Open the zip file - if (($v_result=$this->privOpenFd('rb')) != 1) - { - // ----- Return - return $v_result; - } +// End of class +// -------------------------------------------------------------------------------- - // ----- Read the central directory informations - $v_central_dir = array(); - if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) - { - $this->privCloseFd(); - return $v_result; - } - - // ----- Go to beginning of File - @rewind($this->zip_fd); - - // ----- Open the archive_to_add file - if (($v_result=$p_archive_to_add->privOpenFd('rb')) != 1) - { - $this->privCloseFd(); - - // ----- Return - return $v_result; - } - - // ----- Read the central directory informations - $v_central_dir_to_add = array(); - if (($v_result = $p_archive_to_add->privReadEndCentralDir($v_central_dir_to_add)) != 1) - { - $this->privCloseFd(); - $p_archive_to_add->privCloseFd(); - - return $v_result; - } - - // ----- Go to beginning of File - @rewind($p_archive_to_add->zip_fd); - - // ----- Creates a temporay file - $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp'; - - // ----- Open the temporary file in write mode - if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0) - { - $this->privCloseFd(); - $p_archive_to_add->privCloseFd(); - - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Copy the files from the archive to the temporary file - // TBC : Here I should better append the file and go back to erase the central dir - $v_size = $v_central_dir['offset']; - while ($v_size != 0) - { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = fread($this->zip_fd, $v_read_size); - @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Copy the files from the archive_to_add into the temporary file - $v_size = $v_central_dir_to_add['offset']; - while ($v_size != 0) - { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = fread($p_archive_to_add->zip_fd, $v_read_size); - @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Store the offset of the central dir - $v_offset = @ftell($v_zip_temp_fd); - - // ----- Copy the block of file headers from the old archive - $v_size = $v_central_dir['size']; - while ($v_size != 0) - { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($this->zip_fd, $v_read_size); - @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Copy the block of file headers from the archive_to_add - $v_size = $v_central_dir_to_add['size']; - while ($v_size != 0) - { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($p_archive_to_add->zip_fd, $v_read_size); - @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Merge the file comments - $v_comment = $v_central_dir['comment'].' '.$v_central_dir_to_add['comment']; - - // ----- Calculate the size of the (new) central header - $v_size = @ftell($v_zip_temp_fd)-$v_offset; - - // ----- Swap the file descriptor - // Here is a trick : I swap the temporary fd with the zip fd, in order to use - // the following methods on the temporary fil and not the real archive fd - $v_swap = $this->zip_fd; - $this->zip_fd = $v_zip_temp_fd; - $v_zip_temp_fd = $v_swap; - - // ----- Create the central dir footer - if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries']+$v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1) - { - $this->privCloseFd(); - $p_archive_to_add->privCloseFd(); - @fclose($v_zip_temp_fd); - $this->zip_fd = null; - - // ----- Reset the file list - unset($v_header_list); - - // ----- Return - return $v_result; - } - - // ----- Swap back the file descriptor - $v_swap = $this->zip_fd; - $this->zip_fd = $v_zip_temp_fd; - $v_zip_temp_fd = $v_swap; - - // ----- Close - $this->privCloseFd(); - $p_archive_to_add->privCloseFd(); - - // ----- Close the temporary file - @fclose($v_zip_temp_fd); - - // ----- Delete the zip file - // TBC : I should test the result ... - @unlink($this->zipname); - - // ----- Rename the temporary file - // TBC : I should test the result ... - //@rename($v_zip_temp_name, $this->zipname); - PclZipUtilRename($v_zip_temp_name, $this->zipname); - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privDuplicate() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privDuplicate($p_archive_filename) - { - $v_result=1; - - // ----- Look if the $p_archive_filename exists - if (!is_file($p_archive_filename)) - { - - // ----- Nothing to duplicate, so duplicate is a success. - $v_result = 1; - - // ----- Return - return $v_result; - } - - // ----- Open the zip file - if (($v_result=$this->privOpenFd('wb')) != 1) - { - // ----- Return - return $v_result; - } - - // ----- Open the temporary file in write mode - if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0) - { - $this->privCloseFd(); - - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \''.$p_archive_filename.'\' in binary write mode'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Copy the files from the archive to the temporary file - // TBC : Here I should better append the file and go back to erase the central dir - $v_size = filesize($p_archive_filename); - while ($v_size != 0) - { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = fread($v_zip_temp_fd, $v_read_size); - @fwrite($this->zip_fd, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Close - $this->privCloseFd(); - - // ----- Close the temporary file - @fclose($v_zip_temp_fd); - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privErrorLog() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - function privErrorLog($p_error_code=0, $p_error_string='') - { - if (PCLZIP_ERROR_EXTERNAL == 1) { - PclError($p_error_code, $p_error_string); - } - else { - $this->error_code = $p_error_code; - $this->error_string = $p_error_string; - } - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privErrorReset() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - function privErrorReset() - { - if (PCLZIP_ERROR_EXTERNAL == 1) { - PclErrorReset(); - } - else { - $this->error_code = 0; - $this->error_string = ''; - } - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privDisableMagicQuotes() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privDisableMagicQuotes() - { - $v_result=1; - - // ----- Look if function exists - if ( (!function_exists("get_magic_quotes_runtime")) - || (!function_exists("set_magic_quotes_runtime"))) { - return $v_result; - } - - // ----- Look if already done - if ($this->magic_quotes_status != -1) { - return $v_result; - } - - // ----- Get and memorize the magic_quote value - $this->magic_quotes_status = @get_magic_quotes_runtime(); - - // ----- Disable magic_quotes - if ($this->magic_quotes_status == 1) { - @set_magic_quotes_runtime(0); - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privSwapBackMagicQuotes() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privSwapBackMagicQuotes() - { - $v_result=1; - - // ----- Look if function exists - if ( (!function_exists("get_magic_quotes_runtime")) - || (!function_exists("set_magic_quotes_runtime"))) { - return $v_result; - } - - // ----- Look if something to do - if ($this->magic_quotes_status != -1) { - return $v_result; - } - - // ----- Swap back magic_quotes - if ($this->magic_quotes_status == 1) { - @set_magic_quotes_runtime($this->magic_quotes_status); - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - } - // End of class - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : PclZipUtilPathReduction() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function PclZipUtilPathReduction($p_dir) - { +// -------------------------------------------------------------------------------- +// Function : PclZipUtilPathReduction() +// Description : +// Parameters : +// Return Values : +// -------------------------------------------------------------------------------- +function PclZipUtilPathReduction($p_dir) +{ $v_result = ""; // ----- Look for not empty path if ($p_dir != "") { - // ----- Explode path by directory names - $v_list = explode("/", $p_dir); + // ----- Explode path by directory names + $v_list = explode("/", $p_dir); - // ----- Study directories from last to first - $v_skip = 0; - for ($i=sizeof($v_list)-1; $i>=0; $i--) { - // ----- Look for current path - if ($v_list[$i] == ".") { - // ----- Ignore this directory - // Should be the first $i=0, but no check is done - } - else if ($v_list[$i] == "..") { - $v_skip++; - } - else if ($v_list[$i] == "") { - // ----- First '/' i.e. root slash - if ($i == 0) { - $v_result = "/".$v_result; - if ($v_skip > 0) { - // ----- It is an invalid path, so the path is not modified - // TBC - $v_result = $p_dir; - $v_skip = 0; + // ----- Study directories from last to first + $v_skip = 0; + for ($i = sizeof($v_list) - 1; $i >= 0; $i--) { + // ----- Look for current path + if ($v_list[$i] == ".") { + // ----- Ignore this directory + // Should be the first $i=0, but no check is done + } elseif ($v_list[$i] == "..") { + $v_skip++; + } elseif ($v_list[$i] == "") { + // ----- First '/' i.e. root slash + if ($i == 0) { + $v_result = "/" . $v_result; + if ($v_skip > 0) { + // ----- It is an invalid path, so the path is not modified + // TBC + $v_result = $p_dir; + $v_skip = 0; + } + + // ----- Last '/' i.e. indicates a directory + } elseif ($i == (sizeof($v_list) - 1)) { + $v_result = $v_list[$i]; + + // ----- Double '/' inside the path + } else { + // ----- Ignore only the double '//' in path, + // but not the first and last '/' + } + } else { + // ----- Look for item to skip + if ($v_skip > 0) { + $v_skip--; + } else { + $v_result = $v_list[$i] . ($i != (sizeof($v_list) - 1) ? "/" . $v_result : ""); + } } - } - // ----- Last '/' i.e. indicates a directory - else if ($i == (sizeof($v_list)-1)) { - $v_result = $v_list[$i]; - } - // ----- Double '/' inside the path - else { - // ----- Ignore only the double '//' in path, - // but not the first and last '/' - } } - else { - // ----- Look for item to skip - if ($v_skip > 0) { - $v_skip--; - } - else { - $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:""); - } - } - } - // ----- Look for skip - if ($v_skip > 0) { - while ($v_skip > 0) { - $v_result = '../'.$v_result; - $v_skip--; + // ----- Look for skip + if ($v_skip > 0) { + while ($v_skip > 0) { + $v_result = '../' . $v_result; + $v_skip--; + } } - } } // ----- Return return $v_result; - } - // -------------------------------------------------------------------------------- +} +// -------------------------------------------------------------------------------- - // -------------------------------------------------------------------------------- - // Function : PclZipUtilPathInclusion() - // Description : - // This function indicates if the path $p_path is under the $p_dir tree. Or, - // said in an other way, if the file or sub-dir $p_path is inside the dir - // $p_dir. - // The function indicates also if the path is exactly the same as the dir. - // This function supports path with duplicated '/' like '//', but does not - // support '.' or '..' statements. - // Parameters : - // Return Values : - // 0 if $p_path is not inside directory $p_dir - // 1 if $p_path is inside directory $p_dir - // 2 if $p_path is exactly the same as $p_dir - // -------------------------------------------------------------------------------- - function PclZipUtilPathInclusion($p_dir, $p_path) - { +// -------------------------------------------------------------------------------- +// Function : PclZipUtilPathInclusion() +// Description : +// This function indicates if the path $p_path is under the $p_dir tree. Or, +// said in an other way, if the file or sub-dir $p_path is inside the dir +// $p_dir. +// The function indicates also if the path is exactly the same as the dir. +// This function supports path with duplicated '/' like '//', but does not +// support '.' or '..' statements. +// Parameters : +// Return Values : +// 0 if $p_path is not inside directory $p_dir +// 1 if $p_path is inside directory $p_dir +// 2 if $p_path is exactly the same as $p_dir +// -------------------------------------------------------------------------------- +function PclZipUtilPathInclusion($p_dir, $p_path) +{ $v_result = 1; // ----- Look for path beginning by ./ - if ( ($p_dir == '.') - || ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) { - $p_dir = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_dir, 1); + if (($p_dir == '.') || ((strlen($p_dir) >= 2) && (substr($p_dir, 0, 2) == './'))) { + $p_dir = PclZipUtilTranslateWinPath(getcwd(), false) . '/' . substr($p_dir, 1); } - if ( ($p_path == '.') - || ((strlen($p_path) >=2) && (substr($p_path, 0, 2) == './'))) { - $p_path = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_path, 1); + if (($p_path == '.') || ((strlen($p_path) >= 2) && (substr($p_path, 0, 2) == './'))) { + $p_path = PclZipUtilTranslateWinPath(getcwd(), false) . '/' . substr($p_path, 1); } // ----- Explode dir and path by directory separator - $v_list_dir = explode("/", $p_dir); - $v_list_dir_size = sizeof($v_list_dir); - $v_list_path = explode("/", $p_path); + $v_list_dir = explode("/", $p_dir); + $v_list_dir_size = sizeof($v_list_dir); + $v_list_path = explode("/", $p_path); $v_list_path_size = sizeof($v_list_path); // ----- Study directories paths @@ -5499,193 +5234,182 @@ $j = 0; while (($i < $v_list_dir_size) && ($j < $v_list_path_size) && ($v_result)) { - // ----- Look for empty dir (path reduction) - if ($v_list_dir[$i] == '') { + // ----- Look for empty dir (path reduction) + if ($v_list_dir[$i] == '') { + $i++; + continue; + } + if ($v_list_path[$j] == '') { + $j++; + continue; + } + + // ----- Compare the items + if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ($v_list_path[$j] != '')) { + $v_result = 0; + } + + // ----- Next items $i++; - continue; - } - if ($v_list_path[$j] == '') { $j++; - continue; - } - - // ----- Compare the items - if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ( $v_list_path[$j] != '')) { - $v_result = 0; - } - - // ----- Next items - $i++; - $j++; } // ----- Look if everything seems to be the same if ($v_result) { - // ----- Skip all the empty items - while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) $j++; - while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) $i++; + // ----- Skip all the empty items + while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) { + $j++; + } + while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) { + $i++; + } - if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) { - // ----- There are exactly the same - $v_result = 2; - } - else if ($i < $v_list_dir_size) { - // ----- The path is shorter than the dir - $v_result = 0; - } + if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) { + // ----- There are exactly the same + $v_result = 2; + } elseif ($i < $v_list_dir_size) { + // ----- The path is shorter than the dir + $v_result = 0; + } } // ----- Return return $v_result; - } - // -------------------------------------------------------------------------------- +} +// -------------------------------------------------------------------------------- - // -------------------------------------------------------------------------------- - // Function : PclZipUtilCopyBlock() - // Description : - // Parameters : - // $p_mode : read/write compression mode - // 0 : src & dest normal - // 1 : src gzip, dest normal - // 2 : src normal, dest gzip - // 3 : src & dest gzip - // Return Values : - // -------------------------------------------------------------------------------- - function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0) - { +// -------------------------------------------------------------------------------- +// Function : PclZipUtilCopyBlock() +// Description : +// Parameters : +// $p_mode : read/write compression mode +// 0 : src & dest normal +// 1 : src gzip, dest normal +// 2 : src normal, dest gzip +// 3 : src & dest gzip +// Return Values : +// -------------------------------------------------------------------------------- +function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode = 0) +{ $v_result = 1; - if ($p_mode==0) - { - while ($p_size != 0) - { - $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($p_src, $v_read_size); - @fwrite($p_dest, $v_buffer, $v_read_size); - $p_size -= $v_read_size; - } - } - else if ($p_mode==1) - { - while ($p_size != 0) - { - $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @gzread($p_src, $v_read_size); - @fwrite($p_dest, $v_buffer, $v_read_size); - $p_size -= $v_read_size; - } - } - else if ($p_mode==2) - { - while ($p_size != 0) - { - $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($p_src, $v_read_size); - @gzwrite($p_dest, $v_buffer, $v_read_size); - $p_size -= $v_read_size; - } - } - else if ($p_mode==3) - { - while ($p_size != 0) - { - $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @gzread($p_src, $v_read_size); - @gzwrite($p_dest, $v_buffer, $v_read_size); - $p_size -= $v_read_size; - } + if ($p_mode == 0) { + while ($p_size != 0) { + $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($p_src, $v_read_size); + @fwrite($p_dest, $v_buffer, $v_read_size); + $p_size -= $v_read_size; + } + } elseif ($p_mode == 1) { + while ($p_size != 0) { + $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @gzread($p_src, $v_read_size); + @fwrite($p_dest, $v_buffer, $v_read_size); + $p_size -= $v_read_size; + } + } elseif ($p_mode == 2) { + while ($p_size != 0) { + $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($p_src, $v_read_size); + @gzwrite($p_dest, $v_buffer, $v_read_size); + $p_size -= $v_read_size; + } + } elseif ($p_mode == 3) { + while ($p_size != 0) { + $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @gzread($p_src, $v_read_size); + @gzwrite($p_dest, $v_buffer, $v_read_size); + $p_size -= $v_read_size; + } } // ----- Return return $v_result; - } - // -------------------------------------------------------------------------------- +} +// -------------------------------------------------------------------------------- - // -------------------------------------------------------------------------------- - // Function : PclZipUtilRename() - // Description : - // This function tries to do a simple rename() function. If it fails, it - // tries to copy the $p_src file in a new $p_dest file and then unlink the - // first one. - // Parameters : - // $p_src : Old filename - // $p_dest : New filename - // Return Values : - // 1 on success, 0 on failure. - // -------------------------------------------------------------------------------- - function PclZipUtilRename($p_src, $p_dest) - { +// -------------------------------------------------------------------------------- +// Function : PclZipUtilRename() +// Description : +// This function tries to do a simple rename() function. If it fails, it +// tries to copy the $p_src file in a new $p_dest file and then unlink the +// first one. +// Parameters : +// $p_src : Old filename +// $p_dest : New filename +// Return Values : +// 1 on success, 0 on failure. +// -------------------------------------------------------------------------------- +function PclZipUtilRename($p_src, $p_dest) +{ $v_result = 1; // ----- Try to rename the files if (!@rename($p_src, $p_dest)) { - // ----- Try to copy & unlink the src - if (!@copy($p_src, $p_dest)) { - $v_result = 0; - } - else if (!@unlink($p_src)) { - $v_result = 0; - } + // ----- Try to copy & unlink the src + if (!@copy($p_src, $p_dest)) { + $v_result = 0; + } elseif (!@unlink($p_src)) { + $v_result = 0; + } } // ----- Return return $v_result; - } - // -------------------------------------------------------------------------------- +} +// -------------------------------------------------------------------------------- - // -------------------------------------------------------------------------------- - // Function : PclZipUtilOptionText() - // Description : - // Translate option value in text. Mainly for debug purpose. - // Parameters : - // $p_option : the option value. - // Return Values : - // The option text value. - // -------------------------------------------------------------------------------- - function PclZipUtilOptionText($p_option) - { +// -------------------------------------------------------------------------------- +// Function : PclZipUtilOptionText() +// Description : +// Translate option value in text. Mainly for debug purpose. +// Parameters : +// $p_option : the option value. +// Return Values : +// The option text value. +// -------------------------------------------------------------------------------- +function PclZipUtilOptionText($p_option) +{ $v_list = get_defined_constants(); for (reset($v_list); $v_key = key($v_list); next($v_list)) { $v_prefix = substr($v_key, 0, 10); - if (( ($v_prefix == 'PCLZIP_OPT') - || ($v_prefix == 'PCLZIP_CB_') - || ($v_prefix == 'PCLZIP_ATT')) - && ($v_list[$v_key] == $p_option)) { - return $v_key; + if ((($v_prefix == 'PCLZIP_OPT') || ($v_prefix == 'PCLZIP_CB_') || ($v_prefix == 'PCLZIP_ATT')) && ($v_list[$v_key] == $p_option)) { + return $v_key; } } $v_result = 'Unknown'; return $v_result; - } - // -------------------------------------------------------------------------------- +} +// -------------------------------------------------------------------------------- - // -------------------------------------------------------------------------------- - // Function : PclZipUtilTranslateWinPath() - // Description : - // Translate windows path by replacing '\' by '/' and optionally removing - // drive letter. - // Parameters : - // $p_path : path to translate. - // $p_remove_disk_letter : true | false - // Return Values : - // The path translated. - // -------------------------------------------------------------------------------- - function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter=true) - { +// -------------------------------------------------------------------------------- +// Function : PclZipUtilTranslateWinPath() +// Description : +// Translate windows path by replacing '\' by '/' and optionally removing +// drive letter. +// Parameters : +// $p_path : path to translate. +// $p_remove_disk_letter : true | false +// Return Values : +// The path translated. +// -------------------------------------------------------------------------------- +function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter = true) +{ if (stristr(php_uname(), 'windows')) { - // ----- Look for potential disk letter - if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) { - $p_path = substr($p_path, $v_position+1); - } - // ----- Change potential windows directory separator - if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) { - $p_path = strtr($p_path, '\\', '/'); - } + // ----- Look for potential disk letter + if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) { + $p_path = substr($p_path, $v_position + 1); + } + // ----- Change potential windows directory separator + if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0, 1) == '\\')) { + $p_path = strtr($p_path, '\\', '/'); + } } + return $p_path; - } - // -------------------------------------------------------------------------------- +} +// -------------------------------------------------------------------------------- From b72ffbdc988373101d8c78ae5d6a462477498c9b Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 9 Jul 2017 22:21:52 +0200 Subject: [PATCH 079/370] enable php 7.1 build --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 1a36b21b..43c4b205 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,11 +6,13 @@ php: - 5.5 - 5.6 - 7.0 + - 7.1 ## - hhvm matrix: allow_failures: - php: 7.0 + - php: 7.1 ## - php: hhvm env: From be6b6008e85f4036114f3fc63202df4a07b8f93a Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 11 Jul 2017 01:56:20 +0200 Subject: [PATCH 080/370] add reader/writer for additional values in settings.xml (#1098) * add reader/writer for settings.xml The following values can currently be set/read - w:trackRevisions - w:doNotTrackMoves - w:doNotTrackFormatting - w:proofState - w:zoom - w:decimalSymbol - w:revisionView --- docs/general.rst | 80 ++++++-- src/PhpWord/ComplexType/ProofState.php | 104 ++++++++++ src/PhpWord/ComplexType/TrackChangesView.php | 166 +++++++++++++++ src/PhpWord/Metadata/Settings.php | 192 +++++++++++++++++- src/PhpWord/Reader/Word2007/Settings.php | 62 +++++- src/PhpWord/SimpleType/Zoom.php | 42 ++++ src/PhpWord/Writer/Word2007/Part/Settings.php | 74 ++++++- tests/PhpWord/Metadata/SettingsTest.php | 69 +++++++ tests/PhpWord/Reader/MsDocTest.php | 59 ++++++ .../Writer/Word2007/Part/SettingsTest.php | 125 +++++++++++- tests/PhpWord/_files/documents/reader.doc | Bin 0 -> 49664 bytes tests/PhpWord/_files/documents/reader.docx | Bin 74121 -> 105546 bytes 12 files changed, 935 insertions(+), 38 deletions(-) create mode 100644 src/PhpWord/ComplexType/ProofState.php create mode 100644 src/PhpWord/ComplexType/TrackChangesView.php create mode 100644 src/PhpWord/SimpleType/Zoom.php create mode 100644 tests/PhpWord/Reader/MsDocTest.php create mode 100644 tests/PhpWord/_files/documents/reader.doc diff --git a/docs/general.rst b/docs/general.rst index 8e347089..87fecb77 100644 --- a/docs/general.rst +++ b/docs/general.rst @@ -80,8 +80,8 @@ folder `__. /* Note: we skip RTF, because it's not XML-based and requires a different example. */ /* Note: we skip PDF, because "HTML-to-PDF" approach is used to create PDF documents. */ -Settings --------- +PHPWord Settings +---------------- The ``PhpOffice\PhpWord\Settings`` class provides some options that will affect the behavior of PHPWord. Below are the options. @@ -130,6 +130,35 @@ To turn it on set ``outputEscapingEnabled`` option to ``true`` in your PHPWord c \PhpOffice\PhpWord\Settings::setOutputEscapingEnabled(true); +Default font +~~~~~~~~~~~~ + +By default, every text appears in Arial 10 point. You can alter the +default font by using the following two functions: + +.. code-block:: php + + $phpWord->setDefaultFontName('Times New Roman'); + $phpWord->setDefaultFontSize(12); + +Document settings +----------------- +Settings for the generated document can be set using ``$phpWord->getSettings()`` + +Magnification Setting +~~~~~~~~~~~~~~~~~~~~~ +The default zoom value is 100 percent. This can be changed either to another percentage + +.. code-block:: php + + $phpWord->getSettings()->setZoom(75); + +Or to predefined values ``fullPage``, ``bestFit``, ``textFit`` + +.. code-block:: php + + $phpWord->getSettings()->setZoom(Zoom::BEST_FIT); + Spelling and grammatical checks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -141,16 +170,36 @@ For big documents this can slow down the opening of the document. You can hide t $phpWord->getSettings()->setHideGrammaticalErrors(true); $phpWord->getSettings()->setHideSpellingErrors(true); -Default font -~~~~~~~~~~~~ - -By default, every text appears in Arial 10 point. You can alter the -default font by using the following two functions: +You can also specify the status of the spell and grammar checks, marking spelling or grammar as dirty will force a re-check when opening the document. .. code-block:: php - $phpWord->setDefaultFontName('Times New Roman'); - $phpWord->setDefaultFontSize(12); + $proofState = new ProofState(); + $proofState->setGrammar(ProofState::CLEAN); + $proofState->setSpelling(ProofState::DIRTY); + + $phpWord->getSettings()->setProofState(proofState); + +Track Revisions +~~~~~~~~~~~~~~~ +Track changes can be activated using ``setTrackRevisions``, you can furture specify + +- Not to use move syntax, instead moved items will be seen as deleted in one place and added in another +- Not track formatting revisions + +.. code-block:: php + + $phpWord->getSettings()->setTrackRevisions(true); + $phpWord->getSettings()->setDoNotTrackMoves(true); + $phpWord->getSettings()->setDoNotTrackFormatting(true); + +Decimal Symbol +~~~~~~~~~~~~~~ +The default symbol to represent a decimal figure is the ``.`` in english. In french you might want to change it to ``,`` for instance. + +.. code-block:: php + + $phpWord->getSettings()->setDecimalSymbol(','); Document information -------------------- @@ -194,16 +243,3 @@ points to twips. $sectionStyle->setMarginLeft(\PhpOffice\PhpWord\Shared\Converter::inchToTwip(.5)); // 2 cm right margin $sectionStyle->setMarginRight(\PhpOffice\PhpWord\Shared\Converter::cmToTwip(2)); - -Language --------- - -You can hide spelling errors: - -.. code-block:: php - \PhpOffice\PhpWord\Settings::setSpellingErrorsHidden(true); - -And hide grammatical errors: - -.. code-block:: php - \PhpOffice\PhpWord\Settings::setGrammaticalErrorsHidden(true); diff --git a/src/PhpWord/ComplexType/ProofState.php b/src/PhpWord/ComplexType/ProofState.php new file mode 100644 index 00000000..e5ac9c20 --- /dev/null +++ b/src/PhpWord/ComplexType/ProofState.php @@ -0,0 +1,104 @@ +spelling = $spelling; + } else { + throw new \InvalidArgumentException("Invalid value, dirty or clean possible"); + } + return $this; + } + + /** + * Get the Spell Checking State + * + * @return string + */ + public function getSpelling() + { + return $this->spelling; + } + + /** + * Set the Grammatical Checking State (dirty or clean) + * + * @param string $grammar + * @throws \InvalidArgumentException + * @return self + */ + public function setGrammar($grammar) + { + if ($grammar == self::CLEAN || $grammar == self::DIRTY) { + $this->grammar = $grammar; + } else { + throw new \InvalidArgumentException("Invalid value, dirty or clean possible"); + } + return $this; + } + + /** + * Get the Grammatical Checking State + * + * @return string + */ + public function getGrammar() + { + return $this->grammar; + } +} diff --git a/src/PhpWord/ComplexType/TrackChangesView.php b/src/PhpWord/ComplexType/TrackChangesView.php new file mode 100644 index 00000000..ea26bc3c --- /dev/null +++ b/src/PhpWord/ComplexType/TrackChangesView.php @@ -0,0 +1,166 @@ +markup; + } + + /** + * Set Display Visual Indicator Of Markup Area + * + * @param boolean $markup + * Set to true to show markup + */ + public function setMarkup($markup) + { + $this->markup = $markup === null ? true : $markup; + } + + /** + * Get Display Comments + * + * @return boolean True if comments are shown + */ + public function hasComments() + { + return $this->comments; + } + + /** + * Set Display Comments + * + * @param boolean $comments + * Set to true to show comments + */ + public function setComments($comments) + { + $this->comments = $comments === null ? true : $comments; + } + + /** + * Get Display Content Revisions + * + * @return boolean True if content revisions are shown + */ + public function hasInsDel() + { + return $this->insDel; + } + + /** + * Set Display Content Revisions + * + * @param boolean $insDel + * Set to true to show content revisions + */ + public function setInsDel($insDel) + { + $this->insDel = $insDel === null ? true : $insDel; + } + + /** + * Get Display Formatting Revisions + * + * @return boolean True if formatting revisions are shown + */ + public function hasFormatting() + { + return $this->formatting; + } + + /** + * Set Display Formatting Revisions + * + * @param boolean $insDel + * Set to true to show formatting revisions + */ + public function setFormatting($formatting) + { + $this->formatting = $formatting === null ? true : $formatting; + } + + /** + * Get Display Ink Annotations + * + * @return boolean True if ink annotations are shown + */ + public function hasInkAnnotations() + { + return $this->inkAnnotations; + } + + /** + * Set Display Ink Annotations + * + * @param boolean $inkAnnotations + * Set to true to show ink annotations + */ + public function setInkAnnotations($inkAnnotations) + { + $this->inkAnnotations = $inkAnnotations === null ? true : $inkAnnotations; + } +} diff --git a/src/PhpWord/Metadata/Settings.php b/src/PhpWord/Metadata/Settings.php index d1d1f0ce..9b2c2285 100644 --- a/src/PhpWord/Metadata/Settings.php +++ b/src/PhpWord/Metadata/Settings.php @@ -14,9 +14,12 @@ * @copyright 2010-2016 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ - namespace PhpOffice\PhpWord\Metadata; +use PhpOffice\PhpWord\ComplexType\ProofState; +use PhpOffice\PhpWord\SimpleType\Zoom; +use PhpOffice\PhpWord\ComplexType\TrackChangesView; + /** * Setting class * @@ -26,24 +29,67 @@ namespace PhpOffice\PhpWord\Metadata; class Settings { + /** + * Magnification Setting + * + * @link http://www.datypic.com/sc/ooxml/e-w_zoom-1.html + * @var mixed either integer, in which case it treated as a percent, or one of PhpOffice\PhpWord\SimpleType\Zoom + */ + private $zoom = 100; + /** * Hide spelling errors - * + * * @var boolean */ private $hideSpellingErrors = false; /** * Hide grammatical errors - * + * * @var boolean */ private $hideGrammaticalErrors = false; + /** + * Visibility of Annotation Types + * + * @var TrackChangesView + */ + private $revisionView; + + /** + * Track Revisions to Document + * + * @var boolean + */ + private $trackRevisions = false; + + /** + * Do Not Use Move Syntax When Tracking Revisions + * + * @var boolean + */ + private $doNotTrackMoves = false; + + /** + * Do Not Track Formatting Revisions When Tracking Revisions + * + * @var boolean + */ + private $doNotTrackFormatting = false; + + /** + * Spelling and Grammatical Checking State + * + * @var \PhpOffice\PhpWord\Metadata\ProofState + */ + private $proofState; + /** * Document Editing Restrictions - * - * @var PhpOffice\PhpWord\Metadata\Protection + * + * @var \PhpOffice\PhpWord\Metadata\Protection */ private $documentProtection; @@ -54,6 +100,13 @@ class Settings */ private $evenAndOddHeaders = false; + /** + * Radix Point for Field Code Evaluation + * + * @var string + */ + private $decimalSymbol = '.'; + /** * @return Protection */ @@ -73,6 +126,25 @@ class Settings $this->documentProtection = $documentProtection; } + /** + * @return ProofState + */ + public function getProofState() + { + if ($this->proofState == null) { + $this->proofState = new ProofState(); + } + return $this->proofState; + } + + /** + * @param ProofState $proofState + */ + public function setProofState($proofState) + { + $this->proofState = $proofState; + } + /** * Are spelling errors hidden * @@ -128,4 +200,114 @@ class Settings { $this->evenAndOddHeaders = $evenAndOddHeaders === null ? true : $evenAndOddHeaders; } + + /** + * Get the Visibility of Annotation Types + * + * @return \PhpOffice\PhpWord\ComplexType\TrackChangesView + */ + public function getRevisionView() + { + return $this->revisionView; + } + + /** + * Set the Visibility of Annotation Types + * + * @param TrackChangesView $trackChangesView + */ + public function setRevisionView(TrackChangesView $trackChangesView = null) + { + $this->revisionView = $trackChangesView; + } + + /** + * @return boolean + */ + public function hasTrackRevisions() + { + return $this->trackRevisions; + } + + /** + * @param boolean $trackRevisions + */ + public function setTrackRevisions($trackRevisions) + { + $this->trackRevisions = $trackRevisions === null ? true : $trackRevisions; + } + + /** + * @return boolean + */ + public function hasDoNotTrackMoves() + { + return $this->doNotTrackMoves; + } + + /** + * @param boolean $doNotTrackMoves + */ + public function setDoNotTrackMoves($doNotTrackMoves) + { + $this->doNotTrackMoves = $doNotTrackMoves === null ? true : $doNotTrackMoves; + } + + /** + * @return boolean + */ + public function hasDoNotTrackFormatting() + { + return $this->doNotTrackFormatting; + } + + /** + * @param boolean $doNotTrackFormatting + */ + public function setDoNotTrackFormatting($doNotTrackFormatting) + { + $this->doNotTrackFormatting = $doNotTrackFormatting === null ? true : $doNotTrackFormatting; + } + + /** + * @return mixed + */ + public function getZoom() + { + return $this->zoom; + } + + /** + * @param mixed $zoom + */ + public function setZoom($zoom) + { + if (is_numeric($zoom)) { + // zoom is a percentage + $this->zoom = $zoom; + } else { + Zoom::validate($zoom); + $this->zoom = $zoom; + } + } + + /** + * Returns the Radix Point for Field Code Evaluation + * + * @return string + */ + public function getDecimalSymbol() + { + return $this->decimalSymbol; + } + + /** + * sets the Radix Point for Field Code Evaluation + * + * @param string $decimalSymbol + */ + public function setDecimalSymbol($decimalSymbol) + { + $this->decimalSymbol = $decimalSymbol; + } } diff --git a/src/PhpWord/Reader/Word2007/Settings.php b/src/PhpWord/Reader/Word2007/Settings.php index df0d6dcf..d2ffc1f3 100644 --- a/src/PhpWord/Reader/Word2007/Settings.php +++ b/src/PhpWord/Reader/Word2007/Settings.php @@ -19,6 +19,7 @@ namespace PhpOffice\PhpWord\Reader\Word2007; use PhpOffice\Common\XMLReader; use PhpOffice\PhpWord\PhpWord; +use PhpOffice\PhpWord\ComplexType\TrackChangesView; /** * Settings reader @@ -28,7 +29,7 @@ use PhpOffice\PhpWord\PhpWord; class Settings extends AbstractPart { - private static $booleanProperties = array('hideSpellingErrors', 'hideGrammaticalErrors', 'evenAndOddHeaders'); + private static $booleanProperties = array('hideSpellingErrors', 'hideGrammaticalErrors', 'trackRevisions', 'doNotTrackMoves', 'doNotTrackFormatting', 'evenAndOddHeaders'); /** * Read settings.xml. @@ -58,7 +59,7 @@ class Settings extends AbstractPart } } else if (method_exists($this, $method)) { $this->$method($xmlReader, $phpWord, $node); - } else if (method_exists($this, $method)) { + } else if (method_exists($docSettings, $method)) { $docSettings->$method($value); } } @@ -79,4 +80,61 @@ class Settings extends AbstractPart $edit = $xmlReader->getAttribute('w:edit', $node); $documentProtection->setEditing($edit); } + + /** + * Sets the proof state + * + * @param XMLReader $xmlReader + * @param PhpWord $phpWord + * @param \DOMNode $node + */ + protected function setProofState(XMLReader $xmlReader, PhpWord $phpWord, \DOMNode $node) + { + $proofState = $phpWord->getSettings()->getProofState(); + + $spelling = $xmlReader->getAttribute('w:spelling', $node); + $grammar = $xmlReader->getAttribute('w:grammar', $node); + + if ($spelling != null) { + $proofState->setSpelling($spelling); + } + if ($grammar != null) { + $proofState->setGrammar($grammar); + } + } + + /** + * Sets the proof state + * + * @param XMLReader $xmlReader + * @param PhpWord $phpWord + * @param \DOMNode $node + */ + protected function setZoom(XMLReader $xmlReader, PhpWord $phpWord, \DOMNode $node) + { + $percent = $xmlReader->getAttribute('w:percent', $node); + $val = $xmlReader->getAttribute('w:val', $node); + + if ($percent != null || $val != null) { + $phpWord->getSettings()->setZoom($percent == null ? $val : $percent); + } + } + + /** + * Set the Revision view + * + * @param XMLReader $xmlReader + * @param PhpWord $phpWord + * @param \DOMNode $node + */ + protected function setRevisionView(XMLReader $xmlReader, PhpWord $phpWord, \DOMNode $node) + { + $revisionView = new TrackChangesView(); + $revisionView->setMarkup($xmlReader->getAttribute('w:markup', $node)); + $revisionView->setComments($xmlReader->getAttribute('w:comments', $node)); + $revisionView->setInsDel($xmlReader->getAttribute('w:insDel', $node)); + $revisionView->setFormatting($xmlReader->getAttribute('w:formatting', $node)); + $revisionView->setInkAnnotations($xmlReader->getAttribute('w:inkAnnotations', $node)); + $phpWord->getSettings()->setRevisionView($revisionView); + } } diff --git a/src/PhpWord/SimpleType/Zoom.php b/src/PhpWord/SimpleType/Zoom.php new file mode 100644 index 00000000..3b78fdf9 --- /dev/null +++ b/src/PhpWord/SimpleType/Zoom.php @@ -0,0 +1,42 @@ +getParentWriter()->getPhpWord()->getSettings(); + // Default settings $this->settings = array( - 'w:zoom' => array('@attributes' => array('w:percent' => '100')), 'w:defaultTabStop' => array('@attributes' => array('w:val' => '708')), 'w:hyphenationZone' => array('@attributes' => array('w:val' => '425')), 'w:characterSpacingControl' => array('@attributes' => array('w:val' => 'doNotCompress')), 'w:themeFontLang' => array('@attributes' => array('w:val' => 'en-US')), - 'w:decimalSymbol' => array('@attributes' => array('w:val' => '.')), + 'w:decimalSymbol' => array('@attributes' => array('w:val' => $documentSettings->getDecimalSymbol())), 'w:listSeparator' => array('@attributes' => array('w:val' => ';')), 'w:compat' => array(), 'm:mathPr' => array( @@ -140,15 +145,17 @@ class Settings extends AbstractPart ), ); - /** @var \PhpOffice\PhpWord\Metadata\Settings $documentSettings */ - $documentSettings = $this->getParentWriter()->getPhpWord()->getSettings(); - $this->setOnOffValue('w:hideSpellingErrors', $documentSettings->hasHideSpellingErrors()); $this->setOnOffValue('w:hideGrammaticalErrors', $documentSettings->hasHideGrammaticalErrors()); + $this->setOnOffValue('w:trackRevisions', $documentSettings->hasTrackRevisions()); + $this->setOnOffValue('w:doNotTrackMoves', $documentSettings->hasDoNotTrackMoves()); + $this->setOnOffValue('w:doNotTrackFormatting', $documentSettings->hasDoNotTrackFormatting()); $this->setOnOffValue('w:evenAndOddHeaders', $documentSettings->hasEvenAndOddHeaders()); - // Other settings + $this->setRevisionView($documentSettings->getRevisionView()); $this->setDocumentProtection($documentSettings->getDocumentProtection()); + $this->setProofState($documentSettings->getProofState()); + $this->setZoom($documentSettings->getZoom()); $this->getCompatibility(); } @@ -161,7 +168,11 @@ class Settings extends AbstractPart private function setOnOffValue($settingName, $booleanValue) { if ($booleanValue !== null && is_bool($booleanValue)) { - $this->settings[$settingName] = array('@attributes' => array('w:val' => $booleanValue ? 'true': 'false')); + if ($booleanValue) { + $this->settings[$settingName] = array('@attributes' => array()); + } else { + $this->settings[$settingName] = array('@attributes' => array('w:val' => 'false')); + } } } @@ -183,6 +194,55 @@ class Settings extends AbstractPart } } + /** + * Set the Proof state + * + * @param ProofState $proofState + */ + private function setProofState(ProofState $proofState = null) + { + if ($proofState != null && $proofState->getGrammar() !== null && $proofState->getSpelling() !== null) { + $this->settings['w:proofState'] = array( + '@attributes' => array( + 'w:spelling' => $proofState->getSpelling(), + 'w:grammar' => $proofState->getGrammar() + ) + ); + } + } + + /** + * Set the Proof state + * + * @param ProofState $proofState + */ + private function setRevisionView(TrackChangesView $trackChangesView = null) + { + if ($trackChangesView != null) { + + $revisionView['w:markup'] = $trackChangesView->hasMarkup() ? 'true': 'false'; + $revisionView['w:comments'] = $trackChangesView->hasComments() ? 'true': 'false'; + $revisionView['w:insDel'] = $trackChangesView->hasInsDel() ? 'true': 'false'; + $revisionView['w:formatting'] = $trackChangesView->hasFormatting() ? 'true': 'false'; + $revisionView['w:inkAnnotations'] = $trackChangesView->hasInkAnnotations() ? 'true': 'false'; + + $this->settings['w:revisionView'] = array('@attributes' => $revisionView); + } + } + + /** + * Set the magnification + * + * @param mixed $zoom + */ + private function setZoom($zoom = null) + { + if ($zoom !== null) { + $attr = is_int($zoom) ? 'w:percent' : 'w:val'; + $this->settings['w:zoom'] = array('@attributes' => array($attr => $zoom)); + } + } + /** * Get compatibility setting. * diff --git a/tests/PhpWord/Metadata/SettingsTest.php b/tests/PhpWord/Metadata/SettingsTest.php index 35c15edd..fff51652 100644 --- a/tests/PhpWord/Metadata/SettingsTest.php +++ b/tests/PhpWord/Metadata/SettingsTest.php @@ -17,6 +17,9 @@ namespace PhpOffice\PhpWord\Metadata; +use PhpOffice\PhpWord\ComplexType\ProofState; +use PhpOffice\PhpWord\SimpleType\Zoom; + /** * Test class for PhpOffice\PhpWord\Metadata\Settings * @@ -66,4 +69,70 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $oSettings->getDocumentProtection()->setEditing('trackedChanges'); $this->assertEquals('trackedChanges', $oSettings->getDocumentProtection()->getEditing()); } + + /** + * TrackRevistions + */ + public function testTrackRevisions() + { + $oSettings = new Settings(); + $oSettings->setTrackRevisions(true); + $this->assertEquals(true, $oSettings->hasTrackRevisions()); + } + + /** + * DoNotTrackFormatting + */ + public function testDoNotTrackFormatting() + { + $oSettings = new Settings(); + $oSettings->setDoNotTrackFormatting(true); + $this->assertEquals(true, $oSettings->hasDoNotTrackFormatting()); + } + + /** + * DoNotTrackMoves + */ + public function testDoNotTrackMoves() + { + $oSettings = new Settings(); + $oSettings->setDoNotTrackMoves(true); + $this->assertEquals(true, $oSettings->hasDoNotTrackMoves()); + } + + /** + * ProofState + */ + public function testProofState() + { + $proofState = new ProofState(); + $proofState->setGrammar(ProofState::CLEAN); + $proofState->setSpelling(ProofState::DIRTY); + + $oSettings = new Settings(); + $oSettings->setProofState($proofState); + $this->assertNotNull($oSettings->getProofState()); + $this->assertEquals(ProofState::CLEAN, $oSettings->getProofState()->getGrammar()); + $this->assertEquals(ProofState::DIRTY, $oSettings->getProofState()->getSpelling()); + } + + /** + * Zoom as percentage + */ + public function testZoomPercentage() + { + $oSettings = new Settings(); + $oSettings->setZoom(75); + $this->assertEquals(75, $oSettings->getZoom()); + } + + /** + * Zoom as string + */ + public function testZoomEnum() + { + $oSettings = new Settings(); + $oSettings->setZoom(Zoom::FULL_PAGE); + $this->assertEquals('fullPage', $oSettings->getZoom()); + } } diff --git a/tests/PhpWord/Reader/MsDocTest.php b/tests/PhpWord/Reader/MsDocTest.php new file mode 100644 index 00000000..b4173d17 --- /dev/null +++ b/tests/PhpWord/Reader/MsDocTest.php @@ -0,0 +1,59 @@ +assertTrue($object->canRead($filename)); + } + + /** + * Can read exception + */ + public function testCanReadFailed() + { + $object = new MsDoc(); + $filename = __DIR__ . '/../_files/documents/foo.doc'; + $this->assertFalse($object->canRead($filename)); + } + + /** + * Load + */ + public function testLoad() + { + $filename = __DIR__ . '/../_files/documents/reader.doc'; + $phpWord = IOFactory::load($filename, 'MsDoc'); + $this->assertInstanceOf('PhpOffice\\PhpWord\\PhpWord', $phpWord); + } +} diff --git a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php index fe6ea61c..828e1283 100644 --- a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php @@ -19,6 +19,8 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\TestHelperDOCX; use PhpOffice\PhpWord\Settings; +use PhpOffice\PhpWord\SimpleType\Zoom; +use PhpOffice\PhpWord\ComplexType\TrackChangesView; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Settings @@ -102,7 +104,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertTrue($doc->elementExists($path, $file)); $element = $doc->getElement($path, $file); - $this->assertEquals('true', $element->getAttribute('w:val')); + $this->assertNotEquals('false', $element->getAttribute('w:val')); } /** @@ -121,6 +123,125 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertTrue($doc->elementExists($path, $file)); $element = $doc->getElement($path, $file); - $this->assertEquals('true', $element->getAttribute('w:val')); + $this->assertNotEquals('false', $element->getAttribute('w:val')); + } + + /** + * Test zoom percentage + */ + public function testZoomPercentage() + { + $phpWord = new PhpWord(); + $phpWord->getSettings()->setZoom(75); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:zoom'; + $this->assertTrue($doc->elementExists($path, $file)); + + $element = $doc->getElement($path, $file); + $this->assertEquals('75', $element->getAttribute('w:percent')); + } + + /** + * Test zoom value + */ + public function testZoomValue() + { + $phpWord = new PhpWord(); + $phpWord->getSettings()->setZoom(Zoom::FULL_PAGE); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:zoom'; + $this->assertTrue($doc->elementExists($path, $file)); + + $element = $doc->getElement($path, $file); + $this->assertEquals('fullPage', $element->getAttribute('w:val')); + } + + /** + * Test Revision View + */ + public function testRevisionView() + { + $trackChangesView = new TrackChangesView(); + $trackChangesView->setFormatting(false); + $trackChangesView->setComments(true); + + $phpWord = new PhpWord(); + $phpWord->getSettings()->setRevisionView($trackChangesView); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:revisionView'; + $this->assertTrue($doc->elementExists($path, $file)); + + $element = $doc->getElement($path, $file); + $this->assertEquals('false', $element->getAttribute('w:formatting')); + $this->assertEquals('true', $element->getAttribute('w:comments')); + } + + /** + * Test track Revisions + */ + public function testTrackRevisions() + { + $phpWord = new PhpWord(); + $phpWord->getSettings()->setTrackRevisions(true); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:trackRevisions'; + $this->assertTrue($doc->elementExists($path, $file)); + + $element = $doc->getElement($path, $file); + $this->assertNotEquals('false', $element->getAttribute('w:val')); + } + + /** + * Test doNotTrackMoves + */ + public function testDoNotTrackMoves() + { + $phpWord = new PhpWord(); + $phpWord->getSettings()->setDoNotTrackMoves(true); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:doNotTrackMoves'; + $this->assertTrue($doc->elementExists($path, $file)); + + $element = $doc->getElement($path, $file); + $this->assertNotEquals('false', $element->getAttribute('w:val')); + } + + /** + * Test DoNotTrackFormatting + */ + public function testDoNotTrackFormatting() + { + $phpWord = new PhpWord(); + $phpWord->getSettings()->setDoNotTrackFormatting(true); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:doNotTrackFormatting'; + $this->assertTrue($doc->elementExists($path, $file)); + + $element = $doc->getElement($path, $file); + $this->assertNotEquals('false', $element->getAttribute('w:val')); } } diff --git a/tests/PhpWord/_files/documents/reader.doc b/tests/PhpWord/_files/documents/reader.doc new file mode 100644 index 0000000000000000000000000000000000000000..a5ce295d8aa8c35e681eb66e26857259659f5955 GIT binary patch literal 49664 zcmeFY1yo#1m+0S(y9I)K13`la*Wm7+;O>nRf(1ed5Zr?{?!hgA;GW=`-~{}w`Q#=)~~Bhon5v|_CBYZPh!3ZFwHU=oo5;B$@&fChjLpaXyjfCYd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fOf~=)@CpDApcw$3TXq7#^U8srX;_vR;H<5!7RKJe!UnsWi~_I}-E1-T z))rVR2N`oitQp2+HzRmHdmd(L+G^Oy8aiTjvxWPUy0M`(M#kO-ya)g&&<7xOb3=QK ztc@`U?%52_G(gvZ1d+!DfZNp#$lvwhxPQl~?Oqw+E34e@71kbHbN`H^0mTC+id_fS z?*SsXB;b6%yNBezdjGtK>%E%kD-Qw501K{xE0zkl-tV5P{#p1BC<;(>utxaU!AAUn z_%G3Wnh-!QJl^kP+3#}pMs>e$9XBXH z+@0V)^R49<2D0#Z0Csz0R9T?Yc-IolZa?@M`^S5FpdUWR{F(BD*Y$q6@Ab9SV}Nc) zFq(r$Y1V(Nbe{wbIIHdH{?_vE0KvU1@S$Iq{LdW^k)PZDo(+5X{wv=eL`uOYi@(V2 P>HePb{}m?uU)KL$=${T1 literal 0 HcmV?d00001 diff --git a/tests/PhpWord/_files/documents/reader.docx b/tests/PhpWord/_files/documents/reader.docx index d09091b11983772d56172c519b702ede44df8989..ef6b6615a90234c26186e5ea689de97d045c378a 100644 GIT binary patch literal 105546 zcmb4qV~{A(l4jesZQHnQ+ugTq+qP}nwr<{aHgy_lI8;}|*$o;15aj9ajDH##Qk9C_U_j_bf5(ri8B%qDE>7a`JUv*YV+qzl zHP13z@gR_K$@ble&rWN&h+ZHwp$GGP>=I?lc#|WX_Y zfc^Af`{*rhgg|qY#<61j0ZLw7PV=@tbvy~$rTN&bmQo}|-d@p!Dq@mT;S1}0sPh3@ zB!g@X)|d9LjyiioMZsS&D*6OA{jABL!ku(yJhoL+$^}1?zfqO0&4H^V)i&!Kt^$B09QRg=~7sV#|o$_bGX;bW1$Z$D8TWP>vfz*%%|}4zVx_YB9qWV z%*Xiip*GDg@FO>=8-J)+Ws%n3m*cSrGJgrQ_3)WEJCBoClzb&3-YEYXyBZ2elJDp{ z54%c@^tARy5KRWP*kj?^`W#I618Bb;Qyj@J|Cc0x8S(e(b32jz=ga?ofc+(ju7k0a zBmF;l!TFa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(lWQO|7*L^s@QHfpzdcl zBOfiIdn^aQtKAAihci=chXFX@{MWu1&UhT-1*rQ8mJTV6cmTl&mz{E z3a?OM2%zpKgs0hA@dAW2z=yqYlD&dO_|Li+@S?#mK;6$Mrur?a0x$><#3@DV55v~l z-0DB#^i6l$3sCnHMsr@QX92yJ>49#TMt2Y4uW=$4ro{LF>Mr5ns7Sn%Pw2+Er1yug zeUA@zvg(qqW7;LCd{T$EOD$gCnuTznUyRw`H`43xF^;)`NPzE#ll3)h4%oxAkTPJL z0Cm?1Ao2%pO#){@=!BJ+KFGn`sB{=c+Irg!P_Z!wZ=C=!OaKOF?hj_qjTG37l$V$8 zq5I>Q@sk)=K*eSpJe3JD(5{fI{9$09(Zoi8(PHe}juxoch=WIoKm^*2vUL!#bFc^- z01c^jK~EIzh8ZzFfVvC#e>pV|OzyF^;jxWJuWVv+3RJyc^ccvl@$I_ayIBvG9vvWR z{5{5Zx9+hqV30ubpzg=)-8RC;d?WdT*|&*w7^NhQ1LFj!yOjSIDM8Xdl!MbzJiK3+ zNP)^qL4IhY_U_1FyI{E2IQ9Vl*U6}M&^86sU01g2W$#)an+AtL4_o;k7B8-2L>N~< z-Gv;C7v7%U%9{fEXSIlJ_kI6wOsGKhxkq+rsP?Wqu?zor$L?Pv6P~|q6jTjWT=e=D R!U}w&fFpZtlt2#-`5!b@qe=h( From 18cb0b26f7fbf60265a02077fb3ed1a1c06eefb9 Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 11 Jul 2017 01:58:54 +0200 Subject: [PATCH 081/370] Add support for comments (#1067) Just a writer for now, reader to be done --- .gitignore | 1 + composer.json | 1 + docs/elements.rst | 25 +++- docs/intro.rst | 5 + samples/Sample_37_Comments.php | 63 +++++++++ src/PhpWord/Collection/Comments.php | 27 ++++ src/PhpWord/Element/AbstractContainer.php | 9 +- src/PhpWord/Element/AbstractElement.php | 65 +++++++++- src/PhpWord/Element/Comment.php | 122 ++++++++++++++++++ src/PhpWord/Element/TrackChange.php | 77 +++++++++++ src/PhpWord/PhpWord.php | 6 +- src/PhpWord/Writer/Word2007.php | 26 ++++ .../Word2007/Element/AbstractElement.php | 53 ++++++++ src/PhpWord/Writer/Word2007/Element/Chart.php | 1 + src/PhpWord/Writer/Word2007/Element/Image.php | 1 + src/PhpWord/Writer/Word2007/Element/Line.php | 1 + .../Writer/Word2007/Element/Object.php | 1 + src/PhpWord/Writer/Word2007/Element/Shape.php | 1 + .../Writer/Word2007/Element/TextBox.php | 1 + src/PhpWord/Writer/Word2007/Part/Comments.php | 103 +++++++++++++++ .../Writer/Word2007/Part/ContentTypes.php | 1 + tests/PhpWord/Element/CommentTest.php | 83 ++++++++++++ .../Writer/Word2007/Part/CommentsTest.php | 61 +++++++++ 23 files changed, 726 insertions(+), 8 deletions(-) create mode 100644 samples/Sample_37_Comments.php create mode 100644 src/PhpWord/Collection/Comments.php create mode 100644 src/PhpWord/Element/Comment.php create mode 100644 src/PhpWord/Element/TrackChange.php create mode 100644 src/PhpWord/Writer/Word2007/Part/Comments.php create mode 100644 tests/PhpWord/Element/CommentTest.php create mode 100644 tests/PhpWord/Writer/Word2007/Part/CommentsTest.php diff --git a/.gitignore b/.gitignore index 98f65dbf..66e64406 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ Thumbs.db Desktop.ini .idea _build +/build phpunit.xml composer.lock composer.phar diff --git a/composer.json b/composer.json index c49eb9cd..faa17c1b 100644 --- a/composer.json +++ b/composer.json @@ -42,6 +42,7 @@ "require-dev": { "phpunit/phpunit": "3.7.*", "phpdocumentor/phpdocumentor":"2.*", + "twig/twig":"1.27", "squizlabs/php_codesniffer": "1.*", "phpmd/phpmd": "2.*", "phploc/phploc": "2.*", diff --git a/docs/elements.rst b/docs/elements.rst index 5b671936..c8f701d7 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -398,4 +398,27 @@ Available line style attributes: - ``endArrow``. End type of arrow: block, open, classic, diamond, oval. - ``width``. Line-object width in pt. - ``height``. Line-object height in pt. -- ``flip``. Flip the line element: true, false. \ No newline at end of file +- ``flip``. Flip the line element: true, false. + +Comments +--------- + +Comments can be added to a document by using ``addComment``. +The comment can contain formatted text. Once the comment has been added, it can be linked to any to any element. + +.. code-block:: php + + // first create a comment + $comment= new \PhpOffice\PhpWord\Element\Comment('Authors name', new \DateTime(), 'my_initials'); + $comment->addText('Test', array('bold' => true)); + + // add it to the document + $phpWord->addComment($comment); + + $textrun = $section->addTextRun(); + $textrun->addText('This '); + $text = $textrun->addText('is'); + // link the comment to the text you just created + $text->setCommentStart($comment); + +If no end is set for a comment using the ``setCommentEnd``, the comment will be ended automatically at the end of the element it is started on. \ No newline at end of file diff --git a/docs/intro.rst b/docs/intro.rst index d1c791cf..d88cd626 100644 --- a/docs/intro.rst +++ b/docs/intro.rst @@ -49,6 +49,7 @@ Features - Insert drawing shapes (arc, curve, line, polyline, rect, oval) - Insert charts (pie, doughnut, bar, line, area, scatter, radar) - Insert form fields (textinput, checkbox, and dropdown) +- Insert comments - Create document from templates - Use XSL 1.0 style sheets to transform headers, main document part, and footers of an OOXML template - ... and many more features on progress @@ -102,6 +103,8 @@ Writers +---------------------------+----------------------+--------+-------+-------+--------+-------+ | | Endnote | ✓ | | | ✓ | | +---------------------------+----------------------+--------+-------+-------+--------+-------+ +| | Comments | ✓ | | | | | ++---------------------------+----------------------+--------+-------+-------+--------+-------+ | **Graphs** | 2D basic graphs | ✓ | | | | | +---------------------------+----------------------+--------+-------+-------+--------+-------+ | | 2D advanced graphs | | | | | | @@ -161,6 +164,8 @@ Readers +---------------------------+----------------------+--------+-------+-------+-------+-------+ | | Endnote | ✓ | | | | | +---------------------------+----------------------+--------+-------+-------+-------+-------+ +| | Comments | | | | | | ++---------------------------+----------------------+--------+-------+-------+-------+-------+ | **Graphs** | 2D basic graphs | | | | | | +---------------------------+----------------------+--------+-------+-------+-------+-------+ | | 2D advanced graphs | | | | | | diff --git a/samples/Sample_37_Comments.php b/samples/Sample_37_Comments.php new file mode 100644 index 00000000..670e914b --- /dev/null +++ b/samples/Sample_37_Comments.php @@ -0,0 +1,63 @@ +addText('Test', array('bold' => true)); +$phpWord->addComment($comment); + +$section = $phpWord->addSection(); + +$textrun = $section->addTextRun(); +$textrun->addText('This '); +$text = $textrun->addText('is'); +$text->setCommentRangeStart($comment); +$textrun->addText(' a test'); + +$section->addTextBreak(2); + +// Let's create a comment that we will link to a start element and an end element +$commentWithStartAndEnd = new \PhpOffice\PhpWord\Element\Comment('Foo Bar', new \DateTime(), ''); +$commentWithStartAndEnd->addText('A comment with a start and an end'); +$phpWord->addComment($commentWithStartAndEnd); + +$textrunWithEnd = $section->addTextRun(); +$textrunWithEnd->addText('This '); +$textToStartOn = $textrunWithEnd->addText('is', array('bold' => true)); +$textToStartOn->setCommentRangeStart($commentWithStartAndEnd); +$textrunWithEnd->addText(' another', array('italic' => true)); +$textToEndOn = $textrunWithEnd->addText(' test'); +$textToEndOn->setCommentRangeEnd($commentWithStartAndEnd); + +$section->addTextBreak(2); + +// Let's add a comment on an image +$commentOnImage = new \PhpOffice\PhpWord\Element\Comment('Mr Smart', new \DateTime(), ''); +$imageComment = $commentOnImage->addTextRun(); +$imageComment->addText('Hey, Mars does look '); +$imageComment->addText('red', array('color' => 'FF0000')); +$phpWord->addComment($commentOnImage); +$image = $section->addImage('resources/_mars.jpg'); +$image->setCommentRangeStart($commentOnImage); + +$section->addTextBreak(2); + +// We can also do things the other way round, link the comment to the element +$anotherText = $section->addText("another text"); + +$comment1 = new \PhpOffice\PhpWord\Element\Comment('Authors name', new \DateTime(), 'my_initials'); +$comment1->addText('Test', array('bold' => true)); +$comment1->setStartElement($anotherText); +$comment1->setEndElement($anotherText); +$phpWord->addComment($comment1); + + +// Save file +echo write($phpWord, basename(__FILE__, '.php'), $writers); +if (!CLI) { + include_once 'Sample_Footer.php'; +} diff --git a/src/PhpWord/Collection/Comments.php b/src/PhpWord/Collection/Comments.php new file mode 100644 index 00000000..e0383814 --- /dev/null +++ b/src/PhpWord/Collection/Comments.php @@ -0,0 +1,27 @@ + $generalContainers, 'FormField' => $generalContainers, 'SDT' => $generalContainers, - 'TextRun' => array('Section', 'Header', 'Footer', 'Cell', 'TextBox'), + 'TrackChange' => $generalContainers, + 'TextRun' => array('Section', 'Header', 'Footer', 'Cell', 'TextBox', 'TrackChange'), 'ListItem' => array('Section', 'Header', 'Footer', 'Cell', 'TextBox'), 'ListItemRun' => array('Section', 'Header', 'Footer', 'Cell', 'TextBox'), 'Table' => array('Section', 'Header', 'Footer', 'Cell', 'TextBox'), diff --git a/src/PhpWord/Element/AbstractElement.php b/src/PhpWord/Element/AbstractElement.php index b0ed8ae2..8ff64194 100644 --- a/src/PhpWord/Element/AbstractElement.php +++ b/src/PhpWord/Element/AbstractElement.php @@ -108,12 +108,26 @@ abstract class AbstractElement protected $mediaRelation = false; /** - * Is part of collection; true for Title, Footnote, Endnote, and Chart + * Is part of collection; true for Title, Footnote, Endnote, Chart, and Comment * * @var bool */ protected $collectionRelation = false; + /** + * The start position for the linked comment + * + * @var Comment + */ + protected $commentRangeStart; + + /** + * The end position for the linked comment + * + * @var Comment + */ + protected $commentRangeEnd; + /** * Get PhpWord * @@ -265,6 +279,55 @@ abstract class AbstractElement return $this->nestedLevel; } + /** + * Get comment start + * + * @return Comment + */ + public function getCommentRangeStart() + { + return $this->commentRangeStart; + } + + /** + * Set comment start + * + * @param Comment $value + */ + public function setCommentRangeStart(Comment $value) + { + if ($this instanceof Comment) { + throw new \InvalidArgumentException("Cannot set a Comment on a Comment"); + } + $this->commentRangeStart= $value; + $this->commentRangeStart->setStartElement($this); + } + + /** + * Get comment end + * + * @return Comment + */ + public function getCommentRangeEnd() + { + return $this->commentRangeEnd; + } + + /** + * Set comment end + * + * @param Comment $value + * @return void + */ + public function setCommentRangeEnd(Comment $value) + { + if ($this instanceof Comment) { + throw new \InvalidArgumentException("Cannot set a Comment on a Comment"); + } + $this->commentRangeEnd= $value; + $this->commentRangeEnd->setEndElement($this); + } + /** * Set parent container * diff --git a/src/PhpWord/Element/Comment.php b/src/PhpWord/Element/Comment.php new file mode 100644 index 00000000..def9d5a8 --- /dev/null +++ b/src/PhpWord/Element/Comment.php @@ -0,0 +1,122 @@ +initials = $initials; + return $this; + } + + /** + * Get Initials + * + * @return string + */ + public function getInitials() + { + return $this->initials; + } + + /** + * Sets the element where this comment starts + * + * @param \PhpOffice\PhpWord\Element\AbstractElement $value + */ + public function setStartElement(AbstractElement $value) + { + $this->startElement = $value; + if ($value->getCommentRangeStart() == null) { + $value->setCommentRangeStart($this); + } + } + + /** + * Get the element where this comment starts + * + * @return \PhpOffice\PhpWord\Element\AbstractElement + */ + public function getStartElement() + { + return $this->startElement; + } + + /** + * Sets the element where this comment ends + * + * @param \PhpOffice\PhpWord\Element\AbstractElement $value + */ + public function setEndElement(AbstractElement $value) + { + $this->endElement = $value; + if ($value->getCommentRangeEnd() == null) { + $value->setCommentRangeEnd($this); + } + } + + /** + * Get the element where this comment ends + * + * @return \PhpOffice\PhpWord\Element\AbstractElement + */ + public function getEndElement() + { + return $this->endElement; + } +} diff --git a/src/PhpWord/Element/TrackChange.php b/src/PhpWord/Element/TrackChange.php new file mode 100644 index 00000000..782e6f35 --- /dev/null +++ b/src/PhpWord/Element/TrackChange.php @@ -0,0 +1,77 @@ +author = $author; + $this->date = $date; + return $this; + } + + /** + * Get TrackChange Author + * + * @return string + */ + public function getAuthor() + { + return $this->author; + } + + /** + * Get TrackChange Date + * + * @return \DateTime + */ + public function getDate() + { + return $this->date; + } +} diff --git a/src/PhpWord/PhpWord.php b/src/PhpWord/PhpWord.php index bb5b4956..1571537e 100644 --- a/src/PhpWord/PhpWord.php +++ b/src/PhpWord/PhpWord.php @@ -27,11 +27,13 @@ use PhpOffice\PhpWord\Exception\Exception; * @method Collection\Footnotes getFootnotes() * @method Collection\Endnotes getEndnotes() * @method Collection\Charts getCharts() + * @method Collection\Comments getComments() * @method int addBookmark(Element\Bookmark $bookmark) * @method int addTitle(Element\Title $title) * @method int addFootnote(Element\Footnote $footnote) * @method int addEndnote(Element\Endnote $endnote) * @method int addChart(Element\Chart $chart) + * @method int addComment(Element\Comment $comment) * * @method Style\Paragraph addParagraphStyle(string $styleName, array $styles) * @method Style\Font addFontStyle(string $styleName, mixed $fontStyle, mixed $paragraphStyle = null) @@ -84,7 +86,7 @@ class PhpWord public function __construct() { // Collection - $collections = array('Bookmarks', 'Titles', 'Footnotes', 'Endnotes', 'Charts'); + $collections = array('Bookmarks', 'Titles', 'Footnotes', 'Endnotes', 'Charts', 'Comments'); foreach ($collections as $collection) { $class = 'PhpOffice\\PhpWord\\Collection\\' . $collection; $this->collections[$collection] = new $class(); @@ -118,7 +120,7 @@ class PhpWord $addCollection = array(); $addStyle = array(); - $collections = array('Bookmark', 'Title', 'Footnote', 'Endnote', 'Chart'); + $collections = array('Bookmark', 'Title', 'Footnote', 'Endnote', 'Chart', 'Comment'); foreach ($collections as $collection) { $getCollection[] = strtolower("get{$collection}s"); $addCollection[] = strtolower("add{$collection}"); diff --git a/src/PhpWord/Writer/Word2007.php b/src/PhpWord/Writer/Word2007.php index 8e10f5f6..bb7b521f 100644 --- a/src/PhpWord/Writer/Word2007.php +++ b/src/PhpWord/Writer/Word2007.php @@ -60,6 +60,7 @@ class Word2007 extends AbstractWriter implements WriterInterface 'DocPropsCustom' => 'docProps/custom.xml', 'RelsDocument' => 'word/_rels/document.xml.rels', 'Document' => 'word/document.xml', + 'Comments' => 'word/comments.xml', 'Styles' => 'word/styles.xml', 'Numbering' => 'word/numbering.xml', 'Settings' => 'word/settings.xml', @@ -129,6 +130,7 @@ class Word2007 extends AbstractWriter implements WriterInterface $this->addNotes($zip, $rId, 'footnote'); $this->addNotes($zip, $rId, 'endnote'); + $this->addComments($zip, $rId); $this->addChart($zip, $rId); // Write parts @@ -255,6 +257,30 @@ class Word2007 extends AbstractWriter implements WriterInterface } } + /** + * Add comments + * + * @param \PhpOffice\PhpWord\Shared\ZipArchive $zip + * @param integer &$rId + * @return void + */ + private function addComments(ZipArchive $zip, &$rId) + { + $phpWord = $this->getPhpWord(); + $collection = $phpWord->getComments(); + $partName = "comments"; + + // Add comment relations and contents + /** @var \PhpOffice\PhpWord\Collection\AbstractCollection $collection Type hint */ + if ($collection->countItems() > 0) { + $this->relationships[] = array('target' => "{$partName}.xml", 'type' => $partName, 'rID' => ++$rId); + + // Write content file, e.g. word/comments.xml + $writerPart = $this->getWriterPart($partName)->setElements($collection->getItems()); + $zip->addFromString("word/{$partName}.xml", $writerPart->write()); + } + } + /** * Add chart. * diff --git a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php index f5a454d2..79877b10 100644 --- a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php +++ b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php @@ -103,6 +103,7 @@ abstract class AbstractElement $this->writeParagraphStyle(); } } + $this->writeCommentRangeStart(); } /** @@ -112,11 +113,63 @@ abstract class AbstractElement */ protected function endElementP() { + $this->writeCommentRangeEnd(); if (!$this->withoutP) { $this->xmlWriter->endElement(); // w:p } } + /** + * Writes the w:commentRangeStart DOM element + * + * @return void + */ + protected function writeCommentRangeStart() + { + if ($this->element->getCommentRangeStart() != null) { + $comment = $this->element->getCommentRangeStart(); + //only set the ID if it is not yet set, otherwise it will overwrite it + if ($comment->getElementId() == null) { + $comment->setElementId(); + } + + $this->xmlWriter->writeElementBlock('w:commentRangeStart', array('w:id' => $comment->getElementId())); + + } + } + + /** + * Writes the w:commentRangeEnd DOM element + * + * @return void + */ + protected function writeCommentRangeEnd() + { + if ($this->element->getCommentRangeEnd() != null) { + $comment = $this->element->getCommentRangeEnd(); + //only set the ID if it is not yet set, otherwise it will overwrite it + if ($comment->getElementId() == null) { + $comment->setElementId(); + } + + $this->xmlWriter->writeElementBlock('w:commentRangeEnd', array('w:id' => $comment->getElementId())); + $this->xmlWriter->startElement('w:r'); + $this->xmlWriter->writeElementBlock('w:commentReference', array('w:id' => $comment->getElementId())); + $this->xmlWriter->endElement(); + } elseif ($this->element->getCommentRangeStart() != null && $this->element->getCommentRangeStart()->getEndElement() == null) { + $comment = $this->element->getCommentRangeStart(); + //only set the ID if it is not yet set, otherwise it will overwrite it + if ($comment->getElementId() == null) { + $comment->setElementId(); + } + + $this->xmlWriter->writeElementBlock('w:commentRangeEnd', array('w:id' => $comment->getElementId())); + $this->xmlWriter->startElement('w:r'); + $this->xmlWriter->writeElementBlock('w:commentReference', array('w:id' => $comment->getElementId())); + $this->xmlWriter->endElement(); + } + } + /** * Write ending. * diff --git a/src/PhpWord/Writer/Word2007/Element/Chart.php b/src/PhpWord/Writer/Word2007/Element/Chart.php index 12602532..ecdde362 100644 --- a/src/PhpWord/Writer/Word2007/Element/Chart.php +++ b/src/PhpWord/Writer/Word2007/Element/Chart.php @@ -45,6 +45,7 @@ class Chart extends AbstractElement if (!$this->withoutP) { $xmlWriter->startElement('w:p'); } + $this->writeCommentRangeStart(); $xmlWriter->startElement('w:r'); $xmlWriter->startElement('w:drawing'); diff --git a/src/PhpWord/Writer/Word2007/Element/Image.php b/src/PhpWord/Writer/Word2007/Element/Image.php index 914c78ea..edf32739 100644 --- a/src/PhpWord/Writer/Word2007/Element/Image.php +++ b/src/PhpWord/Writer/Word2007/Element/Image.php @@ -63,6 +63,7 @@ class Image extends AbstractElement $xmlWriter->startElement('w:p'); $styleWriter->writeAlignment(); } + $this->writeCommentRangeStart(); $xmlWriter->startElement('w:r'); $xmlWriter->startElement('w:pict'); diff --git a/src/PhpWord/Writer/Word2007/Element/Line.php b/src/PhpWord/Writer/Word2007/Element/Line.php index ade91fb8..ebc5d395 100644 --- a/src/PhpWord/Writer/Word2007/Element/Line.php +++ b/src/PhpWord/Writer/Word2007/Element/Line.php @@ -48,6 +48,7 @@ class Line extends AbstractElement $xmlWriter->startElement('w:p'); $styleWriter->writeAlignment(); } + $this->writeCommentRangeStart(); $xmlWriter->startElement('w:r'); $xmlWriter->startElement('w:pict'); diff --git a/src/PhpWord/Writer/Word2007/Element/Object.php b/src/PhpWord/Writer/Word2007/Element/Object.php index 4fdf6fed..fc0532cd 100644 --- a/src/PhpWord/Writer/Word2007/Element/Object.php +++ b/src/PhpWord/Writer/Word2007/Element/Object.php @@ -51,6 +51,7 @@ class Object extends AbstractElement $xmlWriter->startElement('w:p'); $styleWriter->writeAlignment(); } + $this->writeCommentRangeStart(); $xmlWriter->startElement('w:r'); $xmlWriter->startElement('w:object'); diff --git a/src/PhpWord/Writer/Word2007/Element/Shape.php b/src/PhpWord/Writer/Word2007/Element/Shape.php index f282c4a5..a589af6c 100644 --- a/src/PhpWord/Writer/Word2007/Element/Shape.php +++ b/src/PhpWord/Writer/Word2007/Element/Shape.php @@ -55,6 +55,7 @@ class Shape extends AbstractElement if (!$this->withoutP) { $xmlWriter->startElement('w:p'); } + $this->writeCommentRangeStart(); $xmlWriter->startElement('w:r'); $xmlWriter->startElement('w:pict'); diff --git a/src/PhpWord/Writer/Word2007/Element/TextBox.php b/src/PhpWord/Writer/Word2007/Element/TextBox.php index 3c4f48c2..e83fe0c9 100644 --- a/src/PhpWord/Writer/Word2007/Element/TextBox.php +++ b/src/PhpWord/Writer/Word2007/Element/TextBox.php @@ -45,6 +45,7 @@ class TextBox extends Image $xmlWriter->startElement('w:p'); $styleWriter->writeAlignment(); } + $this->writeCommentRangeStart(); $xmlWriter->startElement('w:r'); $xmlWriter->startElement('w:pict'); diff --git a/src/PhpWord/Writer/Word2007/Part/Comments.php b/src/PhpWord/Writer/Word2007/Part/Comments.php new file mode 100644 index 00000000..73314785 --- /dev/null +++ b/src/PhpWord/Writer/Word2007/Part/Comments.php @@ -0,0 +1,103 @@ +getXmlWriter(); + + $xmlWriter->startDocument('1.0', 'UTF-8', 'yes'); + $xmlWriter->startElement('w:comments'); + $xmlWriter->writeAttribute('xmlns:ve', 'http://schemas.openxmlformats.org/markup-compatibility/2006'); + $xmlWriter->writeAttribute('xmlns:o', 'urn:schemas-microsoft-com:office:office'); + $xmlWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'); + $xmlWriter->writeAttribute('xmlns:m', 'http://schemas.openxmlformats.org/officeDocument/2006/math'); + $xmlWriter->writeAttribute('xmlns:v', 'urn:schemas-microsoft-com:vml'); + $xmlWriter->writeAttribute('xmlns:wp', 'http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing'); + $xmlWriter->writeAttribute('xmlns:w10', 'urn:schemas-microsoft-com:office:word'); + $xmlWriter->writeAttribute('xmlns:w', 'http://schemas.openxmlformats.org/wordprocessingml/2006/main'); + $xmlWriter->writeAttribute('xmlns:wne', 'http://schemas.microsoft.com/office/word/2006/wordml'); + + if ($this->elements !== null) { + foreach ($this->elements as $element) { + if ($element instanceof Comment) { + $this->writeComment($xmlWriter, $element); + } + } + } + + $xmlWriter->endElement(); // w:comments + + return $xmlWriter->getData(); + } + + /** + * Write comment item. + * + * @param \PhpOffice\Common\XMLWriter $xmlWriter + * @param \PhpOffice\PhpWord\Element\Comment $comment + * @return void + */ + protected function writeComment(XMLWriter $xmlWriter, Comment $comment) + { + $xmlWriter->startElement('w:comment'); + $xmlWriter->writeAttribute('w:id', $comment->getElementId()); + $xmlWriter->writeAttribute('w:author', $comment->getAuthor()); + $xmlWriter->writeAttribute('w:date', $comment->getDate()->format($this->dateFormat)); + $xmlWriter->writeAttribute('w:initials', $comment->getInitials()); + + $containerWriter = new Container($xmlWriter, $comment); + $containerWriter->write(); + + $xmlWriter->endElement(); // w:comment + } + + /** + * Set element + * + * @param \PhpOffice\PhpWord\Collection\Comments $elements + * @return self + */ + public function setElements($elements) + { + $this->elements = $elements; + + return $this; + } +} diff --git a/src/PhpWord/Writer/Word2007/Part/ContentTypes.php b/src/PhpWord/Writer/Word2007/Part/ContentTypes.php index 1c81f343..7a03243e 100644 --- a/src/PhpWord/Writer/Word2007/Part/ContentTypes.php +++ b/src/PhpWord/Writer/Word2007/Part/ContentTypes.php @@ -49,6 +49,7 @@ class ContentTypes extends AbstractPart '/word/theme/theme1.xml' => $openXMLPrefix . 'officedocument.theme+xml', '/word/webSettings.xml' => $wordMLPrefix . 'webSettings+xml', '/word/fontTable.xml' => $wordMLPrefix . 'fontTable+xml', + '/word/comments.xml' => $wordMLPrefix . 'comments+xml', ); $defaults = $contentTypes['default']; diff --git a/tests/PhpWord/Element/CommentTest.php b/tests/PhpWord/Element/CommentTest.php new file mode 100644 index 00000000..db9ec902 --- /dev/null +++ b/tests/PhpWord/Element/CommentTest.php @@ -0,0 +1,83 @@ +setStartElement($oText); + $oComment->setEndElement($oText); + + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Comment', $oComment); + $this->assertEquals($author, $oComment->getAuthor()); + $this->assertEquals($date, $oComment->getDate()); + $this->assertEquals($initials, $oComment->getInitials()); + $this->assertEquals($oText, $oComment->getStartElement()); + $this->assertEquals($oText, $oComment->getEndElement()); + } + + /** + * Add text + */ + public function testAddText() + { + $oComment = new Comment('Test User', new \DateTime(), 'my_initials'); + $element = $oComment->addText('text'); + + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Text', $element); + $this->assertCount(1, $oComment->getElements()); + $this->assertEquals('text', $element->getText()); + } + + /** + * Get elements + */ + public function testGetElements() + { + $oComment = new Comment('Test User', new \DateTime(), 'my_initials'); + + $this->assertInternalType('array', $oComment->getElements()); + } + + /** + * Set/get relation Id + */ + public function testRelationId() + { + $oComment = new Comment('Test User', new \DateTime(), 'my_initials'); + + $iVal = rand(1, 1000); + $oComment->setRelationId($iVal); + $this->assertEquals($iVal, $oComment->getRelationId()); + } +} diff --git a/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php b/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php new file mode 100644 index 00000000..aac4b15b --- /dev/null +++ b/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php @@ -0,0 +1,61 @@ +addText('Test'); + + $phpWord = new PhpWord(); + $phpWord->addComment($comment); + $doc = TestHelperDOCX::getDocument($phpWord); + + $path = '/w:comments/w:comment'; + $file = 'word/comments.xml'; + + $this->assertTrue($doc->elementExists($path, $file)); + + $element = $doc->getElement($path, $file); + $this->assertNotNull($element->getAttribute('w:id')); + $this->assertEquals("Authors name", $element->getAttribute('w:author')); + $this->assertEquals("my_initials", $element->getAttribute('w:initials')); + } +} From cf76b1f217e9221e03848dc811e332bb45001075 Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 20 Jul 2017 07:39:21 +0200 Subject: [PATCH 082/370] Simplify SimpleType validation --- composer.json | 4 +--- src/PhpWord/Shared/AbstractEnum.php | 27 +++++++++++++++++++-- src/PhpWord/SimpleType/Jc.php | 35 +++------------------------- src/PhpWord/SimpleType/JcTable.php | 20 ++-------------- src/PhpWord/Style/Frame.php | 2 +- src/PhpWord/Style/NumberingLevel.php | 2 +- src/PhpWord/Style/Paragraph.php | 2 +- src/PhpWord/Style/Table.php | 2 +- 8 files changed, 35 insertions(+), 59 deletions(-) diff --git a/composer.json b/composer.json index faa17c1b..6b8365bc 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ }, { "name": "Franck Lefevre", - "homepage": "http://blog.rootslabs.net" + "homepage": "https://rootslabs.net/blog/" }, { "name": "Ivan Lanin", @@ -36,13 +36,11 @@ "ext-xml": "*", "zendframework/zend-escaper": "2.4.*", "zendframework/zend-stdlib": "2.4.*", - "zendframework/zend-validator": "2.4.*", "phpoffice/common": "0.2.*" }, "require-dev": { "phpunit/phpunit": "3.7.*", "phpdocumentor/phpdocumentor":"2.*", - "twig/twig":"1.27", "squizlabs/php_codesniffer": "1.*", "phpmd/phpmd": "2.*", "phploc/phploc": "2.*", diff --git a/src/PhpWord/Shared/AbstractEnum.php b/src/PhpWord/Shared/AbstractEnum.php index 4584c2f9..f116e511 100644 --- a/src/PhpWord/Shared/AbstractEnum.php +++ b/src/PhpWord/Shared/AbstractEnum.php @@ -19,16 +19,39 @@ abstract class AbstractEnum return self::$constCacheArray[$calledClass]; } + /** + * Returns all values for this enum + * + * @return array + */ public static function values() { return array_values(self::getConstants()); } - public static function validate($value) + /** + * Returns true the value is valid for this enum + * + * @param strign $value + * @return boolean true if value is valid + */ + public static function isValid($value) { $values = array_values(self::getConstants()); - if (!in_array($value, $values, true)) { + return in_array($value, $values, true); + } + + /** + * Validates that the value passed is a valid value + * + * @param string $value + * @throws \InvalidArgumentException if the value passed is not valid for this enum + */ + public static function validate($value) + { + if (!self::isValid($value)) { $calledClass = get_called_class(); + $values = array_values(self::getConstants()); throw new \InvalidArgumentException("$value is not a valid value for $calledClass, possible values are " . implode(', ', $values)); } } diff --git a/src/PhpWord/SimpleType/Jc.php b/src/PhpWord/SimpleType/Jc.php index e90674a4..5c399a16 100644 --- a/src/PhpWord/SimpleType/Jc.php +++ b/src/PhpWord/SimpleType/Jc.php @@ -17,7 +17,7 @@ namespace PhpOffice\PhpWord\SimpleType; -use Zend\Validator\InArray; +use PhpOffice\PhpWord\Shared\AbstractEnum; /** * Horizontal Alignment Type. @@ -28,10 +28,11 @@ use Zend\Validator\InArray; * @since 0.13.0 * * @see \PhpOffice\PhpWord\SimpleType\JcTable For table alignment modes available since ISO/IEC-29500:2008. + * @link http://www.datypic.com/sc/ooxml/t-w_ST_Jc.html * * @codeCoverageIgnore */ -final class Jc +final class Jc extends AbstractEnum { const START = 'start'; const CENTER = 'center'; @@ -65,34 +66,4 @@ final class Jc * @deprecated 0.13.0 For documents based on ISO/IEC 29500:2008 and later use `BOTH` instead. */ const JUSTIFY = 'justify'; - - /** - * @since 0.13.0 - * - * @return \Zend\Validator\InArray - */ - final public static function getValidator() - { - // todo: consider caching validator instances. - return new InArray( - array ( - 'haystack' => array( - self::START, - self::CENTER, - self::END, - self::BOTH, - self::MEDIUM_KASHIDA, - self::DISTRIBUTE, - self::NUM_TAB, - self::HIGH_KASHIDA, - self::LOW_KASHIDA, - self::THAI_DISTRIBUTE, - self::LEFT, - self::RIGHT, - self::JUSTIFY, - ), - 'strict' => InArray::COMPARE_STRICT, - ) - ); - } } diff --git a/src/PhpWord/SimpleType/JcTable.php b/src/PhpWord/SimpleType/JcTable.php index d9648477..865b25a8 100644 --- a/src/PhpWord/SimpleType/JcTable.php +++ b/src/PhpWord/SimpleType/JcTable.php @@ -17,7 +17,7 @@ namespace PhpOffice\PhpWord\SimpleType; -use Zend\Validator\InArray; +use PhpOffice\PhpWord\Shared\AbstractEnum; /** * Table Alignment Type. @@ -28,25 +28,9 @@ use Zend\Validator\InArray; * * @codeCoverageIgnore */ -final class JcTable +final class JcTable extends AbstractEnum { const START = 'start'; const CENTER = 'center'; const END = 'end'; - - /** - * @since 0.13.0 - * - * @return \Zend\Validator\InArray - */ - final public static function getValidator() - { - // todo: consider caching validator instances. - return new InArray( - array ( - 'haystack' => array(self::START, self::CENTER, self::END), - 'strict' => InArray::COMPARE_STRICT, - ) - ); - } } diff --git a/src/PhpWord/Style/Frame.php b/src/PhpWord/Style/Frame.php index 97faacfb..0a99146b 100644 --- a/src/PhpWord/Style/Frame.php +++ b/src/PhpWord/Style/Frame.php @@ -200,7 +200,7 @@ class Frame extends AbstractStyle */ public function setAlignment($value) { - if (Jc::getValidator()->isValid($value)) { + if (Jc::isValid($value)) { $this->alignment = $value; } diff --git a/src/PhpWord/Style/NumberingLevel.php b/src/PhpWord/Style/NumberingLevel.php index 827d4354..38b9fbee 100644 --- a/src/PhpWord/Style/NumberingLevel.php +++ b/src/PhpWord/Style/NumberingLevel.php @@ -300,7 +300,7 @@ class NumberingLevel extends AbstractStyle */ public function setAlignment($value) { - if (Jc::getValidator()->isValid($value)) { + if (Jc::isValid($value)) { $this->alignment = $value; } diff --git a/src/PhpWord/Style/Paragraph.php b/src/PhpWord/Style/Paragraph.php index a9b53b2b..bad9ace9 100644 --- a/src/PhpWord/Style/Paragraph.php +++ b/src/PhpWord/Style/Paragraph.php @@ -240,7 +240,7 @@ class Paragraph extends Border */ public function setAlignment($value) { - if (Jc::getValidator()->isValid($value)) { + if (Jc::isValid($value)) { $this->alignment = $value; } diff --git a/src/PhpWord/Style/Table.php b/src/PhpWord/Style/Table.php index 91809528..a542af7b 100644 --- a/src/PhpWord/Style/Table.php +++ b/src/PhpWord/Style/Table.php @@ -510,7 +510,7 @@ class Table extends Border */ public function setAlignment($value) { - if (JcTable::getValidator()->isValid($value) || Jc::getValidator()->isValid($value)) { + if (JcTable::isValid($value) || Jc::isValid($value)) { $this->alignment = $value; } From c448046b52272d17a1863e1d8f9fe5c40367c820 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Wed, 2 Aug 2017 10:52:42 +0200 Subject: [PATCH 083/370] Fix: different footer for first page --- src/PhpWord/Element/Section.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/PhpWord/Element/Section.php b/src/PhpWord/Element/Section.php index 6e199bb9..3758af99 100644 --- a/src/PhpWord/Element/Section.php +++ b/src/PhpWord/Element/Section.php @@ -181,6 +181,11 @@ class Section extends AbstractContainer return true; } } + foreach ($this->footers as $footer) { + if ($footer->getType() == Header::FIRST) { + return true; + } + } return false; } From 15585dd3c75c621eac9d718cc0bb6a9fcabd53d1 Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 9 Sep 2017 01:25:33 +0200 Subject: [PATCH 084/370] - fix ZF version Fix travis build to run on precise Update the changelog --- .travis.yml | 2 ++ CHANGELOG.md | 9 +++++++-- README.md | 3 +-- composer.json | 6 +++--- docs/elements.rst | 6 +++--- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1a36b21b..3508dca3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ language: php +dist: precise + php: - 5.3 - 5.4 diff --git a/CHANGELOG.md b/CHANGELOG.md index e1e0245f..52bd6aac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). v0.14.0 (?? ???? 2017) ---------------------- -This release fixes several bugs and adds some new features +This release fixes several bugs and adds some new features. +This is the last version to support PHP 5.3 ### Added - Possibility to control the footnote numbering - @troosan #1068 @@ -13,8 +14,11 @@ This release fixes several bugs and adds some new features - Introduced the `\PhpOffice\PhpWord\SimpleType\NumberFormat` simple type. - @troosan - Support for ContextualSpacing - @postHawk #1088 - Possiblity to hide spelling and/or grammatical errors - @troosan #542 +- Support for Comments - @troosan #1067 +- Add support for changing the document language - @troosan #1108 ### Fixed +- Loosen dependency to Zend - Images are not being printed when generating PDF - @hubertinio #1074 #431 - Fixed some PHP 7 warnings - @ likeuntomurphy #927 - Fixed Word 97 reader - @alsofronie @Benpxpx @mario-rivera #912 #920 #892 @@ -23,7 +27,8 @@ This release fixes several bugs and adds some new features - Fixed Word2007 reader where unnecessary paragraphs were being created - @donghaobo #1043 #620 - Fixed Word2007 reader where margins were not being read correctly - @slowprog #885 #1008 - Impossible to add element PreserveText in Section - @rvanlaak #452 -- Missing options for numbering format - @troosan #1041 +- Added missing options for numbering format - @troosan #1041 +- Fixed impossibility to set a different footer for first page - @ctrlaltca #1116 v0.13.0 (31 July 2016) ------------------- diff --git a/README.md b/README.md index 6b9f7dfa..f712c6c6 100644 --- a/README.md +++ b/README.md @@ -57,8 +57,7 @@ PHPWord requires the following: - PHP 5.3.3+ - [XML Parser extension](http://www.php.net/manual/en/xml.installation.php) - [Zend\Escaper component](http://framework.zend.com/manual/current/en/modules/zend.escaper.introduction.html) -- Zend\Stdlib component -- [Zend\Validator component](http://framework.zend.com/manual/current/en/modules/zend.validator.html) +- [Zend\Stdlib component](http://framework.zend.com/manual/current/en/modules/zend.stdlib.hydrator.html) - [Zip extension](http://php.net/manual/en/book.zip.php) (optional, used to write OOXML and ODF) - [GD extension](http://php.net/manual/en/book.image.php) (optional, used to add images) - [XMLWriter extension](http://php.net/manual/en/book.xmlwriter.php) (optional, used to write OOXML and ODF) diff --git a/composer.json b/composer.json index 6b8365bc..9cc03123 100644 --- a/composer.json +++ b/composer.json @@ -34,9 +34,9 @@ "require": { "php": ">=5.3.3", "ext-xml": "*", - "zendframework/zend-escaper": "2.4.*", - "zendframework/zend-stdlib": "2.4.*", - "phpoffice/common": "0.2.*" + "zendframework/zend-escaper": "^2.2", + "zendframework/zend-stdlib": "^2.2", + "phpoffice/common": "^0.2" }, "require-dev": { "phpunit/phpunit": "3.7.*", diff --git a/docs/elements.rst b/docs/elements.rst index c8f701d7..ede34568 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -158,8 +158,8 @@ Parameters: - ``$text``. Text that appears in the document. - ``$depth``. Depth of list item. - ``$fontStyle``. See :ref:`font-style`. -- ``$listStyle``. List style of the current element TYPE\_NUMBER, - TYPE\_ALPHANUM, TYPE\_BULLET\_FILLED, etc. See list of constants in PHPWord\_Style\_ListItem. +- ``$listStyle``. List style of the current element TYPE\_NUMBER, + TYPE\_ALPHANUM, TYPE\_BULLET\_FILLED, etc. See list of constants in PHPWord\\Style\\ListItem. - ``$paragraphStyle``. See :ref:`paragraph-style`. Advanced usage: @@ -297,7 +297,7 @@ Your TOC can only be generated if you have add at least one title (See "Titles") Options for ``$tocStyle``: -- ``tabLeader``. Fill type between the title text and the page number. Use the defined constants in PHPWord\_Style\_TOC. +- ``tabLeader``. Fill type between the title text and the page number. Use the defined constants in PHPWord\\Style\\TOC. - ``tabPos``. The position of the tab where the page number appears in twips. - ``indent``. The indent factor of the titles in twips. From 41a048604e3c87f60263dc965dc58b35e437fd4a Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 13 Sep 2017 22:10:04 +0200 Subject: [PATCH 085/370] upgrade to dompdf/dompdf 0.8.* --- composer.json | 11 +++++------ src/PhpWord/Writer/PDF/AbstractRenderer.php | 20 +++++++++++--------- src/PhpWord/Writer/PDF/DomPDF.php | 9 +++++---- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/composer.json b/composer.json index c49eb9cd..b06ca3c0 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ }, { "name": "Franck Lefevre", - "homepage": "http://blog.rootslabs.net" + "homepage": "https://rootslabs.net/blog/" }, { "name": "Ivan Lanin", @@ -34,10 +34,9 @@ "require": { "php": ">=5.3.3", "ext-xml": "*", - "zendframework/zend-escaper": "2.4.*", - "zendframework/zend-stdlib": "2.4.*", - "zendframework/zend-validator": "2.4.*", - "phpoffice/common": "0.2.*" + "zendframework/zend-escaper": "^2.2", + "zendframework/zend-stdlib": "^2.2", + "phpoffice/common": "^0.2" }, "require-dev": { "phpunit/phpunit": "3.7.*", @@ -45,7 +44,7 @@ "squizlabs/php_codesniffer": "1.*", "phpmd/phpmd": "2.*", "phploc/phploc": "2.*", - "dompdf/dompdf":"0.6.*", + "dompdf/dompdf":"0.8.*", "tecnickcom/tcpdf": "6.*", "mpdf/mpdf": "5.*" }, diff --git a/src/PhpWord/Writer/PDF/AbstractRenderer.php b/src/PhpWord/Writer/PDF/AbstractRenderer.php index 2778aa52..1c6a8f0d 100644 --- a/src/PhpWord/Writer/PDF/AbstractRenderer.php +++ b/src/PhpWord/Writer/PDF/AbstractRenderer.php @@ -83,15 +83,17 @@ abstract class AbstractRenderer extends HTML public function __construct(PhpWord $phpWord) { parent::__construct($phpWord); - $includeFile = Settings::getPdfRendererPath() . '/' . $this->includeFile; - if (file_exists($includeFile)) { - /** @noinspection PhpIncludeInspection Dynamic includes */ - require_once $includeFile; - } else { - // @codeCoverageIgnoreStart - // Can't find any test case. Uncomment when found. - throw new Exception('Unable to load PDF Rendering library'); - // @codeCoverageIgnoreEnd + if ($this->includeFile != null) { + $includeFile = Settings::getPdfRendererPath() . '/' . $this->includeFile; + if (file_exists($includeFile)) { + /** @noinspection PhpIncludeInspection Dynamic includes */ + require_once $includeFile; + } else { + // @codeCoverageIgnoreStart + // Can't find any test case. Uncomment when found. + throw new Exception('Unable to load PDF Rendering library'); + // @codeCoverageIgnoreEnd + } } } diff --git a/src/PhpWord/Writer/PDF/DomPDF.php b/src/PhpWord/Writer/PDF/DomPDF.php index e31f3aae..4dc89612 100644 --- a/src/PhpWord/Writer/PDF/DomPDF.php +++ b/src/PhpWord/Writer/PDF/DomPDF.php @@ -18,6 +18,7 @@ namespace PhpOffice\PhpWord\Writer\PDF; use PhpOffice\PhpWord\Writer\WriterInterface; +use Dompdf\Dompdf as DompdfLib; /** * DomPDF writer @@ -32,7 +33,7 @@ class DomPDF extends AbstractRenderer implements WriterInterface * * @var string */ - protected $includeFile = 'dompdf_config.inc.php'; + protected $includeFile = null; /** * Save PhpWord to file. @@ -49,9 +50,9 @@ class DomPDF extends AbstractRenderer implements WriterInterface $orientation = 'portrait'; // Create PDF - $pdf = new \DOMPDF(); - $pdf->set_paper(strtolower($paperSize), $orientation); - $pdf->load_html($this->getContent()); + $pdf = new DompdfLib(); + $pdf->setPaper(strtolower($paperSize), $orientation); + $pdf->loadHtml(str_replace(PHP_EOL, '', $this->getContent())); $pdf->render(); // Write to file From 9d57693acdbc43fa2a8de51a951988c5ade14caf Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 13 Sep 2017 23:15:46 +0200 Subject: [PATCH 086/370] update phpunit & hide output during tests --- composer.json | 2 +- tests/PhpWord/PhpWordTest.php | 1 + tests/PhpWord/Writer/ODTextTest.php | 1 + tests/PhpWord/Writer/RTFTest.php | 1 + tests/PhpWord/Writer/Word2007Test.php | 1 + 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0cfa7d15..189b5478 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,7 @@ "phpoffice/common": "^0.2" }, "require-dev": { - "phpunit/phpunit": "3.7.*", + "phpunit/phpunit": "4.8.*", "phpdocumentor/phpdocumentor":"2.*", "twig/twig":"1.27", "squizlabs/php_codesniffer": "1.*", diff --git a/tests/PhpWord/PhpWordTest.php b/tests/PhpWord/PhpWordTest.php index 459c67a0..a7684a48 100644 --- a/tests/PhpWord/PhpWordTest.php +++ b/tests/PhpWord/PhpWordTest.php @@ -152,6 +152,7 @@ class PhpWordTest extends \PHPUnit_Framework_TestCase */ public function testSave() { + $this->setOutputCallback(function() {}); $phpWord = new PhpWord(); $section = $phpWord->addSection(); $section->addText('Hello world!'); diff --git a/tests/PhpWord/Writer/ODTextTest.php b/tests/PhpWord/Writer/ODTextTest.php index d79a9d42..f4c2078a 100644 --- a/tests/PhpWord/Writer/ODTextTest.php +++ b/tests/PhpWord/Writer/ODTextTest.php @@ -102,6 +102,7 @@ class ODTextTest extends \PHPUnit_Framework_TestCase */ public function testSavePhpOutput() { + $this->setOutputCallback(function() {}); $phpWord = new PhpWord(); $section = $phpWord->addSection(); $section->addText('Test'); diff --git a/tests/PhpWord/Writer/RTFTest.php b/tests/PhpWord/Writer/RTFTest.php index 0b4f6b0f..cdf162e6 100644 --- a/tests/PhpWord/Writer/RTFTest.php +++ b/tests/PhpWord/Writer/RTFTest.php @@ -103,6 +103,7 @@ class RTFTest extends \PHPUnit_Framework_TestCase */ public function testSavePhpOutput() { + $this->setOutputCallback(function() {}); $phpWord = new PhpWord(); $section = $phpWord->addSection(); $section->addText(htmlspecialchars('Test', ENT_COMPAT, 'UTF-8')); diff --git a/tests/PhpWord/Writer/Word2007Test.php b/tests/PhpWord/Writer/Word2007Test.php index 76ba2114..656ac6df 100644 --- a/tests/PhpWord/Writer/Word2007Test.php +++ b/tests/PhpWord/Writer/Word2007Test.php @@ -166,6 +166,7 @@ class Word2007Test extends \PHPUnit_Framework_TestCase */ public function testSetGetUseDiskCaching() { + $this->setOutputCallback(function() {}); $phpWord = new PhpWord(); $phpWord->addSection(); $object = new Word2007($phpWord); From f1aee39700ef7279ef423695af5aa30cadfba424 Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 13 Sep 2017 23:24:35 +0200 Subject: [PATCH 087/370] run code coverage analysis on 1 build only --- .travis.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 74b77909..4dc889d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,9 @@ matrix: env: global: - secure: "Sq+6bVtnPsu0mWX8DWQ+9bGAjxMcGorksUiHc4YIXEJsuDfVmVlH8tTD547IeCjDAx9MxXerZ2Z4HSjxTB70VEnJPvZMHI/EZn4Ny31YLHEthdZbV5Gd1h0TGp8VOzPKGShvGrtGBX6MvMfgpK4zuieVWbSfdKeecm8ZNLMpUd4=" + include: + - php: 5.6 + env: COVERAGE=1 before_install: ## Packages @@ -27,6 +30,8 @@ before_install: - sudo apt-get install -y graphviz before_script: + ## Deactivate xdebug if we don't do code coverage + - if [ -z "$COVERAGE" ]; then phpenv config-rm xdebug.ini ; fi ## Composer - composer self-update - composer install --prefer-source @@ -36,15 +41,15 @@ before_script: script: ## PHP_CodeSniffer - - ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip + - if [ -z "$COVERAGE" ]; then ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip ; fi ## PHP Mess Detector - - ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php + - if [ -z "$COVERAGE" ]; then ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php ; fi ## PHPUnit - - ./vendor/bin/phpunit -c ./ --coverage-text --coverage-html ./build/coverage + - ./vendor/bin/phpunit -c ./ $(if [ -n "$COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi) ## PHPLOC - - ./vendor/bin/phploc src/ + - if [ -z "$COVERAGE" ]; then ./vendor/bin/phploc src/ ; fi ## PHPDocumentor - - ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig" + - if [ -z "$COVERAGE" ]; then ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig" ; fi after_script: ## PHPDocumentor From 6cd2633b85cd7d665621328983cdb03657cc11ed Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 13 Sep 2017 23:38:44 +0200 Subject: [PATCH 088/370] fix travis config --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4dc889d2..4af4822e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,9 @@ php: ## - hhvm matrix: + include: + - php: 5.6 + env: COVERAGE=1 allow_failures: - php: 7.0 - php: 7.1 @@ -20,9 +23,6 @@ matrix: env: global: - secure: "Sq+6bVtnPsu0mWX8DWQ+9bGAjxMcGorksUiHc4YIXEJsuDfVmVlH8tTD547IeCjDAx9MxXerZ2Z4HSjxTB70VEnJPvZMHI/EZn4Ny31YLHEthdZbV5Gd1h0TGp8VOzPKGShvGrtGBX6MvMfgpK4zuieVWbSfdKeecm8ZNLMpUd4=" - include: - - php: 5.6 - env: COVERAGE=1 before_install: ## Packages From 0115fc3d9106215e55ad6175a2c66ea6b1b996cf Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 14 Sep 2017 00:00:48 +0200 Subject: [PATCH 089/370] fix formating --- .travis.yml | 3 +-- tests/PhpWord/PhpWordTest.php | 3 ++- tests/PhpWord/Writer/ODTextTest.php | 3 ++- tests/PhpWord/Writer/RTFTest.php | 3 ++- tests/PhpWord/Writer/Word2007/Part/StylesTest.php | 3 ++- tests/PhpWord/Writer/Word2007Test.php | 3 ++- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4af4822e..da4af286 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,5 +55,4 @@ after_script: ## PHPDocumentor - bash .travis_shell_after_success.sh ## Scrutinizer - - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml + - if [ -n "$COVERAGE" ]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml ; fi diff --git a/tests/PhpWord/PhpWordTest.php b/tests/PhpWord/PhpWordTest.php index a7684a48..ef0385b9 100644 --- a/tests/PhpWord/PhpWordTest.php +++ b/tests/PhpWord/PhpWordTest.php @@ -152,7 +152,8 @@ class PhpWordTest extends \PHPUnit_Framework_TestCase */ public function testSave() { - $this->setOutputCallback(function() {}); + $this->setOutputCallback(function () { + }); $phpWord = new PhpWord(); $section = $phpWord->addSection(); $section->addText('Hello world!'); diff --git a/tests/PhpWord/Writer/ODTextTest.php b/tests/PhpWord/Writer/ODTextTest.php index f4c2078a..e3027424 100644 --- a/tests/PhpWord/Writer/ODTextTest.php +++ b/tests/PhpWord/Writer/ODTextTest.php @@ -102,7 +102,8 @@ class ODTextTest extends \PHPUnit_Framework_TestCase */ public function testSavePhpOutput() { - $this->setOutputCallback(function() {}); + $this->setOutputCallback(function () { + }); $phpWord = new PhpWord(); $section = $phpWord->addSection(); $section->addText('Test'); diff --git a/tests/PhpWord/Writer/RTFTest.php b/tests/PhpWord/Writer/RTFTest.php index cdf162e6..ff27229a 100644 --- a/tests/PhpWord/Writer/RTFTest.php +++ b/tests/PhpWord/Writer/RTFTest.php @@ -103,7 +103,8 @@ class RTFTest extends \PHPUnit_Framework_TestCase */ public function testSavePhpOutput() { - $this->setOutputCallback(function() {}); + $this->setOutputCallback(function () { + }); $phpWord = new PhpWord(); $section = $phpWord->addSection(); $section->addText(htmlspecialchars('Test', ENT_COMPAT, 'UTF-8')); diff --git a/tests/PhpWord/Writer/Word2007/Part/StylesTest.php b/tests/PhpWord/Writer/Word2007/Part/StylesTest.php index 9153fe65..e3d89d0e 100644 --- a/tests/PhpWord/Writer/Word2007/Part/StylesTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/StylesTest.php @@ -115,7 +115,8 @@ class StylesTest extends \PHPUnit_Framework_TestCase $this->assertNull($element); } - function testFontStyleBasedOnOtherFontStyle() { + function testFontStyleBasedOnOtherFontStyle() + { $phpWord = new PhpWord(); $styleGenerationP = new Paragraph(); diff --git a/tests/PhpWord/Writer/Word2007Test.php b/tests/PhpWord/Writer/Word2007Test.php index 656ac6df..97f16c43 100644 --- a/tests/PhpWord/Writer/Word2007Test.php +++ b/tests/PhpWord/Writer/Word2007Test.php @@ -166,7 +166,8 @@ class Word2007Test extends \PHPUnit_Framework_TestCase */ public function testSetGetUseDiskCaching() { - $this->setOutputCallback(function() {}); + $this->setOutputCallback(function () { + }); $phpWord = new PhpWord(); $phpWord->addSection(); $object = new Word2007($phpWord); From 8b0ce2e936fa63ae00a0e018d82ab9c39db17190 Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 14 Sep 2017 00:12:29 +0200 Subject: [PATCH 090/370] commit doc based on php 5.6 build --- .travis_shell_after_success.sh | 2 +- tests/PhpWord/Writer/Word2007/Part/StylesTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis_shell_after_success.sh b/.travis_shell_after_success.sh index 35c7a338..12728526 100644 --- a/.travis_shell_after_success.sh +++ b/.travis_shell_after_success.sh @@ -5,7 +5,7 @@ echo "TRAVIS_REPO_SLUG: $TRAVIS_REPO_SLUG" echo "TRAVIS_PHP_VERSION: $TRAVIS_PHP_VERSION" echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST" -if [ "$TRAVIS_REPO_SLUG" == "PHPOffice/PHPWord" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_PHP_VERSION" == "5.5" ]; then +if [ "$TRAVIS_REPO_SLUG" == "PHPOffice/PHPWord" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then echo -e "Publishing PHPDoc...\n" diff --git a/tests/PhpWord/Writer/Word2007/Part/StylesTest.php b/tests/PhpWord/Writer/Word2007/Part/StylesTest.php index e3d89d0e..0c0f7aef 100644 --- a/tests/PhpWord/Writer/Word2007/Part/StylesTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/StylesTest.php @@ -115,7 +115,7 @@ class StylesTest extends \PHPUnit_Framework_TestCase $this->assertNull($element); } - function testFontStyleBasedOnOtherFontStyle() + public function testFontStyleBasedOnOtherFontStyle() { $phpWord = new PhpWord(); From f6aafe48bb8c9c6607840373b934b85c350ea32e Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 14 Sep 2017 22:16:35 +0200 Subject: [PATCH 091/370] Add php-cs --- .gitignore | 1 + .php_cs.dist | 146 ++++++++++++++++++++++++++++++++++++++++++++++++++ .travis.yml | 9 +++- composer.json | 3 +- 4 files changed, 156 insertions(+), 3 deletions(-) create mode 100644 .php_cs.dist diff --git a/.gitignore b/.gitignore index 66e64406..42f03ebe 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ vendor phpword.ini /.buildpath /.project +/.php_cs.cache diff --git a/.php_cs.dist b/.php_cs.dist new file mode 100644 index 00000000..a08e2b21 --- /dev/null +++ b/.php_cs.dist @@ -0,0 +1,146 @@ +exclude('vendor') + ->notPath('src/PhpWord/Shared/PCLZip/pclzip.lib.php') + ->in('samples') + ->in('src') + ->in('tests'); + +return PhpCsFixer\Config::create() + ->setRiskyAllowed(true) + ->setFinder($finder) + ->setRules([ + 'array_syntax' => ['syntax' => 'long'], + 'binary_operator_spaces' => ['align_double_arrow' => true], + 'blank_line_after_namespace' => true, + 'blank_line_after_opening_tag' => true, + 'blank_line_before_return' => true, + 'braces' => true, + 'cast_spaces' => true, + 'class_definition' => true, + 'class_keyword_remove' => false, // ::class keyword gives us beter support in IDE + 'combine_consecutive_unsets' => true, + 'concat_space' => ['spacing' => 'one'], + 'declare_equal_normalize' => true, + 'declare_strict_types' => false, // Too early to adopt strict types + 'dir_constant' => true, + 'elseif' => true, + 'encoding' => true, + 'ereg_to_preg' => true, + 'full_opening_tag' => true, + 'function_declaration' => true, + 'function_typehint_space' => true, + 'general_phpdoc_annotation_remove' => false, // No use for that + 'hash_to_slash_comment' => true, + 'header_comment' => false, // We don't use common header in all our files + 'heredoc_to_nowdoc' => false, // Not sure about this one + 'is_null' => false, // Risky + 'include' => true, + 'indentation_type' => true, + 'line_ending' => true, + 'linebreak_after_opening_tag' => true, + 'lowercase_cast' => true, + 'lowercase_constants' => true, + 'lowercase_keywords' => true, + 'mb_str_functions' => false, // No, too dangerous to change that + 'method_argument_space' => true, + 'method_separation' => true, + 'modernize_types_casting' => true, + 'native_function_casing' => true, + 'native_function_invocation'=> false, // This is risky and seems to be micro-optimization that make code uglier so not worth it, at least for now + 'new_with_braces' => true, + 'no_alias_functions' => true, + 'no_blank_lines_after_class_opening' => true, + 'no_blank_lines_after_phpdoc' => true, + 'no_blank_lines_before_namespace' => false, // we want 1 blank line before namespace + 'no_closing_tag' => true, + 'no_empty_comment' => true, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'useTrait', 'curly_brace_block', 'parenthesis_brace_block', 'square_brace_block'], + 'no_leading_import_slash' => true, + 'no_leading_namespace_whitespace' => true, + 'no_mixed_echo_print' => true, + 'no_multiline_whitespace_around_double_arrow' => true, + 'no_multiline_whitespace_before_semicolons' => true, + 'no_php4_constructor' => true, + 'no_short_bool_cast' => true, + 'no_short_echo_tag' => true, + 'no_singleline_whitespace_before_semicolons' => true, + 'no_spaces_after_function_name' => true, + 'no_spaces_around_offset' => true, + 'no_spaces_inside_parenthesis' => true, + 'no_trailing_comma_in_list_call' => true, + 'no_trailing_comma_in_singleline_array' => true, + 'no_trailing_whitespace' => true, + 'no_trailing_whitespace_in_comment' => true, + 'no_unneeded_control_parentheses' => true, + 'no_unreachable_default_argument_value' => true, + 'no_unused_imports' => true, + 'no_useless_else' => true, + 'no_useless_return' => true, + 'no_whitespace_before_comma_in_array' => true, + 'no_whitespace_in_blank_line' => true, + 'normalize_index_brace' => true, + 'not_operator_with_space' => false, // No we prefer to keep '!' without spaces + 'not_operator_with_successor_space' => false, // idem + 'object_operator_without_whitespace' => true, + 'ordered_class_elements' => false, // We prefer to keep some freedom + 'ordered_imports' => true, + 'php_unit_construct' => true, + 'php_unit_dedicate_assert' => true, + 'php_unit_fqcn_annotation' => true, + 'php_unit_strict' => false, // We sometime actually need assertEquals + 'phpdoc_add_missing_param_annotation' => true, + 'phpdoc_align' => false, // Waste of time + 'phpdoc_annotation_without_dot' => true, + 'phpdoc_indent' => true, + 'phpdoc_inline_tag' => true, + 'phpdoc_no_access' => true, + 'phpdoc_no_alias_tag' => false, //@see instead of @link + 'phpdoc_no_empty_return' => true, + 'phpdoc_no_package' => true, + 'phpdoc_no_useless_inheritdoc' => true, + 'phpdoc_order' => true, + 'phpdoc_return_self_reference' => true, + 'phpdoc_scalar' => true, + 'phpdoc_separation' => false, //TODO + 'phpdoc_single_line_var_spacing' => true, + 'phpdoc_summary' => false, + 'phpdoc_to_comment' => true, + 'phpdoc_trim' => true, + 'phpdoc_types' => true, + 'phpdoc_var_without_name' => true, + 'pow_to_exponentiation' => false, + 'pre_increment' => true, + 'protected_to_private' => true, + 'psr0' => true, + 'psr4' => true, + 'random_api_migration' => false, // This breaks our unit tests + 'return_type_declaration' => true, + 'self_accessor' => true, + 'semicolon_after_instruction' => false, // Buggy in `samples/index.php` + 'short_scalar_cast' => true, + 'silenced_deprecation_error' => true, + 'simplified_null_return' => false, // While technically correct we prefer to be explicit when returning null + 'single_blank_line_at_eof' => true, + 'single_blank_line_before_namespace' => false,//a lot of occurences TODO + 'single_class_element_per_statement' => true, + 'single_import_per_statement' => true, + 'single_line_after_imports' => true, + 'single_quote' => true, + 'space_after_semicolon' => true, + 'standardize_not_equals' => true, + 'strict_comparison' => false, // No, too dangerous to change that + 'strict_param' => false, // No, too dangerous to change that + 'switch_case_semicolon_to_colon' => true, + 'switch_case_space' => true, + 'ternary_operator_spaces' => true, + 'ternary_to_null_coalescing' => false, // Cannot use that with PHP 5.6 + 'trailing_comma_in_multiline_array' => true, + 'trim_array_spaces' => false, + 'unary_operator_spaces' => true, + 'visibility_required' => true, + 'whitespace_after_comma_in_array' => true, + ]); diff --git a/.travis.yml b/.travis.yml index da4af286..37234348 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,6 @@ php: - 5.6 - 7.0 - 7.1 -## - hhvm matrix: include: @@ -18,7 +17,11 @@ matrix: allow_failures: - php: 7.0 - php: 7.1 -## - php: hhvm + +cache: + directories: + - vendor + - $HOME/.composer/cache env: global: @@ -42,6 +45,8 @@ before_script: script: ## PHP_CodeSniffer - if [ -z "$COVERAGE" ]; then ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip ; fi + ## PHP-CS-Fixer + #- if [ -z "$COVERAGE" ]; then ./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run ; fi ## PHP Mess Detector - if [ -z "$COVERAGE" ]; then ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php ; fi ## PHPUnit diff --git a/composer.json b/composer.json index 189b5478..ab8b6aa6 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,8 @@ "phpunit/phpunit": "4.8.*", "phpdocumentor/phpdocumentor":"2.*", "twig/twig":"1.27", - "squizlabs/php_codesniffer": "1.*", + "squizlabs/php_codesniffer": "^2.7", + "friendsofphp/php-cs-fixer": "^2.0", "phpmd/phpmd": "2.*", "phploc/phploc": "2.*", "dompdf/dompdf":"0.8.*", From 8ce1a19ec4201ec1d2fc26e5dc685e54e10f1b13 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 17 Sep 2017 21:38:00 +0200 Subject: [PATCH 092/370] make FontStyle basedOn paragraph if the paragraph is set on the font (#926) * make FontStyle based on paragraph if it set * replace tab with spaces * basedOn not correctly set if FontStyle is based on other FontStyle * Fix warnings --- .../ComplexType/FootnoteProperties.php | 16 ++--- src/PhpWord/ComplexType/ProofState.php | 4 +- src/PhpWord/Element/AbstractElement.php | 6 +- src/PhpWord/Element/Comment.php | 12 ++-- src/PhpWord/Element/Image.php | 4 +- src/PhpWord/Element/Section.php | 7 +- src/PhpWord/Escaper/AbstractEscaper.php | 2 +- src/PhpWord/Escaper/EscaperInterface.php | 2 +- src/PhpWord/Escaper/RegExp.php | 2 +- src/PhpWord/Escaper/Rtf.php | 2 +- src/PhpWord/Escaper/Xml.php | 2 +- src/PhpWord/Metadata/Settings.php | 8 +-- src/PhpWord/Reader/MsDoc.php | 40 +++++------ src/PhpWord/Reader/ODText/Content.php | 1 - src/PhpWord/Reader/Word2007.php | 1 - src/PhpWord/Reader/Word2007/AbstractPart.php | 2 - src/PhpWord/Reader/Word2007/Settings.php | 8 +-- src/PhpWord/Reader/Word2007/Styles.php | 1 - src/PhpWord/Settings.php | 4 +- src/PhpWord/Shared/AbstractEnum.php | 6 +- src/PhpWord/Shared/OLERead.php | 1 - src/PhpWord/Style/Font.php | 4 +- src/PhpWord/Style/NumberingLevel.php | 2 +- src/PhpWord/Style/Paragraph.php | 4 +- src/PhpWord/TemplateProcessor.php | 2 +- src/PhpWord/Writer/HTML/Part/AbstractPart.php | 2 +- src/PhpWord/Writer/RTF/Part/AbstractPart.php | 2 +- .../Word2007/Element/AbstractElement.php | 1 - src/PhpWord/Writer/Word2007/Part/Chart.php | 1 - src/PhpWord/Writer/Word2007/Part/Settings.php | 5 +- src/PhpWord/Writer/Word2007/Part/Styles.php | 11 ++- .../ComplexType/FootnotePropertiesTest.php | 6 +- tests/PhpWord/PhpWordTest.php | 1 - .../Writer/Word2007/Part/StylesTest.php | 69 +++++++++++++++++++ tests/PhpWord/_includes/XmlDocument.php | 1 - 35 files changed, 153 insertions(+), 89 deletions(-) diff --git a/src/PhpWord/ComplexType/FootnoteProperties.php b/src/PhpWord/ComplexType/FootnoteProperties.php index 882834d5..0c1fb40e 100644 --- a/src/PhpWord/ComplexType/FootnoteProperties.php +++ b/src/PhpWord/ComplexType/FootnoteProperties.php @@ -65,7 +65,7 @@ final class FootnoteProperties /** * Get the Footnote Positioning Location - * + * * @return string */ public function getPos() @@ -75,7 +75,7 @@ final class FootnoteProperties /** * Set the Footnote Positioning Location (pageBottom, beneathText, sectEnd, docEnd) - * + * * @param string $pos * @throws \InvalidArgumentException * @return self @@ -99,7 +99,7 @@ final class FootnoteProperties /** * Get the Footnote Numbering Format - * + * * @return string */ public function getNumFmt() @@ -109,7 +109,7 @@ final class FootnoteProperties /** * Set the Footnote Numbering Format - * + * * @param string $numFmt One of NumberFormat * @return self */ @@ -122,7 +122,7 @@ final class FootnoteProperties /** * Get the Footnote Numbering Format - * + * * @return double */ public function getNumStart() @@ -132,7 +132,7 @@ final class FootnoteProperties /** * Set the Footnote Numbering Format - * + * * @param double $numStart * @return self */ @@ -144,7 +144,7 @@ final class FootnoteProperties /** * Get the Footnote and Endnote Numbering Starting Value - * + * * @return string */ public function getNumRestart() @@ -154,7 +154,7 @@ final class FootnoteProperties /** * Set the Footnote and Endnote Numbering Starting Value (continuous, eachSect, eachPage) - * + * * @param string $numRestart * @throws \InvalidArgumentException * @return self diff --git a/src/PhpWord/ComplexType/ProofState.php b/src/PhpWord/ComplexType/ProofState.php index e5ac9c20..daa705dd 100644 --- a/src/PhpWord/ComplexType/ProofState.php +++ b/src/PhpWord/ComplexType/ProofState.php @@ -51,7 +51,7 @@ final class ProofState /** * Set the Spell Checking State (dirty or clean) * - * @param string $spelling + * @param string $spelling * @throws \InvalidArgumentException * @return self */ @@ -78,7 +78,7 @@ final class ProofState /** * Set the Grammatical Checking State (dirty or clean) * - * @param string $grammar + * @param string $grammar * @throws \InvalidArgumentException * @return self */ diff --git a/src/PhpWord/Element/AbstractElement.php b/src/PhpWord/Element/AbstractElement.php index 8ff64194..f657dd1b 100644 --- a/src/PhpWord/Element/AbstractElement.php +++ b/src/PhpWord/Element/AbstractElement.php @@ -116,14 +116,14 @@ abstract class AbstractElement /** * The start position for the linked comment - * + * * @var Comment */ protected $commentRangeStart; /** * The end position for the linked comment - * + * * @var Comment */ protected $commentRangeEnd; @@ -291,7 +291,7 @@ abstract class AbstractElement /** * Set comment start - * + * * @param Comment $value */ public function setCommentRangeStart(Comment $value) diff --git a/src/PhpWord/Element/Comment.php b/src/PhpWord/Element/Comment.php index def9d5a8..685ed296 100644 --- a/src/PhpWord/Element/Comment.php +++ b/src/PhpWord/Element/Comment.php @@ -31,14 +31,14 @@ class Comment extends TrackChange /** * The Element where this comment starts - * + * * @var AbstractElement */ private $startElement; /** * The Element where this comment ends - * + * * @var AbstractElement */ private $endElement; @@ -76,7 +76,7 @@ class Comment extends TrackChange /** * Sets the element where this comment starts - * + * * @param \PhpOffice\PhpWord\Element\AbstractElement $value */ public function setStartElement(AbstractElement $value) @@ -89,7 +89,7 @@ class Comment extends TrackChange /** * Get the element where this comment starts - * + * * @return \PhpOffice\PhpWord\Element\AbstractElement */ public function getStartElement() @@ -99,7 +99,7 @@ class Comment extends TrackChange /** * Sets the element where this comment ends - * + * * @param \PhpOffice\PhpWord\Element\AbstractElement $value */ public function setEndElement(AbstractElement $value) @@ -112,7 +112,7 @@ class Comment extends TrackChange /** * Get the element where this comment ends - * + * * @return \PhpOffice\PhpWord\Element\AbstractElement */ public function getEndElement() diff --git a/src/PhpWord/Element/Image.php b/src/PhpWord/Element/Image.php index b8b5cca1..1c8c520d 100644 --- a/src/PhpWord/Element/Image.php +++ b/src/PhpWord/Element/Image.php @@ -476,9 +476,9 @@ class Image extends AbstractElement /** * get image size from string - * + * * @param string $source - * + * * @codeCoverageIgnore this method is just a replacement for getimagesizefromstring which exists only as of PHP 5.4 */ private function getStringImageSize($source) diff --git a/src/PhpWord/Element/Section.php b/src/PhpWord/Element/Section.php index 3758af99..e9beffcf 100644 --- a/src/PhpWord/Element/Section.php +++ b/src/PhpWord/Element/Section.php @@ -50,7 +50,7 @@ class Section extends AbstractContainer /** * The properties for the footnote of this section - * + * * @var FootnoteProperties */ private $footnoteProperties; @@ -148,7 +148,7 @@ class Section extends AbstractContainer /** * Get the footnote properties - * + * * @return \PhpOffice\PhpWord\Element\FooterProperties */ public function getFootnotePropoperties() @@ -158,7 +158,7 @@ class Section extends AbstractContainer /** * Set the footnote properties - * + * * @param FootnoteProperties $footnoteProperties */ public function setFootnoteProperties(FootnoteProperties $footnoteProperties = null) @@ -219,7 +219,6 @@ class Section extends AbstractContainer } else { throw new \Exception('Invalid header/footer type.'); } - } /** diff --git a/src/PhpWord/Escaper/AbstractEscaper.php b/src/PhpWord/Escaper/AbstractEscaper.php index 6ddcbb51..8ce4e301 100644 --- a/src/PhpWord/Escaper/AbstractEscaper.php +++ b/src/PhpWord/Escaper/AbstractEscaper.php @@ -19,7 +19,7 @@ namespace PhpOffice\PhpWord\Escaper; /** * @since 0.13.0 - * + * * @codeCoverageIgnore */ abstract class AbstractEscaper implements EscaperInterface diff --git a/src/PhpWord/Escaper/EscaperInterface.php b/src/PhpWord/Escaper/EscaperInterface.php index c34cf370..71cf36b4 100644 --- a/src/PhpWord/Escaper/EscaperInterface.php +++ b/src/PhpWord/Escaper/EscaperInterface.php @@ -19,7 +19,7 @@ namespace PhpOffice\PhpWord\Escaper; /** * @since 0.13.0 - * + * * @codeCoverageIgnore */ interface EscaperInterface diff --git a/src/PhpWord/Escaper/RegExp.php b/src/PhpWord/Escaper/RegExp.php index de510bcf..dfcfb1e1 100644 --- a/src/PhpWord/Escaper/RegExp.php +++ b/src/PhpWord/Escaper/RegExp.php @@ -19,7 +19,7 @@ namespace PhpOffice\PhpWord\Escaper; /** * @since 0.13.0 - * + * * @codeCoverageIgnore */ class RegExp extends AbstractEscaper diff --git a/src/PhpWord/Escaper/Rtf.php b/src/PhpWord/Escaper/Rtf.php index 6f83604d..ec24c0af 100644 --- a/src/PhpWord/Escaper/Rtf.php +++ b/src/PhpWord/Escaper/Rtf.php @@ -19,7 +19,7 @@ namespace PhpOffice\PhpWord\Escaper; /** * @since 0.13.0 - * + * * @codeCoverageIgnore */ class Rtf extends AbstractEscaper diff --git a/src/PhpWord/Escaper/Xml.php b/src/PhpWord/Escaper/Xml.php index 274cade5..3a0981aa 100644 --- a/src/PhpWord/Escaper/Xml.php +++ b/src/PhpWord/Escaper/Xml.php @@ -19,7 +19,7 @@ namespace PhpOffice\PhpWord\Escaper; /** * @since 0.13.0 - * + * * @codeCoverageIgnore */ class Xml extends AbstractEscaper diff --git a/src/PhpWord/Metadata/Settings.php b/src/PhpWord/Metadata/Settings.php index 9b2c2285..cd0eaabe 100644 --- a/src/PhpWord/Metadata/Settings.php +++ b/src/PhpWord/Metadata/Settings.php @@ -203,7 +203,7 @@ class Settings /** * Get the Visibility of Annotation Types - * + * * @return \PhpOffice\PhpWord\ComplexType\TrackChangesView */ public function getRevisionView() @@ -213,7 +213,7 @@ class Settings /** * Set the Visibility of Annotation Types - * + * * @param TrackChangesView $trackChangesView */ public function setRevisionView(TrackChangesView $trackChangesView = null) @@ -293,7 +293,7 @@ class Settings /** * Returns the Radix Point for Field Code Evaluation - * + * * @return string */ public function getDecimalSymbol() @@ -303,7 +303,7 @@ class Settings /** * sets the Radix Point for Field Code Evaluation - * + * * @param string $decimalSymbol */ public function setDecimalSymbol($decimalSymbol) diff --git a/src/PhpWord/Reader/MsDoc.php b/src/PhpWord/Reader/MsDoc.php index f21b2bf4..b3fdd9d4 100644 --- a/src/PhpWord/Reader/MsDoc.php +++ b/src/PhpWord/Reader/MsDoc.php @@ -1303,7 +1303,7 @@ class MsDoc extends AbstractReader implements ReaderInterface print_r('$sprm.ispmd : 0x'.dechex($sprm_IsPmd).PHP_EOL); print_r('$sprm.f : 0x'.dechex($sprm_F).PHP_EOL); print_r('$sprm.sgc : 0x'.dechex($sprm_Sgc)); - switch(dechex($sprm_Sgc)) { + switch (dechex($sprm_Sgc)) { case 0x01: print_r(' (Paragraph property)'); break; @@ -1322,12 +1322,12 @@ class MsDoc extends AbstractReader implements ReaderInterface } print_r(PHP_EOL); print_r('$sprm.spra : 0x'.dechex($sprm_Spra).PHP_EOL); - switch(dechex($sprm_Spra)) { + switch (dechex($sprm_Spra)) { case 0x0: $operand = self::getInt1d($this->dataWorkDocument, $offset); $offset += 1; $cb -= 1; - switch(dechex($operand)) { + switch (dechex($operand)) { case 0x00: $operand = 'OFF'; break; @@ -1376,9 +1376,9 @@ class MsDoc extends AbstractReader implements ReaderInterface } // - switch(dechex($sprm_Sgc)) { + switch (dechex($sprm_Sgc)) { case 0x01: // Sprm is modifying a paragraph property. - switch($sprm_IsPmd) { + switch ($sprm_IsPmd) { case 0x0A: // sprmPIlvl print_r('sprmPIlvl : '.$operand.PHP_EOL.PHP_EOL); break; @@ -1391,28 +1391,28 @@ class MsDoc extends AbstractReader implements ReaderInterface } break; case 0x02: // Sprm is modifying a character property. - switch($sprm_IsPmd) { + switch ($sprm_IsPmd) { default: print_r('$sprm_IsPmd(2) : '.$sprm_IsPmd.PHP_EOL.PHP_EOL); break; } break; case 0x03: // Sprm is modifying a picture property. - switch($sprm_IsPmd) { + switch ($sprm_IsPmd) { default: print_r('$sprm_IsPmd(3) : '.$sprm_IsPmd.PHP_EOL.PHP_EOL); break; } break; case 0x04: // Sprm is modifying a section property. - switch($sprm_IsPmd) { + switch ($sprm_IsPmd) { default: print_r('$sprm_IsPmd(4) : '.$sprm_IsPmd.PHP_EOL.PHP_EOL); break; } break; case 0x05: // Sprm is modifying a table property. - switch($sprm_IsPmd) { + switch ($sprm_IsPmd) { default: print_r('$sprm_IsPmd(4) : '.$sprm_IsPmd.PHP_EOL.PHP_EOL); break; @@ -1514,11 +1514,11 @@ class MsDoc extends AbstractReader implements ReaderInterface $length = 0; $operand = null; - switch(dechex($oSprm->spra)) { + switch (dechex($oSprm->spra)) { case 0x0: $operand = self::getInt1d($data, $pos); $length = 1; - switch(dechex($operand)) { + switch (dechex($operand)) { case 0x00: $operand = false; break; @@ -1593,7 +1593,7 @@ class MsDoc extends AbstractReader implements ReaderInterface $cbNum -= $arrayReturn['length']; $operand = $arrayReturn['operand']; - switch(dechex($oSprm->sgc)) { + switch (dechex($oSprm->sgc)) { // Paragraph property case 0x01: break; @@ -1602,7 +1602,7 @@ class MsDoc extends AbstractReader implements ReaderInterface if (!isset($oStylePrl->styleFont)) { $oStylePrl->styleFont = array(); } - switch($oSprm->isPmd) { + switch ($oSprm->isPmd) { // sprmCFRMarkIns case 0x01: break; @@ -1620,7 +1620,7 @@ class MsDoc extends AbstractReader implements ReaderInterface // sprmCFItalic case 0x36: // By default, text is not italicized. - switch($operand) { + switch ($operand) { case false: case true: $oStylePrl->styleFont['italic'] = $operand; @@ -1640,7 +1640,7 @@ class MsDoc extends AbstractReader implements ReaderInterface // sprmCFBold case 0x35: // By default, text is not bold. - switch($operand) { + switch ($operand) { case false: case true: $oStylePrl->styleFont['bold'] = $operand; @@ -1656,7 +1656,7 @@ class MsDoc extends AbstractReader implements ReaderInterface // sprmCFStrike case 0x37: // By default, text is not struck through. - switch($operand) { + switch ($operand) { case false: case true: $oStylePrl->styleFont['strikethrough'] = $operand; @@ -1671,7 +1671,7 @@ class MsDoc extends AbstractReader implements ReaderInterface break; // sprmCKul case 0x3E: - switch(dechex($operand)) { + switch (dechex($operand)) { case 0x00: $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_NONE; break; @@ -1734,7 +1734,7 @@ class MsDoc extends AbstractReader implements ReaderInterface // sprmCIco //@link http://msdn.microsoft.com/en-us/library/dd773060%28v=office.12%29.aspx case 0x42: - switch(dechex($operand)) { + switch (dechex($operand)) { case 0x00: case 0x01: $oStylePrl->styleFont['color'] = '000000'; @@ -1873,7 +1873,7 @@ class MsDoc extends AbstractReader implements ReaderInterface if (!isset($oStylePrl->styleSection)) { $oStylePrl->styleSection = array(); } - switch($oSprm->isPmd) { + switch ($oSprm->isPmd) { // sprmSNfcPgn case 0x0E: // numbering format used for page numbers @@ -1925,7 +1925,6 @@ class MsDoc extends AbstractReader implements ReaderInterface default: // print_r('@todo Section : 0x'.dechex($oSprm->isPmd)); // print_r(PHP_EOL); - } break; // Table property @@ -2285,7 +2284,6 @@ class MsDoc extends AbstractReader implements ReaderInterface } } } - } } diff --git a/src/PhpWord/Reader/ODText/Content.php b/src/PhpWord/Reader/ODText/Content.php index 7362b02c..0e11147b 100644 --- a/src/PhpWord/Reader/ODText/Content.php +++ b/src/PhpWord/Reader/ODText/Content.php @@ -44,7 +44,6 @@ class Content extends AbstractPart foreach ($nodes as $node) { // $styleName = $xmlReader->getAttribute('text:style-name', $node); switch ($node->nodeName) { - case 'text:h': // Heading $depth = $xmlReader->getAttribute('text:outline-level', $node); $section->addTitle($node->nodeValue, $depth); diff --git a/src/PhpWord/Reader/Word2007.php b/src/PhpWord/Reader/Word2007.php index 875415a3..d203dd29 100644 --- a/src/PhpWord/Reader/Word2007.php +++ b/src/PhpWord/Reader/Word2007.php @@ -94,7 +94,6 @@ class Word2007 extends AbstractReader implements ReaderInterface $part->setRels($relationships); $part->read($phpWord); } - } /** diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index 51970a06..5aafcb0d 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -263,7 +263,6 @@ abstract class AbstractPart foreach ($tblNodes as $tblNode) { if ('w:tblGrid' == $tblNode->nodeName) { // Column // @todo Do something with table columns - } elseif ('w:tr' == $tblNode->nodeName) { // Row $rowHeight = $xmlReader->getAttribute('w:val', $tblNode, 'w:trPr/w:trHeight'); $rowHRule = $xmlReader->getAttribute('w:hRule', $tblNode, 'w:trPr/w:trHeight'); @@ -279,7 +278,6 @@ abstract class AbstractPart foreach ($rowNodes as $rowNode) { if ('w:trPr' == $rowNode->nodeName) { // Row style // @todo Do something with row style - } elseif ('w:tc' == $rowNode->nodeName) { // Cell $cellWidth = $xmlReader->getAttribute('w:w', $rowNode, 'w:tcPr/w:tcW'); $cellStyle = null; diff --git a/src/PhpWord/Reader/Word2007/Settings.php b/src/PhpWord/Reader/Word2007/Settings.php index d2ffc1f3..7ade4dc5 100644 --- a/src/PhpWord/Reader/Word2007/Settings.php +++ b/src/PhpWord/Reader/Word2007/Settings.php @@ -68,7 +68,7 @@ class Settings extends AbstractPart /** * Sets the document protection - * + * * @param XMLReader $xmlReader * @param PhpWord $phpWord * @param \DOMNode $node @@ -83,7 +83,7 @@ class Settings extends AbstractPart /** * Sets the proof state - * + * * @param XMLReader $xmlReader * @param PhpWord $phpWord * @param \DOMNode $node @@ -105,7 +105,7 @@ class Settings extends AbstractPart /** * Sets the proof state - * + * * @param XMLReader $xmlReader * @param PhpWord $phpWord * @param \DOMNode $node @@ -122,7 +122,7 @@ class Settings extends AbstractPart /** * Set the Revision view - * + * * @param XMLReader $xmlReader * @param PhpWord $phpWord * @param \DOMNode $node diff --git a/src/PhpWord/Reader/Word2007/Styles.php b/src/PhpWord/Reader/Word2007/Styles.php index 645c9830..c38ca144 100644 --- a/src/PhpWord/Reader/Word2007/Styles.php +++ b/src/PhpWord/Reader/Word2007/Styles.php @@ -49,7 +49,6 @@ class Styles extends AbstractPart preg_match('/Heading(\d)/', $name, $headingMatches); // $default = ($xmlReader->getAttribute('w:default', $node) == 1); switch ($type) { - case 'paragraph': $paragraphStyle = $this->readParagraphStyle($xmlReader, $node); $fontStyle = $this->readFontStyle($xmlReader, $node); diff --git a/src/PhpWord/Settings.php b/src/PhpWord/Settings.php index 70fad3e8..5309baf7 100644 --- a/src/PhpWord/Settings.php +++ b/src/PhpWord/Settings.php @@ -318,7 +318,7 @@ class Settings /** * @since 0.13.0 - * + * * @return boolean * * @codeCoverageIgnore @@ -330,7 +330,7 @@ class Settings /** * @since 0.13.0 - * + * * @param boolean $outputEscapingEnabled * * @codeCoverageIgnore diff --git a/src/PhpWord/Shared/AbstractEnum.php b/src/PhpWord/Shared/AbstractEnum.php index f116e511..35a5749a 100644 --- a/src/PhpWord/Shared/AbstractEnum.php +++ b/src/PhpWord/Shared/AbstractEnum.php @@ -21,7 +21,7 @@ abstract class AbstractEnum /** * Returns all values for this enum - * + * * @return array */ public static function values() @@ -31,7 +31,7 @@ abstract class AbstractEnum /** * Returns true the value is valid for this enum - * + * * @param strign $value * @return boolean true if value is valid */ @@ -43,7 +43,7 @@ abstract class AbstractEnum /** * Validates that the value passed is a valid value - * + * * @param string $value * @throws \InvalidArgumentException if the value passed is not valid for this enum */ diff --git a/src/PhpWord/Shared/OLERead.php b/src/PhpWord/Shared/OLERead.php index cf9b15d3..aa671522 100644 --- a/src/PhpWord/Shared/OLERead.php +++ b/src/PhpWord/Shared/OLERead.php @@ -294,7 +294,6 @@ class OLERead $offset += self::PROPERTY_STORAGE_BLOCK_SIZE; } - } /** diff --git a/src/PhpWord/Style/Font.php b/src/PhpWord/Style/Font.php index b625e3b8..5cc80fb3 100644 --- a/src/PhpWord/Style/Font.php +++ b/src/PhpWord/Style/Font.php @@ -223,7 +223,7 @@ class Font extends AbstractStyle private $shading; /** - * Right to left languages + * Right to left languages * @var boolean */ private $rtl = false; @@ -725,7 +725,7 @@ class Font extends AbstractStyle } /** - * Set shading + * Set Paragraph * * @param mixed $value * @return self diff --git a/src/PhpWord/Style/NumberingLevel.php b/src/PhpWord/Style/NumberingLevel.php index 38b9fbee..9da1a2b1 100644 --- a/src/PhpWord/Style/NumberingLevel.php +++ b/src/PhpWord/Style/NumberingLevel.php @@ -85,7 +85,7 @@ class NumberingLevel extends AbstractStyle /** * Justification, w:lvlJc - * + * * @var string, one of PhpOffice\PhpWord\SimpleType\Jc */ private $alignment = ''; diff --git a/src/PhpWord/Style/Paragraph.php b/src/PhpWord/Style/Paragraph.php index bad9ace9..8d342550 100644 --- a/src/PhpWord/Style/Paragraph.php +++ b/src/PhpWord/Style/Paragraph.php @@ -742,7 +742,7 @@ class Paragraph extends Border /** * Get contextualSpacing - * + * * @return bool */ public function hasContextualSpacing() @@ -752,7 +752,7 @@ class Paragraph extends Border /** * Set contextualSpacing - * + * * @param bool $contextualSpacing * @return self */ diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php index e7a8d039..2f6d6258 100644 --- a/src/PhpWord/TemplateProcessor.php +++ b/src/PhpWord/TemplateProcessor.php @@ -147,7 +147,7 @@ class TemplateProcessor /** * Applies XSL style sheet to template's parts. - * + * * Note: since the method doesn't make any guess on logic of the provided XSL style sheet, * make sure that output is correctly escaped. Otherwise you may get broken document. * diff --git a/src/PhpWord/Writer/HTML/Part/AbstractPart.php b/src/PhpWord/Writer/HTML/Part/AbstractPart.php index 638f846b..584e4489 100644 --- a/src/PhpWord/Writer/HTML/Part/AbstractPart.php +++ b/src/PhpWord/Writer/HTML/Part/AbstractPart.php @@ -48,7 +48,7 @@ abstract class AbstractPart /** * @param \PhpOffice\PhpWord\Writer\AbstractWriter $writer - * + * * @return void */ public function setParentWriter(AbstractWriter $writer = null) diff --git a/src/PhpWord/Writer/RTF/Part/AbstractPart.php b/src/PhpWord/Writer/RTF/Part/AbstractPart.php index 152493db..04fb4cfd 100644 --- a/src/PhpWord/Writer/RTF/Part/AbstractPart.php +++ b/src/PhpWord/Writer/RTF/Part/AbstractPart.php @@ -48,7 +48,7 @@ abstract class AbstractPart /** * @param \PhpOffice\PhpWord\Writer\AbstractWriter $writer - * + * * @return void */ public function setParentWriter(AbstractWriter $writer = null) diff --git a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php index 79877b10..305a768e 100644 --- a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php +++ b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php @@ -134,7 +134,6 @@ abstract class AbstractElement } $this->xmlWriter->writeElementBlock('w:commentRangeStart', array('w:id' => $comment->getElementId())); - } } diff --git a/src/PhpWord/Writer/Word2007/Part/Chart.php b/src/PhpWord/Writer/Word2007/Part/Chart.php index 3dd3968b..86045b9a 100644 --- a/src/PhpWord/Writer/Word2007/Part/Chart.php +++ b/src/PhpWord/Writer/Word2007/Part/Chart.php @@ -213,7 +213,6 @@ class Chart extends AbstractPart $xmlWriter->endElement(); // c:ser $index++; } - } /** diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index 529d47af..d2cb8117 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -161,7 +161,7 @@ class Settings extends AbstractPart /** * Adds a boolean attribute to the settings array - * + * * @param string $settingName * @param boolean $booleanValue */ @@ -219,7 +219,6 @@ class Settings extends AbstractPart private function setRevisionView(TrackChangesView $trackChangesView = null) { if ($trackChangesView != null) { - $revisionView['w:markup'] = $trackChangesView->hasMarkup() ? 'true': 'false'; $revisionView['w:comments'] = $trackChangesView->hasComments() ? 'true': 'false'; $revisionView['w:insDel'] = $trackChangesView->hasInsDel() ? 'true': 'false'; @@ -232,7 +231,7 @@ class Settings extends AbstractPart /** * Set the magnification - * + * * @param mixed $zoom */ private function setZoom($zoom = null) diff --git a/src/PhpWord/Writer/Word2007/Part/Styles.php b/src/PhpWord/Writer/Word2007/Part/Styles.php index 7bcb8d92..01b84c08 100644 --- a/src/PhpWord/Writer/Word2007/Part/Styles.php +++ b/src/PhpWord/Writer/Word2007/Part/Styles.php @@ -170,6 +170,9 @@ class Styles extends AbstractPart $xmlWriter->startElement('w:link'); $xmlWriter->writeAttribute('w:val', $styleLink); $xmlWriter->endElement(); + } else if (!is_null($paragraphStyle)) { + // if type is 'paragraph' it should have a styleId + $xmlWriter->writeAttribute('w:styleId', $styleName); } // Style name @@ -178,7 +181,13 @@ class Styles extends AbstractPart $xmlWriter->endElement(); // Parent style - $xmlWriter->writeElementIf(!is_null($paragraphStyle), 'w:basedOn', 'w:val', 'Normal'); + if (!is_null($paragraphStyle)) { + if ($paragraphStyle->getStyleName() != null) { + $xmlWriter->writeElementBlock('w:basedOn', 'w:val', $paragraphStyle->getStyleName()); + } elseif ($paragraphStyle->getBasedOn() != null) { + $xmlWriter->writeElementBlock('w:basedOn', 'w:val', $paragraphStyle->getBasedOn()); + } + } // w:pPr if (!is_null($paragraphStyle)) { diff --git a/tests/PhpWord/ComplexType/FootnotePropertiesTest.php b/tests/PhpWord/ComplexType/FootnotePropertiesTest.php index 025e8c91..39392fcd 100644 --- a/tests/PhpWord/ComplexType/FootnotePropertiesTest.php +++ b/tests/PhpWord/ComplexType/FootnotePropertiesTest.php @@ -47,7 +47,7 @@ class FootnotePropertiesTest extends \PHPUnit_Framework_TestCase /** * Test throws exception if wrong position given - * + * * @expectedException \InvalidArgumentException */ public function testWrongPos() @@ -58,7 +58,7 @@ class FootnotePropertiesTest extends \PHPUnit_Framework_TestCase /** * Test throws exception if wrong number format given - * + * * @expectedException \InvalidArgumentException */ public function testWrongNumFmt() @@ -69,7 +69,7 @@ class FootnotePropertiesTest extends \PHPUnit_Framework_TestCase /** * Test throws exception if wrong number restart given - * + * * @expectedException \InvalidArgumentException */ public function testWrongNumRestart() diff --git a/tests/PhpWord/PhpWordTest.php b/tests/PhpWord/PhpWordTest.php index 459c67a0..b49666f5 100644 --- a/tests/PhpWord/PhpWordTest.php +++ b/tests/PhpWord/PhpWordTest.php @@ -99,7 +99,6 @@ class PhpWordTest extends \PHPUnit_Framework_TestCase $phpWord->$method($styleId, array()); $this->assertInstanceOf("PhpOffice\\PhpWord\\Style\\{$value}", Style::getStyle($styleId)); } - } /** diff --git a/tests/PhpWord/Writer/Word2007/Part/StylesTest.php b/tests/PhpWord/Writer/Word2007/Part/StylesTest.php index f40387a1..0c0f7aef 100644 --- a/tests/PhpWord/Writer/Word2007/Part/StylesTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/StylesTest.php @@ -18,7 +18,10 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\SimpleType\Jc; +use PhpOffice\PhpWord\Style\Font; +use PhpOffice\PhpWord\Style\Paragraph; use PhpOffice\PhpWord\TestHelperDOCX; +use PhpOffice\PhpWord\Writer\Word2007; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Styles @@ -74,4 +77,70 @@ class StylesTest extends \PHPUnit_Framework_TestCase $element = $doc->getElement($path, $file); $this->assertEquals('Normal', $element->getAttribute('w:val')); } + + public function testFontStyleBasedOn() + { + $phpWord = new PhpWord(); + + $baseParagraphStyle = new Paragraph(); + $baseParagraphStyle->setAlignment(Jc::CENTER); + $baseParagraphStyle = $phpWord->addParagraphStyle('BaseStyle', $baseParagraphStyle); + + $childFont = new Font(); + $childFont->setParagraph($baseParagraphStyle); + $childFont->setSize(16); + $childFont = $phpWord->addFontStyle('ChildFontStyle', $childFont); + + $otherFont = new Font(); + $otherFont->setSize(20); + $otherFont = $phpWord->addFontStyle('OtherFontStyle', $otherFont); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/styles.xml'; + + // Normal style generated? + $path = '/w:styles/w:style[@w:styleId="BaseStyle"]/w:name'; + $element = $doc->getElement($path, $file); + $this->assertEquals('BaseStyle', $element->getAttribute('w:val')); + + // Font style with paragraph should have it's base style set to that paragraphs style name + $path = '/w:styles/w:style[w:name/@w:val="ChildFontStyle"]/w:basedOn'; + $element = $doc->getElement($path, $file); + $this->assertEquals('BaseStyle', $element->getAttribute('w:val')); + + // Font style without paragraph should not have a base style set + $path = '/w:styles/w:style[w:name/@w:val="OtherFontStyle"]/w:basedOn'; + $element = $doc->getElement($path, $file); + $this->assertNull($element); + } + + public function testFontStyleBasedOnOtherFontStyle() + { + $phpWord = new PhpWord(); + + $styleGenerationP = new Paragraph(); + $styleGenerationP->setAlignment(Jc::BOTH); + + $styleGeneration = new Font(); + $styleGeneration->setParagraph($styleGenerationP); + $styleGeneration->setSize(9.5); + $phpWord->addFontStyle('Generation', $styleGeneration); + + $styleGenerationEteinteP = new Paragraph(); + $styleGenerationEteinteP->setBasedOn('Generation'); + + $styleGenerationEteinte = new Font(); + $styleGenerationEteinte->setParagraph($styleGenerationEteinteP); + $styleGenerationEteinte->setSize(8.5); + $phpWord->addFontStyle('GeneratEteinte', $styleGenerationEteinte); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/styles.xml'; + + $path = '/w:styles/w:style[@w:styleId="GeneratEteinte"]/w:basedOn'; + $element = $doc->getElement($path, $file); + $this->assertEquals('Generation', $element->getAttribute('w:val')); + } } diff --git a/tests/PhpWord/_includes/XmlDocument.php b/tests/PhpWord/_includes/XmlDocument.php index 72b18c29..c3bab0f6 100644 --- a/tests/PhpWord/_includes/XmlDocument.php +++ b/tests/PhpWord/_includes/XmlDocument.php @@ -96,7 +96,6 @@ class XmlDocument if (null === $this->xpath) { $this->xpath = new \DOMXpath($this->dom); - } return $this->xpath->query($path); From 34a1be00532b296a4677b576514e297e2b9652b6 Mon Sep 17 00:00:00 2001 From: troosan Date: Mon, 18 Sep 2017 21:45:59 +0200 Subject: [PATCH 093/370] Add support for XE and INDEX fields (#922) --- docs/elements.rst | 30 ++++- samples/Sample_27_Field.php | 24 +++- src/PhpWord/Element/AbstractContainer.php | 2 +- src/PhpWord/Element/Field.php | 61 +++++++++- src/PhpWord/Writer/Word2007/Element/Field.php | 111 ++++++++++++++---- tests/PhpWord/Element/FieldTest.php | 53 +++++++++ tests/PhpWord/Writer/Word2007/ElementTest.php | 46 ++++++++ 7 files changed, 295 insertions(+), 32 deletions(-) diff --git a/docs/elements.rst b/docs/elements.rst index ede34568..a35eb654 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -377,7 +377,35 @@ To be completed Fields ------ -To be completed +Currently the following fields are supported: + +- PAGE +- NUMPAGES +- DATE +- XE +- INDEX + +.. code-block:: php + + $section->addField($fieldType, [$properties], [$options], [$fieldText]) + +See ``\PhpOffice\PhpWord\Element\Field`` for list of properties and options available for each field type. +Options which are not specifically defined can be added. Those must start with a ``\``. + +For instance for the INDEX field, you can do the following (See `Index Field for list of available options `_ ): + +.. code-block:: php + + //the $fieldText can be either a simple string + $fieldText = 'The index value'; + + //or a 'TextRun', to be able to format the text you want in the index + $fieldText = new TextRun(); + $fieldText->addText('My '); + $fieldText->addText('bold index', ['bold' => true]); + $fieldText->addText(' entry'); + + $section->addField('INDEX', array(), array('\\e " " \\h "A" \\c "3"'), $fieldText); Line ------ diff --git a/samples/Sample_27_Field.php b/samples/Sample_27_Field.php index 57747895..b5be12ca 100644 --- a/samples/Sample_27_Field.php +++ b/samples/Sample_27_Field.php @@ -1,4 +1,6 @@ addText('Date field:'); $section->addField('DATE', array('dateformat' => 'dddd d MMMM yyyy H:mm:ss'), array('PreserveFormat')); $section->addText('Page field:'); -$section->addField('PAGE', array('format' => 'ArabicDash')); +$section->addField('PAGE', array('format' => 'Arabic')); $section->addText('Number of pages field:'); -$section->addField('NUMPAGES', array('format' => 'Arabic', 'numformat' => '0,00'), array('PreserveFormat')); +$section->addField('NUMPAGES', array('numformat' => '0,00', 'format' => 'Arabic'), array('PreserveFormat')); + +$textrun = $section->addTextRun(); +$textrun->addText('An index field is '); +$textrun->addField('XE', array(), array('Italic'), 'My first index'); +$textrun->addText('here:'); + +$indexEntryText = new TextRun(); +$indexEntryText->addText('My '); +$indexEntryText->addText('bold index', ['bold' => true]); +$indexEntryText->addText(' entry'); + +$textrun = $section->addTextRun(); +$textrun->addText('A complex index field is '); +$textrun->addField('XE', array(), array('Bold'), $indexEntryText); +$textrun->addText('here:'); + +$section->addText('The actual index:'); +$section->addField('INDEX', array(), array('\\e " "'), 'right click to update the index'); $textrun = $section->addTextRun(array('alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER)); $textrun->addText('This is the date of lunar calendar '); diff --git a/src/PhpWord/Element/AbstractContainer.php b/src/PhpWord/Element/AbstractContainer.php index 0dbfe750..d5b4cc62 100644 --- a/src/PhpWord/Element/AbstractContainer.php +++ b/src/PhpWord/Element/AbstractContainer.php @@ -39,7 +39,7 @@ namespace PhpOffice\PhpWord\Element; * @method Image addImage(string $source, mixed $style = null, bool $isWatermark = false) * @method Object addObject(string $source, mixed $style = null) * @method TextBox addTextBox(mixed $style = null) - * @method Field addField(string $type = null, array $properties = array(), array $options = array()) + * @method Field addField(string $type = null, array $properties = array(), array $options = array(), mixed $text = null) * @method Line addLine(mixed $lineStyle = null) * @method Shape addShape(string $type, mixed $style = null) * @method Chart addChart(string $type, array $categories, array $values, array $style = null) diff --git a/src/PhpWord/Element/Field.php b/src/PhpWord/Element/Field.php index 48dc1d2e..380d7a92 100644 --- a/src/PhpWord/Element/Field.php +++ b/src/PhpWord/Element/Field.php @@ -40,7 +40,8 @@ class Field extends AbstractElement ), 'NUMPAGES'=>array( 'properties'=>array( - 'format' => array('Arabic', 'ArabicDash', 'alphabetic', 'ALPHABETIC', 'roman', 'ROMAN'), + 'format' => array('Arabic', 'ArabicDash', 'CardText', 'DollarText', 'Ordinal', 'OrdText', + 'alphabetic', 'ALPHABETIC', 'roman', 'ROMAN', 'Caps', 'FirstCap', 'Lower', 'Upper'), 'numformat' => array('0', '0,00', '#.##0', '#.##0,00', '€ #.##0,00(€ #.##0,00)', '0%', '0,00%') ), 'options'=>array('PreserveFormat') @@ -52,6 +53,14 @@ class Field extends AbstractElement 'h:mm am/pm', 'h:mm:ss am/pm', 'HH:mm', 'HH:mm:ss') ), 'options'=>array('PreserveFormat', 'LunarCalendar', 'SakaEraCalendar', 'LastUsedFormat') + ), + 'XE'=>array( + 'properties' => array(), + 'options' => array('Bold', 'Italic') + ), + 'INDEX'=>array( + 'properties' => array(), + 'options' => array('PreserveFormat') ) ); @@ -62,6 +71,13 @@ class Field extends AbstractElement */ protected $type; + /** + * Field text + * + * @var TextRun | string + */ + protected $text; + /** * Field properties * @@ -82,12 +98,14 @@ class Field extends AbstractElement * @param string $type * @param array $properties * @param array $options + * @param TextRun | string $text */ - public function __construct($type = null, $properties = array(), $options = array()) + public function __construct($type = null, $properties = array(), $options = array(), $text = null) { $this->setType($type); $this->setProperties($properties); $this->setOptions($options); + $this->setText($text); } /** @@ -105,7 +123,7 @@ class Field extends AbstractElement if (isset($this->fieldsArray[$type])) { $this->type = $type; } else { - throw new \InvalidArgumentException("Invalid type"); + throw new \InvalidArgumentException("Invalid type '$type'"); } } return $this->type; @@ -135,7 +153,7 @@ class Field extends AbstractElement if (is_array($properties)) { foreach (array_keys($properties) as $propkey) { if (!(isset($this->fieldsArray[$this->type]['properties'][$propkey]))) { - throw new \InvalidArgumentException("Invalid property"); + throw new \InvalidArgumentException("Invalid property '$propkey'"); } } $this->properties = array_merge($this->properties, $properties); @@ -166,8 +184,8 @@ class Field extends AbstractElement { if (is_array($options)) { foreach (array_keys($options) as $optionkey) { - if (!(isset($this->fieldsArray[$this->type]['options'][$optionkey]))) { - throw new \InvalidArgumentException("Invalid option"); + if (!(isset($this->fieldsArray[$this->type]['options'][$optionkey])) && substr($optionkey, 0, 1) !== '\\') { + throw new \InvalidArgumentException("Invalid option '$optionkey', possible values are " . implode(', ', $this->fieldsArray[$this->type]['options'])); } } $this->options = array_merge($this->options, $options); @@ -184,4 +202,35 @@ class Field extends AbstractElement { return $this->options; } + + /** + * Set Field text + * + * @param string | TextRun $text + * + * @return string | TextRun + * + * @throws \InvalidArgumentException + */ + public function setText($text) + { + if (isset($text)) { + if (is_string($text) || $text instanceof TextRun) { + $this->text = $text; + } else { + throw new \InvalidArgumentException("Invalid text"); + } + } + return $this->text; + } + + /** + * Get Field text + * + * @return string | TextRun + */ + public function getText() + { + return $this->text; + } } diff --git a/src/PhpWord/Writer/Word2007/Element/Field.php b/src/PhpWord/Writer/Word2007/Element/Field.php index ae4c66ba..9fc45b21 100644 --- a/src/PhpWord/Writer/Word2007/Element/Field.php +++ b/src/PhpWord/Writer/Word2007/Element/Field.php @@ -37,16 +37,90 @@ class Field extends Text return; } + $this->startElementP(); + + $xmlWriter->startElement('w:r'); + $xmlWriter->startElement('w:fldChar'); + $xmlWriter->writeAttribute('w:fldCharType', 'begin'); + $xmlWriter->endElement(); // w:fldChar + $xmlWriter->endElement(); // w:r + $instruction = ' ' . $element->getType() . ' '; + if ($element->getText() != null) { + if (is_string($element->getText())) { + $instruction .= '"' . $element->getText() . '" '; + $instruction .= $this->buildPropertiesAndOptions($element); + } else { + $instruction .= '"'; + } + } else { + $instruction .= $this->buildPropertiesAndOptions($element); + } + $xmlWriter->startElement('w:r'); + $xmlWriter->startElement('w:instrText'); + $xmlWriter->writeAttribute('xml:space', 'preserve'); + $xmlWriter->text($instruction); + $xmlWriter->endElement(); // w:instrText + $xmlWriter->endElement(); // w:r + + if ($element->getText() != null) { + if ($element->getText() instanceof \PhpOffice\PhpWord\Element\TextRun) { + + $containerWriter = new Container($xmlWriter, $element->getText(), true); + $containerWriter->write(); + + $xmlWriter->startElement('w:r'); + $xmlWriter->startElement('w:instrText'); + $xmlWriter->text('"' . $this->buildPropertiesAndOptions($element)); + $xmlWriter->endElement(); // w:instrText + $xmlWriter->endElement(); // w:r + + $xmlWriter->startElement('w:r'); + $xmlWriter->startElement('w:instrText'); + $xmlWriter->writeAttribute('xml:space', 'preserve'); + $xmlWriter->text(' '); + $xmlWriter->endElement(); // w:instrText + $xmlWriter->endElement(); // w:r + } + } + + $xmlWriter->startElement('w:r'); + $xmlWriter->startElement('w:fldChar'); + $xmlWriter->writeAttribute('w:fldCharType', 'separate'); + $xmlWriter->endElement(); // w:fldChar + $xmlWriter->endElement(); // w:r + + $xmlWriter->startElement('w:r'); + $xmlWriter->startElement('w:rPr'); + $xmlWriter->startElement('w:noProof'); + $xmlWriter->endElement(); // w:noProof + $xmlWriter->endElement(); // w:rPr + $xmlWriter->writeElement('w:t', $element->getText() != null && is_string($element->getText()) ? $element->getText() : '1'); + $xmlWriter->endElement(); // w:r + + $xmlWriter->startElement('w:r'); + $xmlWriter->startElement('w:fldChar'); + $xmlWriter->writeAttribute('w:fldCharType', 'end'); + $xmlWriter->endElement(); // w:fldChar + $xmlWriter->endElement(); // w:r + + $this->endElementP(); // w:p + } + + private function buildPropertiesAndOptions(\PhpOffice\PhpWord\Element\Field $element) + { + $propertiesAndOptions = ''; $properties = $element->getProperties(); foreach ($properties as $propkey => $propval) { switch ($propkey) { case 'format': + $propertiesAndOptions.= '\* ' . $propval . ' '; + break; case 'numformat': - $instruction .= '\* ' . $propval . ' '; + $propertiesAndOptions.= '\# ' . $propval . ' '; break; case 'dateformat': - $instruction .= '\@ "' . $propval . '" '; + $propertiesAndOptions.= '\@ "' . $propval . '" '; break; } } @@ -55,34 +129,27 @@ class Field extends Text foreach ($options as $option) { switch ($option) { case 'PreserveFormat': - $instruction .= '\* MERGEFORMAT '; + $propertiesAndOptions.= '\* MERGEFORMAT '; break; case 'LunarCalendar': - $instruction .= '\h '; + $propertiesAndOptions.= '\h '; break; case 'SakaEraCalendar': - $instruction .= '\s '; + $propertiesAndOptions.= '\s '; break; case 'LastUsedFormat': - $instruction .= '\l '; + $propertiesAndOptions.= '\l '; break; + case 'Bold': + $propertiesAndOptions.= '\b '; + break; + case 'Italic': + $propertiesAndOptions.= '\i '; + break; + default: + $propertiesAndOptions.= $option .' '; } } - - $this->startElementP(); - - $xmlWriter->startElement('w:fldSimple'); - $xmlWriter->writeAttribute('w:instr', $instruction); - $xmlWriter->startElement('w:r'); - $xmlWriter->startElement('w:rPr'); - $xmlWriter->startElement('w:noProof'); - $xmlWriter->endElement(); // w:noProof - $xmlWriter->endElement(); // w:rPr - - $xmlWriter->writeElement('w:t', '1'); - $xmlWriter->endElement(); // w:r - $xmlWriter->endElement(); // w:fldSimple - - $this->endElementP(); // w:p + return $propertiesAndOptions; } } diff --git a/tests/PhpWord/Element/FieldTest.php b/tests/PhpWord/Element/FieldTest.php index b9afad1f..6f5ebbbf 100644 --- a/tests/PhpWord/Element/FieldTest.php +++ b/tests/PhpWord/Element/FieldTest.php @@ -70,6 +70,47 @@ class FieldTest extends \PHPUnit_Framework_TestCase $this->assertEquals(array('SakaEraCalendar', 'PreserveFormat'), $oField->getOptions()); } + /** + * New instance with type and properties and options and text + */ + public function testConstructWithTypePropertiesOptionsText() + { + $oField = new Field('XE', array(), array('Bold', 'Italic'), 'FieldValue'); + + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Field', $oField); + $this->assertEquals('XE', $oField->getType()); + $this->assertEquals(array(), $oField->getProperties()); + $this->assertEquals(array('Bold', 'Italic'), $oField->getOptions()); + $this->assertEquals('FieldValue', $oField->getText()); + } + + /** + * New instance with type and properties and options and text as TextRun + */ + public function testConstructWithTypePropertiesOptionsTextAsTextRun() + { + $textRun = new TextRun(); + $textRun->addText('test string'); + + $oField = new Field('XE', array(), array('Bold', 'Italic'), $textRun); + + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Field', $oField); + $this->assertEquals('XE', $oField->getType()); + $this->assertEquals(array(), $oField->getProperties()); + $this->assertEquals(array('Bold', 'Italic'), $oField->getOptions()); + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\TextRun', $oField->getText()); + } + + public function testConstructWithOptionValue() + { + $oField = new Field('INDEX', array(), array('\\c "3" \\h "A"')); + + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Field', $oField); + $this->assertEquals('INDEX', $oField->getType()); + $this->assertEquals(array(), $oField->getProperties()); + $this->assertEquals(array('\\c "3" \\h "A"'), $oField->getOptions()); + } + /** * Test setType exception * @@ -105,4 +146,16 @@ class FieldTest extends \PHPUnit_Framework_TestCase $object = new Field('PAGE'); $object->setOptions(array('foo' => 'bar')); } + + /** + * Test setText exception + * + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Invalid text + */ + public function testSetTextException() + { + $object = new Field('XE'); + $object->setText(array()); + } } diff --git a/tests/PhpWord/Writer/Word2007/ElementTest.php b/tests/PhpWord/Writer/Word2007/ElementTest.php index 027ba86a..b3c7b197 100644 --- a/tests/PhpWord/Writer/Word2007/ElementTest.php +++ b/tests/PhpWord/Writer/Word2007/ElementTest.php @@ -19,6 +19,7 @@ namespace PhpOffice\PhpWord\Writer\Word2007; use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\TestHelperDOCX; +use PhpOffice\PhpWord\Element\TextRun; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Element subnamespace @@ -192,6 +193,51 @@ class ElementTest extends \PHPUnit_Framework_TestCase } } + public function testFieldElement() + { + $phpWord = new PhpWord(); + $section = $phpWord->addSection(); + + $section->addField('INDEX', array(), array('\\c "3"')); + $section->addField('XE', array(), array('Bold', 'Italic'), 'Index Entry'); + $section->addField('DATE', array('dateformat' => 'd-M-yyyy'), array('PreserveFormat', 'LastUsedFormat')); + $section->addField('DATE', array(), array('LunarCalendar')); + $section->addField('DATE', array(), array('SakaEraCalendar')); + $section->addField('NUMPAGES', array('format' => 'roman', 'numformat' => '0,00'), array('SakaEraCalendar')); + $doc = TestHelperDOCX::getDocument($phpWord); + + $element = '/w:document/w:body/w:p/w:r/w:instrText'; + $this->assertTrue($doc->elementExists($element)); + $this->assertEquals(' INDEX \\c "3" ', $doc->getElement($element)->textContent); + } + + public function testFieldElementWithComplexText() + { + $phpWord = new PhpWord(); + $section = $phpWord->addSection(); + + $text = new TextRun(); + $text->addText('test string', array('bold' => true)); + + $section->addField('XE', array(), array('Bold', 'Italic'), $text); + $doc = TestHelperDOCX::getDocument($phpWord); + + $element = '/w:document/w:body/w:p/w:r[2]/w:instrText'; + $this->assertTrue($doc->elementExists($element)); + $this->assertEquals(' XE "', $doc->getElement($element)->textContent); + + $element = '/w:document/w:body/w:p/w:r[3]/w:rPr/w:b'; + $this->assertTrue($doc->elementExists($element)); + + $element = '/w:document/w:body/w:p/w:r[3]/w:t'; + $this->assertTrue($doc->elementExists($element)); + $this->assertEquals('test string', $doc->getElement($element)->textContent); + + $element = '/w:document/w:body/w:p/w:r[4]/w:instrText'; + $this->assertTrue($doc->elementExists($element)); + $this->assertEquals('"\\b \\i ', $doc->getElement($element)->textContent); + } + /** * Test form fields */ From 743dbff9d4ab6e32a45284acd1eacdd9884ac183 Mon Sep 17 00:00:00 2001 From: troosan Date: Mon, 18 Sep 2017 22:35:27 +0200 Subject: [PATCH 094/370] use php 5.3 array construct --- samples/Sample_27_Field.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/Sample_27_Field.php b/samples/Sample_27_Field.php index b5be12ca..ec9dbe25 100644 --- a/samples/Sample_27_Field.php +++ b/samples/Sample_27_Field.php @@ -28,7 +28,7 @@ $textrun->addText('here:'); $indexEntryText = new TextRun(); $indexEntryText->addText('My '); -$indexEntryText->addText('bold index', ['bold' => true]); +$indexEntryText->addText('bold index', array('bold' => true)); $indexEntryText->addText(' entry'); $textrun = $section->addTextRun(); From 0be9ae335362d83f80230c68ca5704e5e8c5cc7b Mon Sep 17 00:00:00 2001 From: troosan Date: Mon, 25 Sep 2017 07:00:58 +0200 Subject: [PATCH 095/370] Fix php-cs option --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fbcc4dd5..f2730575 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,7 +47,7 @@ script: ## PHP_CodeSniffer - if [ -z "$COVERAGE" ]; then ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip ; fi ## PHP-CS-Fixer - - if [ -z "$COVERAGE" ]; then ./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run --cache-dir=$HOME/.php-cs-fixer ; fi + - if [ -z "$COVERAGE" ]; then ./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run --cache-file=$HOME/.php-cs-fixer ; fi ## PHP Mess Detector - if [ -z "$COVERAGE" ]; then ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php ; fi ## PHPUnit From 3f3f398524aea7936f9464db8888affeb7fadd2d Mon Sep 17 00:00:00 2001 From: troosan Date: Mon, 25 Sep 2017 21:30:59 +0200 Subject: [PATCH 096/370] php-cs fix --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f2730575..0f4d2532 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ cache: directories: - vendor - $HOME/.composer/cache - - $HOME/.php-cs-fixer + - .php-cs.cache env: global: @@ -47,7 +47,7 @@ script: ## PHP_CodeSniffer - if [ -z "$COVERAGE" ]; then ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip ; fi ## PHP-CS-Fixer - - if [ -z "$COVERAGE" ]; then ./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run --cache-file=$HOME/.php-cs-fixer ; fi + - if [ -n "$COVERAGE" ]; then ./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run --cache-file=.php-cs.cache ; fi ## PHP Mess Detector - if [ -z "$COVERAGE" ]; then ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php ; fi ## PHPUnit From 5364feb6c86a902584c350674e85b8bb11ff6c9c Mon Sep 17 00:00:00 2001 From: troosan Date: Mon, 25 Sep 2017 22:48:53 +0200 Subject: [PATCH 097/370] remove cache-file option --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0f4d2532..0ec84081 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,7 +47,7 @@ script: ## PHP_CodeSniffer - if [ -z "$COVERAGE" ]; then ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip ; fi ## PHP-CS-Fixer - - if [ -n "$COVERAGE" ]; then ./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run --cache-file=.php-cs.cache ; fi + - if [ -n "$COVERAGE" ]; then ./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run ; fi ## PHP Mess Detector - if [ -z "$COVERAGE" ]; then ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php ; fi ## PHPUnit From e0a2c40fb4c777c5f09fdcd6033e0b008e3493ea Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 26 Sep 2017 08:01:28 +0200 Subject: [PATCH 098/370] fix failing test --- tests/bootstrap.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index e75a1c34..1fcdbc40 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -14,7 +14,6 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ - require_once __DIR__ . '/../bootstrap.php'; date_default_timezone_set('UTC'); From cb469b973ee44183dbe3df1497a53a4c8acfef97 Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 26 Sep 2017 17:34:57 +0200 Subject: [PATCH 099/370] more fixes --- .php_cs.dist | 4 ++-- src/PhpWord/Collection/AbstractCollection.php | 2 +- src/PhpWord/Collection/Bookmarks.php | 1 + src/PhpWord/Collection/Charts.php | 1 + src/PhpWord/Collection/Comments.php | 1 + src/PhpWord/Collection/Endnotes.php | 1 + src/PhpWord/Collection/Footnotes.php | 1 + src/PhpWord/Collection/Titles.php | 1 + .../ComplexType/FootnoteProperties.php | 1 + src/PhpWord/ComplexType/ProofState.php | 1 + src/PhpWord/ComplexType/TrackChangesView.php | 1 + src/PhpWord/Element/AbstractContainer.php | 1 + src/PhpWord/Element/AbstractElement.php | 1 + src/PhpWord/Element/Bookmark.php | 1 + src/PhpWord/Element/Cell.php | 1 + src/PhpWord/Element/Chart.php | 3 +-- src/PhpWord/Element/CheckBox.php | 1 + src/PhpWord/Element/Comment.php | 1 + src/PhpWord/Element/Endnote.php | 1 + src/PhpWord/Element/Field.php | 1 + src/PhpWord/Element/Footer.php | 2 +- src/PhpWord/Element/Footnote.php | 1 + src/PhpWord/Element/FormField.php | 1 + src/PhpWord/Element/Header.php | 1 + src/PhpWord/Element/Image.php | 1 + src/PhpWord/Element/Line.php | 1 + src/PhpWord/Element/Link.php | 1 + src/PhpWord/Element/ListItem.php | 1 + src/PhpWord/Element/ListItemRun.php | 1 + src/PhpWord/Element/Object.php | 2 +- src/PhpWord/Element/PageBreak.php | 1 + src/PhpWord/Element/PreserveText.php | 1 + src/PhpWord/Element/Row.php | 1 + src/PhpWord/Element/SDT.php | 1 + src/PhpWord/Element/Section.php | 2 +- src/PhpWord/Element/Shape.php | 1 + src/PhpWord/Element/TOC.php | 3 +-- src/PhpWord/Element/Table.php | 2 +- src/PhpWord/Element/Text.php | 1 + src/PhpWord/Element/TextBox.php | 1 + src/PhpWord/Element/TextBreak.php | 1 + src/PhpWord/Element/TextRun.php | 1 + src/PhpWord/Element/Title.php | 1 + src/PhpWord/Element/TrackChange.php | 1 + src/PhpWord/Escaper/AbstractEscaper.php | 1 + src/PhpWord/Escaper/EscaperInterface.php | 1 + src/PhpWord/Escaper/RegExp.php | 1 + src/PhpWord/Escaper/Rtf.php | 1 + src/PhpWord/Escaper/Xml.php | 1 + src/PhpWord/Exception/CopyFileException.php | 1 + .../CreateTemporaryFileException.php | 1 + src/PhpWord/Exception/Exception.php | 1 + .../Exception/InvalidImageException.php | 1 + .../Exception/InvalidObjectException.php | 1 + .../Exception/InvalidStyleException.php | 1 + .../UnsupportedImageTypeException.php | 1 + src/PhpWord/IOFactory.php | 1 + src/PhpWord/Media.php | 1 + src/PhpWord/Metadata/Compatibility.php | 1 + src/PhpWord/Metadata/DocInfo.php | 1 + src/PhpWord/Metadata/Protection.php | 1 + src/PhpWord/Metadata/Settings.php | 1 + src/PhpWord/PhpWord.php | 3 +-- src/PhpWord/Reader/AbstractReader.php | 1 + src/PhpWord/Reader/HTML.php | 1 + src/PhpWord/Reader/MsDoc.php | 1 + src/PhpWord/Reader/ODText.php | 2 +- src/PhpWord/Reader/ODText/AbstractPart.php | 1 + src/PhpWord/Reader/ODText/Content.php | 2 +- src/PhpWord/Reader/ODText/Meta.php | 2 +- src/PhpWord/Reader/RTF.php | 1 + src/PhpWord/Reader/RTF/Document.php | 22 +------------------ src/PhpWord/Reader/ReaderInterface.php | 1 + src/PhpWord/Reader/Word2007.php | 2 +- src/PhpWord/Reader/Word2007/AbstractPart.php | 5 +---- src/PhpWord/Reader/Word2007/DocPropsApp.php | 1 + src/PhpWord/Reader/Word2007/DocPropsCore.php | 2 +- .../Reader/Word2007/DocPropsCustom.php | 2 +- src/PhpWord/Reader/Word2007/Document.php | 1 + src/PhpWord/Reader/Word2007/Endnotes.php | 1 + src/PhpWord/Reader/Word2007/Footnotes.php | 2 +- src/PhpWord/Reader/Word2007/Numbering.php | 1 + src/PhpWord/Reader/Word2007/Settings.php | 1 + src/PhpWord/Reader/Word2007/Styles.php | 1 + src/PhpWord/Settings.php | 3 +-- src/PhpWord/Shared/Converter.php | 1 + src/PhpWord/Shared/Html.php | 8 +------ src/PhpWord/Shared/ZipArchive.php | 1 + src/PhpWord/SimpleType/Jc.php | 1 + src/PhpWord/SimpleType/JcTable.php | 1 + src/PhpWord/SimpleType/NumberFormat.php | 1 + src/PhpWord/SimpleType/Zoom.php | 1 + src/PhpWord/Style.php | 1 + src/PhpWord/Style/AbstractStyle.php | 1 + src/PhpWord/Style/Border.php | 1 + src/PhpWord/Style/Cell.php | 1 + src/PhpWord/Style/Chart.php | 1 + src/PhpWord/Style/Extrusion.php | 1 + src/PhpWord/Style/Fill.php | 1 + src/PhpWord/Style/Font.php | 1 + src/PhpWord/Style/Frame.php | 1 + src/PhpWord/Style/Image.php | 1 + src/PhpWord/Style/Indentation.php | 1 + src/PhpWord/Style/Line.php | 1 + src/PhpWord/Style/LineNumbering.php | 1 + src/PhpWord/Style/ListItem.php | 1 + src/PhpWord/Style/Numbering.php | 1 + src/PhpWord/Style/NumberingLevel.php | 1 + src/PhpWord/Style/Outline.php | 1 + src/PhpWord/Style/Paper.php | 1 + src/PhpWord/Style/Paragraph.php | 1 + src/PhpWord/Style/Row.php | 1 + src/PhpWord/Style/Section.php | 1 + src/PhpWord/Style/Shading.php | 1 + src/PhpWord/Style/Shadow.php | 1 + src/PhpWord/Style/Shape.php | 1 + src/PhpWord/Style/Spacing.php | 1 + src/PhpWord/Style/TOC.php | 1 + src/PhpWord/Style/Tab.php | 1 + src/PhpWord/Style/Table.php | 1 + src/PhpWord/Style/TextBox.php | 8 +------ src/PhpWord/Template.php | 1 + src/PhpWord/TemplateProcessor.php | 1 + src/PhpWord/Writer/AbstractWriter.php | 1 + src/PhpWord/Writer/HTML.php | 1 + .../Writer/HTML/Element/AbstractElement.php | 2 +- src/PhpWord/Writer/HTML/Element/Container.php | 1 + src/PhpWord/Writer/HTML/Element/Endnote.php | 1 + src/PhpWord/Writer/HTML/Element/Footnote.php | 1 + src/PhpWord/Writer/HTML/Element/Image.php | 1 + src/PhpWord/Writer/HTML/Element/Link.php | 1 + src/PhpWord/Writer/HTML/Element/ListItem.php | 1 + src/PhpWord/Writer/HTML/Element/PageBreak.php | 1 + src/PhpWord/Writer/HTML/Element/Table.php | 1 + src/PhpWord/Writer/HTML/Element/Text.php | 1 + src/PhpWord/Writer/HTML/Element/TextBreak.php | 1 + src/PhpWord/Writer/HTML/Element/TextRun.php | 1 + src/PhpWord/Writer/HTML/Element/Title.php | 1 + src/PhpWord/Writer/HTML/Part/AbstractPart.php | 1 + src/PhpWord/Writer/HTML/Part/Body.php | 1 + src/PhpWord/Writer/HTML/Part/Head.php | 1 + .../Writer/HTML/Style/AbstractStyle.php | 2 +- src/PhpWord/Writer/HTML/Style/Font.php | 1 + src/PhpWord/Writer/HTML/Style/Generic.php | 1 + src/PhpWord/Writer/HTML/Style/Image.php | 1 + src/PhpWord/Writer/HTML/Style/Paragraph.php | 1 + src/PhpWord/Writer/ODText.php | 2 +- .../Writer/ODText/Element/AbstractElement.php | 1 + .../Writer/ODText/Element/Container.php | 1 + src/PhpWord/Writer/ODText/Element/Image.php | 1 + src/PhpWord/Writer/ODText/Element/Link.php | 1 + src/PhpWord/Writer/ODText/Element/Table.php | 1 + src/PhpWord/Writer/ODText/Element/Text.php | 1 + .../Writer/ODText/Element/TextBreak.php | 1 + src/PhpWord/Writer/ODText/Element/TextRun.php | 1 + src/PhpWord/Writer/ODText/Element/Title.php | 1 + .../Writer/ODText/Part/AbstractPart.php | 3 +-- src/PhpWord/Writer/ODText/Part/Content.php | 6 +---- src/PhpWord/Writer/ODText/Part/Manifest.php | 1 + src/PhpWord/Writer/ODText/Part/Meta.php | 2 +- src/PhpWord/Writer/ODText/Part/Mimetype.php | 1 + src/PhpWord/Writer/ODText/Part/Styles.php | 1 + .../Writer/ODText/Style/AbstractStyle.php | 1 + src/PhpWord/Writer/ODText/Style/Font.php | 3 +-- src/PhpWord/Writer/ODText/Style/Image.php | 3 +-- src/PhpWord/Writer/ODText/Style/Paragraph.php | 3 +-- src/PhpWord/Writer/ODText/Style/Section.php | 1 + src/PhpWord/Writer/ODText/Style/Table.php | 3 +-- src/PhpWord/Writer/PDF.php | 1 + src/PhpWord/Writer/PDF/AbstractRenderer.php | 1 + src/PhpWord/Writer/PDF/DomPDF.php | 2 +- src/PhpWord/Writer/PDF/MPDF.php | 2 +- src/PhpWord/Writer/PDF/TCPDF.php | 1 + src/PhpWord/Writer/RTF.php | 1 + .../Writer/RTF/Element/AbstractElement.php | 1 + src/PhpWord/Writer/RTF/Element/Container.php | 1 + src/PhpWord/Writer/RTF/Element/Image.php | 1 + src/PhpWord/Writer/RTF/Element/Link.php | 1 + src/PhpWord/Writer/RTF/Element/ListItem.php | 1 + src/PhpWord/Writer/RTF/Element/PageBreak.php | 1 + src/PhpWord/Writer/RTF/Element/Table.php | 1 + src/PhpWord/Writer/RTF/Element/Text.php | 1 + src/PhpWord/Writer/RTF/Element/TextBreak.php | 1 + src/PhpWord/Writer/RTF/Element/TextRun.php | 1 + src/PhpWord/Writer/RTF/Element/Title.php | 1 + src/PhpWord/Writer/RTF/Part/AbstractPart.php | 1 + src/PhpWord/Writer/RTF/Part/Document.php | 1 + src/PhpWord/Writer/RTF/Part/Header.php | 6 +---- .../Writer/RTF/Style/AbstractStyle.php | 1 + src/PhpWord/Writer/RTF/Style/Border.php | 1 + src/PhpWord/Writer/RTF/Style/Font.php | 1 + src/PhpWord/Writer/RTF/Style/Paragraph.php | 2 +- src/PhpWord/Writer/RTF/Style/Section.php | 1 + src/PhpWord/Writer/Word2007.php | 1 + .../Word2007/Element/AbstractElement.php | 1 + .../Writer/Word2007/Element/Bookmark.php | 1 + src/PhpWord/Writer/Word2007/Element/Chart.php | 3 +-- .../Writer/Word2007/Element/CheckBox.php | 1 + .../Writer/Word2007/Element/Container.php | 3 +-- .../Writer/Word2007/Element/Endnote.php | 1 + src/PhpWord/Writer/Word2007/Element/Field.php | 1 + .../Writer/Word2007/Element/Footnote.php | 3 +-- .../Writer/Word2007/Element/FormField.php | 1 + src/PhpWord/Writer/Word2007/Element/Image.php | 7 +----- src/PhpWord/Writer/Word2007/Element/Line.php | 1 + src/PhpWord/Writer/Word2007/Element/Link.php | 3 +-- .../Writer/Word2007/Element/ListItem.php | 3 +-- .../Writer/Word2007/Element/ListItemRun.php | 3 +-- .../Writer/Word2007/Element/Object.php | 3 +-- .../Writer/Word2007/Element/PageBreak.php | 2 +- .../Word2007/Element/ParagraphAlignment.php | 1 + .../Writer/Word2007/Element/PreserveText.php | 3 +-- src/PhpWord/Writer/Word2007/Element/SDT.php | 6 +---- src/PhpWord/Writer/Word2007/Element/Shape.php | 8 +------ src/PhpWord/Writer/Word2007/Element/TOC.php | 6 +---- src/PhpWord/Writer/Word2007/Element/Table.php | 1 + .../Word2007/Element/TableAlignment.php | 1 + src/PhpWord/Writer/Word2007/Element/Text.php | 3 +-- .../Writer/Word2007/Element/TextBox.php | 3 +-- .../Writer/Word2007/Element/TextBreak.php | 3 +-- .../Writer/Word2007/Element/TextRun.php | 3 +-- src/PhpWord/Writer/Word2007/Element/Title.php | 3 +-- .../Writer/Word2007/Part/AbstractPart.php | 1 + src/PhpWord/Writer/Word2007/Part/Chart.php | 1 + src/PhpWord/Writer/Word2007/Part/Comments.php | 2 +- .../Writer/Word2007/Part/ContentTypes.php | 1 + .../Writer/Word2007/Part/DocPropsApp.php | 1 + .../Writer/Word2007/Part/DocPropsCore.php | 1 + .../Writer/Word2007/Part/DocPropsCustom.php | 1 + src/PhpWord/Writer/Word2007/Part/Document.php | 3 +-- src/PhpWord/Writer/Word2007/Part/Endnotes.php | 1 + .../Writer/Word2007/Part/FontTable.php | 1 + src/PhpWord/Writer/Word2007/Part/Footer.php | 1 + .../Writer/Word2007/Part/Footnotes.php | 2 +- src/PhpWord/Writer/Word2007/Part/Header.php | 1 + .../Writer/Word2007/Part/Numbering.php | 4 +--- src/PhpWord/Writer/Word2007/Part/Rels.php | 1 + .../Writer/Word2007/Part/RelsDocument.php | 1 + src/PhpWord/Writer/Word2007/Part/RelsPart.php | 1 + src/PhpWord/Writer/Word2007/Part/Settings.php | 1 + src/PhpWord/Writer/Word2007/Part/Styles.php | 1 + src/PhpWord/Writer/Word2007/Part/Theme.php | 1 + .../Writer/Word2007/Part/WebSettings.php | 1 + .../Writer/Word2007/Style/AbstractStyle.php | 2 +- src/PhpWord/Writer/Word2007/Style/Cell.php | 4 +--- .../Writer/Word2007/Style/Extrusion.php | 1 + src/PhpWord/Writer/Word2007/Style/Fill.php | 3 +-- src/PhpWord/Writer/Word2007/Style/Font.php | 1 + src/PhpWord/Writer/Word2007/Style/Frame.php | 1 + src/PhpWord/Writer/Word2007/Style/Image.php | 1 + .../Writer/Word2007/Style/Indentation.php | 3 +-- src/PhpWord/Writer/Word2007/Style/Line.php | 1 + .../Writer/Word2007/Style/LineNumbering.php | 1 + .../Writer/Word2007/Style/MarginBorder.php | 1 + src/PhpWord/Writer/Word2007/Style/Outline.php | 1 + .../Writer/Word2007/Style/Paragraph.php | 1 + src/PhpWord/Writer/Word2007/Style/Row.php | 1 + src/PhpWord/Writer/Word2007/Style/Section.php | 1 + src/PhpWord/Writer/Word2007/Style/Shading.php | 1 + src/PhpWord/Writer/Word2007/Style/Shadow.php | 1 + src/PhpWord/Writer/Word2007/Style/Shape.php | 3 +-- src/PhpWord/Writer/Word2007/Style/Spacing.php | 3 +-- src/PhpWord/Writer/Word2007/Style/Tab.php | 1 + src/PhpWord/Writer/Word2007/Style/Table.php | 10 +-------- src/PhpWord/Writer/Word2007/Style/TextBox.php | 1 + src/PhpWord/Writer/WriterInterface.php | 1 + tests/PhpWord/Collection/CollectionTest.php | 1 + .../ComplexType/FootnotePropertiesTest.php | 1 + tests/PhpWord/Element/AbstractElementTest.php | 1 + tests/PhpWord/Element/CellTest.php | 1 + tests/PhpWord/Element/CheckBoxTest.php | 1 + tests/PhpWord/Element/CommentTest.php | 1 + tests/PhpWord/Element/FieldTest.php | 1 + tests/PhpWord/Element/FooterTest.php | 1 + tests/PhpWord/Element/FootnoteTest.php | 1 + tests/PhpWord/Element/HeaderTest.php | 1 + tests/PhpWord/Element/ImageTest.php | 1 + tests/PhpWord/Element/LineTest.php | 1 + tests/PhpWord/Element/LinkTest.php | 1 + tests/PhpWord/Element/ListItemRunTest.php | 1 + tests/PhpWord/Element/ListItemTest.php | 1 + tests/PhpWord/Element/ObjectTest.php | 1 + tests/PhpWord/Element/PageBreakTest.php | 1 + tests/PhpWord/Element/PreserveTextTest.php | 1 + tests/PhpWord/Element/RowTest.php | 1 + tests/PhpWord/Element/SDTTest.php | 1 + tests/PhpWord/Element/SectionTest.php | 1 + tests/PhpWord/Element/TOCTest.php | 1 + tests/PhpWord/Element/TableTest.php | 1 + tests/PhpWord/Element/TextBoxTest.php | 1 + tests/PhpWord/Element/TextBreakTest.php | 1 + tests/PhpWord/Element/TextRunTest.php | 1 + tests/PhpWord/Element/TextTest.php | 1 + tests/PhpWord/Element/TitleTest.php | 1 + .../Exception/CopyFileExceptionTest.php | 1 + .../CreateTemporaryFileExceptionTest.php | 1 + tests/PhpWord/Exception/ExceptionTest.php | 1 + .../Exception/InvalidImageExceptionTest.php | 1 + .../Exception/InvalidStyleExceptionTest.php | 1 + .../UnsupportedImageTypeExceptionTest.php | 1 + tests/PhpWord/IOFactoryTest.php | 1 + tests/PhpWord/MediaTest.php | 1 + tests/PhpWord/Metadata/DocInfoTest.php | 1 + tests/PhpWord/Metadata/SettingsTest.php | 1 + tests/PhpWord/PhpWordTest.php | 1 + tests/PhpWord/Reader/HTMLTest.php | 1 + tests/PhpWord/Reader/MsDocTest.php | 1 + tests/PhpWord/Reader/ODTextTest.php | 1 + tests/PhpWord/Reader/RTFTest.php | 1 + tests/PhpWord/Reader/Word2007Test.php | 1 + tests/PhpWord/SettingsTest.php | 1 + tests/PhpWord/Shared/ConverterTest.php | 1 + tests/PhpWord/Shared/HtmlTest.php | 1 + tests/PhpWord/Shared/ZipArchiveTest.php | 1 + tests/PhpWord/Style/AbstractStyleTest.php | 1 + tests/PhpWord/Style/CellTest.php | 1 + tests/PhpWord/Style/FontTest.php | 1 + tests/PhpWord/Style/ImageTest.php | 1 + tests/PhpWord/Style/IndentationTest.php | 1 + tests/PhpWord/Style/LineNumberingTest.php | 1 + tests/PhpWord/Style/LineTest.php | 1 + tests/PhpWord/Style/ListItemTest.php | 1 + tests/PhpWord/Style/NumberingLevelTest.php | 1 + tests/PhpWord/Style/NumberingTest.php | 1 + tests/PhpWord/Style/PaperTest.php | 1 + tests/PhpWord/Style/ParagraphTest.php | 1 + tests/PhpWord/Style/RowTest.php | 1 + tests/PhpWord/Style/SectionTest.php | 1 + tests/PhpWord/Style/ShadingTest.php | 1 + tests/PhpWord/Style/SpacingTest.php | 1 + tests/PhpWord/Style/TOCTest.php | 1 + tests/PhpWord/Style/TabTest.php | 1 + tests/PhpWord/Style/TableTest.php | 1 + tests/PhpWord/Style/TextBoxTest.php | 1 + tests/PhpWord/StyleTest.php | 1 + tests/PhpWord/TemplateProcessorTest.php | 1 + tests/PhpWord/Writer/HTML/ElementTest.php | 1 + tests/PhpWord/Writer/HTML/PartTest.php | 1 + tests/PhpWord/Writer/HTML/StyleTest.php | 1 + tests/PhpWord/Writer/HTMLTest.php | 1 + tests/PhpWord/Writer/ODText/ElementTest.php | 1 + .../Writer/ODText/Part/AbstractPartTest.php | 1 + .../Writer/ODText/Part/ContentTest.php | 1 + tests/PhpWord/Writer/ODText/StyleTest.php | 1 + tests/PhpWord/Writer/ODTextTest.php | 1 + tests/PhpWord/Writer/PDF/DomPDFTest.php | 1 + tests/PhpWord/Writer/PDF/MPDFTest.php | 1 + tests/PhpWord/Writer/PDF/TCPDFTest.php | 1 + tests/PhpWord/Writer/PDFTest.php | 1 + tests/PhpWord/Writer/RTF/ElementTest.php | 1 + tests/PhpWord/Writer/RTF/StyleTest.php | 1 + tests/PhpWord/Writer/RTFTest.php | 1 + tests/PhpWord/Writer/Word2007/ElementTest.php | 1 + .../Writer/Word2007/Part/AbstractPartTest.php | 1 + .../Writer/Word2007/Part/CommentsTest.php | 1 + .../Writer/Word2007/Part/DocumentTest.php | 1 + .../Writer/Word2007/Part/FooterTest.php | 1 + .../Writer/Word2007/Part/FootnotesTest.php | 1 + .../Writer/Word2007/Part/HeaderTest.php | 1 + .../Writer/Word2007/Part/NumberingTest.php | 1 + .../Writer/Word2007/Part/SettingsTest.php | 1 + .../Writer/Word2007/Part/StylesTest.php | 1 + tests/PhpWord/Writer/Word2007/PartTest.php | 1 + .../Writer/Word2007/Style/FontTest.php | 1 + tests/PhpWord/Writer/Word2007/StyleTest.php | 1 + tests/PhpWord/Writer/Word2007Test.php | 1 + tests/PhpWord/_includes/TestHelperDOCX.php | 1 + tests/PhpWord/_includes/XmlDocument.php | 1 + 368 files changed, 369 insertions(+), 166 deletions(-) diff --git a/.php_cs.dist b/.php_cs.dist index d441972b..51a6117a 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -99,7 +99,7 @@ return PhpCsFixer\Config::create() 'phpdoc_inline_tag' => true, 'phpdoc_no_access' => true, 'phpdoc_no_alias_tag' => false, //@see instead of @link - 'phpdoc_no_empty_return' => false, //TODO: reactivate + 'phpdoc_no_empty_return' => true, 'phpdoc_no_package' => true, 'phpdoc_no_useless_inheritdoc' => true, 'phpdoc_order' => true, @@ -125,7 +125,7 @@ return PhpCsFixer\Config::create() 'silenced_deprecation_error' => true, 'simplified_null_return' => false, // While technically correct we prefer to be explicit when returning null 'single_blank_line_at_eof' => true, - 'single_blank_line_before_namespace' => false,//a lot of occurences TODO + 'single_blank_line_before_namespace' => true, 'single_class_element_per_statement' => true, 'single_import_per_statement' => true, 'single_line_after_imports' => true, diff --git a/src/PhpWord/Collection/AbstractCollection.php b/src/PhpWord/Collection/AbstractCollection.php index 39e8f1d3..f7f29785 100644 --- a/src/PhpWord/Collection/AbstractCollection.php +++ b/src/PhpWord/Collection/AbstractCollection.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Collection; /** @@ -60,7 +61,6 @@ abstract class AbstractCollection * * @param int $index * @param mixed $item - * @return void */ public function setItem($index, $item) { diff --git a/src/PhpWord/Collection/Bookmarks.php b/src/PhpWord/Collection/Bookmarks.php index d1a07755..c7bcc34f 100644 --- a/src/PhpWord/Collection/Bookmarks.php +++ b/src/PhpWord/Collection/Bookmarks.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Collection; /** diff --git a/src/PhpWord/Collection/Charts.php b/src/PhpWord/Collection/Charts.php index 117cdaf0..ad550a2c 100644 --- a/src/PhpWord/Collection/Charts.php +++ b/src/PhpWord/Collection/Charts.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Collection; /** diff --git a/src/PhpWord/Collection/Comments.php b/src/PhpWord/Collection/Comments.php index 75ee8a9b..828c56b7 100644 --- a/src/PhpWord/Collection/Comments.php +++ b/src/PhpWord/Collection/Comments.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Collection; /** diff --git a/src/PhpWord/Collection/Endnotes.php b/src/PhpWord/Collection/Endnotes.php index 11f2d136..f30f638f 100644 --- a/src/PhpWord/Collection/Endnotes.php +++ b/src/PhpWord/Collection/Endnotes.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Collection; /** diff --git a/src/PhpWord/Collection/Footnotes.php b/src/PhpWord/Collection/Footnotes.php index d93a6124..bb09e3ec 100644 --- a/src/PhpWord/Collection/Footnotes.php +++ b/src/PhpWord/Collection/Footnotes.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Collection; /** diff --git a/src/PhpWord/Collection/Titles.php b/src/PhpWord/Collection/Titles.php index 4c2cc6de..b2a81065 100644 --- a/src/PhpWord/Collection/Titles.php +++ b/src/PhpWord/Collection/Titles.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Collection; /** diff --git a/src/PhpWord/ComplexType/FootnoteProperties.php b/src/PhpWord/ComplexType/FootnoteProperties.php index b96b6255..6d0e45c1 100644 --- a/src/PhpWord/ComplexType/FootnoteProperties.php +++ b/src/PhpWord/ComplexType/FootnoteProperties.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\ComplexType; use PhpOffice\PhpWord\SimpleType\NumberFormat; diff --git a/src/PhpWord/ComplexType/ProofState.php b/src/PhpWord/ComplexType/ProofState.php index 2e91abbf..b41e2441 100644 --- a/src/PhpWord/ComplexType/ProofState.php +++ b/src/PhpWord/ComplexType/ProofState.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\ComplexType; /** diff --git a/src/PhpWord/ComplexType/TrackChangesView.php b/src/PhpWord/ComplexType/TrackChangesView.php index ed777a55..b74e5e3c 100644 --- a/src/PhpWord/ComplexType/TrackChangesView.php +++ b/src/PhpWord/ComplexType/TrackChangesView.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\ComplexType; /** diff --git a/src/PhpWord/Element/AbstractContainer.php b/src/PhpWord/Element/AbstractContainer.php index 7fddb6fc..75fb38b2 100644 --- a/src/PhpWord/Element/AbstractContainer.php +++ b/src/PhpWord/Element/AbstractContainer.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/src/PhpWord/Element/AbstractElement.php b/src/PhpWord/Element/AbstractElement.php index cdb6b0ee..00130170 100644 --- a/src/PhpWord/Element/AbstractElement.php +++ b/src/PhpWord/Element/AbstractElement.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\Media; diff --git a/src/PhpWord/Element/Bookmark.php b/src/PhpWord/Element/Bookmark.php index 5f304047..5bb93f65 100644 --- a/src/PhpWord/Element/Bookmark.php +++ b/src/PhpWord/Element/Bookmark.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\Common\Text as CommonText; diff --git a/src/PhpWord/Element/Cell.php b/src/PhpWord/Element/Cell.php index c01cfb4d..18f698c6 100644 --- a/src/PhpWord/Element/Cell.php +++ b/src/PhpWord/Element/Cell.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\Style\Cell as CellStyle; diff --git a/src/PhpWord/Element/Chart.php b/src/PhpWord/Element/Chart.php index 1a4ee327..0453bd95 100644 --- a/src/PhpWord/Element/Chart.php +++ b/src/PhpWord/Element/Chart.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\Style\Chart as ChartStyle; @@ -82,7 +83,6 @@ class Chart extends AbstractElement * Set type. * * @param string $value - * @return void */ public function setType($value) { @@ -95,7 +95,6 @@ class Chart extends AbstractElement * * @param array $categories * @param array $values - * @return void */ public function addSeries($categories, $values) { diff --git a/src/PhpWord/Element/CheckBox.php b/src/PhpWord/Element/CheckBox.php index 27f031a4..cf55166a 100644 --- a/src/PhpWord/Element/CheckBox.php +++ b/src/PhpWord/Element/CheckBox.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\Common\Text as CommonText; diff --git a/src/PhpWord/Element/Comment.php b/src/PhpWord/Element/Comment.php index 91a6cf78..6189afd9 100644 --- a/src/PhpWord/Element/Comment.php +++ b/src/PhpWord/Element/Comment.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/src/PhpWord/Element/Endnote.php b/src/PhpWord/Element/Endnote.php index 3b3d55f9..36ae66f3 100644 --- a/src/PhpWord/Element/Endnote.php +++ b/src/PhpWord/Element/Endnote.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\Style\Paragraph; diff --git a/src/PhpWord/Element/Field.php b/src/PhpWord/Element/Field.php index 6048530a..c9f50357 100644 --- a/src/PhpWord/Element/Field.php +++ b/src/PhpWord/Element/Field.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/src/PhpWord/Element/Footer.php b/src/PhpWord/Element/Footer.php index 5aaf802b..fa668dd7 100644 --- a/src/PhpWord/Element/Footer.php +++ b/src/PhpWord/Element/Footer.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** @@ -63,7 +64,6 @@ class Footer extends AbstractContainer * @since 0.10.0 * * @param string $value - * @return void */ public function setType($value = self::AUTO) { diff --git a/src/PhpWord/Element/Footnote.php b/src/PhpWord/Element/Footnote.php index e4e13b6b..7789b2db 100644 --- a/src/PhpWord/Element/Footnote.php +++ b/src/PhpWord/Element/Footnote.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\Style\Paragraph; diff --git a/src/PhpWord/Element/FormField.php b/src/PhpWord/Element/FormField.php index 77edcabd..19955416 100644 --- a/src/PhpWord/Element/FormField.php +++ b/src/PhpWord/Element/FormField.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/src/PhpWord/Element/Header.php b/src/PhpWord/Element/Header.php index 79faed90..2e2612b6 100644 --- a/src/PhpWord/Element/Header.php +++ b/src/PhpWord/Element/Header.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/src/PhpWord/Element/Image.php b/src/PhpWord/Element/Image.php index 25ca706c..46fb60a0 100644 --- a/src/PhpWord/Element/Image.php +++ b/src/PhpWord/Element/Image.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\Exception\CreateTemporaryFileException; diff --git a/src/PhpWord/Element/Line.php b/src/PhpWord/Element/Line.php index 3da26317..e94a5791 100644 --- a/src/PhpWord/Element/Line.php +++ b/src/PhpWord/Element/Line.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\Style\Line as LineStyle; diff --git a/src/PhpWord/Element/Link.php b/src/PhpWord/Element/Link.php index d41cd50c..d884fc71 100644 --- a/src/PhpWord/Element/Link.php +++ b/src/PhpWord/Element/Link.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\Common\Text as CommonText; diff --git a/src/PhpWord/Element/ListItem.php b/src/PhpWord/Element/ListItem.php index ce8e58d5..c1294908 100644 --- a/src/PhpWord/Element/ListItem.php +++ b/src/PhpWord/Element/ListItem.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\Common\Text as CommonText; diff --git a/src/PhpWord/Element/ListItemRun.php b/src/PhpWord/Element/ListItemRun.php index 061a9274..9a44dd50 100644 --- a/src/PhpWord/Element/ListItemRun.php +++ b/src/PhpWord/Element/ListItemRun.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\Style\ListItem as ListItemStyle; diff --git a/src/PhpWord/Element/Object.php b/src/PhpWord/Element/Object.php index cd32ab95..891b7d53 100644 --- a/src/PhpWord/Element/Object.php +++ b/src/PhpWord/Element/Object.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\Exception\InvalidObjectException; @@ -132,7 +133,6 @@ class Object extends AbstractElement * Set Image Relation ID. * * @param int $rId - * @return void */ public function setImageRelationId($rId) { diff --git a/src/PhpWord/Element/PageBreak.php b/src/PhpWord/Element/PageBreak.php index fc44700f..a2debaf6 100644 --- a/src/PhpWord/Element/PageBreak.php +++ b/src/PhpWord/Element/PageBreak.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/src/PhpWord/Element/PreserveText.php b/src/PhpWord/Element/PreserveText.php index 7a0aaa6d..e9fa4839 100644 --- a/src/PhpWord/Element/PreserveText.php +++ b/src/PhpWord/Element/PreserveText.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\Common\Text as CommonText; diff --git a/src/PhpWord/Element/Row.php b/src/PhpWord/Element/Row.php index 213f1450..f3d26ef5 100644 --- a/src/PhpWord/Element/Row.php +++ b/src/PhpWord/Element/Row.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\Style\Row as RowStyle; diff --git a/src/PhpWord/Element/SDT.php b/src/PhpWord/Element/SDT.php index 7135b060..2efefc1e 100644 --- a/src/PhpWord/Element/SDT.php +++ b/src/PhpWord/Element/SDT.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/src/PhpWord/Element/Section.php b/src/PhpWord/Element/Section.php index 6b6f770d..eb562586 100644 --- a/src/PhpWord/Element/Section.php +++ b/src/PhpWord/Element/Section.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\ComplexType\FootnoteProperties; @@ -72,7 +73,6 @@ class Section extends AbstractContainer * Set section style. * * @param array $style - * @return void */ public function setStyle($style = null) { diff --git a/src/PhpWord/Element/Shape.php b/src/PhpWord/Element/Shape.php index e5405468..a2412ce9 100644 --- a/src/PhpWord/Element/Shape.php +++ b/src/PhpWord/Element/Shape.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\Style\Shape as ShapeStyle; diff --git a/src/PhpWord/Element/TOC.php b/src/PhpWord/Element/TOC.php index c9b37e00..e01aec84 100644 --- a/src/PhpWord/Element/TOC.php +++ b/src/PhpWord/Element/TOC.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\PhpWord; @@ -130,7 +131,6 @@ class TOC extends AbstractElement * Set max depth. * * @param int $value - * @return void */ public function setMaxDepth($value) { @@ -151,7 +151,6 @@ class TOC extends AbstractElement * Set min depth. * * @param int $value - * @return void */ public function setMinDepth($value) { diff --git a/src/PhpWord/Element/Table.php b/src/PhpWord/Element/Table.php index 016d2a60..777b84e2 100644 --- a/src/PhpWord/Element/Table.php +++ b/src/PhpWord/Element/Table.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\Style\Table as TableStyle; @@ -120,7 +121,6 @@ class Table extends AbstractElement * Set table width. * * @param int $width - * @return void */ public function setWidth($width) { diff --git a/src/PhpWord/Element/Text.php b/src/PhpWord/Element/Text.php index 89c62ee7..f50f3366 100644 --- a/src/PhpWord/Element/Text.php +++ b/src/PhpWord/Element/Text.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\Common\Text as CommonText; diff --git a/src/PhpWord/Element/TextBox.php b/src/PhpWord/Element/TextBox.php index dbeaae92..b97a46d1 100644 --- a/src/PhpWord/Element/TextBox.php +++ b/src/PhpWord/Element/TextBox.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\Style\TextBox as TextBoxStyle; diff --git a/src/PhpWord/Element/TextBreak.php b/src/PhpWord/Element/TextBreak.php index 0a216e7a..da986f74 100644 --- a/src/PhpWord/Element/TextBreak.php +++ b/src/PhpWord/Element/TextBreak.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\Style\Font; diff --git a/src/PhpWord/Element/TextRun.php b/src/PhpWord/Element/TextRun.php index f114dcef..9a23470f 100644 --- a/src/PhpWord/Element/TextRun.php +++ b/src/PhpWord/Element/TextRun.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\Style\Paragraph; diff --git a/src/PhpWord/Element/Title.php b/src/PhpWord/Element/Title.php index dd1db965..40be3a2b 100644 --- a/src/PhpWord/Element/Title.php +++ b/src/PhpWord/Element/Title.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\Common\Text as CommonText; diff --git a/src/PhpWord/Element/TrackChange.php b/src/PhpWord/Element/TrackChange.php index df88ea8f..721c372a 100644 --- a/src/PhpWord/Element/TrackChange.php +++ b/src/PhpWord/Element/TrackChange.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/src/PhpWord/Escaper/AbstractEscaper.php b/src/PhpWord/Escaper/AbstractEscaper.php index d1309dfb..cb3fdfeb 100644 --- a/src/PhpWord/Escaper/AbstractEscaper.php +++ b/src/PhpWord/Escaper/AbstractEscaper.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Escaper; /** diff --git a/src/PhpWord/Escaper/EscaperInterface.php b/src/PhpWord/Escaper/EscaperInterface.php index a77da3c5..45f7f301 100644 --- a/src/PhpWord/Escaper/EscaperInterface.php +++ b/src/PhpWord/Escaper/EscaperInterface.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Escaper; /** diff --git a/src/PhpWord/Escaper/RegExp.php b/src/PhpWord/Escaper/RegExp.php index 99691074..18279eb8 100644 --- a/src/PhpWord/Escaper/RegExp.php +++ b/src/PhpWord/Escaper/RegExp.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Escaper; /** diff --git a/src/PhpWord/Escaper/Rtf.php b/src/PhpWord/Escaper/Rtf.php index 332a69ab..9663c6fc 100644 --- a/src/PhpWord/Escaper/Rtf.php +++ b/src/PhpWord/Escaper/Rtf.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Escaper; /** diff --git a/src/PhpWord/Escaper/Xml.php b/src/PhpWord/Escaper/Xml.php index f45d8f8a..7b092aac 100644 --- a/src/PhpWord/Escaper/Xml.php +++ b/src/PhpWord/Escaper/Xml.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Escaper; /** diff --git a/src/PhpWord/Exception/CopyFileException.php b/src/PhpWord/Exception/CopyFileException.php index 7557616b..97e68112 100644 --- a/src/PhpWord/Exception/CopyFileException.php +++ b/src/PhpWord/Exception/CopyFileException.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Exception; /** diff --git a/src/PhpWord/Exception/CreateTemporaryFileException.php b/src/PhpWord/Exception/CreateTemporaryFileException.php index ade359ee..16a9baa0 100644 --- a/src/PhpWord/Exception/CreateTemporaryFileException.php +++ b/src/PhpWord/Exception/CreateTemporaryFileException.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Exception; /** diff --git a/src/PhpWord/Exception/Exception.php b/src/PhpWord/Exception/Exception.php index dd6dfbc6..498ef38c 100644 --- a/src/PhpWord/Exception/Exception.php +++ b/src/PhpWord/Exception/Exception.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Exception; /** diff --git a/src/PhpWord/Exception/InvalidImageException.php b/src/PhpWord/Exception/InvalidImageException.php index ed422a25..4d863545 100644 --- a/src/PhpWord/Exception/InvalidImageException.php +++ b/src/PhpWord/Exception/InvalidImageException.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Exception; /** diff --git a/src/PhpWord/Exception/InvalidObjectException.php b/src/PhpWord/Exception/InvalidObjectException.php index 9e9f185a..61e933f3 100644 --- a/src/PhpWord/Exception/InvalidObjectException.php +++ b/src/PhpWord/Exception/InvalidObjectException.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Exception; /** diff --git a/src/PhpWord/Exception/InvalidStyleException.php b/src/PhpWord/Exception/InvalidStyleException.php index ef0ca430..4110e55e 100644 --- a/src/PhpWord/Exception/InvalidStyleException.php +++ b/src/PhpWord/Exception/InvalidStyleException.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Exception; use InvalidArgumentException; diff --git a/src/PhpWord/Exception/UnsupportedImageTypeException.php b/src/PhpWord/Exception/UnsupportedImageTypeException.php index 4c4d6c39..d2d2b360 100644 --- a/src/PhpWord/Exception/UnsupportedImageTypeException.php +++ b/src/PhpWord/Exception/UnsupportedImageTypeException.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Exception; /** diff --git a/src/PhpWord/IOFactory.php b/src/PhpWord/IOFactory.php index f33b2500..b523480c 100644 --- a/src/PhpWord/IOFactory.php +++ b/src/PhpWord/IOFactory.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord; use PhpOffice\PhpWord\Exception\Exception; diff --git a/src/PhpWord/Media.php b/src/PhpWord/Media.php index b696d796..c358f2a0 100644 --- a/src/PhpWord/Media.php +++ b/src/PhpWord/Media.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord; use PhpOffice\PhpWord\Element\Image; diff --git a/src/PhpWord/Metadata/Compatibility.php b/src/PhpWord/Metadata/Compatibility.php index b6cc3b61..d990b095 100644 --- a/src/PhpWord/Metadata/Compatibility.php +++ b/src/PhpWord/Metadata/Compatibility.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Metadata; /** diff --git a/src/PhpWord/Metadata/DocInfo.php b/src/PhpWord/Metadata/DocInfo.php index 9239f71f..37a5ff92 100644 --- a/src/PhpWord/Metadata/DocInfo.php +++ b/src/PhpWord/Metadata/DocInfo.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Metadata; /** diff --git a/src/PhpWord/Metadata/Protection.php b/src/PhpWord/Metadata/Protection.php index 18747061..448b1063 100644 --- a/src/PhpWord/Metadata/Protection.php +++ b/src/PhpWord/Metadata/Protection.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Metadata; /** diff --git a/src/PhpWord/Metadata/Settings.php b/src/PhpWord/Metadata/Settings.php index 7cf79b2e..418c044d 100644 --- a/src/PhpWord/Metadata/Settings.php +++ b/src/PhpWord/Metadata/Settings.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Metadata; use PhpOffice\PhpWord\ComplexType\ProofState; diff --git a/src/PhpWord/PhpWord.php b/src/PhpWord/PhpWord.php index c3dfac70..6f524350 100644 --- a/src/PhpWord/PhpWord.php +++ b/src/PhpWord/PhpWord.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord; use PhpOffice\PhpWord\Element\Section; @@ -240,7 +241,6 @@ class PhpWord * Set default font name. * * @param string $fontName - * @return void */ public function setDefaultFontName($fontName) { @@ -261,7 +261,6 @@ class PhpWord * Set default font size. * * @param int $fontSize - * @return void */ public function setDefaultFontSize($fontSize) { diff --git a/src/PhpWord/Reader/AbstractReader.php b/src/PhpWord/Reader/AbstractReader.php index be1a2a09..7779226f 100644 --- a/src/PhpWord/Reader/AbstractReader.php +++ b/src/PhpWord/Reader/AbstractReader.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader; use PhpOffice\PhpWord\Exception\Exception; diff --git a/src/PhpWord/Reader/HTML.php b/src/PhpWord/Reader/HTML.php index d58908e5..46ea4abc 100644 --- a/src/PhpWord/Reader/HTML.php +++ b/src/PhpWord/Reader/HTML.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader; use PhpOffice\PhpWord\PhpWord; diff --git a/src/PhpWord/Reader/MsDoc.php b/src/PhpWord/Reader/MsDoc.php index e5fd3ca3..79731cfd 100644 --- a/src/PhpWord/Reader/MsDoc.php +++ b/src/PhpWord/Reader/MsDoc.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader; use PhpOffice\Common\Drawing; diff --git a/src/PhpWord/Reader/ODText.php b/src/PhpWord/Reader/ODText.php index 6fd135cd..1d2577c8 100644 --- a/src/PhpWord/Reader/ODText.php +++ b/src/PhpWord/Reader/ODText.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader; use PhpOffice\Common\XMLReader; @@ -57,7 +58,6 @@ class ODText extends AbstractReader implements ReaderInterface * @param string $partName * @param string $docFile * @param string $xmlFile - * @return void */ private function readPart(PhpWord $phpWord, $relationships, $partName, $docFile, $xmlFile) { diff --git a/src/PhpWord/Reader/ODText/AbstractPart.php b/src/PhpWord/Reader/ODText/AbstractPart.php index f38eff7c..c48b4ade 100644 --- a/src/PhpWord/Reader/ODText/AbstractPart.php +++ b/src/PhpWord/Reader/ODText/AbstractPart.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader\ODText; use PhpOffice\PhpWord\Reader\Word2007\AbstractPart as Word2007AbstractPart; diff --git a/src/PhpWord/Reader/ODText/Content.php b/src/PhpWord/Reader/ODText/Content.php index bc699abe..5e3d8ca6 100644 --- a/src/PhpWord/Reader/ODText/Content.php +++ b/src/PhpWord/Reader/ODText/Content.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader\ODText; use PhpOffice\Common\XMLReader; @@ -30,7 +31,6 @@ class Content extends AbstractPart * Read content.xml. * * @param \PhpOffice\PhpWord\PhpWord $phpWord - * @return void */ public function read(PhpWord $phpWord) { diff --git a/src/PhpWord/Reader/ODText/Meta.php b/src/PhpWord/Reader/ODText/Meta.php index 6bd490a7..6f8f813f 100644 --- a/src/PhpWord/Reader/ODText/Meta.php +++ b/src/PhpWord/Reader/ODText/Meta.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader\ODText; use PhpOffice\Common\XMLReader; @@ -30,7 +31,6 @@ class Meta extends AbstractPart * Read meta.xml. * * @param \PhpOffice\PhpWord\PhpWord $phpWord - * @return void * @todo Process property type */ public function read(PhpWord $phpWord) diff --git a/src/PhpWord/Reader/RTF.php b/src/PhpWord/Reader/RTF.php index 982e1d1a..dafd5b3c 100644 --- a/src/PhpWord/Reader/RTF.php +++ b/src/PhpWord/Reader/RTF.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader; use PhpOffice\PhpWord\PhpWord; diff --git a/src/PhpWord/Reader/RTF/Document.php b/src/PhpWord/Reader/RTF/Document.php index e41caba5..6f39abe9 100644 --- a/src/PhpWord/Reader/RTF/Document.php +++ b/src/PhpWord/Reader/RTF/Document.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader\RTF; use PhpOffice\PhpWord\PhpWord; @@ -130,7 +131,6 @@ class Document * - Pushes every other character into the text queue * * @param \PhpOffice\PhpWord\PhpWord $phpWord - * @return void * @todo Use `fread` stream for scalability */ public function read(PhpWord $phpWord) @@ -183,8 +183,6 @@ class Document /** * Mark opening braket `{` character. - * - * @return void */ private function markOpening() { @@ -194,8 +192,6 @@ class Document /** * Mark closing braket `}` character. - * - * @return void */ private function markClosing() { @@ -205,8 +201,6 @@ class Document /** * Mark backslash `\` character. - * - * @return void */ private function markBackslash() { @@ -222,8 +216,6 @@ class Document /** * Mark newline character: Flush control word because it's not possible to span multiline. - * - * @return void */ private function markNewline() { @@ -236,7 +228,6 @@ class Document * Flush control word or text. * * @param bool $isControl - * @return void */ private function flush($isControl = false) { @@ -251,7 +242,6 @@ class Document * Flush control word. * * @param bool $isControl - * @return void */ private function flushControl($isControl = false) { @@ -267,8 +257,6 @@ class Document /** * Flush text in queue. - * - * @return void */ private function flushText() { @@ -295,7 +283,6 @@ class Document * Reset control word and first char state. * * @param bool $value - * @return void */ private function setControl($value) { @@ -307,7 +294,6 @@ class Document * Push text into queue. * * @param string $char - * @return void */ private function pushText($char) { @@ -325,7 +311,6 @@ class Document * * @param string $control * @param string $parameter - * @return void */ private function parseControl($control, $parameter) { @@ -365,7 +350,6 @@ class Document * Read paragraph. * * @param array $directives - * @return void */ private function readParagraph($directives) { @@ -378,7 +362,6 @@ class Document * Read style. * * @param array $directives - * @return void */ private function readStyle($directives) { @@ -390,7 +373,6 @@ class Document * Read skip. * * @param array $directives - * @return void */ private function readSkip($directives) { @@ -401,8 +383,6 @@ class Document /** * Read text. - * - * @return void */ private function readText() { diff --git a/src/PhpWord/Reader/ReaderInterface.php b/src/PhpWord/Reader/ReaderInterface.php index b1c3535a..5f52ad19 100644 --- a/src/PhpWord/Reader/ReaderInterface.php +++ b/src/PhpWord/Reader/ReaderInterface.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader; /** diff --git a/src/PhpWord/Reader/Word2007.php b/src/PhpWord/Reader/Word2007.php index 14ce3242..cacefb55 100644 --- a/src/PhpWord/Reader/Word2007.php +++ b/src/PhpWord/Reader/Word2007.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader; use PhpOffice\Common\XMLReader; @@ -82,7 +83,6 @@ class Word2007 extends AbstractReader implements ReaderInterface * @param string $partName * @param string $docFile * @param string $xmlFile - * @return void */ private function readPart(PhpWord $phpWord, $relationships, $partName, $docFile, $xmlFile) { diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index 93bf8a01..a420d45a 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader\Word2007; use PhpOffice\Common\XMLReader; @@ -81,7 +82,6 @@ abstract class AbstractPart * Set relationships. * * @param array $value - * @return void */ public function setRels($value) { @@ -95,7 +95,6 @@ abstract class AbstractPart * @param \DOMElement $domNode * @param mixed $parent * @param string $docPart - * @return void * * @todo Get font style for preserve text */ @@ -181,7 +180,6 @@ abstract class AbstractPart * @param mixed $parent * @param string $docPart * @param mixed $paragraphStyle - * @return void * * @todo Footnote paragraph style */ @@ -239,7 +237,6 @@ abstract class AbstractPart * @param \DOMElement $domNode * @param mixed $parent * @param string $docPart - * @return void */ protected function readTable(XMLReader $xmlReader, \DOMElement $domNode, $parent, $docPart = 'document') { diff --git a/src/PhpWord/Reader/Word2007/DocPropsApp.php b/src/PhpWord/Reader/Word2007/DocPropsApp.php index 679abbcf..72ad3da5 100644 --- a/src/PhpWord/Reader/Word2007/DocPropsApp.php +++ b/src/PhpWord/Reader/Word2007/DocPropsApp.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader\Word2007; /** diff --git a/src/PhpWord/Reader/Word2007/DocPropsCore.php b/src/PhpWord/Reader/Word2007/DocPropsCore.php index 4261ce79..aa02f155 100644 --- a/src/PhpWord/Reader/Word2007/DocPropsCore.php +++ b/src/PhpWord/Reader/Word2007/DocPropsCore.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader\Word2007; use PhpOffice\Common\XMLReader; @@ -54,7 +55,6 @@ class DocPropsCore extends AbstractPart * Read core/extended document properties. * * @param \PhpOffice\PhpWord\PhpWord $phpWord - * @return void */ public function read(PhpWord $phpWord) { diff --git a/src/PhpWord/Reader/Word2007/DocPropsCustom.php b/src/PhpWord/Reader/Word2007/DocPropsCustom.php index 9b44cd51..90580c17 100644 --- a/src/PhpWord/Reader/Word2007/DocPropsCustom.php +++ b/src/PhpWord/Reader/Word2007/DocPropsCustom.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader\Word2007; use PhpOffice\Common\XMLReader; @@ -31,7 +32,6 @@ class DocPropsCustom extends AbstractPart * Read custom document properties. * * @param \PhpOffice\PhpWord\PhpWord $phpWord - * @return void */ public function read(PhpWord $phpWord) { diff --git a/src/PhpWord/Reader/Word2007/Document.php b/src/PhpWord/Reader/Word2007/Document.php index 5a8f091b..be9263d5 100644 --- a/src/PhpWord/Reader/Word2007/Document.php +++ b/src/PhpWord/Reader/Word2007/Document.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader\Word2007; use PhpOffice\Common\XMLReader; diff --git a/src/PhpWord/Reader/Word2007/Endnotes.php b/src/PhpWord/Reader/Word2007/Endnotes.php index 010591c3..5b753473 100644 --- a/src/PhpWord/Reader/Word2007/Endnotes.php +++ b/src/PhpWord/Reader/Word2007/Endnotes.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader\Word2007; /** diff --git a/src/PhpWord/Reader/Word2007/Footnotes.php b/src/PhpWord/Reader/Word2007/Footnotes.php index ba1e2c69..6de107a4 100644 --- a/src/PhpWord/Reader/Word2007/Footnotes.php +++ b/src/PhpWord/Reader/Word2007/Footnotes.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader\Word2007; use PhpOffice\Common\XMLReader; @@ -44,7 +45,6 @@ class Footnotes extends AbstractPart * Read (footnotes|endnotes).xml. * * @param \PhpOffice\PhpWord\PhpWord $phpWord - * @return void */ public function read(PhpWord $phpWord) { diff --git a/src/PhpWord/Reader/Word2007/Numbering.php b/src/PhpWord/Reader/Word2007/Numbering.php index c16af7b2..9669f4e0 100644 --- a/src/PhpWord/Reader/Word2007/Numbering.php +++ b/src/PhpWord/Reader/Word2007/Numbering.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader\Word2007; use PhpOffice\Common\XMLReader; diff --git a/src/PhpWord/Reader/Word2007/Settings.php b/src/PhpWord/Reader/Word2007/Settings.php index 58f32ec6..e5519a78 100644 --- a/src/PhpWord/Reader/Word2007/Settings.php +++ b/src/PhpWord/Reader/Word2007/Settings.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader\Word2007; use PhpOffice\Common\XMLReader; diff --git a/src/PhpWord/Reader/Word2007/Styles.php b/src/PhpWord/Reader/Word2007/Styles.php index 6e90360e..93bf2132 100644 --- a/src/PhpWord/Reader/Word2007/Styles.php +++ b/src/PhpWord/Reader/Word2007/Styles.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader\Word2007; use PhpOffice\Common\XMLReader; diff --git a/src/PhpWord/Settings.php b/src/PhpWord/Settings.php index 38965e35..7a336f3b 100644 --- a/src/PhpWord/Settings.php +++ b/src/PhpWord/Settings.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord; /** @@ -289,8 +290,6 @@ class Settings * @since 0.12.0 * * @param string $tempDir The user defined path to temporary directory - * - * @return void */ public static function setTempDir($tempDir) { diff --git a/src/PhpWord/Shared/Converter.php b/src/PhpWord/Shared/Converter.php index 19615286..64126a6f 100644 --- a/src/PhpWord/Shared/Converter.php +++ b/src/PhpWord/Shared/Converter.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Shared; /** diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index b3c38f00..53fcc329 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Shared; use PhpOffice\PhpWord\Element\AbstractContainer; @@ -33,7 +34,6 @@ class Html * @param \PhpOffice\PhpWord\Element\AbstractContainer $element Where the parts need to be added * @param string $html The code to parse * @param bool $fullHTML If it's a full HTML, no need to add 'body' tag - * @return void */ public static function addHtml($element, $html, $fullHTML = false) { @@ -94,7 +94,6 @@ class Html * @param \PhpOffice\PhpWord\Element\AbstractContainer $element object to add an element corresponding with the node * @param array $styles Array with all styles * @param array $data Array to transport data to a next level in the DOM tree, for example level of listitems - * @return void */ protected static function parseNode($node, $element, $styles = array(), $data = array()) { @@ -168,7 +167,6 @@ class Html * @param \PhpOffice\PhpWord\Element\AbstractContainer $element * @param array $styles * @param array $data - * @return void */ private static function parseChildNodes($node, $element, $styles, $data) { @@ -225,7 +223,6 @@ class Html * @param \DOMNode $node * @param \PhpOffice\PhpWord\Element\AbstractContainer $element * @param array &$styles - * @return null */ private static function parseText($node, $element, &$styles) { @@ -246,7 +243,6 @@ class Html * @param array &$styles * @param string $argument1 Style name * @param string $argument2 Style value - * @return null */ private static function parseProperty(&$styles, $argument1, $argument2) { @@ -293,7 +289,6 @@ class Html * @param array &$styles * @param array &$data * @param string $argument1 List type - * @return null */ private static function parseList(&$styles, &$data, $argument1) { @@ -314,7 +309,6 @@ class Html * @param \PhpOffice\PhpWord\Element\AbstractContainer $element * @param array &$styles * @param array $data - * @return null * * @todo This function is almost the same like `parseChildNodes`. Merged? * @todo As soon as ListItem inherits from AbstractContainer or TextRun delete parsing part of childNodes diff --git a/src/PhpWord/Shared/ZipArchive.php b/src/PhpWord/Shared/ZipArchive.php index 1bd8f2b0..c8cf36cf 100644 --- a/src/PhpWord/Shared/ZipArchive.php +++ b/src/PhpWord/Shared/ZipArchive.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Shared; use PhpOffice\PhpWord\Exception\Exception; diff --git a/src/PhpWord/SimpleType/Jc.php b/src/PhpWord/SimpleType/Jc.php index ad035518..5c4ba2fa 100644 --- a/src/PhpWord/SimpleType/Jc.php +++ b/src/PhpWord/SimpleType/Jc.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\SimpleType; use PhpOffice\PhpWord\Shared\AbstractEnum; diff --git a/src/PhpWord/SimpleType/JcTable.php b/src/PhpWord/SimpleType/JcTable.php index f0278b4c..fc30f676 100644 --- a/src/PhpWord/SimpleType/JcTable.php +++ b/src/PhpWord/SimpleType/JcTable.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\SimpleType; use PhpOffice\PhpWord\Shared\AbstractEnum; diff --git a/src/PhpWord/SimpleType/NumberFormat.php b/src/PhpWord/SimpleType/NumberFormat.php index 8e4ccb9e..06f2df21 100644 --- a/src/PhpWord/SimpleType/NumberFormat.php +++ b/src/PhpWord/SimpleType/NumberFormat.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\SimpleType; use PhpOffice\PhpWord\Shared\AbstractEnum; diff --git a/src/PhpWord/SimpleType/Zoom.php b/src/PhpWord/SimpleType/Zoom.php index 679632c3..987026b5 100644 --- a/src/PhpWord/SimpleType/Zoom.php +++ b/src/PhpWord/SimpleType/Zoom.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\SimpleType; use PhpOffice\PhpWord\Shared\AbstractEnum; diff --git a/src/PhpWord/Style.php b/src/PhpWord/Style.php index 31324564..4d82a7af 100644 --- a/src/PhpWord/Style.php +++ b/src/PhpWord/Style.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord; use PhpOffice\PhpWord\Style\AbstractStyle; diff --git a/src/PhpWord/Style/AbstractStyle.php b/src/PhpWord/Style/AbstractStyle.php index e42c8ca6..8bfb3a09 100644 --- a/src/PhpWord/Style/AbstractStyle.php +++ b/src/PhpWord/Style/AbstractStyle.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; use PhpOffice\Common\Text; diff --git a/src/PhpWord/Style/Border.php b/src/PhpWord/Style/Border.php index a4fc3312..23add07f 100644 --- a/src/PhpWord/Style/Border.php +++ b/src/PhpWord/Style/Border.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/src/PhpWord/Style/Cell.php b/src/PhpWord/Style/Cell.php index 4bcf6104..ecd4fc61 100644 --- a/src/PhpWord/Style/Cell.php +++ b/src/PhpWord/Style/Cell.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/src/PhpWord/Style/Chart.php b/src/PhpWord/Style/Chart.php index 8e4b79b4..6a0e2c14 100644 --- a/src/PhpWord/Style/Chart.php +++ b/src/PhpWord/Style/Chart.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/src/PhpWord/Style/Extrusion.php b/src/PhpWord/Style/Extrusion.php index 6537b0da..e2cf76e5 100644 --- a/src/PhpWord/Style/Extrusion.php +++ b/src/PhpWord/Style/Extrusion.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/src/PhpWord/Style/Fill.php b/src/PhpWord/Style/Fill.php index 432604d8..184e6970 100644 --- a/src/PhpWord/Style/Fill.php +++ b/src/PhpWord/Style/Fill.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/src/PhpWord/Style/Font.php b/src/PhpWord/Style/Font.php index 36020625..fa54e5e2 100644 --- a/src/PhpWord/Style/Font.php +++ b/src/PhpWord/Style/Font.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/src/PhpWord/Style/Frame.php b/src/PhpWord/Style/Frame.php index deb9234b..35f5ad00 100644 --- a/src/PhpWord/Style/Frame.php +++ b/src/PhpWord/Style/Frame.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\SimpleType\Jc; diff --git a/src/PhpWord/Style/Image.php b/src/PhpWord/Style/Image.php index ed80fe21..b9ce2acc 100644 --- a/src/PhpWord/Style/Image.php +++ b/src/PhpWord/Style/Image.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/src/PhpWord/Style/Indentation.php b/src/PhpWord/Style/Indentation.php index c0ac025f..ab5b8bb2 100644 --- a/src/PhpWord/Style/Indentation.php +++ b/src/PhpWord/Style/Indentation.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/src/PhpWord/Style/Line.php b/src/PhpWord/Style/Line.php index aa211692..49530f24 100644 --- a/src/PhpWord/Style/Line.php +++ b/src/PhpWord/Style/Line.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/src/PhpWord/Style/LineNumbering.php b/src/PhpWord/Style/LineNumbering.php index 70a44d59..7e293bf0 100644 --- a/src/PhpWord/Style/LineNumbering.php +++ b/src/PhpWord/Style/LineNumbering.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/src/PhpWord/Style/ListItem.php b/src/PhpWord/Style/ListItem.php index cad78080..7a252e5d 100644 --- a/src/PhpWord/Style/ListItem.php +++ b/src/PhpWord/Style/ListItem.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\Style; diff --git a/src/PhpWord/Style/Numbering.php b/src/PhpWord/Style/Numbering.php index 2d0e01a2..2d490a06 100644 --- a/src/PhpWord/Style/Numbering.php +++ b/src/PhpWord/Style/Numbering.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/src/PhpWord/Style/NumberingLevel.php b/src/PhpWord/Style/NumberingLevel.php index 0e4cd10a..8406218c 100644 --- a/src/PhpWord/Style/NumberingLevel.php +++ b/src/PhpWord/Style/NumberingLevel.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\SimpleType\Jc; diff --git a/src/PhpWord/Style/Outline.php b/src/PhpWord/Style/Outline.php index cc9c4e03..82e906a2 100644 --- a/src/PhpWord/Style/Outline.php +++ b/src/PhpWord/Style/Outline.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/src/PhpWord/Style/Paper.php b/src/PhpWord/Style/Paper.php index 44a4efd5..891d4068 100644 --- a/src/PhpWord/Style/Paper.php +++ b/src/PhpWord/Style/Paper.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\Shared\Converter; diff --git a/src/PhpWord/Style/Paragraph.php b/src/PhpWord/Style/Paragraph.php index c7a22b39..6ed83758 100644 --- a/src/PhpWord/Style/Paragraph.php +++ b/src/PhpWord/Style/Paragraph.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; use PhpOffice\Common\Text; diff --git a/src/PhpWord/Style/Row.php b/src/PhpWord/Style/Row.php index 8a5db99f..444f7f28 100644 --- a/src/PhpWord/Style/Row.php +++ b/src/PhpWord/Style/Row.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/src/PhpWord/Style/Section.php b/src/PhpWord/Style/Section.php index d0945c88..64403663 100644 --- a/src/PhpWord/Style/Section.php +++ b/src/PhpWord/Style/Section.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/src/PhpWord/Style/Shading.php b/src/PhpWord/Style/Shading.php index 125ba89c..5d0c51e9 100644 --- a/src/PhpWord/Style/Shading.php +++ b/src/PhpWord/Style/Shading.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/src/PhpWord/Style/Shadow.php b/src/PhpWord/Style/Shadow.php index add319e7..f71bc3f9 100644 --- a/src/PhpWord/Style/Shadow.php +++ b/src/PhpWord/Style/Shadow.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/src/PhpWord/Style/Shape.php b/src/PhpWord/Style/Shape.php index cdc2f033..586a15c8 100644 --- a/src/PhpWord/Style/Shape.php +++ b/src/PhpWord/Style/Shape.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/src/PhpWord/Style/Spacing.php b/src/PhpWord/Style/Spacing.php index cb52d54b..35ea88d6 100644 --- a/src/PhpWord/Style/Spacing.php +++ b/src/PhpWord/Style/Spacing.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/src/PhpWord/Style/TOC.php b/src/PhpWord/Style/TOC.php index 786d1e48..ccce2b38 100644 --- a/src/PhpWord/Style/TOC.php +++ b/src/PhpWord/Style/TOC.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/src/PhpWord/Style/Tab.php b/src/PhpWord/Style/Tab.php index 053436ea..3a892523 100644 --- a/src/PhpWord/Style/Tab.php +++ b/src/PhpWord/Style/Tab.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/src/PhpWord/Style/Table.php b/src/PhpWord/Style/Table.php index 3523122f..6d5e1b22 100644 --- a/src/PhpWord/Style/Table.php +++ b/src/PhpWord/Style/Table.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\SimpleType\Jc; diff --git a/src/PhpWord/Style/TextBox.php b/src/PhpWord/Style/TextBox.php index 744d3979..7a8b6efb 100644 --- a/src/PhpWord/Style/TextBox.php +++ b/src/PhpWord/Style/TextBox.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** @@ -69,7 +70,6 @@ class TextBox extends Image * Set margin top. * * @param int $value - * @return void */ public function setInnerMarginTop($value = null) { @@ -90,7 +90,6 @@ class TextBox extends Image * Set margin left. * * @param int $value - * @return void */ public function setInnerMarginLeft($value = null) { @@ -111,7 +110,6 @@ class TextBox extends Image * Set margin right. * * @param int $value - * @return void */ public function setInnerMarginRight($value = null) { @@ -132,7 +130,6 @@ class TextBox extends Image * Set margin bottom. * * @param int $value - * @return void */ public function setInnerMarginBottom($value = null) { @@ -153,7 +150,6 @@ class TextBox extends Image * Set TLRB cell margin. * * @param int $value Margin in twips - * @return void */ public function setInnerMargin($value = null) { @@ -195,7 +191,6 @@ class TextBox extends Image * Set border size. * * @param int $value Size in points - * @return void */ public function setBorderSize($value = null) { @@ -216,7 +211,6 @@ class TextBox extends Image * Set border color. * * @param string $value - * @return void */ public function setBorderColor($value = null) { diff --git a/src/PhpWord/Template.php b/src/PhpWord/Template.php index 3825a3bd..96962b8e 100644 --- a/src/PhpWord/Template.php +++ b/src/PhpWord/Template.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord; /** diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php index 2b294950..85a809cc 100644 --- a/src/PhpWord/TemplateProcessor.php +++ b/src/PhpWord/TemplateProcessor.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord; use PhpOffice\PhpWord\Escaper\RegExp; diff --git a/src/PhpWord/Writer/AbstractWriter.php b/src/PhpWord/Writer/AbstractWriter.php index fc560d4d..bf9a52f4 100644 --- a/src/PhpWord/Writer/AbstractWriter.php +++ b/src/PhpWord/Writer/AbstractWriter.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer; use PhpOffice\PhpWord\Exception\CopyFileException; diff --git a/src/PhpWord/Writer/HTML.php b/src/PhpWord/Writer/HTML.php index f20f4824..cb48cf10 100644 --- a/src/PhpWord/Writer/HTML.php +++ b/src/PhpWord/Writer/HTML.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer; use PhpOffice\PhpWord\PhpWord; diff --git a/src/PhpWord/Writer/HTML/Element/AbstractElement.php b/src/PhpWord/Writer/HTML/Element/AbstractElement.php index 283c87b9..65429db5 100644 --- a/src/PhpWord/Writer/HTML/Element/AbstractElement.php +++ b/src/PhpWord/Writer/HTML/Element/AbstractElement.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML\Element; use PhpOffice\PhpWord\Element\AbstractElement as Element; @@ -77,7 +78,6 @@ abstract class AbstractElement * Set without paragraph. * * @param bool $value - * @return void */ public function setWithoutP($value) { diff --git a/src/PhpWord/Writer/HTML/Element/Container.php b/src/PhpWord/Writer/HTML/Element/Container.php index acd5bcb3..78c6d8ed 100644 --- a/src/PhpWord/Writer/HTML/Element/Container.php +++ b/src/PhpWord/Writer/HTML/Element/Container.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML\Element; use PhpOffice\PhpWord\Element\AbstractContainer as ContainerElement; diff --git a/src/PhpWord/Writer/HTML/Element/Endnote.php b/src/PhpWord/Writer/HTML/Element/Endnote.php index 0b7f0f23..f387669c 100644 --- a/src/PhpWord/Writer/HTML/Element/Endnote.php +++ b/src/PhpWord/Writer/HTML/Element/Endnote.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML\Element; /** diff --git a/src/PhpWord/Writer/HTML/Element/Footnote.php b/src/PhpWord/Writer/HTML/Element/Footnote.php index 2da0bec3..179384af 100644 --- a/src/PhpWord/Writer/HTML/Element/Footnote.php +++ b/src/PhpWord/Writer/HTML/Element/Footnote.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML\Element; /** diff --git a/src/PhpWord/Writer/HTML/Element/Image.php b/src/PhpWord/Writer/HTML/Element/Image.php index a0dbc6c7..fbc14e42 100644 --- a/src/PhpWord/Writer/HTML/Element/Image.php +++ b/src/PhpWord/Writer/HTML/Element/Image.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML\Element; use PhpOffice\PhpWord\Element\Image as ImageElement; diff --git a/src/PhpWord/Writer/HTML/Element/Link.php b/src/PhpWord/Writer/HTML/Element/Link.php index 302f0a20..25dafca1 100644 --- a/src/PhpWord/Writer/HTML/Element/Link.php +++ b/src/PhpWord/Writer/HTML/Element/Link.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML\Element; use PhpOffice\PhpWord\Settings; diff --git a/src/PhpWord/Writer/HTML/Element/ListItem.php b/src/PhpWord/Writer/HTML/Element/ListItem.php index bf5ec9ae..ae8ee340 100644 --- a/src/PhpWord/Writer/HTML/Element/ListItem.php +++ b/src/PhpWord/Writer/HTML/Element/ListItem.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML\Element; use PhpOffice\PhpWord\Settings; diff --git a/src/PhpWord/Writer/HTML/Element/PageBreak.php b/src/PhpWord/Writer/HTML/Element/PageBreak.php index 6e955f85..2bb008df 100644 --- a/src/PhpWord/Writer/HTML/Element/PageBreak.php +++ b/src/PhpWord/Writer/HTML/Element/PageBreak.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML\Element; /** diff --git a/src/PhpWord/Writer/HTML/Element/Table.php b/src/PhpWord/Writer/HTML/Element/Table.php index 33d6a18d..4e4a1149 100644 --- a/src/PhpWord/Writer/HTML/Element/Table.php +++ b/src/PhpWord/Writer/HTML/Element/Table.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML\Element; /** diff --git a/src/PhpWord/Writer/HTML/Element/Text.php b/src/PhpWord/Writer/HTML/Element/Text.php index e318d883..e8cd4a7c 100644 --- a/src/PhpWord/Writer/HTML/Element/Text.php +++ b/src/PhpWord/Writer/HTML/Element/Text.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML\Element; use PhpOffice\PhpWord\Settings; diff --git a/src/PhpWord/Writer/HTML/Element/TextBreak.php b/src/PhpWord/Writer/HTML/Element/TextBreak.php index ce8a5e1b..b4b13788 100644 --- a/src/PhpWord/Writer/HTML/Element/TextBreak.php +++ b/src/PhpWord/Writer/HTML/Element/TextBreak.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML\Element; /** diff --git a/src/PhpWord/Writer/HTML/Element/TextRun.php b/src/PhpWord/Writer/HTML/Element/TextRun.php index 63d73cfe..321c3146 100644 --- a/src/PhpWord/Writer/HTML/Element/TextRun.php +++ b/src/PhpWord/Writer/HTML/Element/TextRun.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML\Element; /** diff --git a/src/PhpWord/Writer/HTML/Element/Title.php b/src/PhpWord/Writer/HTML/Element/Title.php index 9d8f7842..289a9e43 100644 --- a/src/PhpWord/Writer/HTML/Element/Title.php +++ b/src/PhpWord/Writer/HTML/Element/Title.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML\Element; use PhpOffice\PhpWord\Settings; diff --git a/src/PhpWord/Writer/HTML/Part/AbstractPart.php b/src/PhpWord/Writer/HTML/Part/AbstractPart.php index 2c2ea35e..6d3fff3d 100644 --- a/src/PhpWord/Writer/HTML/Part/AbstractPart.php +++ b/src/PhpWord/Writer/HTML/Part/AbstractPart.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML\Part; use PhpOffice\PhpWord\Exception\Exception; diff --git a/src/PhpWord/Writer/HTML/Part/Body.php b/src/PhpWord/Writer/HTML/Part/Body.php index c7ba00a9..d9f28bca 100644 --- a/src/PhpWord/Writer/HTML/Part/Body.php +++ b/src/PhpWord/Writer/HTML/Part/Body.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML\Part; use PhpOffice\PhpWord\Writer\HTML\Element\Container; diff --git a/src/PhpWord/Writer/HTML/Part/Head.php b/src/PhpWord/Writer/HTML/Part/Head.php index 3bcbd5a5..695a1c0c 100644 --- a/src/PhpWord/Writer/HTML/Part/Head.php +++ b/src/PhpWord/Writer/HTML/Part/Head.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML\Part; use PhpOffice\PhpWord\Settings; diff --git a/src/PhpWord/Writer/HTML/Style/AbstractStyle.php b/src/PhpWord/Writer/HTML/Style/AbstractStyle.php index 5fdb7cb3..26153b31 100644 --- a/src/PhpWord/Writer/HTML/Style/AbstractStyle.php +++ b/src/PhpWord/Writer/HTML/Style/AbstractStyle.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML\Style; use PhpOffice\PhpWord\Style\AbstractStyle as Style; @@ -58,7 +59,6 @@ abstract class AbstractStyle * Set parent writer. * * @param \PhpOffice\PhpWord\Writer\AbstractWriter $writer - * @return void */ public function setParentWriter($writer) { diff --git a/src/PhpWord/Writer/HTML/Style/Font.php b/src/PhpWord/Writer/HTML/Style/Font.php index 2cb374bc..aa86d46a 100644 --- a/src/PhpWord/Writer/HTML/Style/Font.php +++ b/src/PhpWord/Writer/HTML/Style/Font.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML\Style; use PhpOffice\PhpWord\Style\Font as FontStyle; diff --git a/src/PhpWord/Writer/HTML/Style/Generic.php b/src/PhpWord/Writer/HTML/Style/Generic.php index 80a5da53..1e812518 100644 --- a/src/PhpWord/Writer/HTML/Style/Generic.php +++ b/src/PhpWord/Writer/HTML/Style/Generic.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML\Style; /** diff --git a/src/PhpWord/Writer/HTML/Style/Image.php b/src/PhpWord/Writer/HTML/Style/Image.php index 73580a55..74843603 100644 --- a/src/PhpWord/Writer/HTML/Style/Image.php +++ b/src/PhpWord/Writer/HTML/Style/Image.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML\Style; /** diff --git a/src/PhpWord/Writer/HTML/Style/Paragraph.php b/src/PhpWord/Writer/HTML/Style/Paragraph.php index f0bcf224..4e7ab1fd 100644 --- a/src/PhpWord/Writer/HTML/Style/Paragraph.php +++ b/src/PhpWord/Writer/HTML/Style/Paragraph.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML\Style; use PhpOffice\PhpWord\SimpleType\Jc; diff --git a/src/PhpWord/Writer/ODText.php b/src/PhpWord/Writer/ODText.php index ff6e567a..f280f241 100644 --- a/src/PhpWord/Writer/ODText.php +++ b/src/PhpWord/Writer/ODText.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer; use PhpOffice\PhpWord\Media; @@ -62,7 +63,6 @@ class ODText extends AbstractWriter implements WriterInterface * Save PhpWord to file. * * @param string $filename - * @return void */ public function save($filename = null) { diff --git a/src/PhpWord/Writer/ODText/Element/AbstractElement.php b/src/PhpWord/Writer/ODText/Element/AbstractElement.php index 7ec2254b..cfa5b2f5 100644 --- a/src/PhpWord/Writer/ODText/Element/AbstractElement.php +++ b/src/PhpWord/Writer/ODText/Element/AbstractElement.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Element; use PhpOffice\PhpWord\Writer\Word2007\Element\AbstractElement as Word2007AbstractElement; diff --git a/src/PhpWord/Writer/ODText/Element/Container.php b/src/PhpWord/Writer/ODText/Element/Container.php index 7f0ad990..c2a5e016 100644 --- a/src/PhpWord/Writer/ODText/Element/Container.php +++ b/src/PhpWord/Writer/ODText/Element/Container.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Element; use PhpOffice\PhpWord\Writer\Word2007\Element\Container as Word2007Container; diff --git a/src/PhpWord/Writer/ODText/Element/Image.php b/src/PhpWord/Writer/ODText/Element/Image.php index 0dccdf0f..23dc0ac1 100644 --- a/src/PhpWord/Writer/ODText/Element/Image.php +++ b/src/PhpWord/Writer/ODText/Element/Image.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Element; use PhpOffice\PhpWord\Shared\Converter; diff --git a/src/PhpWord/Writer/ODText/Element/Link.php b/src/PhpWord/Writer/ODText/Element/Link.php index c1f3df35..91a1962e 100644 --- a/src/PhpWord/Writer/ODText/Element/Link.php +++ b/src/PhpWord/Writer/ODText/Element/Link.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Element; use PhpOffice\PhpWord\Settings; diff --git a/src/PhpWord/Writer/ODText/Element/Table.php b/src/PhpWord/Writer/ODText/Element/Table.php index 86e41582..73f18926 100644 --- a/src/PhpWord/Writer/ODText/Element/Table.php +++ b/src/PhpWord/Writer/ODText/Element/Table.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Element; /** diff --git a/src/PhpWord/Writer/ODText/Element/Text.php b/src/PhpWord/Writer/ODText/Element/Text.php index bbd27e69..699510b2 100644 --- a/src/PhpWord/Writer/ODText/Element/Text.php +++ b/src/PhpWord/Writer/ODText/Element/Text.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Element; use PhpOffice\PhpWord\Exception\Exception; diff --git a/src/PhpWord/Writer/ODText/Element/TextBreak.php b/src/PhpWord/Writer/ODText/Element/TextBreak.php index fc002ed5..7106797d 100644 --- a/src/PhpWord/Writer/ODText/Element/TextBreak.php +++ b/src/PhpWord/Writer/ODText/Element/TextBreak.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Element; /** diff --git a/src/PhpWord/Writer/ODText/Element/TextRun.php b/src/PhpWord/Writer/ODText/Element/TextRun.php index c2ade20a..e202eccf 100644 --- a/src/PhpWord/Writer/ODText/Element/TextRun.php +++ b/src/PhpWord/Writer/ODText/Element/TextRun.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Element; /** diff --git a/src/PhpWord/Writer/ODText/Element/Title.php b/src/PhpWord/Writer/ODText/Element/Title.php index 20f5009c..737afd18 100644 --- a/src/PhpWord/Writer/ODText/Element/Title.php +++ b/src/PhpWord/Writer/ODText/Element/Title.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Element; use PhpOffice\PhpWord\Settings; diff --git a/src/PhpWord/Writer/ODText/Part/AbstractPart.php b/src/PhpWord/Writer/ODText/Part/AbstractPart.php index e6782d51..abe0a7b9 100644 --- a/src/PhpWord/Writer/ODText/Part/AbstractPart.php +++ b/src/PhpWord/Writer/ODText/Part/AbstractPart.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Part; use PhpOffice\Common\XMLWriter; @@ -36,7 +37,6 @@ abstract class AbstractPart extends Word2007AbstractPart * Write common root attributes. * * @param \PhpOffice\Common\XMLWriter $xmlWriter - * @return void */ protected function writeCommonRootAttributes(XMLWriter $xmlWriter) { @@ -73,7 +73,6 @@ abstract class AbstractPart extends Word2007AbstractPart * Write font faces declaration. * * @param \PhpOffice\Common\XMLWriter $xmlWriter - * @return void */ protected function writeFontFaces(XMLWriter $xmlWriter) { diff --git a/src/PhpWord/Writer/ODText/Part/Content.php b/src/PhpWord/Writer/ODText/Part/Content.php index cde079bf..d08eb217 100644 --- a/src/PhpWord/Writer/ODText/Part/Content.php +++ b/src/PhpWord/Writer/ODText/Part/Content.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Part; use PhpOffice\Common\XMLWriter; @@ -110,7 +111,6 @@ class Content extends AbstractPart * @since 0.11.0 * * @param \PhpOffice\Common\XMLWriter $xmlWriter - * @return void */ private function writeAutoStyles(XMLWriter $xmlWriter) { @@ -133,7 +133,6 @@ class Content extends AbstractPart * Write automatic styles. * * @param \PhpOffice\Common\XMLWriter $xmlWriter - * @return void */ private function writeTextStyles(XMLWriter $xmlWriter) { @@ -167,7 +166,6 @@ class Content extends AbstractPart * Get automatic styles. * * @param \PhpOffice\PhpWord\PhpWord $phpWord - * @return void */ private function getAutoStyles(PhpWord $phpWord) { @@ -190,7 +188,6 @@ class Content extends AbstractPart * @param \PhpOffice\PhpWord\Element\AbstractContainer $container * @param int &$paragraphStyleCount * @param int &$fontStyleCount - * @return void * @todo Simplify the logic */ private function getContainerStyle($container, &$paragraphStyleCount, &$fontStyleCount) @@ -224,7 +221,6 @@ class Content extends AbstractPart * @param \PhpOffice\PhpWord\Element\Text &$element * @param int &$paragraphStyleCount * @param int &$fontStyleCount - * @return void */ private function getElementStyle(&$element, &$paragraphStyleCount, &$fontStyleCount) { diff --git a/src/PhpWord/Writer/ODText/Part/Manifest.php b/src/PhpWord/Writer/ODText/Part/Manifest.php index b0bc280c..f706cbff 100644 --- a/src/PhpWord/Writer/ODText/Part/Manifest.php +++ b/src/PhpWord/Writer/ODText/Part/Manifest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Part; use PhpOffice\PhpWord\Media; diff --git a/src/PhpWord/Writer/ODText/Part/Meta.php b/src/PhpWord/Writer/ODText/Part/Meta.php index 67e26bbb..d637fef1 100644 --- a/src/PhpWord/Writer/ODText/Part/Meta.php +++ b/src/PhpWord/Writer/ODText/Part/Meta.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Part; use PhpOffice\Common\XMLWriter; @@ -89,7 +90,6 @@ class Meta extends AbstractPart * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param string $property * @param string $value - * @return void * * @todo Handle other `$type`: double|date|dateTime|duration|boolean (4th arguments) */ diff --git a/src/PhpWord/Writer/ODText/Part/Mimetype.php b/src/PhpWord/Writer/ODText/Part/Mimetype.php index c29ea9a0..aab88e4d 100644 --- a/src/PhpWord/Writer/ODText/Part/Mimetype.php +++ b/src/PhpWord/Writer/ODText/Part/Mimetype.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Part; /** diff --git a/src/PhpWord/Writer/ODText/Part/Styles.php b/src/PhpWord/Writer/ODText/Part/Styles.php index f656c148..043fe0f6 100644 --- a/src/PhpWord/Writer/ODText/Part/Styles.php +++ b/src/PhpWord/Writer/ODText/Part/Styles.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Part; use PhpOffice\Common\XMLWriter; diff --git a/src/PhpWord/Writer/ODText/Style/AbstractStyle.php b/src/PhpWord/Writer/ODText/Style/AbstractStyle.php index 072e1d37..050abe02 100644 --- a/src/PhpWord/Writer/ODText/Style/AbstractStyle.php +++ b/src/PhpWord/Writer/ODText/Style/AbstractStyle.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Style; use PhpOffice\PhpWord\Writer\Word2007\Style\AbstractStyle as Word2007AbstractStyle; diff --git a/src/PhpWord/Writer/ODText/Style/Font.php b/src/PhpWord/Writer/ODText/Style/Font.php index e5ac2419..b31dadae 100644 --- a/src/PhpWord/Writer/ODText/Style/Font.php +++ b/src/PhpWord/Writer/ODText/Style/Font.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Style; /** @@ -25,8 +26,6 @@ class Font extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/ODText/Style/Image.php b/src/PhpWord/Writer/ODText/Style/Image.php index 983bf06c..3efc945c 100644 --- a/src/PhpWord/Writer/ODText/Style/Image.php +++ b/src/PhpWord/Writer/ODText/Style/Image.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Style; /** @@ -25,8 +26,6 @@ class Image extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/ODText/Style/Paragraph.php b/src/PhpWord/Writer/ODText/Style/Paragraph.php index 9a452477..d0670c42 100644 --- a/src/PhpWord/Writer/ODText/Style/Paragraph.php +++ b/src/PhpWord/Writer/ODText/Style/Paragraph.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Style; /** @@ -25,8 +26,6 @@ class Paragraph extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/ODText/Style/Section.php b/src/PhpWord/Writer/ODText/Style/Section.php index ec5fcfb1..24766278 100644 --- a/src/PhpWord/Writer/ODText/Style/Section.php +++ b/src/PhpWord/Writer/ODText/Style/Section.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Style; /** diff --git a/src/PhpWord/Writer/ODText/Style/Table.php b/src/PhpWord/Writer/ODText/Style/Table.php index 2b387dc3..0144391a 100644 --- a/src/PhpWord/Writer/ODText/Style/Table.php +++ b/src/PhpWord/Writer/ODText/Style/Table.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Style; /** @@ -25,8 +26,6 @@ class Table extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/PDF.php b/src/PhpWord/Writer/PDF.php index ac3d4795..4f29bb63 100644 --- a/src/PhpWord/Writer/PDF.php +++ b/src/PhpWord/Writer/PDF.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer; use PhpOffice\PhpWord\Exception\Exception; diff --git a/src/PhpWord/Writer/PDF/AbstractRenderer.php b/src/PhpWord/Writer/PDF/AbstractRenderer.php index a486276c..3b5e3a08 100644 --- a/src/PhpWord/Writer/PDF/AbstractRenderer.php +++ b/src/PhpWord/Writer/PDF/AbstractRenderer.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\PDF; use PhpOffice\PhpWord\Exception\Exception; diff --git a/src/PhpWord/Writer/PDF/DomPDF.php b/src/PhpWord/Writer/PDF/DomPDF.php index 4875d052..8825d4c3 100644 --- a/src/PhpWord/Writer/PDF/DomPDF.php +++ b/src/PhpWord/Writer/PDF/DomPDF.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\PDF; use Dompdf\Dompdf as DompdfLib; @@ -38,7 +39,6 @@ class DomPDF extends AbstractRenderer implements WriterInterface * Save PhpWord to file. * * @param string $filename Name of the file to save as - * @return void */ public function save($filename = null) { diff --git a/src/PhpWord/Writer/PDF/MPDF.php b/src/PhpWord/Writer/PDF/MPDF.php index 84ad47dc..764a38d4 100644 --- a/src/PhpWord/Writer/PDF/MPDF.php +++ b/src/PhpWord/Writer/PDF/MPDF.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\PDF; use PhpOffice\PhpWord\Writer\WriterInterface; @@ -37,7 +38,6 @@ class MPDF extends AbstractRenderer implements WriterInterface * Save PhpWord to file. * * @param string $filename Name of the file to save as - * @return void */ public function save($filename = null) { diff --git a/src/PhpWord/Writer/PDF/TCPDF.php b/src/PhpWord/Writer/PDF/TCPDF.php index 01bb9898..4991cee8 100644 --- a/src/PhpWord/Writer/PDF/TCPDF.php +++ b/src/PhpWord/Writer/PDF/TCPDF.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\PDF; use PhpOffice\PhpWord\Writer\WriterInterface; diff --git a/src/PhpWord/Writer/RTF.php b/src/PhpWord/Writer/RTF.php index c95881f7..4c33b733 100644 --- a/src/PhpWord/Writer/RTF.php +++ b/src/PhpWord/Writer/RTF.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer; use PhpOffice\PhpWord\PhpWord; diff --git a/src/PhpWord/Writer/RTF/Element/AbstractElement.php b/src/PhpWord/Writer/RTF/Element/AbstractElement.php index 97585bdb..83ccd14e 100644 --- a/src/PhpWord/Writer/RTF/Element/AbstractElement.php +++ b/src/PhpWord/Writer/RTF/Element/AbstractElement.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\RTF\Element; use PhpOffice\Common\Text as CommonText; diff --git a/src/PhpWord/Writer/RTF/Element/Container.php b/src/PhpWord/Writer/RTF/Element/Container.php index a07c62fd..32be7d7f 100644 --- a/src/PhpWord/Writer/RTF/Element/Container.php +++ b/src/PhpWord/Writer/RTF/Element/Container.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\RTF\Element; use PhpOffice\PhpWord\Writer\HTML\Element\Container as HTMLContainer; diff --git a/src/PhpWord/Writer/RTF/Element/Image.php b/src/PhpWord/Writer/RTF/Element/Image.php index 8251e9e6..bf90bf66 100644 --- a/src/PhpWord/Writer/RTF/Element/Image.php +++ b/src/PhpWord/Writer/RTF/Element/Image.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\RTF\Element; use PhpOffice\PhpWord\Element\Image as ImageElement; diff --git a/src/PhpWord/Writer/RTF/Element/Link.php b/src/PhpWord/Writer/RTF/Element/Link.php index 120cf230..ef11eb10 100644 --- a/src/PhpWord/Writer/RTF/Element/Link.php +++ b/src/PhpWord/Writer/RTF/Element/Link.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\RTF\Element; /** diff --git a/src/PhpWord/Writer/RTF/Element/ListItem.php b/src/PhpWord/Writer/RTF/Element/ListItem.php index 379d4660..f80ef5d1 100644 --- a/src/PhpWord/Writer/RTF/Element/ListItem.php +++ b/src/PhpWord/Writer/RTF/Element/ListItem.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\RTF\Element; /** diff --git a/src/PhpWord/Writer/RTF/Element/PageBreak.php b/src/PhpWord/Writer/RTF/Element/PageBreak.php index 903cb015..8ea86e0f 100644 --- a/src/PhpWord/Writer/RTF/Element/PageBreak.php +++ b/src/PhpWord/Writer/RTF/Element/PageBreak.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\RTF\Element; /** diff --git a/src/PhpWord/Writer/RTF/Element/Table.php b/src/PhpWord/Writer/RTF/Element/Table.php index 7c552d41..20ee26c1 100644 --- a/src/PhpWord/Writer/RTF/Element/Table.php +++ b/src/PhpWord/Writer/RTF/Element/Table.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\RTF\Element; use PhpOffice\PhpWord\Element\Cell as CellElement; diff --git a/src/PhpWord/Writer/RTF/Element/Text.php b/src/PhpWord/Writer/RTF/Element/Text.php index e6e5071d..7b7de882 100644 --- a/src/PhpWord/Writer/RTF/Element/Text.php +++ b/src/PhpWord/Writer/RTF/Element/Text.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\RTF\Element; /** diff --git a/src/PhpWord/Writer/RTF/Element/TextBreak.php b/src/PhpWord/Writer/RTF/Element/TextBreak.php index ae6836cb..480f9d15 100644 --- a/src/PhpWord/Writer/RTF/Element/TextBreak.php +++ b/src/PhpWord/Writer/RTF/Element/TextBreak.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\RTF\Element; /** diff --git a/src/PhpWord/Writer/RTF/Element/TextRun.php b/src/PhpWord/Writer/RTF/Element/TextRun.php index f7af2792..2d9081a7 100644 --- a/src/PhpWord/Writer/RTF/Element/TextRun.php +++ b/src/PhpWord/Writer/RTF/Element/TextRun.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\RTF\Element; /** diff --git a/src/PhpWord/Writer/RTF/Element/Title.php b/src/PhpWord/Writer/RTF/Element/Title.php index 28b0ccbf..8c18d972 100644 --- a/src/PhpWord/Writer/RTF/Element/Title.php +++ b/src/PhpWord/Writer/RTF/Element/Title.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\RTF\Element; /** diff --git a/src/PhpWord/Writer/RTF/Part/AbstractPart.php b/src/PhpWord/Writer/RTF/Part/AbstractPart.php index 688c9bf4..7c8c93ba 100644 --- a/src/PhpWord/Writer/RTF/Part/AbstractPart.php +++ b/src/PhpWord/Writer/RTF/Part/AbstractPart.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\RTF\Part; use PhpOffice\PhpWord\Escaper\Rtf; diff --git a/src/PhpWord/Writer/RTF/Part/Document.php b/src/PhpWord/Writer/RTF/Part/Document.php index ac24bcd6..7ed7ea27 100644 --- a/src/PhpWord/Writer/RTF/Part/Document.php +++ b/src/PhpWord/Writer/RTF/Part/Document.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\RTF\Part; use PhpOffice\PhpWord\Settings; diff --git a/src/PhpWord/Writer/RTF/Part/Header.php b/src/PhpWord/Writer/RTF/Part/Header.php index 18e674f1..a399ccdc 100644 --- a/src/PhpWord/Writer/RTF/Part/Header.php +++ b/src/PhpWord/Writer/RTF/Part/Header.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\RTF\Part; use PhpOffice\PhpWord\Settings; @@ -180,8 +181,6 @@ class Header extends AbstractPart /** * Register all fonts and colors in both named and inline styles to appropriate header table. - * - * @return void */ private function registerFont() { @@ -212,7 +211,6 @@ class Header extends AbstractPart * Register border colors. * * @param \PhpOffice\PhpWord\Style\Border $style - * @return void */ private function registerBorderColor($style) { @@ -228,7 +226,6 @@ class Header extends AbstractPart * Register fonts and colors. * * @param \PhpOffice\PhpWord\Style\AbstractStyle $style - * @return void */ private function registerFontItems($style) { @@ -248,7 +245,6 @@ class Header extends AbstractPart * @param array &$table * @param string $value * @param string $default - * @return void */ private function registerTableItem(&$table, $value, $default = null) { diff --git a/src/PhpWord/Writer/RTF/Style/AbstractStyle.php b/src/PhpWord/Writer/RTF/Style/AbstractStyle.php index 1eaf370a..fa7351e9 100644 --- a/src/PhpWord/Writer/RTF/Style/AbstractStyle.php +++ b/src/PhpWord/Writer/RTF/Style/AbstractStyle.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\RTF\Style; use PhpOffice\PhpWord\Writer\HTML\Style\AbstractStyle as HTMLAbstractStyle; diff --git a/src/PhpWord/Writer/RTF/Style/Border.php b/src/PhpWord/Writer/RTF/Style/Border.php index f0a8fa5e..2913a18c 100644 --- a/src/PhpWord/Writer/RTF/Style/Border.php +++ b/src/PhpWord/Writer/RTF/Style/Border.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\RTF\Style; /** diff --git a/src/PhpWord/Writer/RTF/Style/Font.php b/src/PhpWord/Writer/RTF/Style/Font.php index 50a41747..4f78719f 100644 --- a/src/PhpWord/Writer/RTF/Style/Font.php +++ b/src/PhpWord/Writer/RTF/Style/Font.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\RTF\Style; use PhpOffice\PhpWord\Style\Font as FontStyle; diff --git a/src/PhpWord/Writer/RTF/Style/Paragraph.php b/src/PhpWord/Writer/RTF/Style/Paragraph.php index 73dbe962..a758a488 100644 --- a/src/PhpWord/Writer/RTF/Style/Paragraph.php +++ b/src/PhpWord/Writer/RTF/Style/Paragraph.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\RTF\Style; use PhpOffice\PhpWord\SimpleType\Jc; @@ -73,7 +74,6 @@ class Paragraph extends AbstractStyle * Set nested level. * * @param int $value - * @return void */ public function setNestedLevel($value) { diff --git a/src/PhpWord/Writer/RTF/Style/Section.php b/src/PhpWord/Writer/RTF/Style/Section.php index ce3faa68..b64e17d9 100644 --- a/src/PhpWord/Writer/RTF/Style/Section.php +++ b/src/PhpWord/Writer/RTF/Style/Section.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\RTF\Style; use PhpOffice\PhpWord\Style\Section as SectionStyle; diff --git a/src/PhpWord/Writer/Word2007.php b/src/PhpWord/Writer/Word2007.php index 577ac76a..0a25c12c 100644 --- a/src/PhpWord/Writer/Word2007.php +++ b/src/PhpWord/Writer/Word2007.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer; use PhpOffice\PhpWord\Element\Section; diff --git a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php index 7cebd160..2f44c704 100644 --- a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php +++ b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\Common\Text as CommonText; diff --git a/src/PhpWord/Writer/Word2007/Element/Bookmark.php b/src/PhpWord/Writer/Word2007/Element/Bookmark.php index 6deb1a24..8ecb1e99 100644 --- a/src/PhpWord/Writer/Word2007/Element/Bookmark.php +++ b/src/PhpWord/Writer/Word2007/Element/Bookmark.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; /** diff --git a/src/PhpWord/Writer/Word2007/Element/Chart.php b/src/PhpWord/Writer/Word2007/Element/Chart.php index 32bf576e..284b6bc1 100644 --- a/src/PhpWord/Writer/Word2007/Element/Chart.php +++ b/src/PhpWord/Writer/Word2007/Element/Chart.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\PhpWord\Element\Chart as ChartElement; @@ -27,8 +28,6 @@ class Chart extends AbstractElement { /** * Write element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/CheckBox.php b/src/PhpWord/Writer/Word2007/Element/CheckBox.php index aa0e6b41..ce2ebb3e 100644 --- a/src/PhpWord/Writer/Word2007/Element/CheckBox.php +++ b/src/PhpWord/Writer/Word2007/Element/CheckBox.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\PhpWord\Settings; diff --git a/src/PhpWord/Writer/Word2007/Element/Container.php b/src/PhpWord/Writer/Word2007/Element/Container.php index 22701d02..7b40e199 100644 --- a/src/PhpWord/Writer/Word2007/Element/Container.php +++ b/src/PhpWord/Writer/Word2007/Element/Container.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\Common\XMLWriter; @@ -37,8 +38,6 @@ class Container extends AbstractElement /** * Write element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/Endnote.php b/src/PhpWord/Writer/Word2007/Element/Endnote.php index bdd53501..946c1419 100644 --- a/src/PhpWord/Writer/Word2007/Element/Endnote.php +++ b/src/PhpWord/Writer/Word2007/Element/Endnote.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; /** diff --git a/src/PhpWord/Writer/Word2007/Element/Field.php b/src/PhpWord/Writer/Word2007/Element/Field.php index 34f62d54..a0db34f7 100644 --- a/src/PhpWord/Writer/Word2007/Element/Field.php +++ b/src/PhpWord/Writer/Word2007/Element/Field.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; /** diff --git a/src/PhpWord/Writer/Word2007/Element/Footnote.php b/src/PhpWord/Writer/Word2007/Element/Footnote.php index 2564c46a..ee844534 100644 --- a/src/PhpWord/Writer/Word2007/Element/Footnote.php +++ b/src/PhpWord/Writer/Word2007/Element/Footnote.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; /** @@ -32,8 +33,6 @@ class Footnote extends Text /** * Write element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/FormField.php b/src/PhpWord/Writer/Word2007/Element/FormField.php index bdc9ac7f..db7ebaa4 100644 --- a/src/PhpWord/Writer/Word2007/Element/FormField.php +++ b/src/PhpWord/Writer/Word2007/Element/FormField.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\Common\XMLWriter; diff --git a/src/PhpWord/Writer/Word2007/Element/Image.php b/src/PhpWord/Writer/Word2007/Element/Image.php index 59e7125e..dd0f7756 100644 --- a/src/PhpWord/Writer/Word2007/Element/Image.php +++ b/src/PhpWord/Writer/Word2007/Element/Image.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\Common\XMLWriter; @@ -29,8 +30,6 @@ class Image extends AbstractElement { /** * Write element. - * - * @return void */ public function write() { @@ -49,8 +48,6 @@ class Image extends AbstractElement /** * Write image element. - * - * @return void */ private function writeImage(XMLWriter $xmlWriter, ImageElement $element) { @@ -85,8 +82,6 @@ class Image extends AbstractElement /** * Write watermark element. - * - * @return void */ private function writeWatermark(XMLWriter $xmlWriter, ImageElement $element) { diff --git a/src/PhpWord/Writer/Word2007/Element/Line.php b/src/PhpWord/Writer/Word2007/Element/Line.php index 384f53f7..1f853a20 100644 --- a/src/PhpWord/Writer/Word2007/Element/Line.php +++ b/src/PhpWord/Writer/Word2007/Element/Line.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\PhpWord\Element\Line as LineElement; diff --git a/src/PhpWord/Writer/Word2007/Element/Link.php b/src/PhpWord/Writer/Word2007/Element/Link.php index d06e7643..6edc4f2c 100644 --- a/src/PhpWord/Writer/Word2007/Element/Link.php +++ b/src/PhpWord/Writer/Word2007/Element/Link.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\PhpWord\Settings; @@ -27,8 +28,6 @@ class Link extends Text { /** * Write link element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/ListItem.php b/src/PhpWord/Writer/Word2007/Element/ListItem.php index 01ca2397..2584fff1 100644 --- a/src/PhpWord/Writer/Word2007/Element/ListItem.php +++ b/src/PhpWord/Writer/Word2007/Element/ListItem.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\PhpWord\Writer\Word2007\Style\Paragraph as ParagraphStyleWriter; @@ -27,8 +28,6 @@ class ListItem extends AbstractElement { /** * Write list item element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/ListItemRun.php b/src/PhpWord/Writer/Word2007/Element/ListItemRun.php index 986c3e9f..c0e34093 100644 --- a/src/PhpWord/Writer/Word2007/Element/ListItemRun.php +++ b/src/PhpWord/Writer/Word2007/Element/ListItemRun.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\PhpWord\Writer\Word2007\Style\Paragraph as ParagraphStyleWriter; @@ -27,8 +28,6 @@ class ListItemRun extends AbstractElement { /** * Write list item element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/Object.php b/src/PhpWord/Writer/Word2007/Element/Object.php index 41fc70e3..54d1869b 100644 --- a/src/PhpWord/Writer/Word2007/Element/Object.php +++ b/src/PhpWord/Writer/Word2007/Element/Object.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\PhpWord\Writer\Word2007\Style\Image as ImageStyleWriter; @@ -27,8 +28,6 @@ class Object extends AbstractElement { /** * Write object element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/PageBreak.php b/src/PhpWord/Writer/Word2007/Element/PageBreak.php index 96592441..a7087fd2 100644 --- a/src/PhpWord/Writer/Word2007/Element/PageBreak.php +++ b/src/PhpWord/Writer/Word2007/Element/PageBreak.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; /** @@ -27,7 +28,6 @@ class PageBreak extends AbstractElement * Write element. * * @usedby \PhpOffice\PhpWord\Writer\Word2007\Element\AbstractElement::startElementP() - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/ParagraphAlignment.php b/src/PhpWord/Writer/Word2007/Element/ParagraphAlignment.php index 6aba9de6..2f67ffb1 100644 --- a/src/PhpWord/Writer/Word2007/Element/ParagraphAlignment.php +++ b/src/PhpWord/Writer/Word2007/Element/ParagraphAlignment.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; /** diff --git a/src/PhpWord/Writer/Word2007/Element/PreserveText.php b/src/PhpWord/Writer/Word2007/Element/PreserveText.php index 2afabbdb..dba02197 100644 --- a/src/PhpWord/Writer/Word2007/Element/PreserveText.php +++ b/src/PhpWord/Writer/Word2007/Element/PreserveText.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\PhpWord\Settings; @@ -27,8 +28,6 @@ class PreserveText extends Text { /** * Write preserve text element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/SDT.php b/src/PhpWord/Writer/Word2007/Element/SDT.php index ea2a1328..2badb761 100644 --- a/src/PhpWord/Writer/Word2007/Element/SDT.php +++ b/src/PhpWord/Writer/Word2007/Element/SDT.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\Common\XMLWriter; @@ -30,8 +31,6 @@ class SDT extends Text { /** * Write element. - * - * @return void */ public function write() { @@ -72,7 +71,6 @@ class SDT extends Text * @link http://www.datypic.com/sc/ooxml/t-w_CT_SdtComboBox.html * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\SDT $element - * @return void */ private function writeComboBox(XMLWriter $xmlWriter, SDTElement $element) { @@ -92,7 +90,6 @@ class SDT extends Text * @link http://www.datypic.com/sc/ooxml/t-w_CT_SdtDropDownList.html * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\SDT $element - * @return void */ private function writeDropDownList(XMLWriter $xmlWriter, SDTElement $element) { @@ -105,7 +102,6 @@ class SDT extends Text * @link http://www.datypic.com/sc/ooxml/t-w_CT_SdtDate.html * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\SDT $element - * @return void */ private function writeDate(XMLWriter $xmlWriter, SDTElement $element) { diff --git a/src/PhpWord/Writer/Word2007/Element/Shape.php b/src/PhpWord/Writer/Word2007/Element/Shape.php index 0307a2e3..8f5bf651 100644 --- a/src/PhpWord/Writer/Word2007/Element/Shape.php +++ b/src/PhpWord/Writer/Word2007/Element/Shape.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\Common\XMLWriter; @@ -31,8 +32,6 @@ class Shape extends AbstractElement { /** * Write element. - * - * @return void */ public function write() { @@ -80,7 +79,6 @@ class Shape extends AbstractElement * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Shape $style - * @return void */ private function writeArc(XMLWriter $xmlWriter, ShapeStyle $style) { @@ -95,7 +93,6 @@ class Shape extends AbstractElement * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Shape $style - * @return void */ private function writeCurve(XMLWriter $xmlWriter, ShapeStyle $style) { @@ -111,7 +108,6 @@ class Shape extends AbstractElement * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Shape $style - * @return void */ private function writeLine(XMLWriter $xmlWriter, ShapeStyle $style) { @@ -126,7 +122,6 @@ class Shape extends AbstractElement * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Shape $style - * @return void */ private function writePolyline(XMLWriter $xmlWriter, ShapeStyle $style) { @@ -138,7 +133,6 @@ class Shape extends AbstractElement * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Shape $style - * @return void */ private function writeRoundRect(XMLWriter $xmlWriter, ShapeStyle $style) { diff --git a/src/PhpWord/Writer/Word2007/Element/TOC.php b/src/PhpWord/Writer/Word2007/Element/TOC.php index 93ba8a6c..fd33f268 100644 --- a/src/PhpWord/Writer/Word2007/Element/TOC.php +++ b/src/PhpWord/Writer/Word2007/Element/TOC.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\Common\XMLWriter; @@ -33,8 +34,6 @@ class TOC extends AbstractElement { /** * Write element. - * - * @return void */ public function write() { @@ -70,7 +69,6 @@ class TOC extends AbstractElement * @param \PhpOffice\PhpWord\Element\TOC $element * @param \PhpOffice\PhpWord\Element\Title $title * @param bool $writeFieldMark - * @return void */ private function writeTitle(XMLWriter $xmlWriter, TOCElement $element, $title, $writeFieldMark) { @@ -142,7 +140,6 @@ class TOC extends AbstractElement * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\TOC $element * @param int $indent - * @return void */ private function writeStyle(XMLWriter $xmlWriter, TOCElement $element, $indent) { @@ -188,7 +185,6 @@ class TOC extends AbstractElement * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\TOC $element - * @return void */ private function writeFieldMark(XMLWriter $xmlWriter, TOCElement $element) { diff --git a/src/PhpWord/Writer/Word2007/Element/Table.php b/src/PhpWord/Writer/Word2007/Element/Table.php index 5ebca13b..40d4cb64 100644 --- a/src/PhpWord/Writer/Word2007/Element/Table.php +++ b/src/PhpWord/Writer/Word2007/Element/Table.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\Common\XMLWriter; diff --git a/src/PhpWord/Writer/Word2007/Element/TableAlignment.php b/src/PhpWord/Writer/Word2007/Element/TableAlignment.php index fccc3f53..926f6840 100644 --- a/src/PhpWord/Writer/Word2007/Element/TableAlignment.php +++ b/src/PhpWord/Writer/Word2007/Element/TableAlignment.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; /** diff --git a/src/PhpWord/Writer/Word2007/Element/Text.php b/src/PhpWord/Writer/Word2007/Element/Text.php index a24dc2e0..6b85c566 100644 --- a/src/PhpWord/Writer/Word2007/Element/Text.php +++ b/src/PhpWord/Writer/Word2007/Element/Text.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\PhpWord\Settings; @@ -27,8 +28,6 @@ class Text extends AbstractElement { /** * Write text element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/TextBox.php b/src/PhpWord/Writer/Word2007/Element/TextBox.php index 4e2a79e8..57273094 100644 --- a/src/PhpWord/Writer/Word2007/Element/TextBox.php +++ b/src/PhpWord/Writer/Word2007/Element/TextBox.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\PhpWord\Writer\Word2007\Style\TextBox as TextBoxStyleWriter; @@ -27,8 +28,6 @@ class TextBox extends Image { /** * Write element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/TextBreak.php b/src/PhpWord/Writer/Word2007/Element/TextBreak.php index 221e1b95..474f42cc 100644 --- a/src/PhpWord/Writer/Word2007/Element/TextBreak.php +++ b/src/PhpWord/Writer/Word2007/Element/TextBreak.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; /** @@ -25,8 +26,6 @@ class TextBreak extends Text { /** * Write text break element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/TextRun.php b/src/PhpWord/Writer/Word2007/Element/TextRun.php index 1a684089..8f359021 100644 --- a/src/PhpWord/Writer/Word2007/Element/TextRun.php +++ b/src/PhpWord/Writer/Word2007/Element/TextRun.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; /** @@ -25,8 +26,6 @@ class TextRun extends Text { /** * Write textrun element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/Title.php b/src/PhpWord/Writer/Word2007/Element/Title.php index 7c6e496e..479bdd40 100644 --- a/src/PhpWord/Writer/Word2007/Element/Title.php +++ b/src/PhpWord/Writer/Word2007/Element/Title.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\PhpWord\Settings; @@ -27,8 +28,6 @@ class Title extends AbstractElement { /** * Write title element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Part/AbstractPart.php b/src/PhpWord/Writer/Word2007/Part/AbstractPart.php index 4a617b42..a78a9bc3 100644 --- a/src/PhpWord/Writer/Word2007/Part/AbstractPart.php +++ b/src/PhpWord/Writer/Word2007/Part/AbstractPart.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\Common\XMLWriter; diff --git a/src/PhpWord/Writer/Word2007/Part/Chart.php b/src/PhpWord/Writer/Word2007/Part/Chart.php index 417d7001..eec09e9d 100644 --- a/src/PhpWord/Writer/Word2007/Part/Chart.php +++ b/src/PhpWord/Writer/Word2007/Part/Chart.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\Common\XMLWriter; diff --git a/src/PhpWord/Writer/Word2007/Part/Comments.php b/src/PhpWord/Writer/Word2007/Part/Comments.php index 58b874af..30374a84 100644 --- a/src/PhpWord/Writer/Word2007/Part/Comments.php +++ b/src/PhpWord/Writer/Word2007/Part/Comments.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\Common\XMLWriter; @@ -71,7 +72,6 @@ class Comments extends AbstractPart * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\Comment $comment - * @return void */ protected function writeComment(XMLWriter $xmlWriter, Comment $comment) { diff --git a/src/PhpWord/Writer/Word2007/Part/ContentTypes.php b/src/PhpWord/Writer/Word2007/Part/ContentTypes.php index 174a793d..b2f55d32 100644 --- a/src/PhpWord/Writer/Word2007/Part/ContentTypes.php +++ b/src/PhpWord/Writer/Word2007/Part/ContentTypes.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\Common\XMLWriter; diff --git a/src/PhpWord/Writer/Word2007/Part/DocPropsApp.php b/src/PhpWord/Writer/Word2007/Part/DocPropsApp.php index 29c8d961..eb397a2a 100644 --- a/src/PhpWord/Writer/Word2007/Part/DocPropsApp.php +++ b/src/PhpWord/Writer/Word2007/Part/DocPropsApp.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; /** diff --git a/src/PhpWord/Writer/Word2007/Part/DocPropsCore.php b/src/PhpWord/Writer/Word2007/Part/DocPropsCore.php index 1c5440b2..0ce58337 100644 --- a/src/PhpWord/Writer/Word2007/Part/DocPropsCore.php +++ b/src/PhpWord/Writer/Word2007/Part/DocPropsCore.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; /** diff --git a/src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php b/src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php index e1f331da..bb5c3b2a 100644 --- a/src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php +++ b/src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; /** diff --git a/src/PhpWord/Writer/Word2007/Part/Document.php b/src/PhpWord/Writer/Word2007/Part/Document.php index 29268faa..a8318f5c 100644 --- a/src/PhpWord/Writer/Word2007/Part/Document.php +++ b/src/PhpWord/Writer/Word2007/Part/Document.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\Common\XMLWriter; @@ -81,7 +82,6 @@ class Document extends AbstractPart * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\Section $section - * @return void */ private function writeSection(XMLWriter $xmlWriter, Section $section) { @@ -97,7 +97,6 @@ class Document extends AbstractPart * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\Section $section - * @return void */ private function writeSectionSettings(XMLWriter $xmlWriter, Section $section) { diff --git a/src/PhpWord/Writer/Word2007/Part/Endnotes.php b/src/PhpWord/Writer/Word2007/Part/Endnotes.php index 898d8c31..d975354e 100644 --- a/src/PhpWord/Writer/Word2007/Part/Endnotes.php +++ b/src/PhpWord/Writer/Word2007/Part/Endnotes.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; /** diff --git a/src/PhpWord/Writer/Word2007/Part/FontTable.php b/src/PhpWord/Writer/Word2007/Part/FontTable.php index fde8db8e..85da0324 100644 --- a/src/PhpWord/Writer/Word2007/Part/FontTable.php +++ b/src/PhpWord/Writer/Word2007/Part/FontTable.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; /** diff --git a/src/PhpWord/Writer/Word2007/Part/Footer.php b/src/PhpWord/Writer/Word2007/Part/Footer.php index c405f653..ce3a8b9c 100644 --- a/src/PhpWord/Writer/Word2007/Part/Footer.php +++ b/src/PhpWord/Writer/Word2007/Part/Footer.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\Writer\Word2007\Element\Container; diff --git a/src/PhpWord/Writer/Word2007/Part/Footnotes.php b/src/PhpWord/Writer/Word2007/Part/Footnotes.php index c854e7f3..61145be0 100644 --- a/src/PhpWord/Writer/Word2007/Part/Footnotes.php +++ b/src/PhpWord/Writer/Word2007/Part/Footnotes.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\Common\XMLWriter; @@ -136,7 +137,6 @@ class Footnotes extends AbstractPart * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\Footnote|\PhpOffice\PhpWord\Element\Endnote $element - * @return void */ protected function writeNote(XMLWriter $xmlWriter, $element) { diff --git a/src/PhpWord/Writer/Word2007/Part/Header.php b/src/PhpWord/Writer/Word2007/Part/Header.php index 01e7c60b..784f1801 100644 --- a/src/PhpWord/Writer/Word2007/Part/Header.php +++ b/src/PhpWord/Writer/Word2007/Part/Header.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; /** diff --git a/src/PhpWord/Writer/Word2007/Part/Numbering.php b/src/PhpWord/Writer/Word2007/Part/Numbering.php index f6553d30..bb8ae59d 100644 --- a/src/PhpWord/Writer/Word2007/Part/Numbering.php +++ b/src/PhpWord/Writer/Word2007/Part/Numbering.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\Common\XMLWriter; @@ -98,7 +99,6 @@ class Numbering extends AbstractPart * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\NumberingLevel $level - * @return void */ private function writeLevel(XMLWriter $xmlWriter, NumberingLevel $level) { @@ -139,7 +139,6 @@ class Numbering extends AbstractPart * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\NumberingLevel $level - * @return void * @todo Use paragraph style writer */ private function writeParagraph(XMLWriter $xmlWriter, NumberingLevel $level) @@ -172,7 +171,6 @@ class Numbering extends AbstractPart * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\NumberingLevel $level - * @return void * @todo Use font style writer */ private function writeFont(XMLWriter $xmlWriter, NumberingLevel $level) diff --git a/src/PhpWord/Writer/Word2007/Part/Rels.php b/src/PhpWord/Writer/Word2007/Part/Rels.php index b12933db..4eb687c6 100644 --- a/src/PhpWord/Writer/Word2007/Part/Rels.php +++ b/src/PhpWord/Writer/Word2007/Part/Rels.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\Common\XMLWriter; diff --git a/src/PhpWord/Writer/Word2007/Part/RelsDocument.php b/src/PhpWord/Writer/Word2007/Part/RelsDocument.php index 3f750168..eca3686e 100644 --- a/src/PhpWord/Writer/Word2007/Part/RelsDocument.php +++ b/src/PhpWord/Writer/Word2007/Part/RelsDocument.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; /** diff --git a/src/PhpWord/Writer/Word2007/Part/RelsPart.php b/src/PhpWord/Writer/Word2007/Part/RelsPart.php index ecf1805a..348558c5 100644 --- a/src/PhpWord/Writer/Word2007/Part/RelsPart.php +++ b/src/PhpWord/Writer/Word2007/Part/RelsPart.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; /** diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index 3160de11..f6ea65c5 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\ComplexType\ProofState; diff --git a/src/PhpWord/Writer/Word2007/Part/Styles.php b/src/PhpWord/Writer/Word2007/Part/Styles.php index cc06ef02..36bd095e 100644 --- a/src/PhpWord/Writer/Word2007/Part/Styles.php +++ b/src/PhpWord/Writer/Word2007/Part/Styles.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\Common\XMLWriter; diff --git a/src/PhpWord/Writer/Word2007/Part/Theme.php b/src/PhpWord/Writer/Word2007/Part/Theme.php index d616ff39..ee3e1f45 100644 --- a/src/PhpWord/Writer/Word2007/Part/Theme.php +++ b/src/PhpWord/Writer/Word2007/Part/Theme.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; /** diff --git a/src/PhpWord/Writer/Word2007/Part/WebSettings.php b/src/PhpWord/Writer/Word2007/Part/WebSettings.php index 834347e7..f0a9fa86 100644 --- a/src/PhpWord/Writer/Word2007/Part/WebSettings.php +++ b/src/PhpWord/Writer/Word2007/Part/WebSettings.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; /** diff --git a/src/PhpWord/Writer/Word2007/Style/AbstractStyle.php b/src/PhpWord/Writer/Word2007/Style/AbstractStyle.php index 55dc8065..26eb62b1 100644 --- a/src/PhpWord/Writer/Word2007/Style/AbstractStyle.php +++ b/src/PhpWord/Writer/Word2007/Style/AbstractStyle.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Style; use PhpOffice\Common\XMLWriter; @@ -108,7 +109,6 @@ abstract class AbstractStyle * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param string $name * @param mixed $value - * @return void */ protected function writeChildStyle(XMLWriter $xmlWriter, $name, $value) { diff --git a/src/PhpWord/Writer/Word2007/Style/Cell.php b/src/PhpWord/Writer/Word2007/Style/Cell.php index 790c42fb..256bf45b 100644 --- a/src/PhpWord/Writer/Word2007/Style/Cell.php +++ b/src/PhpWord/Writer/Word2007/Style/Cell.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Style; use PhpOffice\PhpWord\Style\Cell as CellStyle; @@ -32,8 +33,6 @@ class Cell extends AbstractStyle /** * Write style. - * - * @return void */ public function write() { @@ -92,7 +91,6 @@ class Cell extends AbstractStyle * Set width. * * @param int $value - * @return void */ public function setWidth($value = null) { diff --git a/src/PhpWord/Writer/Word2007/Style/Extrusion.php b/src/PhpWord/Writer/Word2007/Style/Extrusion.php index 1d616445..ac81bed6 100644 --- a/src/PhpWord/Writer/Word2007/Style/Extrusion.php +++ b/src/PhpWord/Writer/Word2007/Style/Extrusion.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Style; /** diff --git a/src/PhpWord/Writer/Word2007/Style/Fill.php b/src/PhpWord/Writer/Word2007/Style/Fill.php index bf48325c..6edd3847 100644 --- a/src/PhpWord/Writer/Word2007/Style/Fill.php +++ b/src/PhpWord/Writer/Word2007/Style/Fill.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Style; /** @@ -25,8 +26,6 @@ class Fill extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Style/Font.php b/src/PhpWord/Writer/Word2007/Style/Font.php index cfb42fa5..193f3ba8 100644 --- a/src/PhpWord/Writer/Word2007/Style/Font.php +++ b/src/PhpWord/Writer/Word2007/Style/Font.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Style; /** diff --git a/src/PhpWord/Writer/Word2007/Style/Frame.php b/src/PhpWord/Writer/Word2007/Style/Frame.php index 33d0d375..e88334cf 100644 --- a/src/PhpWord/Writer/Word2007/Style/Frame.php +++ b/src/PhpWord/Writer/Word2007/Style/Frame.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Style; use PhpOffice\Common\XMLWriter; diff --git a/src/PhpWord/Writer/Word2007/Style/Image.php b/src/PhpWord/Writer/Word2007/Style/Image.php index 315b4ac4..8bed7c0b 100644 --- a/src/PhpWord/Writer/Word2007/Style/Image.php +++ b/src/PhpWord/Writer/Word2007/Style/Image.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Style; /** diff --git a/src/PhpWord/Writer/Word2007/Style/Indentation.php b/src/PhpWord/Writer/Word2007/Style/Indentation.php index 194c7d4f..6cf82f88 100644 --- a/src/PhpWord/Writer/Word2007/Style/Indentation.php +++ b/src/PhpWord/Writer/Word2007/Style/Indentation.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Style; /** @@ -25,8 +26,6 @@ class Indentation extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Style/Line.php b/src/PhpWord/Writer/Word2007/Style/Line.php index 8fff76b3..d3001f0d 100644 --- a/src/PhpWord/Writer/Word2007/Style/Line.php +++ b/src/PhpWord/Writer/Word2007/Style/Line.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Style; use PhpOffice\PhpWord\Style\Line as LineStyle; diff --git a/src/PhpWord/Writer/Word2007/Style/LineNumbering.php b/src/PhpWord/Writer/Word2007/Style/LineNumbering.php index 2003d066..a5c2c738 100644 --- a/src/PhpWord/Writer/Word2007/Style/LineNumbering.php +++ b/src/PhpWord/Writer/Word2007/Style/LineNumbering.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Style; /** diff --git a/src/PhpWord/Writer/Word2007/Style/MarginBorder.php b/src/PhpWord/Writer/Word2007/Style/MarginBorder.php index aadac78e..7a4ffe2f 100644 --- a/src/PhpWord/Writer/Word2007/Style/MarginBorder.php +++ b/src/PhpWord/Writer/Word2007/Style/MarginBorder.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Style; use PhpOffice\Common\XMLWriter; diff --git a/src/PhpWord/Writer/Word2007/Style/Outline.php b/src/PhpWord/Writer/Word2007/Style/Outline.php index 2a20da75..cbb6f283 100644 --- a/src/PhpWord/Writer/Word2007/Style/Outline.php +++ b/src/PhpWord/Writer/Word2007/Style/Outline.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Style; /** diff --git a/src/PhpWord/Writer/Word2007/Style/Paragraph.php b/src/PhpWord/Writer/Word2007/Style/Paragraph.php index dca4ddda..b58dc361 100644 --- a/src/PhpWord/Writer/Word2007/Style/Paragraph.php +++ b/src/PhpWord/Writer/Word2007/Style/Paragraph.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Style; use PhpOffice\Common\XMLWriter; diff --git a/src/PhpWord/Writer/Word2007/Style/Row.php b/src/PhpWord/Writer/Word2007/Style/Row.php index a89e6b11..1ecf6cf6 100644 --- a/src/PhpWord/Writer/Word2007/Style/Row.php +++ b/src/PhpWord/Writer/Word2007/Style/Row.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Style; /** diff --git a/src/PhpWord/Writer/Word2007/Style/Section.php b/src/PhpWord/Writer/Word2007/Style/Section.php index 55aed399..64c8dc71 100644 --- a/src/PhpWord/Writer/Word2007/Style/Section.php +++ b/src/PhpWord/Writer/Word2007/Style/Section.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Style; use PhpOffice\PhpWord\Style\Section as SectionStyle; diff --git a/src/PhpWord/Writer/Word2007/Style/Shading.php b/src/PhpWord/Writer/Word2007/Style/Shading.php index 0c9dc3ac..3a260def 100644 --- a/src/PhpWord/Writer/Word2007/Style/Shading.php +++ b/src/PhpWord/Writer/Word2007/Style/Shading.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Style; /** diff --git a/src/PhpWord/Writer/Word2007/Style/Shadow.php b/src/PhpWord/Writer/Word2007/Style/Shadow.php index 4b38ba34..a9159ecc 100644 --- a/src/PhpWord/Writer/Word2007/Style/Shadow.php +++ b/src/PhpWord/Writer/Word2007/Style/Shadow.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Style; /** diff --git a/src/PhpWord/Writer/Word2007/Style/Shape.php b/src/PhpWord/Writer/Word2007/Style/Shape.php index 15adda3d..faae22bf 100644 --- a/src/PhpWord/Writer/Word2007/Style/Shape.php +++ b/src/PhpWord/Writer/Word2007/Style/Shape.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Style; /** @@ -25,8 +26,6 @@ class Shape extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Style/Spacing.php b/src/PhpWord/Writer/Word2007/Style/Spacing.php index 60b7f178..d225ef56 100644 --- a/src/PhpWord/Writer/Word2007/Style/Spacing.php +++ b/src/PhpWord/Writer/Word2007/Style/Spacing.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Style; /** @@ -25,8 +26,6 @@ class Spacing extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Style/Tab.php b/src/PhpWord/Writer/Word2007/Style/Tab.php index ec502e1c..13a70bca 100644 --- a/src/PhpWord/Writer/Word2007/Style/Tab.php +++ b/src/PhpWord/Writer/Word2007/Style/Tab.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Style; /** diff --git a/src/PhpWord/Writer/Word2007/Style/Table.php b/src/PhpWord/Writer/Word2007/Style/Table.php index 9ab18162..ce0b0cab 100644 --- a/src/PhpWord/Writer/Word2007/Style/Table.php +++ b/src/PhpWord/Writer/Word2007/Style/Table.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Style; use PhpOffice\Common\XMLWriter; @@ -34,8 +35,6 @@ class Table extends AbstractStyle /** * Write style. - * - * @return void */ public function write() { @@ -61,7 +60,6 @@ class Table extends AbstractStyle * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Table $style - * @return void */ private function writeStyle(XMLWriter $xmlWriter, TableStyle $style) { @@ -99,7 +97,6 @@ class Table extends AbstractStyle * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param int $width * @param string $unit - * @return void */ private function writeWidth(XMLWriter $xmlWriter, $width, $unit) { @@ -114,7 +111,6 @@ class Table extends AbstractStyle * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Table $style - * @return void */ private function writeMargin(XMLWriter $xmlWriter, TableStyle $style) { @@ -134,7 +130,6 @@ class Table extends AbstractStyle * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Table $style - * @return void */ private function writeBorder(XMLWriter $xmlWriter, TableStyle $style) { @@ -155,7 +150,6 @@ class Table extends AbstractStyle * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Table $style - * @return void */ private function writeFirstRow(XMLWriter $xmlWriter, TableStyle $style) { @@ -175,7 +169,6 @@ class Table extends AbstractStyle * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Table $style - * @return void */ private function writeShading(XMLWriter $xmlWriter, TableStyle $style) { @@ -193,7 +186,6 @@ class Table extends AbstractStyle * Set width. * * @param int $value - * @return void */ public function setWidth($value = null) { diff --git a/src/PhpWord/Writer/Word2007/Style/TextBox.php b/src/PhpWord/Writer/Word2007/Style/TextBox.php index 975fd926..6e94cb0f 100644 --- a/src/PhpWord/Writer/Word2007/Style/TextBox.php +++ b/src/PhpWord/Writer/Word2007/Style/TextBox.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Style; use PhpOffice\PhpWord\Style\TextBox as TextBoxStyle; diff --git a/src/PhpWord/Writer/WriterInterface.php b/src/PhpWord/Writer/WriterInterface.php index bc1c21e0..09f87617 100644 --- a/src/PhpWord/Writer/WriterInterface.php +++ b/src/PhpWord/Writer/WriterInterface.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer; /** diff --git a/tests/PhpWord/Collection/CollectionTest.php b/tests/PhpWord/Collection/CollectionTest.php index 59dd162c..18dfeb70 100644 --- a/tests/PhpWord/Collection/CollectionTest.php +++ b/tests/PhpWord/Collection/CollectionTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Collection; use PhpOffice\PhpWord\Element\Footnote; diff --git a/tests/PhpWord/ComplexType/FootnotePropertiesTest.php b/tests/PhpWord/ComplexType/FootnotePropertiesTest.php index 8d0eac5d..003f22e4 100644 --- a/tests/PhpWord/ComplexType/FootnotePropertiesTest.php +++ b/tests/PhpWord/ComplexType/FootnotePropertiesTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\ComplexType; use PhpOffice\PhpWord\SimpleType\NumberFormat; diff --git a/tests/PhpWord/Element/AbstractElementTest.php b/tests/PhpWord/Element/AbstractElementTest.php index be0aff7c..80de38bf 100644 --- a/tests/PhpWord/Element/AbstractElementTest.php +++ b/tests/PhpWord/Element/AbstractElementTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/tests/PhpWord/Element/CellTest.php b/tests/PhpWord/Element/CellTest.php index ca58d8c8..3b8d84a9 100644 --- a/tests/PhpWord/Element/CellTest.php +++ b/tests/PhpWord/Element/CellTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/tests/PhpWord/Element/CheckBoxTest.php b/tests/PhpWord/Element/CheckBoxTest.php index 6431d145..630fc77f 100644 --- a/tests/PhpWord/Element/CheckBoxTest.php +++ b/tests/PhpWord/Element/CheckBoxTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\SimpleType\Jc; diff --git a/tests/PhpWord/Element/CommentTest.php b/tests/PhpWord/Element/CommentTest.php index 13d0c330..08783e99 100644 --- a/tests/PhpWord/Element/CommentTest.php +++ b/tests/PhpWord/Element/CommentTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/tests/PhpWord/Element/FieldTest.php b/tests/PhpWord/Element/FieldTest.php index a4e95dc6..e3494004 100644 --- a/tests/PhpWord/Element/FieldTest.php +++ b/tests/PhpWord/Element/FieldTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/tests/PhpWord/Element/FooterTest.php b/tests/PhpWord/Element/FooterTest.php index 69ee3b5b..c30103c0 100644 --- a/tests/PhpWord/Element/FooterTest.php +++ b/tests/PhpWord/Element/FooterTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/tests/PhpWord/Element/FootnoteTest.php b/tests/PhpWord/Element/FootnoteTest.php index aad9d99f..a5f233d6 100644 --- a/tests/PhpWord/Element/FootnoteTest.php +++ b/tests/PhpWord/Element/FootnoteTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/tests/PhpWord/Element/HeaderTest.php b/tests/PhpWord/Element/HeaderTest.php index fdc77607..8f5f1fea 100644 --- a/tests/PhpWord/Element/HeaderTest.php +++ b/tests/PhpWord/Element/HeaderTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/tests/PhpWord/Element/ImageTest.php b/tests/PhpWord/Element/ImageTest.php index 0be6bd6b..df2aad98 100644 --- a/tests/PhpWord/Element/ImageTest.php +++ b/tests/PhpWord/Element/ImageTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\SimpleType\Jc; diff --git a/tests/PhpWord/Element/LineTest.php b/tests/PhpWord/Element/LineTest.php index f0fdb9b7..c7e52f83 100644 --- a/tests/PhpWord/Element/LineTest.php +++ b/tests/PhpWord/Element/LineTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/tests/PhpWord/Element/LinkTest.php b/tests/PhpWord/Element/LinkTest.php index d3f97d5e..793e4c9b 100644 --- a/tests/PhpWord/Element/LinkTest.php +++ b/tests/PhpWord/Element/LinkTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\Style\Font; diff --git a/tests/PhpWord/Element/ListItemRunTest.php b/tests/PhpWord/Element/ListItemRunTest.php index 8ba5308d..fe9f5bbe 100644 --- a/tests/PhpWord/Element/ListItemRunTest.php +++ b/tests/PhpWord/Element/ListItemRunTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/tests/PhpWord/Element/ListItemTest.php b/tests/PhpWord/Element/ListItemTest.php index 9c92ec61..9e5beb4b 100644 --- a/tests/PhpWord/Element/ListItemTest.php +++ b/tests/PhpWord/Element/ListItemTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/tests/PhpWord/Element/ObjectTest.php b/tests/PhpWord/Element/ObjectTest.php index ba081bff..4c50f6ad 100644 --- a/tests/PhpWord/Element/ObjectTest.php +++ b/tests/PhpWord/Element/ObjectTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/tests/PhpWord/Element/PageBreakTest.php b/tests/PhpWord/Element/PageBreakTest.php index d86e8841..66b10a6f 100644 --- a/tests/PhpWord/Element/PageBreakTest.php +++ b/tests/PhpWord/Element/PageBreakTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/tests/PhpWord/Element/PreserveTextTest.php b/tests/PhpWord/Element/PreserveTextTest.php index 9252c733..37979cad 100644 --- a/tests/PhpWord/Element/PreserveTextTest.php +++ b/tests/PhpWord/Element/PreserveTextTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\SimpleType\Jc; diff --git a/tests/PhpWord/Element/RowTest.php b/tests/PhpWord/Element/RowTest.php index 03863f5d..6625e61a 100644 --- a/tests/PhpWord/Element/RowTest.php +++ b/tests/PhpWord/Element/RowTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/tests/PhpWord/Element/SDTTest.php b/tests/PhpWord/Element/SDTTest.php index e1032b8d..40da2cf3 100644 --- a/tests/PhpWord/Element/SDTTest.php +++ b/tests/PhpWord/Element/SDTTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/tests/PhpWord/Element/SectionTest.php b/tests/PhpWord/Element/SectionTest.php index 39b37683..fbdf2fa8 100644 --- a/tests/PhpWord/Element/SectionTest.php +++ b/tests/PhpWord/Element/SectionTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\PhpWord; diff --git a/tests/PhpWord/Element/TOCTest.php b/tests/PhpWord/Element/TOCTest.php index 1ac57b7b..4a4d253c 100644 --- a/tests/PhpWord/Element/TOCTest.php +++ b/tests/PhpWord/Element/TOCTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\PhpWord; diff --git a/tests/PhpWord/Element/TableTest.php b/tests/PhpWord/Element/TableTest.php index 0b428ea4..e23427eb 100644 --- a/tests/PhpWord/Element/TableTest.php +++ b/tests/PhpWord/Element/TableTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/tests/PhpWord/Element/TextBoxTest.php b/tests/PhpWord/Element/TextBoxTest.php index be28e7b3..b616ae16 100644 --- a/tests/PhpWord/Element/TextBoxTest.php +++ b/tests/PhpWord/Element/TextBoxTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/tests/PhpWord/Element/TextBreakTest.php b/tests/PhpWord/Element/TextBreakTest.php index 3e84add6..cc760877 100644 --- a/tests/PhpWord/Element/TextBreakTest.php +++ b/tests/PhpWord/Element/TextBreakTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\Style\Font; diff --git a/tests/PhpWord/Element/TextRunTest.php b/tests/PhpWord/Element/TextRunTest.php index c4364423..d8a68eca 100644 --- a/tests/PhpWord/Element/TextRunTest.php +++ b/tests/PhpWord/Element/TextRunTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\PhpWord; diff --git a/tests/PhpWord/Element/TextTest.php b/tests/PhpWord/Element/TextTest.php index a2ab6df4..0ce7c474 100644 --- a/tests/PhpWord/Element/TextTest.php +++ b/tests/PhpWord/Element/TextTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\SimpleType\Jc; diff --git a/tests/PhpWord/Element/TitleTest.php b/tests/PhpWord/Element/TitleTest.php index 426fa6d8..2e7ebe40 100644 --- a/tests/PhpWord/Element/TitleTest.php +++ b/tests/PhpWord/Element/TitleTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Element; /** diff --git a/tests/PhpWord/Exception/CopyFileExceptionTest.php b/tests/PhpWord/Exception/CopyFileExceptionTest.php index 490dfe1a..11d88f0a 100644 --- a/tests/PhpWord/Exception/CopyFileExceptionTest.php +++ b/tests/PhpWord/Exception/CopyFileExceptionTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Exception; /** diff --git a/tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php b/tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php index 68941506..e0823a85 100644 --- a/tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php +++ b/tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Exception; /** diff --git a/tests/PhpWord/Exception/ExceptionTest.php b/tests/PhpWord/Exception/ExceptionTest.php index c0e96e21..c620c7e8 100644 --- a/tests/PhpWord/Exception/ExceptionTest.php +++ b/tests/PhpWord/Exception/ExceptionTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Exception; /** diff --git a/tests/PhpWord/Exception/InvalidImageExceptionTest.php b/tests/PhpWord/Exception/InvalidImageExceptionTest.php index 42f9206d..d6efe909 100644 --- a/tests/PhpWord/Exception/InvalidImageExceptionTest.php +++ b/tests/PhpWord/Exception/InvalidImageExceptionTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Exception; /** diff --git a/tests/PhpWord/Exception/InvalidStyleExceptionTest.php b/tests/PhpWord/Exception/InvalidStyleExceptionTest.php index 6c1f8482..e9d79b05 100644 --- a/tests/PhpWord/Exception/InvalidStyleExceptionTest.php +++ b/tests/PhpWord/Exception/InvalidStyleExceptionTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Exception; /** diff --git a/tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php b/tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php index 553a2e89..c52d3766 100644 --- a/tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php +++ b/tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Exception; /** diff --git a/tests/PhpWord/IOFactoryTest.php b/tests/PhpWord/IOFactoryTest.php index 666854cc..7a711734 100644 --- a/tests/PhpWord/IOFactoryTest.php +++ b/tests/PhpWord/IOFactoryTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord; /** diff --git a/tests/PhpWord/MediaTest.php b/tests/PhpWord/MediaTest.php index 8755f31b..e2262352 100644 --- a/tests/PhpWord/MediaTest.php +++ b/tests/PhpWord/MediaTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord; use PhpOffice\PhpWord\Element\Image; diff --git a/tests/PhpWord/Metadata/DocInfoTest.php b/tests/PhpWord/Metadata/DocInfoTest.php index da1a9f1b..a1ea7a0e 100644 --- a/tests/PhpWord/Metadata/DocInfoTest.php +++ b/tests/PhpWord/Metadata/DocInfoTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Metadata; /** diff --git a/tests/PhpWord/Metadata/SettingsTest.php b/tests/PhpWord/Metadata/SettingsTest.php index 37e2cc12..b726a49a 100644 --- a/tests/PhpWord/Metadata/SettingsTest.php +++ b/tests/PhpWord/Metadata/SettingsTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Metadata; use PhpOffice\PhpWord\ComplexType\ProofState; diff --git a/tests/PhpWord/PhpWordTest.php b/tests/PhpWord/PhpWordTest.php index 23a29f89..c44b7926 100644 --- a/tests/PhpWord/PhpWordTest.php +++ b/tests/PhpWord/PhpWordTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord; use PhpOffice\PhpWord\Metadata\DocInfo; diff --git a/tests/PhpWord/Reader/HTMLTest.php b/tests/PhpWord/Reader/HTMLTest.php index 67342dc2..50510232 100644 --- a/tests/PhpWord/Reader/HTMLTest.php +++ b/tests/PhpWord/Reader/HTMLTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader; use PhpOffice\PhpWord\IOFactory; diff --git a/tests/PhpWord/Reader/MsDocTest.php b/tests/PhpWord/Reader/MsDocTest.php index 86e42c87..ad2afb56 100644 --- a/tests/PhpWord/Reader/MsDocTest.php +++ b/tests/PhpWord/Reader/MsDocTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader; use PhpOffice\PhpWord\IOFactory; diff --git a/tests/PhpWord/Reader/ODTextTest.php b/tests/PhpWord/Reader/ODTextTest.php index 09b1adda..63a1c149 100644 --- a/tests/PhpWord/Reader/ODTextTest.php +++ b/tests/PhpWord/Reader/ODTextTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader; use PhpOffice\PhpWord\IOFactory; diff --git a/tests/PhpWord/Reader/RTFTest.php b/tests/PhpWord/Reader/RTFTest.php index 027e7c73..aab4072c 100644 --- a/tests/PhpWord/Reader/RTFTest.php +++ b/tests/PhpWord/Reader/RTFTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader; use PhpOffice\PhpWord\IOFactory; diff --git a/tests/PhpWord/Reader/Word2007Test.php b/tests/PhpWord/Reader/Word2007Test.php index 8766730a..5421cf98 100644 --- a/tests/PhpWord/Reader/Word2007Test.php +++ b/tests/PhpWord/Reader/Word2007Test.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Reader; use PhpOffice\PhpWord\IOFactory; diff --git a/tests/PhpWord/SettingsTest.php b/tests/PhpWord/SettingsTest.php index 7699a843..0d32eab3 100644 --- a/tests/PhpWord/SettingsTest.php +++ b/tests/PhpWord/SettingsTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord; /** diff --git a/tests/PhpWord/Shared/ConverterTest.php b/tests/PhpWord/Shared/ConverterTest.php index 9f256e07..6f2e63c8 100644 --- a/tests/PhpWord/Shared/ConverterTest.php +++ b/tests/PhpWord/Shared/ConverterTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Shared; /** diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index eb39d3b7..9e40cfc9 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Shared; use PhpOffice\PhpWord\Element\Section; diff --git a/tests/PhpWord/Shared/ZipArchiveTest.php b/tests/PhpWord/Shared/ZipArchiveTest.php index 94dc33b2..156c016c 100644 --- a/tests/PhpWord/Shared/ZipArchiveTest.php +++ b/tests/PhpWord/Shared/ZipArchiveTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Shared; use PhpOffice\PhpWord\Settings; diff --git a/tests/PhpWord/Style/AbstractStyleTest.php b/tests/PhpWord/Style/AbstractStyleTest.php index 86efdb68..39d55fbd 100644 --- a/tests/PhpWord/Style/AbstractStyleTest.php +++ b/tests/PhpWord/Style/AbstractStyleTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/tests/PhpWord/Style/CellTest.php b/tests/PhpWord/Style/CellTest.php index 198386fe..d531f506 100644 --- a/tests/PhpWord/Style/CellTest.php +++ b/tests/PhpWord/Style/CellTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/tests/PhpWord/Style/FontTest.php b/tests/PhpWord/Style/FontTest.php index e2f1fd02..cc25fa66 100644 --- a/tests/PhpWord/Style/FontTest.php +++ b/tests/PhpWord/Style/FontTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\PhpWord; diff --git a/tests/PhpWord/Style/ImageTest.php b/tests/PhpWord/Style/ImageTest.php index cf4a35b0..6543a2b3 100644 --- a/tests/PhpWord/Style/ImageTest.php +++ b/tests/PhpWord/Style/ImageTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\SimpleType\Jc; diff --git a/tests/PhpWord/Style/IndentationTest.php b/tests/PhpWord/Style/IndentationTest.php index 419780ca..01ba2aae 100644 --- a/tests/PhpWord/Style/IndentationTest.php +++ b/tests/PhpWord/Style/IndentationTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/tests/PhpWord/Style/LineNumberingTest.php b/tests/PhpWord/Style/LineNumberingTest.php index 06b1a70a..9e7d6e71 100644 --- a/tests/PhpWord/Style/LineNumberingTest.php +++ b/tests/PhpWord/Style/LineNumberingTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/tests/PhpWord/Style/LineTest.php b/tests/PhpWord/Style/LineTest.php index a07c5ac3..1cb30b38 100644 --- a/tests/PhpWord/Style/LineTest.php +++ b/tests/PhpWord/Style/LineTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/tests/PhpWord/Style/ListItemTest.php b/tests/PhpWord/Style/ListItemTest.php index 2ac453b4..d99cb475 100644 --- a/tests/PhpWord/Style/ListItemTest.php +++ b/tests/PhpWord/Style/ListItemTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/tests/PhpWord/Style/NumberingLevelTest.php b/tests/PhpWord/Style/NumberingLevelTest.php index 1af7a77c..9d7a0748 100644 --- a/tests/PhpWord/Style/NumberingLevelTest.php +++ b/tests/PhpWord/Style/NumberingLevelTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\SimpleType\Jc; diff --git a/tests/PhpWord/Style/NumberingTest.php b/tests/PhpWord/Style/NumberingTest.php index 1158e0e8..41933531 100644 --- a/tests/PhpWord/Style/NumberingTest.php +++ b/tests/PhpWord/Style/NumberingTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/tests/PhpWord/Style/PaperTest.php b/tests/PhpWord/Style/PaperTest.php index 437fdde8..d5dfab05 100644 --- a/tests/PhpWord/Style/PaperTest.php +++ b/tests/PhpWord/Style/PaperTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\PhpWord; diff --git a/tests/PhpWord/Style/ParagraphTest.php b/tests/PhpWord/Style/ParagraphTest.php index 28530d6e..a403dc00 100644 --- a/tests/PhpWord/Style/ParagraphTest.php +++ b/tests/PhpWord/Style/ParagraphTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\PhpWord; diff --git a/tests/PhpWord/Style/RowTest.php b/tests/PhpWord/Style/RowTest.php index d5a31c49..972c6340 100644 --- a/tests/PhpWord/Style/RowTest.php +++ b/tests/PhpWord/Style/RowTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/tests/PhpWord/Style/SectionTest.php b/tests/PhpWord/Style/SectionTest.php index 2ec08d4d..830423ac 100644 --- a/tests/PhpWord/Style/SectionTest.php +++ b/tests/PhpWord/Style/SectionTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/tests/PhpWord/Style/ShadingTest.php b/tests/PhpWord/Style/ShadingTest.php index 0dd82fa3..82522384 100644 --- a/tests/PhpWord/Style/ShadingTest.php +++ b/tests/PhpWord/Style/ShadingTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/tests/PhpWord/Style/SpacingTest.php b/tests/PhpWord/Style/SpacingTest.php index 4c846ce1..6307a53f 100644 --- a/tests/PhpWord/Style/SpacingTest.php +++ b/tests/PhpWord/Style/SpacingTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/tests/PhpWord/Style/TOCTest.php b/tests/PhpWord/Style/TOCTest.php index 15fbd546..ce5484cc 100644 --- a/tests/PhpWord/Style/TOCTest.php +++ b/tests/PhpWord/Style/TOCTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/tests/PhpWord/Style/TabTest.php b/tests/PhpWord/Style/TabTest.php index 7ef53c60..49a7192f 100644 --- a/tests/PhpWord/Style/TabTest.php +++ b/tests/PhpWord/Style/TabTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/tests/PhpWord/Style/TableTest.php b/tests/PhpWord/Style/TableTest.php index 863e05eb..ee2a9c7f 100644 --- a/tests/PhpWord/Style/TableTest.php +++ b/tests/PhpWord/Style/TableTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\SimpleType\JcTable; diff --git a/tests/PhpWord/Style/TextBoxTest.php b/tests/PhpWord/Style/TextBoxTest.php index d59fd426..9e25b8cd 100644 --- a/tests/PhpWord/Style/TextBoxTest.php +++ b/tests/PhpWord/Style/TextBoxTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\SimpleType\Jc; diff --git a/tests/PhpWord/StyleTest.php b/tests/PhpWord/StyleTest.php index 242af07e..48b3c3cd 100644 --- a/tests/PhpWord/StyleTest.php +++ b/tests/PhpWord/StyleTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord; use PhpOffice\PhpWord\SimpleType\Jc; diff --git a/tests/PhpWord/TemplateProcessorTest.php b/tests/PhpWord/TemplateProcessorTest.php index 7da6a2c4..0cac9931 100644 --- a/tests/PhpWord/TemplateProcessorTest.php +++ b/tests/PhpWord/TemplateProcessorTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord; /** diff --git a/tests/PhpWord/Writer/HTML/ElementTest.php b/tests/PhpWord/Writer/HTML/ElementTest.php index b39de48b..f92eacd6 100644 --- a/tests/PhpWord/Writer/HTML/ElementTest.php +++ b/tests/PhpWord/Writer/HTML/ElementTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML; use PhpOffice\PhpWord\Element\Text as TextElement; diff --git a/tests/PhpWord/Writer/HTML/PartTest.php b/tests/PhpWord/Writer/HTML/PartTest.php index 26894a5e..544c6708 100644 --- a/tests/PhpWord/Writer/HTML/PartTest.php +++ b/tests/PhpWord/Writer/HTML/PartTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML; use PhpOffice\PhpWord\Writer\HTML\Part\Body; diff --git a/tests/PhpWord/Writer/HTML/StyleTest.php b/tests/PhpWord/Writer/HTML/StyleTest.php index 54f3779e..ddb7cdd3 100644 --- a/tests/PhpWord/Writer/HTML/StyleTest.php +++ b/tests/PhpWord/Writer/HTML/StyleTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML; /** diff --git a/tests/PhpWord/Writer/HTMLTest.php b/tests/PhpWord/Writer/HTMLTest.php index 36f346d9..a2fe8395 100644 --- a/tests/PhpWord/Writer/HTMLTest.php +++ b/tests/PhpWord/Writer/HTMLTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer; use PhpOffice\PhpWord\PhpWord; diff --git a/tests/PhpWord/Writer/ODText/ElementTest.php b/tests/PhpWord/Writer/ODText/ElementTest.php index 0c2425e7..5b5f7363 100644 --- a/tests/PhpWord/Writer/ODText/ElementTest.php +++ b/tests/PhpWord/Writer/ODText/ElementTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText; use PhpOffice\Common\XMLWriter; diff --git a/tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php b/tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php index 724a4b5f..14f4cb1a 100644 --- a/tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php +++ b/tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Part; use PhpOffice\PhpWord\Writer\ODText; diff --git a/tests/PhpWord/Writer/ODText/Part/ContentTest.php b/tests/PhpWord/Writer/ODText/Part/ContentTest.php index e9fd994b..9d0daedf 100644 --- a/tests/PhpWord/Writer/ODText/Part/ContentTest.php +++ b/tests/PhpWord/Writer/ODText/Part/ContentTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Part; use PhpOffice\PhpWord\PhpWord; diff --git a/tests/PhpWord/Writer/ODText/StyleTest.php b/tests/PhpWord/Writer/ODText/StyleTest.php index 6369a09b..e086ea0f 100644 --- a/tests/PhpWord/Writer/ODText/StyleTest.php +++ b/tests/PhpWord/Writer/ODText/StyleTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText; use PhpOffice\Common\XMLWriter; diff --git a/tests/PhpWord/Writer/ODTextTest.php b/tests/PhpWord/Writer/ODTextTest.php index 9877b700..ec36b4e8 100644 --- a/tests/PhpWord/Writer/ODTextTest.php +++ b/tests/PhpWord/Writer/ODTextTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer; use PhpOffice\PhpWord\PhpWord; diff --git a/tests/PhpWord/Writer/PDF/DomPDFTest.php b/tests/PhpWord/Writer/PDF/DomPDFTest.php index 93189e49..e4c4ee52 100644 --- a/tests/PhpWord/Writer/PDF/DomPDFTest.php +++ b/tests/PhpWord/Writer/PDF/DomPDFTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\PDF; use PhpOffice\PhpWord\PhpWord; diff --git a/tests/PhpWord/Writer/PDF/MPDFTest.php b/tests/PhpWord/Writer/PDF/MPDFTest.php index c77e785f..e829e68f 100644 --- a/tests/PhpWord/Writer/PDF/MPDFTest.php +++ b/tests/PhpWord/Writer/PDF/MPDFTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\PDF; use PhpOffice\PhpWord\PhpWord; diff --git a/tests/PhpWord/Writer/PDF/TCPDFTest.php b/tests/PhpWord/Writer/PDF/TCPDFTest.php index a92fea19..a7bb2a31 100644 --- a/tests/PhpWord/Writer/PDF/TCPDFTest.php +++ b/tests/PhpWord/Writer/PDF/TCPDFTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\PDF; use PhpOffice\PhpWord\PhpWord; diff --git a/tests/PhpWord/Writer/PDFTest.php b/tests/PhpWord/Writer/PDFTest.php index 3a3ecdff..eb763f79 100644 --- a/tests/PhpWord/Writer/PDFTest.php +++ b/tests/PhpWord/Writer/PDFTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer; use PhpOffice\PhpWord\PhpWord; diff --git a/tests/PhpWord/Writer/RTF/ElementTest.php b/tests/PhpWord/Writer/RTF/ElementTest.php index ba0b34b4..31998350 100644 --- a/tests/PhpWord/Writer/RTF/ElementTest.php +++ b/tests/PhpWord/Writer/RTF/ElementTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\RTF; use PhpOffice\PhpWord\Writer\RTF; diff --git a/tests/PhpWord/Writer/RTF/StyleTest.php b/tests/PhpWord/Writer/RTF/StyleTest.php index 1c94604e..bd48814c 100644 --- a/tests/PhpWord/Writer/RTF/StyleTest.php +++ b/tests/PhpWord/Writer/RTF/StyleTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\RTF; /** diff --git a/tests/PhpWord/Writer/RTFTest.php b/tests/PhpWord/Writer/RTFTest.php index d2bd60e3..c2b30920 100644 --- a/tests/PhpWord/Writer/RTFTest.php +++ b/tests/PhpWord/Writer/RTFTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer; use PhpOffice\PhpWord\PhpWord; diff --git a/tests/PhpWord/Writer/Word2007/ElementTest.php b/tests/PhpWord/Writer/Word2007/ElementTest.php index a85cd628..4730ebfc 100644 --- a/tests/PhpWord/Writer/Word2007/ElementTest.php +++ b/tests/PhpWord/Writer/Word2007/ElementTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007; use PhpOffice\Common\XMLWriter; diff --git a/tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php b/tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php index 85d8b139..e231f1c8 100644 --- a/tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\Writer\Word2007; diff --git a/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php b/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php index 34213a01..8e3be114 100644 --- a/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\PhpWord; diff --git a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php index 3dbc465d..6103d4c8 100644 --- a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\ComplexType\FootnoteProperties; diff --git a/tests/PhpWord/Writer/Word2007/Part/FooterTest.php b/tests/PhpWord/Writer/Word2007/Part/FooterTest.php index 6833b29e..1fb81e8d 100644 --- a/tests/PhpWord/Writer/Word2007/Part/FooterTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/FooterTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\Writer\Word2007; diff --git a/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php b/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php index ae104a1c..0ecea19e 100644 --- a/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\PhpWord; diff --git a/tests/PhpWord/Writer/Word2007/Part/HeaderTest.php b/tests/PhpWord/Writer/Word2007/Part/HeaderTest.php index 342e0d70..0418ccec 100644 --- a/tests/PhpWord/Writer/Word2007/Part/HeaderTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/HeaderTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\Writer\Word2007; diff --git a/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php b/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php index 54abcd96..3eeb37cf 100644 --- a/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\PhpWord; diff --git a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php index 9ff5c638..f88ebe2e 100644 --- a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\ComplexType\TrackChangesView; diff --git a/tests/PhpWord/Writer/Word2007/Part/StylesTest.php b/tests/PhpWord/Writer/Word2007/Part/StylesTest.php index 827f633b..0478d0e4 100644 --- a/tests/PhpWord/Writer/Word2007/Part/StylesTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/StylesTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\PhpWord; diff --git a/tests/PhpWord/Writer/Word2007/PartTest.php b/tests/PhpWord/Writer/Word2007/PartTest.php index da836396..0c8568aa 100644 --- a/tests/PhpWord/Writer/Word2007/PartTest.php +++ b/tests/PhpWord/Writer/Word2007/PartTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007; use PhpOffice\PhpWord\Writer\Word2007\Part\RelsPart; diff --git a/tests/PhpWord/Writer/Word2007/Style/FontTest.php b/tests/PhpWord/Writer/Word2007/Style/FontTest.php index 764388dc..32a0c923 100644 --- a/tests/PhpWord/Writer/Word2007/Style/FontTest.php +++ b/tests/PhpWord/Writer/Word2007/Style/FontTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Style; use PhpOffice\PhpWord\TestHelperDOCX; diff --git a/tests/PhpWord/Writer/Word2007/StyleTest.php b/tests/PhpWord/Writer/Word2007/StyleTest.php index 7273dc33..474d2410 100644 --- a/tests/PhpWord/Writer/Word2007/StyleTest.php +++ b/tests/PhpWord/Writer/Word2007/StyleTest.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007; use PhpOffice\Common\XMLWriter; diff --git a/tests/PhpWord/Writer/Word2007Test.php b/tests/PhpWord/Writer/Word2007Test.php index c17cb81d..e7708961 100644 --- a/tests/PhpWord/Writer/Word2007Test.php +++ b/tests/PhpWord/Writer/Word2007Test.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer; use PhpOffice\PhpWord\PhpWord; diff --git a/tests/PhpWord/_includes/TestHelperDOCX.php b/tests/PhpWord/_includes/TestHelperDOCX.php index 1acf3561..d33b78c9 100644 --- a/tests/PhpWord/_includes/TestHelperDOCX.php +++ b/tests/PhpWord/_includes/TestHelperDOCX.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord; use PhpOffice\PhpWord\Exception\CreateTemporaryFileException; diff --git a/tests/PhpWord/_includes/XmlDocument.php b/tests/PhpWord/_includes/XmlDocument.php index 2c2f5c5f..353d3132 100644 --- a/tests/PhpWord/_includes/XmlDocument.php +++ b/tests/PhpWord/_includes/XmlDocument.php @@ -14,6 +14,7 @@ * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord; /** From 7e3d9fb89a397182ddd29e0d9a01e6803c5b603b Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 26 Sep 2017 22:00:02 +0200 Subject: [PATCH 100/370] replace @link with @see --- .php_cs.dist | 4 +- bootstrap.php | 2 +- src/PhpWord/Collection/AbstractCollection.php | 2 +- src/PhpWord/Collection/Bookmarks.php | 2 +- src/PhpWord/Collection/Charts.php | 2 +- src/PhpWord/Collection/Comments.php | 2 +- src/PhpWord/Collection/Endnotes.php | 2 +- src/PhpWord/Collection/Footnotes.php | 2 +- src/PhpWord/Collection/Titles.php | 2 +- .../ComplexType/FootnoteProperties.php | 2 +- src/PhpWord/ComplexType/ProofState.php | 2 +- src/PhpWord/ComplexType/TrackChangesView.php | 2 +- src/PhpWord/Element/AbstractContainer.php | 2 +- src/PhpWord/Element/AbstractElement.php | 2 +- src/PhpWord/Element/Bookmark.php | 2 +- src/PhpWord/Element/Cell.php | 2 +- src/PhpWord/Element/Chart.php | 2 +- src/PhpWord/Element/CheckBox.php | 2 +- src/PhpWord/Element/Comment.php | 2 +- src/PhpWord/Element/Endnote.php | 2 +- src/PhpWord/Element/Field.php | 4 +- src/PhpWord/Element/Footer.php | 4 +- src/PhpWord/Element/Footnote.php | 2 +- src/PhpWord/Element/FormField.php | 4 +- src/PhpWord/Element/Header.php | 2 +- src/PhpWord/Element/Image.php | 2 +- src/PhpWord/Element/Line.php | 2 +- src/PhpWord/Element/Link.php | 2 +- src/PhpWord/Element/ListItem.php | 2 +- src/PhpWord/Element/ListItemRun.php | 2 +- src/PhpWord/Element/Object.php | 2 +- src/PhpWord/Element/PageBreak.php | 2 +- src/PhpWord/Element/PreserveText.php | 2 +- src/PhpWord/Element/Row.php | 2 +- src/PhpWord/Element/SDT.php | 2 +- src/PhpWord/Element/Section.php | 2 +- src/PhpWord/Element/Shape.php | 2 +- src/PhpWord/Element/TOC.php | 2 +- src/PhpWord/Element/Table.php | 2 +- src/PhpWord/Element/Text.php | 2 +- src/PhpWord/Element/TextBox.php | 2 +- src/PhpWord/Element/TextBreak.php | 2 +- src/PhpWord/Element/TextRun.php | 2 +- src/PhpWord/Element/Title.php | 2 +- src/PhpWord/Element/TrackChange.php | 2 +- src/PhpWord/Escaper/AbstractEscaper.php | 2 +- src/PhpWord/Escaper/EscaperInterface.php | 2 +- src/PhpWord/Escaper/RegExp.php | 2 +- src/PhpWord/Escaper/Rtf.php | 2 +- src/PhpWord/Escaper/Xml.php | 2 +- src/PhpWord/Exception/CopyFileException.php | 2 +- .../CreateTemporaryFileException.php | 2 +- src/PhpWord/Exception/Exception.php | 2 +- .../Exception/InvalidImageException.php | 2 +- .../Exception/InvalidObjectException.php | 2 +- .../Exception/InvalidStyleException.php | 2 +- .../UnsupportedImageTypeException.php | 2 +- src/PhpWord/IOFactory.php | 2 +- src/PhpWord/Media.php | 2 +- src/PhpWord/Metadata/Compatibility.php | 6 +-- src/PhpWord/Metadata/DocInfo.php | 2 +- src/PhpWord/Metadata/Protection.php | 6 +-- src/PhpWord/Metadata/Settings.php | 6 +-- src/PhpWord/PhpWord.php | 2 +- src/PhpWord/Reader/AbstractReader.php | 2 +- src/PhpWord/Reader/HTML.php | 2 +- src/PhpWord/Reader/MsDoc.php | 48 +++++++++---------- src/PhpWord/Reader/ODText.php | 2 +- src/PhpWord/Reader/ODText/AbstractPart.php | 2 +- src/PhpWord/Reader/ODText/Content.php | 2 +- src/PhpWord/Reader/ODText/Meta.php | 2 +- src/PhpWord/Reader/RTF.php | 2 +- src/PhpWord/Reader/RTF/Document.php | 2 +- src/PhpWord/Reader/ReaderInterface.php | 2 +- src/PhpWord/Reader/Word2007.php | 2 +- src/PhpWord/Reader/Word2007/AbstractPart.php | 2 +- src/PhpWord/Reader/Word2007/DocPropsApp.php | 2 +- src/PhpWord/Reader/Word2007/DocPropsCore.php | 2 +- .../Reader/Word2007/DocPropsCustom.php | 2 +- src/PhpWord/Reader/Word2007/Document.php | 2 +- src/PhpWord/Reader/Word2007/Endnotes.php | 2 +- src/PhpWord/Reader/Word2007/Footnotes.php | 2 +- src/PhpWord/Reader/Word2007/Numbering.php | 2 +- src/PhpWord/Reader/Word2007/Settings.php | 2 +- src/PhpWord/Reader/Word2007/Styles.php | 2 +- src/PhpWord/Settings.php | 2 +- src/PhpWord/Shared/Converter.php | 2 +- src/PhpWord/Shared/Html.php | 2 +- src/PhpWord/Shared/OLERead.php | 2 +- src/PhpWord/Shared/ZipArchive.php | 2 +- src/PhpWord/SimpleType/Jc.php | 4 +- src/PhpWord/SimpleType/JcTable.php | 2 +- src/PhpWord/SimpleType/NumberFormat.php | 2 +- src/PhpWord/SimpleType/Zoom.php | 2 +- src/PhpWord/Style.php | 2 +- src/PhpWord/Style/AbstractStyle.php | 2 +- src/PhpWord/Style/Border.php | 2 +- src/PhpWord/Style/Cell.php | 2 +- src/PhpWord/Style/Chart.php | 2 +- src/PhpWord/Style/Extrusion.php | 4 +- src/PhpWord/Style/Fill.php | 6 +-- src/PhpWord/Style/Font.php | 12 ++--- src/PhpWord/Style/Frame.php | 2 +- src/PhpWord/Style/Image.php | 2 +- src/PhpWord/Style/Indentation.php | 4 +- src/PhpWord/Style/Line.php | 2 +- src/PhpWord/Style/LineNumbering.php | 6 +-- src/PhpWord/Style/ListItem.php | 2 +- src/PhpWord/Style/Numbering.php | 12 ++--- src/PhpWord/Style/NumberingLevel.php | 18 +++---- src/PhpWord/Style/Outline.php | 14 +++--- src/PhpWord/Style/Paper.php | 2 +- src/PhpWord/Style/Paragraph.php | 4 +- src/PhpWord/Style/Row.php | 2 +- src/PhpWord/Style/Section.php | 8 ++-- src/PhpWord/Style/Shading.php | 8 ++-- src/PhpWord/Style/Shadow.php | 4 +- src/PhpWord/Style/Shape.php | 2 +- src/PhpWord/Style/Spacing.php | 4 +- src/PhpWord/Style/TOC.php | 2 +- src/PhpWord/Style/Tab.php | 2 +- src/PhpWord/Style/Table.php | 2 +- src/PhpWord/Style/TextBox.php | 2 +- src/PhpWord/Template.php | 2 +- src/PhpWord/TemplateProcessor.php | 2 +- src/PhpWord/Writer/AbstractWriter.php | 2 +- src/PhpWord/Writer/HTML.php | 2 +- .../Writer/HTML/Element/AbstractElement.php | 2 +- src/PhpWord/Writer/HTML/Element/Container.php | 2 +- src/PhpWord/Writer/HTML/Element/Endnote.php | 2 +- src/PhpWord/Writer/HTML/Element/Footnote.php | 2 +- src/PhpWord/Writer/HTML/Element/Image.php | 2 +- src/PhpWord/Writer/HTML/Element/Link.php | 2 +- src/PhpWord/Writer/HTML/Element/ListItem.php | 2 +- src/PhpWord/Writer/HTML/Element/PageBreak.php | 2 +- src/PhpWord/Writer/HTML/Element/Table.php | 2 +- src/PhpWord/Writer/HTML/Element/Text.php | 2 +- src/PhpWord/Writer/HTML/Element/TextBreak.php | 2 +- src/PhpWord/Writer/HTML/Element/TextRun.php | 2 +- src/PhpWord/Writer/HTML/Element/Title.php | 2 +- src/PhpWord/Writer/HTML/Part/AbstractPart.php | 2 +- src/PhpWord/Writer/HTML/Part/Body.php | 2 +- src/PhpWord/Writer/HTML/Part/Head.php | 2 +- .../Writer/HTML/Style/AbstractStyle.php | 2 +- src/PhpWord/Writer/HTML/Style/Font.php | 2 +- src/PhpWord/Writer/HTML/Style/Generic.php | 2 +- src/PhpWord/Writer/HTML/Style/Image.php | 2 +- src/PhpWord/Writer/HTML/Style/Paragraph.php | 2 +- src/PhpWord/Writer/ODText.php | 2 +- .../Writer/ODText/Element/AbstractElement.php | 2 +- .../Writer/ODText/Element/Container.php | 2 +- src/PhpWord/Writer/ODText/Element/Image.php | 2 +- src/PhpWord/Writer/ODText/Element/Link.php | 2 +- src/PhpWord/Writer/ODText/Element/Table.php | 2 +- src/PhpWord/Writer/ODText/Element/Text.php | 2 +- .../Writer/ODText/Element/TextBreak.php | 2 +- src/PhpWord/Writer/ODText/Element/TextRun.php | 2 +- src/PhpWord/Writer/ODText/Element/Title.php | 2 +- .../Writer/ODText/Part/AbstractPart.php | 2 +- src/PhpWord/Writer/ODText/Part/Content.php | 2 +- src/PhpWord/Writer/ODText/Part/Manifest.php | 2 +- src/PhpWord/Writer/ODText/Part/Meta.php | 2 +- src/PhpWord/Writer/ODText/Part/Mimetype.php | 2 +- src/PhpWord/Writer/ODText/Part/Styles.php | 2 +- .../Writer/ODText/Style/AbstractStyle.php | 2 +- src/PhpWord/Writer/ODText/Style/Font.php | 2 +- src/PhpWord/Writer/ODText/Style/Image.php | 2 +- src/PhpWord/Writer/ODText/Style/Paragraph.php | 2 +- src/PhpWord/Writer/ODText/Style/Section.php | 2 +- src/PhpWord/Writer/ODText/Style/Table.php | 2 +- src/PhpWord/Writer/PDF.php | 2 +- src/PhpWord/Writer/PDF/AbstractRenderer.php | 2 +- src/PhpWord/Writer/PDF/DomPDF.php | 4 +- src/PhpWord/Writer/PDF/MPDF.php | 4 +- src/PhpWord/Writer/PDF/TCPDF.php | 4 +- src/PhpWord/Writer/RTF.php | 2 +- .../Writer/RTF/Element/AbstractElement.php | 2 +- src/PhpWord/Writer/RTF/Element/Container.php | 2 +- src/PhpWord/Writer/RTF/Element/Image.php | 2 +- src/PhpWord/Writer/RTF/Element/Link.php | 2 +- src/PhpWord/Writer/RTF/Element/ListItem.php | 2 +- src/PhpWord/Writer/RTF/Element/PageBreak.php | 2 +- src/PhpWord/Writer/RTF/Element/Table.php | 2 +- src/PhpWord/Writer/RTF/Element/Text.php | 2 +- src/PhpWord/Writer/RTF/Element/TextBreak.php | 2 +- src/PhpWord/Writer/RTF/Element/TextRun.php | 2 +- src/PhpWord/Writer/RTF/Element/Title.php | 2 +- src/PhpWord/Writer/RTF/Part/AbstractPart.php | 2 +- src/PhpWord/Writer/RTF/Part/Document.php | 4 +- src/PhpWord/Writer/RTF/Part/Header.php | 4 +- .../Writer/RTF/Style/AbstractStyle.php | 2 +- src/PhpWord/Writer/RTF/Style/Border.php | 2 +- src/PhpWord/Writer/RTF/Style/Font.php | 2 +- src/PhpWord/Writer/RTF/Style/Paragraph.php | 2 +- src/PhpWord/Writer/RTF/Style/Section.php | 2 +- src/PhpWord/Writer/Word2007.php | 2 +- .../Word2007/Element/AbstractElement.php | 2 +- .../Writer/Word2007/Element/Bookmark.php | 2 +- src/PhpWord/Writer/Word2007/Element/Chart.php | 2 +- .../Writer/Word2007/Element/CheckBox.php | 2 +- .../Writer/Word2007/Element/Container.php | 2 +- .../Writer/Word2007/Element/Endnote.php | 2 +- src/PhpWord/Writer/Word2007/Element/Field.php | 2 +- .../Writer/Word2007/Element/Footnote.php | 2 +- .../Writer/Word2007/Element/FormField.php | 10 ++-- src/PhpWord/Writer/Word2007/Element/Image.php | 2 +- src/PhpWord/Writer/Word2007/Element/Line.php | 2 +- src/PhpWord/Writer/Word2007/Element/Link.php | 2 +- .../Writer/Word2007/Element/ListItem.php | 2 +- .../Writer/Word2007/Element/ListItemRun.php | 2 +- .../Writer/Word2007/Element/Object.php | 2 +- .../Writer/Word2007/Element/PageBreak.php | 2 +- .../Word2007/Element/ParagraphAlignment.php | 2 +- .../Writer/Word2007/Element/PreserveText.php | 2 +- src/PhpWord/Writer/Word2007/Element/SDT.php | 10 ++-- src/PhpWord/Writer/Word2007/Element/Shape.php | 2 +- src/PhpWord/Writer/Word2007/Element/TOC.php | 2 +- src/PhpWord/Writer/Word2007/Element/Table.php | 2 +- .../Word2007/Element/TableAlignment.php | 2 +- src/PhpWord/Writer/Word2007/Element/Text.php | 2 +- .../Writer/Word2007/Element/TextBox.php | 2 +- .../Writer/Word2007/Element/TextBreak.php | 2 +- .../Writer/Word2007/Element/TextRun.php | 2 +- src/PhpWord/Writer/Word2007/Element/Title.php | 2 +- .../Writer/Word2007/Part/AbstractPart.php | 2 +- src/PhpWord/Writer/Word2007/Part/Chart.php | 26 +++++----- src/PhpWord/Writer/Word2007/Part/Comments.php | 2 +- .../Writer/Word2007/Part/ContentTypes.php | 2 +- .../Writer/Word2007/Part/DocPropsApp.php | 2 +- .../Writer/Word2007/Part/DocPropsCore.php | 2 +- .../Writer/Word2007/Part/DocPropsCustom.php | 2 +- src/PhpWord/Writer/Word2007/Part/Document.php | 2 +- src/PhpWord/Writer/Word2007/Part/Endnotes.php | 2 +- .../Writer/Word2007/Part/FontTable.php | 2 +- src/PhpWord/Writer/Word2007/Part/Footer.php | 2 +- .../Writer/Word2007/Part/Footnotes.php | 2 +- src/PhpWord/Writer/Word2007/Part/Header.php | 2 +- .../Writer/Word2007/Part/Numbering.php | 2 +- src/PhpWord/Writer/Word2007/Part/Rels.php | 2 +- .../Writer/Word2007/Part/RelsDocument.php | 2 +- src/PhpWord/Writer/Word2007/Part/RelsPart.php | 2 +- src/PhpWord/Writer/Word2007/Part/Settings.php | 4 +- src/PhpWord/Writer/Word2007/Part/Styles.php | 2 +- src/PhpWord/Writer/Word2007/Part/Theme.php | 2 +- .../Writer/Word2007/Part/WebSettings.php | 2 +- .../Writer/Word2007/Style/AbstractStyle.php | 2 +- src/PhpWord/Writer/Word2007/Style/Cell.php | 2 +- .../Writer/Word2007/Style/Extrusion.php | 2 +- src/PhpWord/Writer/Word2007/Style/Fill.php | 2 +- src/PhpWord/Writer/Word2007/Style/Font.php | 2 +- src/PhpWord/Writer/Word2007/Style/Frame.php | 2 +- src/PhpWord/Writer/Word2007/Style/Image.php | 2 +- .../Writer/Word2007/Style/Indentation.php | 2 +- src/PhpWord/Writer/Word2007/Style/Line.php | 2 +- .../Writer/Word2007/Style/LineNumbering.php | 2 +- .../Writer/Word2007/Style/MarginBorder.php | 2 +- src/PhpWord/Writer/Word2007/Style/Outline.php | 2 +- .../Writer/Word2007/Style/Paragraph.php | 2 +- src/PhpWord/Writer/Word2007/Style/Row.php | 2 +- src/PhpWord/Writer/Word2007/Style/Section.php | 2 +- src/PhpWord/Writer/Word2007/Style/Shading.php | 2 +- src/PhpWord/Writer/Word2007/Style/Shadow.php | 2 +- src/PhpWord/Writer/Word2007/Style/Shape.php | 2 +- src/PhpWord/Writer/Word2007/Style/Spacing.php | 2 +- src/PhpWord/Writer/Word2007/Style/Tab.php | 2 +- src/PhpWord/Writer/Word2007/Style/Table.php | 2 +- src/PhpWord/Writer/Word2007/Style/TextBox.php | 2 +- src/PhpWord/Writer/WriterInterface.php | 2 +- tests/PhpWord/Collection/CollectionTest.php | 2 +- .../ComplexType/FootnotePropertiesTest.php | 2 +- tests/PhpWord/Element/AbstractElementTest.php | 2 +- tests/PhpWord/Element/CellTest.php | 2 +- tests/PhpWord/Element/CheckBoxTest.php | 2 +- tests/PhpWord/Element/CommentTest.php | 2 +- tests/PhpWord/Element/FieldTest.php | 2 +- tests/PhpWord/Element/FooterTest.php | 2 +- tests/PhpWord/Element/FootnoteTest.php | 2 +- tests/PhpWord/Element/HeaderTest.php | 2 +- tests/PhpWord/Element/ImageTest.php | 2 +- tests/PhpWord/Element/LineTest.php | 2 +- tests/PhpWord/Element/LinkTest.php | 2 +- tests/PhpWord/Element/ListItemRunTest.php | 2 +- tests/PhpWord/Element/ListItemTest.php | 2 +- tests/PhpWord/Element/ObjectTest.php | 2 +- tests/PhpWord/Element/PageBreakTest.php | 2 +- tests/PhpWord/Element/PreserveTextTest.php | 2 +- tests/PhpWord/Element/RowTest.php | 2 +- tests/PhpWord/Element/SDTTest.php | 2 +- tests/PhpWord/Element/SectionTest.php | 2 +- tests/PhpWord/Element/TOCTest.php | 2 +- tests/PhpWord/Element/TableTest.php | 2 +- tests/PhpWord/Element/TextBoxTest.php | 2 +- tests/PhpWord/Element/TextBreakTest.php | 2 +- tests/PhpWord/Element/TextRunTest.php | 2 +- tests/PhpWord/Element/TextTest.php | 2 +- tests/PhpWord/Element/TitleTest.php | 2 +- .../Exception/CopyFileExceptionTest.php | 2 +- .../CreateTemporaryFileExceptionTest.php | 2 +- tests/PhpWord/Exception/ExceptionTest.php | 2 +- .../Exception/InvalidImageExceptionTest.php | 2 +- .../Exception/InvalidStyleExceptionTest.php | 2 +- .../UnsupportedImageTypeExceptionTest.php | 2 +- tests/PhpWord/IOFactoryTest.php | 2 +- tests/PhpWord/MediaTest.php | 2 +- tests/PhpWord/Metadata/DocInfoTest.php | 2 +- tests/PhpWord/Metadata/SettingsTest.php | 2 +- tests/PhpWord/PhpWordTest.php | 2 +- tests/PhpWord/Reader/HTMLTest.php | 2 +- tests/PhpWord/Reader/MsDocTest.php | 2 +- tests/PhpWord/Reader/ODTextTest.php | 2 +- tests/PhpWord/Reader/RTFTest.php | 2 +- tests/PhpWord/Reader/Word2007Test.php | 2 +- tests/PhpWord/SettingsTest.php | 2 +- tests/PhpWord/Shared/ConverterTest.php | 2 +- tests/PhpWord/Shared/HtmlTest.php | 2 +- tests/PhpWord/Shared/ZipArchiveTest.php | 2 +- tests/PhpWord/Style/AbstractStyleTest.php | 2 +- tests/PhpWord/Style/CellTest.php | 2 +- tests/PhpWord/Style/FontTest.php | 2 +- tests/PhpWord/Style/ImageTest.php | 2 +- tests/PhpWord/Style/IndentationTest.php | 2 +- tests/PhpWord/Style/LineNumberingTest.php | 2 +- tests/PhpWord/Style/LineTest.php | 2 +- tests/PhpWord/Style/ListItemTest.php | 2 +- tests/PhpWord/Style/NumberingLevelTest.php | 2 +- tests/PhpWord/Style/NumberingTest.php | 2 +- tests/PhpWord/Style/PaperTest.php | 2 +- tests/PhpWord/Style/ParagraphTest.php | 2 +- tests/PhpWord/Style/RowTest.php | 2 +- tests/PhpWord/Style/SectionTest.php | 2 +- tests/PhpWord/Style/ShadingTest.php | 2 +- tests/PhpWord/Style/SpacingTest.php | 2 +- tests/PhpWord/Style/TOCTest.php | 2 +- tests/PhpWord/Style/TabTest.php | 2 +- tests/PhpWord/Style/TableTest.php | 2 +- tests/PhpWord/Style/TextBoxTest.php | 2 +- tests/PhpWord/StyleTest.php | 2 +- tests/PhpWord/TemplateProcessorTest.php | 2 +- tests/PhpWord/Writer/HTML/ElementTest.php | 2 +- tests/PhpWord/Writer/HTML/PartTest.php | 2 +- tests/PhpWord/Writer/HTML/StyleTest.php | 2 +- tests/PhpWord/Writer/HTMLTest.php | 2 +- tests/PhpWord/Writer/ODText/ElementTest.php | 2 +- .../Writer/ODText/Part/AbstractPartTest.php | 2 +- .../Writer/ODText/Part/ContentTest.php | 2 +- tests/PhpWord/Writer/ODText/StyleTest.php | 2 +- tests/PhpWord/Writer/ODTextTest.php | 2 +- tests/PhpWord/Writer/PDF/DomPDFTest.php | 2 +- tests/PhpWord/Writer/PDF/MPDFTest.php | 2 +- tests/PhpWord/Writer/PDF/TCPDFTest.php | 2 +- tests/PhpWord/Writer/PDFTest.php | 2 +- tests/PhpWord/Writer/RTF/ElementTest.php | 2 +- tests/PhpWord/Writer/RTF/StyleTest.php | 2 +- tests/PhpWord/Writer/RTFTest.php | 2 +- tests/PhpWord/Writer/Word2007/ElementTest.php | 2 +- .../Writer/Word2007/Part/AbstractPartTest.php | 2 +- .../Writer/Word2007/Part/CommentsTest.php | 2 +- .../Writer/Word2007/Part/DocumentTest.php | 2 +- .../Writer/Word2007/Part/FooterTest.php | 2 +- .../Writer/Word2007/Part/FootnotesTest.php | 2 +- .../Writer/Word2007/Part/HeaderTest.php | 2 +- .../Writer/Word2007/Part/NumberingTest.php | 2 +- .../Writer/Word2007/Part/SettingsTest.php | 2 +- .../Writer/Word2007/Part/StylesTest.php | 2 +- tests/PhpWord/Writer/Word2007/PartTest.php | 2 +- .../Writer/Word2007/Style/FontTest.php | 2 +- tests/PhpWord/Writer/Word2007/StyleTest.php | 2 +- tests/PhpWord/Writer/Word2007Test.php | 2 +- tests/PhpWord/_includes/TestHelperDOCX.php | 2 +- tests/PhpWord/_includes/XmlDocument.php | 2 +- tests/bootstrap.php | 2 +- 371 files changed, 470 insertions(+), 470 deletions(-) diff --git a/.php_cs.dist b/.php_cs.dist index 51a6117a..895ed80f 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -98,14 +98,14 @@ return PhpCsFixer\Config::create() 'phpdoc_indent' => true, 'phpdoc_inline_tag' => true, 'phpdoc_no_access' => true, - 'phpdoc_no_alias_tag' => false, //@see instead of @link + 'phpdoc_no_alias_tag' => true, 'phpdoc_no_empty_return' => true, 'phpdoc_no_package' => true, 'phpdoc_no_useless_inheritdoc' => true, 'phpdoc_order' => true, 'phpdoc_return_self_reference' => true, 'phpdoc_scalar' => true, - 'phpdoc_separation' => false, //TODO + 'phpdoc_separation' => false, 'phpdoc_single_line_var_spacing' => true, 'phpdoc_summary' => false, 'phpdoc_to_comment' => true, diff --git a/bootstrap.php b/bootstrap.php index 4bef8451..362e8b74 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. test bootstrap * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Collection/AbstractCollection.php b/src/PhpWord/Collection/AbstractCollection.php index f7f29785..61709a50 100644 --- a/src/PhpWord/Collection/AbstractCollection.php +++ b/src/PhpWord/Collection/AbstractCollection.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Collection/Bookmarks.php b/src/PhpWord/Collection/Bookmarks.php index c7bcc34f..7210fb03 100644 --- a/src/PhpWord/Collection/Bookmarks.php +++ b/src/PhpWord/Collection/Bookmarks.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Collection/Charts.php b/src/PhpWord/Collection/Charts.php index ad550a2c..56d92c94 100644 --- a/src/PhpWord/Collection/Charts.php +++ b/src/PhpWord/Collection/Charts.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Collection/Comments.php b/src/PhpWord/Collection/Comments.php index 828c56b7..f2fe82d9 100644 --- a/src/PhpWord/Collection/Comments.php +++ b/src/PhpWord/Collection/Comments.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Collection/Endnotes.php b/src/PhpWord/Collection/Endnotes.php index f30f638f..52a56d31 100644 --- a/src/PhpWord/Collection/Endnotes.php +++ b/src/PhpWord/Collection/Endnotes.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Collection/Footnotes.php b/src/PhpWord/Collection/Footnotes.php index bb09e3ec..63989f53 100644 --- a/src/PhpWord/Collection/Footnotes.php +++ b/src/PhpWord/Collection/Footnotes.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Collection/Titles.php b/src/PhpWord/Collection/Titles.php index b2a81065..9e4f12cd 100644 --- a/src/PhpWord/Collection/Titles.php +++ b/src/PhpWord/Collection/Titles.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/ComplexType/FootnoteProperties.php b/src/PhpWord/ComplexType/FootnoteProperties.php index 6d0e45c1..8cb3a869 100644 --- a/src/PhpWord/ComplexType/FootnoteProperties.php +++ b/src/PhpWord/ComplexType/FootnoteProperties.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/ComplexType/ProofState.php b/src/PhpWord/ComplexType/ProofState.php index b41e2441..6a915da1 100644 --- a/src/PhpWord/ComplexType/ProofState.php +++ b/src/PhpWord/ComplexType/ProofState.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/ComplexType/TrackChangesView.php b/src/PhpWord/ComplexType/TrackChangesView.php index b74e5e3c..51364b4a 100644 --- a/src/PhpWord/ComplexType/TrackChangesView.php +++ b/src/PhpWord/ComplexType/TrackChangesView.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/AbstractContainer.php b/src/PhpWord/Element/AbstractContainer.php index 75fb38b2..75153499 100644 --- a/src/PhpWord/Element/AbstractContainer.php +++ b/src/PhpWord/Element/AbstractContainer.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/AbstractElement.php b/src/PhpWord/Element/AbstractElement.php index 00130170..792a340f 100644 --- a/src/PhpWord/Element/AbstractElement.php +++ b/src/PhpWord/Element/AbstractElement.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Bookmark.php b/src/PhpWord/Element/Bookmark.php index 5bb93f65..f4c1a684 100644 --- a/src/PhpWord/Element/Bookmark.php +++ b/src/PhpWord/Element/Bookmark.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Cell.php b/src/PhpWord/Element/Cell.php index 18f698c6..b5250cd6 100644 --- a/src/PhpWord/Element/Cell.php +++ b/src/PhpWord/Element/Cell.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Chart.php b/src/PhpWord/Element/Chart.php index 0453bd95..c340da40 100644 --- a/src/PhpWord/Element/Chart.php +++ b/src/PhpWord/Element/Chart.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/CheckBox.php b/src/PhpWord/Element/CheckBox.php index cf55166a..11f71ee2 100644 --- a/src/PhpWord/Element/CheckBox.php +++ b/src/PhpWord/Element/CheckBox.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Comment.php b/src/PhpWord/Element/Comment.php index 6189afd9..8f76c471 100644 --- a/src/PhpWord/Element/Comment.php +++ b/src/PhpWord/Element/Comment.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Endnote.php b/src/PhpWord/Element/Endnote.php index 36ae66f3..6565c039 100644 --- a/src/PhpWord/Element/Endnote.php +++ b/src/PhpWord/Element/Endnote.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Field.php b/src/PhpWord/Element/Field.php index c9f50357..726938b5 100644 --- a/src/PhpWord/Element/Field.php +++ b/src/PhpWord/Element/Field.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -21,7 +21,7 @@ namespace PhpOffice\PhpWord\Element; * Field element * * @since 0.11.0 - * @link http://www.schemacentral.com/sc/ooxml/t-w_CT_SimpleField.html + * @see http://www.schemacentral.com/sc/ooxml/t-w_CT_SimpleField.html */ class Field extends AbstractElement { diff --git a/src/PhpWord/Element/Footer.php b/src/PhpWord/Element/Footer.php index fa668dd7..08ff525a 100644 --- a/src/PhpWord/Element/Footer.php +++ b/src/PhpWord/Element/Footer.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,7 +26,7 @@ class Footer extends AbstractContainer * Header/footer types constants * * @var string - * @link http://www.datypic.com/sc/ooxml/t-w_ST_HdrFtr.html Header or Footer Type + * @see http://www.datypic.com/sc/ooxml/t-w_ST_HdrFtr.html Header or Footer Type */ const AUTO = 'default'; // default and odd pages const FIRST = 'first'; diff --git a/src/PhpWord/Element/Footnote.php b/src/PhpWord/Element/Footnote.php index 7789b2db..9acdc4c3 100644 --- a/src/PhpWord/Element/Footnote.php +++ b/src/PhpWord/Element/Footnote.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/FormField.php b/src/PhpWord/Element/FormField.php index 19955416..61eb4301 100644 --- a/src/PhpWord/Element/FormField.php +++ b/src/PhpWord/Element/FormField.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -21,7 +21,7 @@ namespace PhpOffice\PhpWord\Element; * Form field element * * @since 0.12.0 - * @link http://www.datypic.com/sc/ooxml/t-w_CT_FFData.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_FFData.html */ class FormField extends Text { diff --git a/src/PhpWord/Element/Header.php b/src/PhpWord/Element/Header.php index 2e2612b6..ee820877 100644 --- a/src/PhpWord/Element/Header.php +++ b/src/PhpWord/Element/Header.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Image.php b/src/PhpWord/Element/Image.php index 46fb60a0..c9620b6b 100644 --- a/src/PhpWord/Element/Image.php +++ b/src/PhpWord/Element/Image.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Line.php b/src/PhpWord/Element/Line.php index e94a5791..eba66473 100644 --- a/src/PhpWord/Element/Line.php +++ b/src/PhpWord/Element/Line.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Link.php b/src/PhpWord/Element/Link.php index d884fc71..05ae0137 100644 --- a/src/PhpWord/Element/Link.php +++ b/src/PhpWord/Element/Link.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/ListItem.php b/src/PhpWord/Element/ListItem.php index c1294908..7f665b1b 100644 --- a/src/PhpWord/Element/ListItem.php +++ b/src/PhpWord/Element/ListItem.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/ListItemRun.php b/src/PhpWord/Element/ListItemRun.php index 9a44dd50..5286f662 100644 --- a/src/PhpWord/Element/ListItemRun.php +++ b/src/PhpWord/Element/ListItemRun.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * -* @link https://github.com/PHPOffice/PHPWord +* @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Object.php b/src/PhpWord/Element/Object.php index 891b7d53..8fe83224 100644 --- a/src/PhpWord/Element/Object.php +++ b/src/PhpWord/Element/Object.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/PageBreak.php b/src/PhpWord/Element/PageBreak.php index a2debaf6..e41e807b 100644 --- a/src/PhpWord/Element/PageBreak.php +++ b/src/PhpWord/Element/PageBreak.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/PreserveText.php b/src/PhpWord/Element/PreserveText.php index e9fa4839..c0a4a84d 100644 --- a/src/PhpWord/Element/PreserveText.php +++ b/src/PhpWord/Element/PreserveText.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Row.php b/src/PhpWord/Element/Row.php index f3d26ef5..2e89b354 100644 --- a/src/PhpWord/Element/Row.php +++ b/src/PhpWord/Element/Row.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/SDT.php b/src/PhpWord/Element/SDT.php index 2efefc1e..f65b5b26 100644 --- a/src/PhpWord/Element/SDT.php +++ b/src/PhpWord/Element/SDT.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Section.php b/src/PhpWord/Element/Section.php index eb562586..ffc98435 100644 --- a/src/PhpWord/Element/Section.php +++ b/src/PhpWord/Element/Section.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Shape.php b/src/PhpWord/Element/Shape.php index a2412ce9..b553a4ac 100644 --- a/src/PhpWord/Element/Shape.php +++ b/src/PhpWord/Element/Shape.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/TOC.php b/src/PhpWord/Element/TOC.php index e01aec84..900198d0 100644 --- a/src/PhpWord/Element/TOC.php +++ b/src/PhpWord/Element/TOC.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Table.php b/src/PhpWord/Element/Table.php index 777b84e2..3a045031 100644 --- a/src/PhpWord/Element/Table.php +++ b/src/PhpWord/Element/Table.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Text.php b/src/PhpWord/Element/Text.php index f50f3366..4de12176 100644 --- a/src/PhpWord/Element/Text.php +++ b/src/PhpWord/Element/Text.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/TextBox.php b/src/PhpWord/Element/TextBox.php index b97a46d1..8058d0c9 100644 --- a/src/PhpWord/Element/TextBox.php +++ b/src/PhpWord/Element/TextBox.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/TextBreak.php b/src/PhpWord/Element/TextBreak.php index da986f74..4cf65f35 100644 --- a/src/PhpWord/Element/TextBreak.php +++ b/src/PhpWord/Element/TextBreak.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/TextRun.php b/src/PhpWord/Element/TextRun.php index 9a23470f..d8a898b4 100644 --- a/src/PhpWord/Element/TextRun.php +++ b/src/PhpWord/Element/TextRun.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Title.php b/src/PhpWord/Element/Title.php index 40be3a2b..808af55e 100644 --- a/src/PhpWord/Element/Title.php +++ b/src/PhpWord/Element/Title.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/TrackChange.php b/src/PhpWord/Element/TrackChange.php index 721c372a..deaf0055 100644 --- a/src/PhpWord/Element/TrackChange.php +++ b/src/PhpWord/Element/TrackChange.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Escaper/AbstractEscaper.php b/src/PhpWord/Escaper/AbstractEscaper.php index cb3fdfeb..8207e2c6 100644 --- a/src/PhpWord/Escaper/AbstractEscaper.php +++ b/src/PhpWord/Escaper/AbstractEscaper.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Escaper/EscaperInterface.php b/src/PhpWord/Escaper/EscaperInterface.php index 45f7f301..1ef35c1b 100644 --- a/src/PhpWord/Escaper/EscaperInterface.php +++ b/src/PhpWord/Escaper/EscaperInterface.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Escaper/RegExp.php b/src/PhpWord/Escaper/RegExp.php index 18279eb8..2f4e12ec 100644 --- a/src/PhpWord/Escaper/RegExp.php +++ b/src/PhpWord/Escaper/RegExp.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Escaper/Rtf.php b/src/PhpWord/Escaper/Rtf.php index 9663c6fc..35f91ada 100644 --- a/src/PhpWord/Escaper/Rtf.php +++ b/src/PhpWord/Escaper/Rtf.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Escaper/Xml.php b/src/PhpWord/Escaper/Xml.php index 7b092aac..81cedaa9 100644 --- a/src/PhpWord/Escaper/Xml.php +++ b/src/PhpWord/Escaper/Xml.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Exception/CopyFileException.php b/src/PhpWord/Exception/CopyFileException.php index 97e68112..a5c1da6a 100644 --- a/src/PhpWord/Exception/CopyFileException.php +++ b/src/PhpWord/Exception/CopyFileException.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Exception/CreateTemporaryFileException.php b/src/PhpWord/Exception/CreateTemporaryFileException.php index 16a9baa0..fafc8dac 100644 --- a/src/PhpWord/Exception/CreateTemporaryFileException.php +++ b/src/PhpWord/Exception/CreateTemporaryFileException.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Exception/Exception.php b/src/PhpWord/Exception/Exception.php index 498ef38c..b94ed1be 100644 --- a/src/PhpWord/Exception/Exception.php +++ b/src/PhpWord/Exception/Exception.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Exception/InvalidImageException.php b/src/PhpWord/Exception/InvalidImageException.php index 4d863545..0a7b8fed 100644 --- a/src/PhpWord/Exception/InvalidImageException.php +++ b/src/PhpWord/Exception/InvalidImageException.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Exception/InvalidObjectException.php b/src/PhpWord/Exception/InvalidObjectException.php index 61e933f3..54015506 100644 --- a/src/PhpWord/Exception/InvalidObjectException.php +++ b/src/PhpWord/Exception/InvalidObjectException.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Exception/InvalidStyleException.php b/src/PhpWord/Exception/InvalidStyleException.php index 4110e55e..e697f6cf 100644 --- a/src/PhpWord/Exception/InvalidStyleException.php +++ b/src/PhpWord/Exception/InvalidStyleException.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Exception/UnsupportedImageTypeException.php b/src/PhpWord/Exception/UnsupportedImageTypeException.php index d2d2b360..73b41d04 100644 --- a/src/PhpWord/Exception/UnsupportedImageTypeException.php +++ b/src/PhpWord/Exception/UnsupportedImageTypeException.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/IOFactory.php b/src/PhpWord/IOFactory.php index b523480c..eed1f163 100644 --- a/src/PhpWord/IOFactory.php +++ b/src/PhpWord/IOFactory.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Media.php b/src/PhpWord/Media.php index c358f2a0..d9879010 100644 --- a/src/PhpWord/Media.php +++ b/src/PhpWord/Media.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Metadata/Compatibility.php b/src/PhpWord/Metadata/Compatibility.php index d990b095..69f6f98a 100644 --- a/src/PhpWord/Metadata/Compatibility.php +++ b/src/PhpWord/Metadata/Compatibility.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -21,7 +21,7 @@ namespace PhpOffice\PhpWord\Metadata; * Compatibility setting class * * @since 0.12.0 - * @link http://www.datypic.com/sc/ooxml/t-w_CT_Compat.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_Compat.html */ class Compatibility { @@ -33,7 +33,7 @@ class Compatibility * 15 = 2013 * * @var int - * @link http://msdn.microsoft.com/en-us/library/dd909048%28v=office.12%29.aspx + * @see http://msdn.microsoft.com/en-us/library/dd909048%28v=office.12%29.aspx */ private $ooxmlVersion = 12; diff --git a/src/PhpWord/Metadata/DocInfo.php b/src/PhpWord/Metadata/DocInfo.php index 37a5ff92..0508dcd0 100644 --- a/src/PhpWord/Metadata/DocInfo.php +++ b/src/PhpWord/Metadata/DocInfo.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Metadata/Protection.php b/src/PhpWord/Metadata/Protection.php index 448b1063..ef5063f8 100644 --- a/src/PhpWord/Metadata/Protection.php +++ b/src/PhpWord/Metadata/Protection.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -21,7 +21,7 @@ namespace PhpOffice\PhpWord\Metadata; * Document protection class * * @since 0.12.0 - * @link http://www.datypic.com/sc/ooxml/t-w_CT_DocProtect.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_DocProtect.html * @todo Password! */ class Protection @@ -30,7 +30,7 @@ class Protection * Editing restriction readOnly|comments|trackedChanges|forms * * @var string - * @link http://www.datypic.com/sc/ooxml/a-w_edit-1.html + * @see http://www.datypic.com/sc/ooxml/a-w_edit-1.html */ private $editing; diff --git a/src/PhpWord/Metadata/Settings.php b/src/PhpWord/Metadata/Settings.php index 418c044d..d5652640 100644 --- a/src/PhpWord/Metadata/Settings.php +++ b/src/PhpWord/Metadata/Settings.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -25,14 +25,14 @@ use PhpOffice\PhpWord\SimpleType\Zoom; * Setting class * * @since 0.14.0 - * @link http://www.datypic.com/sc/ooxml/t-w_CT_Settings.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_Settings.html */ class Settings { /** * Magnification Setting * - * @link http://www.datypic.com/sc/ooxml/e-w_zoom-1.html + * @see http://www.datypic.com/sc/ooxml/e-w_zoom-1.html * @var mixed either integer, in which case it treated as a percent, or one of PhpOffice\PhpWord\SimpleType\Zoom */ private $zoom = 100; diff --git a/src/PhpWord/PhpWord.php b/src/PhpWord/PhpWord.php index 6f524350..d7c2348a 100644 --- a/src/PhpWord/PhpWord.php +++ b/src/PhpWord/PhpWord.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/AbstractReader.php b/src/PhpWord/Reader/AbstractReader.php index 7779226f..f59a9556 100644 --- a/src/PhpWord/Reader/AbstractReader.php +++ b/src/PhpWord/Reader/AbstractReader.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/HTML.php b/src/PhpWord/Reader/HTML.php index 46ea4abc..4e8b5e82 100644 --- a/src/PhpWord/Reader/HTML.php +++ b/src/PhpWord/Reader/HTML.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/MsDoc.php b/src/PhpWord/Reader/MsDoc.php index 79731cfd..9baacb51 100644 --- a/src/PhpWord/Reader/MsDoc.php +++ b/src/PhpWord/Reader/MsDoc.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -169,8 +169,8 @@ class MsDoc extends AbstractReader implements ReaderInterface } /** - * @link http://msdn.microsoft.com/en-us/library/dd949344%28v=office.12%29.aspx - * @link https://igor.io/2012/09/24/binary-parsing.html + * @see http://msdn.microsoft.com/en-us/library/dd949344%28v=office.12%29.aspx + * @see https://igor.io/2012/09/24/binary-parsing.html * @param string $data */ private function readFib($data) @@ -1109,11 +1109,11 @@ class MsDoc extends AbstractReader implements ReaderInterface $this->readRecordPlcfSed(); // reading paragraphs - //@link https://github.com/notmasteryet/CompoundFile/blob/ec118f354efebdee9102e41b5b7084fce81125b0/WordFileReader/WordDocument.cs#L86 + //@see https://github.com/notmasteryet/CompoundFile/blob/ec118f354efebdee9102e41b5b7084fce81125b0/WordFileReader/WordDocument.cs#L86 $this->readRecordPlcfBtePapx(); // reading character formattings - //@link https://github.com/notmasteryet/CompoundFile/blob/ec118f354efebdee9102e41b5b7084fce81125b0/WordFileReader/WordDocument.cs#L94 + //@see https://github.com/notmasteryet/CompoundFile/blob/ec118f354efebdee9102e41b5b7084fce81125b0/WordFileReader/WordDocument.cs#L94 $this->readRecordPlcfBteChpx(); $this->generatePhpWord(); @@ -1121,7 +1121,7 @@ class MsDoc extends AbstractReader implements ReaderInterface /** * Section and information about them - * @link : http://msdn.microsoft.com/en-us/library/dd924458%28v=office.12%29.aspx + * @see : http://msdn.microsoft.com/en-us/library/dd924458%28v=office.12%29.aspx */ private function readRecordPlcfSed() { @@ -1135,7 +1135,7 @@ class MsDoc extends AbstractReader implements ReaderInterface $posMem += 4; // PlcfSed : aSed - //@link : http://msdn.microsoft.com/en-us/library/dd950194%28v=office.12%29.aspx + //@see : http://msdn.microsoft.com/en-us/library/dd950194%28v=office.12%29.aspx $numSed = $this->getNumInLcb($this->arrayFib['lcbPlcfSed'], 12); $aSed = array(); @@ -1166,7 +1166,7 @@ class MsDoc extends AbstractReader implements ReaderInterface /** * Specifies the fonts that are used in the document - * @link : http://msdn.microsoft.com/en-us/library/dd943880%28v=office.12%29.aspx + * @see : http://msdn.microsoft.com/en-us/library/dd943880%28v=office.12%29.aspx */ private function readRecordSttbfFfn() { @@ -1225,7 +1225,7 @@ class MsDoc extends AbstractReader implements ReaderInterface /** * Paragraph and information about them - * @link http://msdn.microsoft.com/en-us/library/dd908569%28v=office.12%29.aspx + * @see http://msdn.microsoft.com/en-us/library/dd908569%28v=office.12%29.aspx */ private function readRecordPlcfBtePapx() { @@ -1249,7 +1249,7 @@ class MsDoc extends AbstractReader implements ReaderInterface } $arrayRGB = array(); for ($inc = 1; $inc <= $numRun; $inc++) { - // @link http://msdn.microsoft.com/en-us/library/dd925804(v=office.12).aspx + // @see http://msdn.microsoft.com/en-us/library/dd925804(v=office.12).aspx $arrayRGB[$inc] = self::getInt1d($this->dataWorkDocument, $offset); $offset += 1; // reserved @@ -1428,7 +1428,7 @@ class MsDoc extends AbstractReader implements ReaderInterface } else { if ($istd > 0) { // @todo : Determining Properties of a Paragraph Style - # @link http://msdn.microsoft.com/en-us/library/dd948631%28v=office.12%29.aspx + # @see http://msdn.microsoft.com/en-us/library/dd948631%28v=office.12%29.aspx } } }*/ @@ -1437,7 +1437,7 @@ class MsDoc extends AbstractReader implements ReaderInterface /** * Character formatting properties to text in a document - * @link http://msdn.microsoft.com/en-us/library/dd907108%28v=office.12%29.aspx + * @see http://msdn.microsoft.com/en-us/library/dd907108%28v=office.12%29.aspx */ private function readRecordPlcfBteChpx() { @@ -1455,7 +1455,7 @@ class MsDoc extends AbstractReader implements ReaderInterface $offset = $offsetBase; // ChpxFkp - // @link : http://msdn.microsoft.com/en-us/library/dd910989%28v=office.12%29.aspx + // @see : http://msdn.microsoft.com/en-us/library/dd910989%28v=office.12%29.aspx $numRGFC = self::getInt1d($this->dataWorkDocument, $offset + 511); $arrayRGFC = array(); for ($inc = 0; $inc <= $numRGFC; $inc++) { @@ -1478,7 +1478,7 @@ class MsDoc extends AbstractReader implements ReaderInterface if ($rgb > 0) { // Chp Structure - // @link : http://msdn.microsoft.com/en-us/library/dd772849%28v=office.12%29.aspx + // @see : http://msdn.microsoft.com/en-us/library/dd772849%28v=office.12%29.aspx $posRGB = $offsetBase + $rgb * 2; $cb = self::getInt1d($this->dataWorkDocument, $posRGB); @@ -1571,7 +1571,7 @@ class MsDoc extends AbstractReader implements ReaderInterface * @param $pos int * @param $cbNum int * @return \stdClass - * @link http://msdn.microsoft.com/en-us/library/dd772849%28v=office.12%29.aspx + * @see http://msdn.microsoft.com/en-us/library/dd772849%28v=office.12%29.aspx */ private function readPrl($data, $pos, $cbNum) { @@ -1736,7 +1736,7 @@ class MsDoc extends AbstractReader implements ReaderInterface } break; // sprmCIco - //@link http://msdn.microsoft.com/en-us/library/dd773060%28v=office.12%29.aspx + //@see http://msdn.microsoft.com/en-us/library/dd773060%28v=office.12%29.aspx case 0x42: switch (dechex($operand)) { case 0x00: @@ -1842,7 +1842,7 @@ class MsDoc extends AbstractReader implements ReaderInterface case 0x61: break; // sprmCShd80 - //@link http://msdn.microsoft.com/en-us/library/dd923447%28v=office.12%29.aspx + //@see http://msdn.microsoft.com/en-us/library/dd923447%28v=office.12%29.aspx case 0x66: // $operand = self::getInt2d($data, $pos); $pos += 2; @@ -1852,7 +1852,7 @@ class MsDoc extends AbstractReader implements ReaderInterface // $icoFore = ($operand >> 11) && bindec('11111'); break; // sprmCCv - //@link : http://msdn.microsoft.com/en-us/library/dd952824%28v=office.12%29.aspx + //@see : http://msdn.microsoft.com/en-us/library/dd952824%28v=office.12%29.aspx case 0x70: $red = str_pad(dechex(self::getInt1d($this->dataWorkDocument, $pos)), 2, '0', STR_PAD_LEFT); $pos += 1; @@ -1954,7 +1954,7 @@ class MsDoc extends AbstractReader implements ReaderInterface // HFD > clsid $sprmCPicLocation += 16; // HFD > hyperlink - //@link : http://msdn.microsoft.com/en-us/library/dd909835%28v=office.12%29.aspx + //@see : http://msdn.microsoft.com/en-us/library/dd909835%28v=office.12%29.aspx $streamVersion = self::getInt4d($this->dataData, $sprmCPicLocation); $sprmCPicLocation += 4; $data = self::getInt4d($this->dataData, $sprmCPicLocation); @@ -2022,8 +2022,8 @@ class MsDoc extends AbstractReader implements ReaderInterface }*/ } else { // Pictures - //@link : http://msdn.microsoft.com/en-us/library/dd925458%28v=office.12%29.aspx - //@link : http://msdn.microsoft.com/en-us/library/dd926136%28v=office.12%29.aspx + //@see : http://msdn.microsoft.com/en-us/library/dd925458%28v=office.12%29.aspx + //@see : http://msdn.microsoft.com/en-us/library/dd926136%28v=office.12%29.aspx // PICF : lcb $sprmCPicLocation += 4; // PICF : cbHeader @@ -2110,13 +2110,13 @@ class MsDoc extends AbstractReader implements ReaderInterface $sprmCPicLocation += $shapeRH['recLen']; } // picture : rgfb - //@link : http://msdn.microsoft.com/en-us/library/dd950560%28v=office.12%29.aspx + //@see : http://msdn.microsoft.com/en-us/library/dd950560%28v=office.12%29.aspx $fileBlockRH = $this->loadRecordHeader($this->dataData, $sprmCPicLocation); while ($fileBlockRH['recType'] == 0xF007 || ($fileBlockRH['recType'] >= 0xF018 && $fileBlockRH['recType'] <= 0xF117)) { $sprmCPicLocation += 8; switch ($fileBlockRH['recType']) { // OfficeArtFBSE - //@link : http://msdn.microsoft.com/en-us/library/dd944923%28v=office.12%29.aspx + //@see : http://msdn.microsoft.com/en-us/library/dd944923%28v=office.12%29.aspx case 0xF007: // btWin32 $sprmCPicLocation += 1; @@ -2151,7 +2151,7 @@ class MsDoc extends AbstractReader implements ReaderInterface } } // embeddedBlip - //@link : http://msdn.microsoft.com/en-us/library/dd910081%28v=office.12%29.aspx + //@see : http://msdn.microsoft.com/en-us/library/dd910081%28v=office.12%29.aspx $embeddedBlipRH = $this->loadRecordHeader($this->dataData, $sprmCPicLocation); switch ($embeddedBlipRH['recType']) { case self::OFFICEARTBLIPJPG: diff --git a/src/PhpWord/Reader/ODText.php b/src/PhpWord/Reader/ODText.php index 1d2577c8..5a22b4ba 100644 --- a/src/PhpWord/Reader/ODText.php +++ b/src/PhpWord/Reader/ODText.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/ODText/AbstractPart.php b/src/PhpWord/Reader/ODText/AbstractPart.php index c48b4ade..bdac3b6f 100644 --- a/src/PhpWord/Reader/ODText/AbstractPart.php +++ b/src/PhpWord/Reader/ODText/AbstractPart.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/ODText/Content.php b/src/PhpWord/Reader/ODText/Content.php index 5e3d8ca6..8843d8a2 100644 --- a/src/PhpWord/Reader/ODText/Content.php +++ b/src/PhpWord/Reader/ODText/Content.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/ODText/Meta.php b/src/PhpWord/Reader/ODText/Meta.php index 6f8f813f..98832d17 100644 --- a/src/PhpWord/Reader/ODText/Meta.php +++ b/src/PhpWord/Reader/ODText/Meta.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/RTF.php b/src/PhpWord/Reader/RTF.php index dafd5b3c..2d09a04d 100644 --- a/src/PhpWord/Reader/RTF.php +++ b/src/PhpWord/Reader/RTF.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/RTF/Document.php b/src/PhpWord/Reader/RTF/Document.php index 6f39abe9..be16d707 100644 --- a/src/PhpWord/Reader/RTF/Document.php +++ b/src/PhpWord/Reader/RTF/Document.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/ReaderInterface.php b/src/PhpWord/Reader/ReaderInterface.php index 5f52ad19..3b2e357b 100644 --- a/src/PhpWord/Reader/ReaderInterface.php +++ b/src/PhpWord/Reader/ReaderInterface.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/Word2007.php b/src/PhpWord/Reader/Word2007.php index cacefb55..9f9fce08 100644 --- a/src/PhpWord/Reader/Word2007.php +++ b/src/PhpWord/Reader/Word2007.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index a420d45a..0cc8b114 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/Word2007/DocPropsApp.php b/src/PhpWord/Reader/Word2007/DocPropsApp.php index 72ad3da5..df34c9c3 100644 --- a/src/PhpWord/Reader/Word2007/DocPropsApp.php +++ b/src/PhpWord/Reader/Word2007/DocPropsApp.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/Word2007/DocPropsCore.php b/src/PhpWord/Reader/Word2007/DocPropsCore.php index aa02f155..f82c6b4b 100644 --- a/src/PhpWord/Reader/Word2007/DocPropsCore.php +++ b/src/PhpWord/Reader/Word2007/DocPropsCore.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/Word2007/DocPropsCustom.php b/src/PhpWord/Reader/Word2007/DocPropsCustom.php index 90580c17..a3d6b90b 100644 --- a/src/PhpWord/Reader/Word2007/DocPropsCustom.php +++ b/src/PhpWord/Reader/Word2007/DocPropsCustom.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/Word2007/Document.php b/src/PhpWord/Reader/Word2007/Document.php index be9263d5..ff094bcc 100644 --- a/src/PhpWord/Reader/Word2007/Document.php +++ b/src/PhpWord/Reader/Word2007/Document.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/Word2007/Endnotes.php b/src/PhpWord/Reader/Word2007/Endnotes.php index 5b753473..0f46cb2f 100644 --- a/src/PhpWord/Reader/Word2007/Endnotes.php +++ b/src/PhpWord/Reader/Word2007/Endnotes.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/Word2007/Footnotes.php b/src/PhpWord/Reader/Word2007/Footnotes.php index 6de107a4..61988723 100644 --- a/src/PhpWord/Reader/Word2007/Footnotes.php +++ b/src/PhpWord/Reader/Word2007/Footnotes.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/Word2007/Numbering.php b/src/PhpWord/Reader/Word2007/Numbering.php index 9669f4e0..c2a81dd5 100644 --- a/src/PhpWord/Reader/Word2007/Numbering.php +++ b/src/PhpWord/Reader/Word2007/Numbering.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/Word2007/Settings.php b/src/PhpWord/Reader/Word2007/Settings.php index e5519a78..450870e7 100644 --- a/src/PhpWord/Reader/Word2007/Settings.php +++ b/src/PhpWord/Reader/Word2007/Settings.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/Word2007/Styles.php b/src/PhpWord/Reader/Word2007/Styles.php index 93bf2132..b8e6f22b 100644 --- a/src/PhpWord/Reader/Word2007/Styles.php +++ b/src/PhpWord/Reader/Word2007/Styles.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Settings.php b/src/PhpWord/Settings.php index 7a336f3b..91efa1a6 100644 --- a/src/PhpWord/Settings.php +++ b/src/PhpWord/Settings.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Shared/Converter.php b/src/PhpWord/Shared/Converter.php index 64126a6f..6ba2b567 100644 --- a/src/PhpWord/Shared/Converter.php +++ b/src/PhpWord/Shared/Converter.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 53fcc329..670ba6e5 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Shared/OLERead.php b/src/PhpWord/Shared/OLERead.php index 398f28b3..e4efd7da 100644 --- a/src/PhpWord/Shared/OLERead.php +++ b/src/PhpWord/Shared/OLERead.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Shared/ZipArchive.php b/src/PhpWord/Shared/ZipArchive.php index c8cf36cf..d73f6c33 100644 --- a/src/PhpWord/Shared/ZipArchive.php +++ b/src/PhpWord/Shared/ZipArchive.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/SimpleType/Jc.php b/src/PhpWord/SimpleType/Jc.php index 5c4ba2fa..1a5d33ad 100644 --- a/src/PhpWord/SimpleType/Jc.php +++ b/src/PhpWord/SimpleType/Jc.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -28,7 +28,7 @@ use PhpOffice\PhpWord\Shared\AbstractEnum; * @since 0.13.0 * * @see \PhpOffice\PhpWord\SimpleType\JcTable For table alignment modes available since ISO/IEC-29500:2008. - * @link http://www.datypic.com/sc/ooxml/t-w_ST_Jc.html + * @see http://www.datypic.com/sc/ooxml/t-w_ST_Jc.html * * @codeCoverageIgnore */ diff --git a/src/PhpWord/SimpleType/JcTable.php b/src/PhpWord/SimpleType/JcTable.php index fc30f676..e1af89ad 100644 --- a/src/PhpWord/SimpleType/JcTable.php +++ b/src/PhpWord/SimpleType/JcTable.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/SimpleType/NumberFormat.php b/src/PhpWord/SimpleType/NumberFormat.php index 06f2df21..480d8539 100644 --- a/src/PhpWord/SimpleType/NumberFormat.php +++ b/src/PhpWord/SimpleType/NumberFormat.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/SimpleType/Zoom.php b/src/PhpWord/SimpleType/Zoom.php index 987026b5..111e4ea1 100644 --- a/src/PhpWord/SimpleType/Zoom.php +++ b/src/PhpWord/SimpleType/Zoom.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style.php b/src/PhpWord/Style.php index 4d82a7af..1939aaba 100644 --- a/src/PhpWord/Style.php +++ b/src/PhpWord/Style.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/AbstractStyle.php b/src/PhpWord/Style/AbstractStyle.php index 8bfb3a09..fb62922c 100644 --- a/src/PhpWord/Style/AbstractStyle.php +++ b/src/PhpWord/Style/AbstractStyle.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Border.php b/src/PhpWord/Style/Border.php index 23add07f..5c62afcd 100644 --- a/src/PhpWord/Style/Border.php +++ b/src/PhpWord/Style/Border.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Cell.php b/src/PhpWord/Style/Cell.php index ecd4fc61..0c4ca2e1 100644 --- a/src/PhpWord/Style/Cell.php +++ b/src/PhpWord/Style/Cell.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Chart.php b/src/PhpWord/Style/Chart.php index 6a0e2c14..694fcddc 100644 --- a/src/PhpWord/Style/Chart.php +++ b/src/PhpWord/Style/Chart.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Extrusion.php b/src/PhpWord/Style/Extrusion.php index e2cf76e5..11c03eda 100644 --- a/src/PhpWord/Style/Extrusion.php +++ b/src/PhpWord/Style/Extrusion.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -20,7 +20,7 @@ namespace PhpOffice\PhpWord\Style; /** * 3D extrusion style * - * @link http://www.schemacentral.com/sc/ooxml/t-o_CT_Extrusion.html + * @see http://www.schemacentral.com/sc/ooxml/t-o_CT_Extrusion.html * @since 0.12.0 */ class Extrusion extends AbstractStyle diff --git a/src/PhpWord/Style/Fill.php b/src/PhpWord/Style/Fill.php index 184e6970..9b473009 100644 --- a/src/PhpWord/Style/Fill.php +++ b/src/PhpWord/Style/Fill.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -20,9 +20,9 @@ namespace PhpOffice\PhpWord\Style; /** * Fill style * - * There are still lot of interesting things for this style that can be added, including gradient. See @link. + * There are still lot of interesting things for this style that can be added, including gradient. See @see . * - * @link http://www.schemacentral.com/sc/ooxml/t-v_CT_Fill.html + * @see http://www.schemacentral.com/sc/ooxml/t-v_CT_Fill.html * @since 0.12.0 */ class Fill extends AbstractStyle diff --git a/src/PhpWord/Style/Font.php b/src/PhpWord/Style/Font.php index fa54e5e2..b5d57c02 100644 --- a/src/PhpWord/Style/Font.php +++ b/src/PhpWord/Style/Font.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -162,7 +162,7 @@ class Font extends AbstractStyle * Small caps * * @var bool - * @link http://www.schemacentral.com/sc/ooxml/e-w_smallCaps-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_smallCaps-1.html */ private $smallCaps = false; @@ -170,7 +170,7 @@ class Font extends AbstractStyle * All caps * * @var bool - * @link http://www.schemacentral.com/sc/ooxml/e-w_caps-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_caps-1.html */ private $allCaps = false; @@ -186,7 +186,7 @@ class Font extends AbstractStyle * * @var int * @since 0.12.0 - * @link http://www.schemacentral.com/sc/ooxml/e-w_w-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_w-1.html */ private $scale; @@ -195,7 +195,7 @@ class Font extends AbstractStyle * * @var int|float * @since 0.12.0 - * @link http://www.schemacentral.com/sc/ooxml/e-w_spacing-2.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_spacing-2.html */ private $spacing; @@ -204,7 +204,7 @@ class Font extends AbstractStyle * * @var int|float * @since 0.12.0 - * @link http://www.schemacentral.com/sc/ooxml/e-w_kern-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_kern-1.html */ private $kerning; diff --git a/src/PhpWord/Style/Frame.php b/src/PhpWord/Style/Frame.php index 35f5ad00..a8e1c69d 100644 --- a/src/PhpWord/Style/Frame.php +++ b/src/PhpWord/Style/Frame.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Image.php b/src/PhpWord/Style/Image.php index b9ce2acc..c3f1863c 100644 --- a/src/PhpWord/Style/Image.php +++ b/src/PhpWord/Style/Image.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Indentation.php b/src/PhpWord/Style/Indentation.php index ab5b8bb2..9621714c 100644 --- a/src/PhpWord/Style/Indentation.php +++ b/src/PhpWord/Style/Indentation.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -20,7 +20,7 @@ namespace PhpOffice\PhpWord\Style; /** * Paragraph indentation style * - * @link http://www.schemacentral.com/sc/ooxml/t-w_CT_Ind.html + * @see http://www.schemacentral.com/sc/ooxml/t-w_CT_Ind.html * @since 0.10.0 */ class Indentation extends AbstractStyle diff --git a/src/PhpWord/Style/Line.php b/src/PhpWord/Style/Line.php index 49530f24..16d15950 100644 --- a/src/PhpWord/Style/Line.php +++ b/src/PhpWord/Style/Line.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/LineNumbering.php b/src/PhpWord/Style/LineNumbering.php index 7e293bf0..b5f3c263 100644 --- a/src/PhpWord/Style/LineNumbering.php +++ b/src/PhpWord/Style/LineNumbering.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -20,7 +20,7 @@ namespace PhpOffice\PhpWord\Style; /** * Line numbering style * - * @link http://www.schemacentral.com/sc/ooxml/t-w_CT_LineNumber.html + * @see http://www.schemacentral.com/sc/ooxml/t-w_CT_LineNumber.html * @since 0.10.0 */ class LineNumbering extends AbstractStyle @@ -55,7 +55,7 @@ class LineNumbering extends AbstractStyle * Line numbering restart setting continuous|newPage|newSection * * @var string - * @link http://www.schemacentral.com/sc/ooxml/a-w_restart-1.html + * @see http://www.schemacentral.com/sc/ooxml/a-w_restart-1.html */ private $restart; diff --git a/src/PhpWord/Style/ListItem.php b/src/PhpWord/Style/ListItem.php index 7a252e5d..8eaf11b3 100644 --- a/src/PhpWord/Style/ListItem.php +++ b/src/PhpWord/Style/ListItem.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Numbering.php b/src/PhpWord/Style/Numbering.php index 2d490a06..80ed5dca 100644 --- a/src/PhpWord/Style/Numbering.php +++ b/src/PhpWord/Style/Numbering.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -20,9 +20,9 @@ namespace PhpOffice\PhpWord\Style; /** * Numbering style * - * @link http://www.schemacentral.com/sc/ooxml/e-w_numbering.html - * @link http://www.schemacentral.com/sc/ooxml/e-w_abstractNum-1.html - * @link http://www.schemacentral.com/sc/ooxml/e-w_num-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_numbering.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_abstractNum-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_num-1.html * @since 0.10.0 */ class Numbering extends AbstractStyle @@ -31,7 +31,7 @@ class Numbering extends AbstractStyle * Numbering definition instance ID * * @var int - * @link http://www.schemacentral.com/sc/ooxml/e-w_num-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_num-1.html */ private $numId; @@ -39,7 +39,7 @@ class Numbering extends AbstractStyle * Multilevel type singleLevel|multilevel|hybridMultilevel * * @var string - * @link http://www.schemacentral.com/sc/ooxml/a-w_val-67.html + * @see http://www.schemacentral.com/sc/ooxml/a-w_val-67.html */ private $type; diff --git a/src/PhpWord/Style/NumberingLevel.php b/src/PhpWord/Style/NumberingLevel.php index 8406218c..33c151e4 100644 --- a/src/PhpWord/Style/NumberingLevel.php +++ b/src/PhpWord/Style/NumberingLevel.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -23,7 +23,7 @@ use PhpOffice\PhpWord\SimpleType\NumberFormat; /** * Numbering level definition * - * @link http://www.schemacentral.com/sc/ooxml/e-w_lvl-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_lvl-1.html * @since 0.10.0 */ class NumberingLevel extends AbstractStyle @@ -39,7 +39,7 @@ class NumberingLevel extends AbstractStyle * Starting value w:start * * @var int - * @link http://www.schemacentral.com/sc/ooxml/e-w_start-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_start-1.html */ private $start = 1; @@ -47,7 +47,7 @@ class NumberingLevel extends AbstractStyle * Numbering format w:numFmt, one of PhpOffice\PhpWord\SimpleType\NumberFormat * * @var string - * @link http://www.schemacentral.com/sc/ooxml/t-w_ST_NumberFormat.html + * @see http://www.schemacentral.com/sc/ooxml/t-w_ST_NumberFormat.html */ private $format; @@ -55,7 +55,7 @@ class NumberingLevel extends AbstractStyle * Restart numbering level symbol w:lvlRestart * * @var int - * @link http://www.schemacentral.com/sc/ooxml/e-w_lvlRestart-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_lvlRestart-1.html */ private $restart; @@ -63,7 +63,7 @@ class NumberingLevel extends AbstractStyle * Related paragraph style * * @var string - * @link http://www.schemacentral.com/sc/ooxml/e-w_pStyle-2.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_pStyle-2.html */ private $pStyle; @@ -71,7 +71,7 @@ class NumberingLevel extends AbstractStyle * Content between numbering symbol and paragraph text w:suff * * @var string tab|space|nothing - * @link http://www.schemacentral.com/sc/ooxml/e-w_suff-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_suff-1.html */ private $suffix = 'tab'; @@ -79,7 +79,7 @@ class NumberingLevel extends AbstractStyle * Numbering level text e.g. %1 for nonbullet or bullet character * * @var string - * @link http://www.schemacentral.com/sc/ooxml/e-w_lvlText-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_lvlText-1.html */ private $text; @@ -122,7 +122,7 @@ class NumberingLevel extends AbstractStyle * Hint default|eastAsia|cs * * @var string - * @link http://www.schemacentral.com/sc/ooxml/a-w_hint-1.html + * @see http://www.schemacentral.com/sc/ooxml/a-w_hint-1.html */ private $hint; diff --git a/src/PhpWord/Style/Outline.php b/src/PhpWord/Style/Outline.php index 82e906a2..fb7e028a 100644 --- a/src/PhpWord/Style/Outline.php +++ b/src/PhpWord/Style/Outline.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -20,8 +20,8 @@ namespace PhpOffice\PhpWord\Style; /** * Outline defines the line/border of the object * - * @link http://www.schemacentral.com/sc/ooxml/t-v_CT_Stroke.html - * @link http://www.w3.org/TR/1998/NOTE-VML-19980513#_Toc416858395 + * @see http://www.schemacentral.com/sc/ooxml/t-v_CT_Stroke.html + * @see http://www.w3.org/TR/1998/NOTE-VML-19980513#_Toc416858395 * @since 0.12.0 */ class Outline extends AbstractStyle @@ -29,7 +29,7 @@ class Outline extends AbstractStyle /** * Line style constants * - * @link http://www.schemacentral.com/sc/ooxml/t-v_ST_StrokeLineStyle.html + * @see http://www.schemacentral.com/sc/ooxml/t-v_ST_StrokeLineStyle.html * @const string */ const LINE_SINGLE = 'single'; @@ -41,7 +41,7 @@ class Outline extends AbstractStyle /** * Line style constants * - * @link http://www.schemacentral.com/sc/ooxml/t-v_ST_StrokeEndCap.html + * @see http://www.schemacentral.com/sc/ooxml/t-v_ST_StrokeEndCap.html * @const string */ const ENDCAP_FLAT = 'flat'; @@ -51,7 +51,7 @@ class Outline extends AbstractStyle /** * Arrowhead type constants * - * @link http://www.schemacentral.com/sc/ooxml/t-v_ST_StrokeArrowType.html + * @see http://www.schemacentral.com/sc/ooxml/t-v_ST_StrokeArrowType.html * @const string */ const ARROW_NONE = 'none'; @@ -100,7 +100,7 @@ class Outline extends AbstractStyle * End cap * * @var string - * @link http://www.schemacentral.com/sc/ooxml/t-v_ST_StrokeEndCap.html + * @see http://www.schemacentral.com/sc/ooxml/t-v_ST_StrokeEndCap.html */ private $endCap; diff --git a/src/PhpWord/Style/Paper.php b/src/PhpWord/Style/Paper.php index 891d4068..2fbf59d2 100644 --- a/src/PhpWord/Style/Paper.php +++ b/src/PhpWord/Style/Paper.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Paragraph.php b/src/PhpWord/Style/Paragraph.php index 6ed83758..8b44ad8b 100644 --- a/src/PhpWord/Style/Paragraph.php +++ b/src/PhpWord/Style/Paragraph.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -46,7 +46,7 @@ use PhpOffice\PhpWord\SimpleType\Jc; * - Borders * - Background * - * @link http://www.schemacentral.com/sc/ooxml/t-w_CT_PPr.html + * @see http://www.schemacentral.com/sc/ooxml/t-w_CT_PPr.html */ class Paragraph extends Border { diff --git a/src/PhpWord/Style/Row.php b/src/PhpWord/Style/Row.php index 444f7f28..b56c6f5f 100644 --- a/src/PhpWord/Style/Row.php +++ b/src/PhpWord/Style/Row.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Section.php b/src/PhpWord/Style/Section.php index 64403663..476846f5 100644 --- a/src/PhpWord/Style/Section.php +++ b/src/PhpWord/Style/Section.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -48,7 +48,7 @@ class Section extends Border * Page Orientation * * @var string - * @link http://www.schemacentral.com/sc/ooxml/a-w_orient-1.html + * @see http://www.schemacentral.com/sc/ooxml/a-w_orient-1.html */ private $orientation = self::ORIENTATION_PORTRAIT; @@ -105,7 +105,7 @@ class Section extends Border * Page gutter spacing * * @var int|float - * @link http://www.schemacentral.com/sc/ooxml/e-w_pgMar-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_pgMar-1.html */ private $gutter = self::DEFAULT_GUTTER; @@ -162,7 +162,7 @@ class Section extends Border * Line numbering * * @var \PhpOffice\PhpWord\Style\LineNumbering - * @link http://www.schemacentral.com/sc/ooxml/e-w_lnNumType-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_lnNumType-1.html */ private $lineNumbering; diff --git a/src/PhpWord/Style/Shading.php b/src/PhpWord/Style/Shading.php index 5d0c51e9..eeb055b2 100644 --- a/src/PhpWord/Style/Shading.php +++ b/src/PhpWord/Style/Shading.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -20,7 +20,7 @@ namespace PhpOffice\PhpWord\Style; /** * Shading style * - * @link http://www.schemacentral.com/sc/ooxml/t-w_CT_Shd.html + * @see http://www.schemacentral.com/sc/ooxml/t-w_CT_Shd.html * @since 0.10.0 */ class Shading extends AbstractStyle @@ -29,7 +29,7 @@ class Shading extends AbstractStyle * Pattern constants (partly) * * @const string - * @link http://www.schemacentral.com/sc/ooxml/t-w_ST_Shd.html + * @see http://www.schemacentral.com/sc/ooxml/t-w_ST_Shd.html */ const PATTERN_CLEAR = 'clear'; // No pattern const PATTERN_SOLID = 'solid'; // 100% fill pattern @@ -43,7 +43,7 @@ class Shading extends AbstractStyle * Shading pattern * * @var string - * @link http://www.schemacentral.com/sc/ooxml/t-w_ST_Shd.html + * @see http://www.schemacentral.com/sc/ooxml/t-w_ST_Shd.html */ private $pattern = self::PATTERN_CLEAR; diff --git a/src/PhpWord/Style/Shadow.php b/src/PhpWord/Style/Shadow.php index f71bc3f9..71d1e3e0 100644 --- a/src/PhpWord/Style/Shadow.php +++ b/src/PhpWord/Style/Shadow.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -20,7 +20,7 @@ namespace PhpOffice\PhpWord\Style; /** * Shadow style * - * @link http://www.schemacentral.com/sc/ooxml/t-v_CT_Shadow.html + * @see http://www.schemacentral.com/sc/ooxml/t-v_CT_Shadow.html * @since 0.12.0 */ class Shadow extends AbstractStyle diff --git a/src/PhpWord/Style/Shape.php b/src/PhpWord/Style/Shape.php index 586a15c8..fc84241d 100644 --- a/src/PhpWord/Style/Shape.php +++ b/src/PhpWord/Style/Shape.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Spacing.php b/src/PhpWord/Style/Spacing.php index 35ea88d6..e0eee374 100644 --- a/src/PhpWord/Style/Spacing.php +++ b/src/PhpWord/Style/Spacing.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -20,7 +20,7 @@ namespace PhpOffice\PhpWord\Style; /** * Spacing between lines and above/below paragraph style * - * @link http://www.schemacentral.com/sc/ooxml/t-w_CT_Spacing.html + * @see http://www.schemacentral.com/sc/ooxml/t-w_CT_Spacing.html * @since 0.10.0 */ class Spacing extends AbstractStyle diff --git a/src/PhpWord/Style/TOC.php b/src/PhpWord/Style/TOC.php index ccce2b38..938e6de1 100644 --- a/src/PhpWord/Style/TOC.php +++ b/src/PhpWord/Style/TOC.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Tab.php b/src/PhpWord/Style/Tab.php index 3a892523..09e49e02 100644 --- a/src/PhpWord/Style/Tab.php +++ b/src/PhpWord/Style/Tab.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Table.php b/src/PhpWord/Style/Table.php index 6d5e1b22..a3d454f3 100644 --- a/src/PhpWord/Style/Table.php +++ b/src/PhpWord/Style/Table.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/TextBox.php b/src/PhpWord/Style/TextBox.php index 7a8b6efb..093e1f3f 100644 --- a/src/PhpWord/Style/TextBox.php +++ b/src/PhpWord/Style/TextBox.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Template.php b/src/PhpWord/Template.php index 96962b8e..a4769927 100644 --- a/src/PhpWord/Template.php +++ b/src/PhpWord/Template.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php index 85a809cc..c46038ee 100644 --- a/src/PhpWord/TemplateProcessor.php +++ b/src/PhpWord/TemplateProcessor.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/AbstractWriter.php b/src/PhpWord/Writer/AbstractWriter.php index bf9a52f4..09a00990 100644 --- a/src/PhpWord/Writer/AbstractWriter.php +++ b/src/PhpWord/Writer/AbstractWriter.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML.php b/src/PhpWord/Writer/HTML.php index cb48cf10..9b098dd8 100644 --- a/src/PhpWord/Writer/HTML.php +++ b/src/PhpWord/Writer/HTML.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/AbstractElement.php b/src/PhpWord/Writer/HTML/Element/AbstractElement.php index 65429db5..f6e06258 100644 --- a/src/PhpWord/Writer/HTML/Element/AbstractElement.php +++ b/src/PhpWord/Writer/HTML/Element/AbstractElement.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/Container.php b/src/PhpWord/Writer/HTML/Element/Container.php index 78c6d8ed..677b6173 100644 --- a/src/PhpWord/Writer/HTML/Element/Container.php +++ b/src/PhpWord/Writer/HTML/Element/Container.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/Endnote.php b/src/PhpWord/Writer/HTML/Element/Endnote.php index f387669c..c4a3e436 100644 --- a/src/PhpWord/Writer/HTML/Element/Endnote.php +++ b/src/PhpWord/Writer/HTML/Element/Endnote.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/Footnote.php b/src/PhpWord/Writer/HTML/Element/Footnote.php index 179384af..60b246f8 100644 --- a/src/PhpWord/Writer/HTML/Element/Footnote.php +++ b/src/PhpWord/Writer/HTML/Element/Footnote.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/Image.php b/src/PhpWord/Writer/HTML/Element/Image.php index fbc14e42..3e516b53 100644 --- a/src/PhpWord/Writer/HTML/Element/Image.php +++ b/src/PhpWord/Writer/HTML/Element/Image.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/Link.php b/src/PhpWord/Writer/HTML/Element/Link.php index 25dafca1..bdea985a 100644 --- a/src/PhpWord/Writer/HTML/Element/Link.php +++ b/src/PhpWord/Writer/HTML/Element/Link.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/ListItem.php b/src/PhpWord/Writer/HTML/Element/ListItem.php index ae8ee340..02b25eb9 100644 --- a/src/PhpWord/Writer/HTML/Element/ListItem.php +++ b/src/PhpWord/Writer/HTML/Element/ListItem.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/PageBreak.php b/src/PhpWord/Writer/HTML/Element/PageBreak.php index 2bb008df..5cab2724 100644 --- a/src/PhpWord/Writer/HTML/Element/PageBreak.php +++ b/src/PhpWord/Writer/HTML/Element/PageBreak.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/Table.php b/src/PhpWord/Writer/HTML/Element/Table.php index 4e4a1149..c7d8670b 100644 --- a/src/PhpWord/Writer/HTML/Element/Table.php +++ b/src/PhpWord/Writer/HTML/Element/Table.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/Text.php b/src/PhpWord/Writer/HTML/Element/Text.php index e8cd4a7c..ed1ba4a3 100644 --- a/src/PhpWord/Writer/HTML/Element/Text.php +++ b/src/PhpWord/Writer/HTML/Element/Text.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/TextBreak.php b/src/PhpWord/Writer/HTML/Element/TextBreak.php index b4b13788..93ab924a 100644 --- a/src/PhpWord/Writer/HTML/Element/TextBreak.php +++ b/src/PhpWord/Writer/HTML/Element/TextBreak.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/TextRun.php b/src/PhpWord/Writer/HTML/Element/TextRun.php index 321c3146..d7461539 100644 --- a/src/PhpWord/Writer/HTML/Element/TextRun.php +++ b/src/PhpWord/Writer/HTML/Element/TextRun.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/Title.php b/src/PhpWord/Writer/HTML/Element/Title.php index 289a9e43..ee8f271b 100644 --- a/src/PhpWord/Writer/HTML/Element/Title.php +++ b/src/PhpWord/Writer/HTML/Element/Title.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Part/AbstractPart.php b/src/PhpWord/Writer/HTML/Part/AbstractPart.php index 6d3fff3d..7b6e0c3e 100644 --- a/src/PhpWord/Writer/HTML/Part/AbstractPart.php +++ b/src/PhpWord/Writer/HTML/Part/AbstractPart.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Part/Body.php b/src/PhpWord/Writer/HTML/Part/Body.php index d9f28bca..eea17350 100644 --- a/src/PhpWord/Writer/HTML/Part/Body.php +++ b/src/PhpWord/Writer/HTML/Part/Body.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Part/Head.php b/src/PhpWord/Writer/HTML/Part/Head.php index 695a1c0c..f4d63014 100644 --- a/src/PhpWord/Writer/HTML/Part/Head.php +++ b/src/PhpWord/Writer/HTML/Part/Head.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Style/AbstractStyle.php b/src/PhpWord/Writer/HTML/Style/AbstractStyle.php index 26153b31..fa27c085 100644 --- a/src/PhpWord/Writer/HTML/Style/AbstractStyle.php +++ b/src/PhpWord/Writer/HTML/Style/AbstractStyle.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Style/Font.php b/src/PhpWord/Writer/HTML/Style/Font.php index aa86d46a..cb96cf64 100644 --- a/src/PhpWord/Writer/HTML/Style/Font.php +++ b/src/PhpWord/Writer/HTML/Style/Font.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Style/Generic.php b/src/PhpWord/Writer/HTML/Style/Generic.php index 1e812518..73830707 100644 --- a/src/PhpWord/Writer/HTML/Style/Generic.php +++ b/src/PhpWord/Writer/HTML/Style/Generic.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Style/Image.php b/src/PhpWord/Writer/HTML/Style/Image.php index 74843603..178b1434 100644 --- a/src/PhpWord/Writer/HTML/Style/Image.php +++ b/src/PhpWord/Writer/HTML/Style/Image.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Style/Paragraph.php b/src/PhpWord/Writer/HTML/Style/Paragraph.php index 4e7ab1fd..e264ead0 100644 --- a/src/PhpWord/Writer/HTML/Style/Paragraph.php +++ b/src/PhpWord/Writer/HTML/Style/Paragraph.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText.php b/src/PhpWord/Writer/ODText.php index f280f241..7158874c 100644 --- a/src/PhpWord/Writer/ODText.php +++ b/src/PhpWord/Writer/ODText.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/AbstractElement.php b/src/PhpWord/Writer/ODText/Element/AbstractElement.php index cfa5b2f5..481995ff 100644 --- a/src/PhpWord/Writer/ODText/Element/AbstractElement.php +++ b/src/PhpWord/Writer/ODText/Element/AbstractElement.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/Container.php b/src/PhpWord/Writer/ODText/Element/Container.php index c2a5e016..112e71e8 100644 --- a/src/PhpWord/Writer/ODText/Element/Container.php +++ b/src/PhpWord/Writer/ODText/Element/Container.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/Image.php b/src/PhpWord/Writer/ODText/Element/Image.php index 23dc0ac1..2c0b4727 100644 --- a/src/PhpWord/Writer/ODText/Element/Image.php +++ b/src/PhpWord/Writer/ODText/Element/Image.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/Link.php b/src/PhpWord/Writer/ODText/Element/Link.php index 91a1962e..c996ab59 100644 --- a/src/PhpWord/Writer/ODText/Element/Link.php +++ b/src/PhpWord/Writer/ODText/Element/Link.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/Table.php b/src/PhpWord/Writer/ODText/Element/Table.php index 73f18926..cdc2a0e3 100644 --- a/src/PhpWord/Writer/ODText/Element/Table.php +++ b/src/PhpWord/Writer/ODText/Element/Table.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/Text.php b/src/PhpWord/Writer/ODText/Element/Text.php index 699510b2..3b06217d 100644 --- a/src/PhpWord/Writer/ODText/Element/Text.php +++ b/src/PhpWord/Writer/ODText/Element/Text.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/TextBreak.php b/src/PhpWord/Writer/ODText/Element/TextBreak.php index 7106797d..f7642e3b 100644 --- a/src/PhpWord/Writer/ODText/Element/TextBreak.php +++ b/src/PhpWord/Writer/ODText/Element/TextBreak.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/TextRun.php b/src/PhpWord/Writer/ODText/Element/TextRun.php index e202eccf..f5c855fe 100644 --- a/src/PhpWord/Writer/ODText/Element/TextRun.php +++ b/src/PhpWord/Writer/ODText/Element/TextRun.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/Title.php b/src/PhpWord/Writer/ODText/Element/Title.php index 737afd18..bf9bf9d6 100644 --- a/src/PhpWord/Writer/ODText/Element/Title.php +++ b/src/PhpWord/Writer/ODText/Element/Title.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Part/AbstractPart.php b/src/PhpWord/Writer/ODText/Part/AbstractPart.php index abe0a7b9..74412fd4 100644 --- a/src/PhpWord/Writer/ODText/Part/AbstractPart.php +++ b/src/PhpWord/Writer/ODText/Part/AbstractPart.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Part/Content.php b/src/PhpWord/Writer/ODText/Part/Content.php index d08eb217..8ae4dca9 100644 --- a/src/PhpWord/Writer/ODText/Part/Content.php +++ b/src/PhpWord/Writer/ODText/Part/Content.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Part/Manifest.php b/src/PhpWord/Writer/ODText/Part/Manifest.php index f706cbff..d916ccdf 100644 --- a/src/PhpWord/Writer/ODText/Part/Manifest.php +++ b/src/PhpWord/Writer/ODText/Part/Manifest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Part/Meta.php b/src/PhpWord/Writer/ODText/Part/Meta.php index d637fef1..72d03ae6 100644 --- a/src/PhpWord/Writer/ODText/Part/Meta.php +++ b/src/PhpWord/Writer/ODText/Part/Meta.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Part/Mimetype.php b/src/PhpWord/Writer/ODText/Part/Mimetype.php index aab88e4d..6e45b848 100644 --- a/src/PhpWord/Writer/ODText/Part/Mimetype.php +++ b/src/PhpWord/Writer/ODText/Part/Mimetype.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Part/Styles.php b/src/PhpWord/Writer/ODText/Part/Styles.php index 043fe0f6..138f6f10 100644 --- a/src/PhpWord/Writer/ODText/Part/Styles.php +++ b/src/PhpWord/Writer/ODText/Part/Styles.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Style/AbstractStyle.php b/src/PhpWord/Writer/ODText/Style/AbstractStyle.php index 050abe02..26b9905b 100644 --- a/src/PhpWord/Writer/ODText/Style/AbstractStyle.php +++ b/src/PhpWord/Writer/ODText/Style/AbstractStyle.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Style/Font.php b/src/PhpWord/Writer/ODText/Style/Font.php index b31dadae..50de32ad 100644 --- a/src/PhpWord/Writer/ODText/Style/Font.php +++ b/src/PhpWord/Writer/ODText/Style/Font.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Style/Image.php b/src/PhpWord/Writer/ODText/Style/Image.php index 3efc945c..b85d4d70 100644 --- a/src/PhpWord/Writer/ODText/Style/Image.php +++ b/src/PhpWord/Writer/ODText/Style/Image.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Style/Paragraph.php b/src/PhpWord/Writer/ODText/Style/Paragraph.php index d0670c42..a047ad32 100644 --- a/src/PhpWord/Writer/ODText/Style/Paragraph.php +++ b/src/PhpWord/Writer/ODText/Style/Paragraph.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Style/Section.php b/src/PhpWord/Writer/ODText/Style/Section.php index 24766278..bef023e9 100644 --- a/src/PhpWord/Writer/ODText/Style/Section.php +++ b/src/PhpWord/Writer/ODText/Style/Section.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Style/Table.php b/src/PhpWord/Writer/ODText/Style/Table.php index 0144391a..7d66899a 100644 --- a/src/PhpWord/Writer/ODText/Style/Table.php +++ b/src/PhpWord/Writer/ODText/Style/Table.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/PDF.php b/src/PhpWord/Writer/PDF.php index 4f29bb63..45fe8f35 100644 --- a/src/PhpWord/Writer/PDF.php +++ b/src/PhpWord/Writer/PDF.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PhpWord + * @see https://github.com/PHPOffice/PhpWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/PDF/AbstractRenderer.php b/src/PhpWord/Writer/PDF/AbstractRenderer.php index 3b5e3a08..7b668e0b 100644 --- a/src/PhpWord/Writer/PDF/AbstractRenderer.php +++ b/src/PhpWord/Writer/PDF/AbstractRenderer.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PhpWord + * @see https://github.com/PHPOffice/PhpWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/PDF/DomPDF.php b/src/PhpWord/Writer/PDF/DomPDF.php index 8825d4c3..be282d20 100644 --- a/src/PhpWord/Writer/PDF/DomPDF.php +++ b/src/PhpWord/Writer/PDF/DomPDF.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PhpWord + * @see https://github.com/PHPOffice/PhpWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -23,7 +23,7 @@ use PhpOffice\PhpWord\Writer\WriterInterface; /** * DomPDF writer * - * @link https://github.com/dompdf/dompdf + * @see https://github.com/dompdf/dompdf * @since 0.10.0 */ class DomPDF extends AbstractRenderer implements WriterInterface diff --git a/src/PhpWord/Writer/PDF/MPDF.php b/src/PhpWord/Writer/PDF/MPDF.php index 764a38d4..80c2eccf 100644 --- a/src/PhpWord/Writer/PDF/MPDF.php +++ b/src/PhpWord/Writer/PDF/MPDF.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PhpWord + * @see https://github.com/PHPOffice/PhpWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -22,7 +22,7 @@ use PhpOffice\PhpWord\Writer\WriterInterface; /** * MPDF writer * - * @link http://www.mpdf1.com/ + * @see http://www.mpdf1.com/ * @since 0.11.0 */ class MPDF extends AbstractRenderer implements WriterInterface diff --git a/src/PhpWord/Writer/PDF/TCPDF.php b/src/PhpWord/Writer/PDF/TCPDF.php index 4991cee8..3b82511a 100644 --- a/src/PhpWord/Writer/PDF/TCPDF.php +++ b/src/PhpWord/Writer/PDF/TCPDF.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PhpWord + * @see https://github.com/PHPOffice/PhpWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -24,7 +24,7 @@ use PhpOffice\PhpWord\Writer\WriterInterface; * * @deprecated 0.13.0 Use `DomPDF` or `MPDF` instead. * - * @link http://www.tcpdf.org/ + * @see http://www.tcpdf.org/ * @since 0.11.0 */ class TCPDF extends AbstractRenderer implements WriterInterface diff --git a/src/PhpWord/Writer/RTF.php b/src/PhpWord/Writer/RTF.php index 4c33b733..7756253a 100644 --- a/src/PhpWord/Writer/RTF.php +++ b/src/PhpWord/Writer/RTF.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/AbstractElement.php b/src/PhpWord/Writer/RTF/Element/AbstractElement.php index 83ccd14e..1013ee36 100644 --- a/src/PhpWord/Writer/RTF/Element/AbstractElement.php +++ b/src/PhpWord/Writer/RTF/Element/AbstractElement.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/Container.php b/src/PhpWord/Writer/RTF/Element/Container.php index 32be7d7f..4850c8bf 100644 --- a/src/PhpWord/Writer/RTF/Element/Container.php +++ b/src/PhpWord/Writer/RTF/Element/Container.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/Image.php b/src/PhpWord/Writer/RTF/Element/Image.php index bf90bf66..fb96baff 100644 --- a/src/PhpWord/Writer/RTF/Element/Image.php +++ b/src/PhpWord/Writer/RTF/Element/Image.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/Link.php b/src/PhpWord/Writer/RTF/Element/Link.php index ef11eb10..91a75720 100644 --- a/src/PhpWord/Writer/RTF/Element/Link.php +++ b/src/PhpWord/Writer/RTF/Element/Link.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/ListItem.php b/src/PhpWord/Writer/RTF/Element/ListItem.php index f80ef5d1..e628bffd 100644 --- a/src/PhpWord/Writer/RTF/Element/ListItem.php +++ b/src/PhpWord/Writer/RTF/Element/ListItem.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/PageBreak.php b/src/PhpWord/Writer/RTF/Element/PageBreak.php index 8ea86e0f..0adbe06e 100644 --- a/src/PhpWord/Writer/RTF/Element/PageBreak.php +++ b/src/PhpWord/Writer/RTF/Element/PageBreak.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/Table.php b/src/PhpWord/Writer/RTF/Element/Table.php index 20ee26c1..d0bc0845 100644 --- a/src/PhpWord/Writer/RTF/Element/Table.php +++ b/src/PhpWord/Writer/RTF/Element/Table.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/Text.php b/src/PhpWord/Writer/RTF/Element/Text.php index 7b7de882..2fac0520 100644 --- a/src/PhpWord/Writer/RTF/Element/Text.php +++ b/src/PhpWord/Writer/RTF/Element/Text.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/TextBreak.php b/src/PhpWord/Writer/RTF/Element/TextBreak.php index 480f9d15..2009fcff 100644 --- a/src/PhpWord/Writer/RTF/Element/TextBreak.php +++ b/src/PhpWord/Writer/RTF/Element/TextBreak.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/TextRun.php b/src/PhpWord/Writer/RTF/Element/TextRun.php index 2d9081a7..d4e56765 100644 --- a/src/PhpWord/Writer/RTF/Element/TextRun.php +++ b/src/PhpWord/Writer/RTF/Element/TextRun.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/Title.php b/src/PhpWord/Writer/RTF/Element/Title.php index 8c18d972..18bad9fd 100644 --- a/src/PhpWord/Writer/RTF/Element/Title.php +++ b/src/PhpWord/Writer/RTF/Element/Title.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Part/AbstractPart.php b/src/PhpWord/Writer/RTF/Part/AbstractPart.php index 7c8c93ba..7569a105 100644 --- a/src/PhpWord/Writer/RTF/Part/AbstractPart.php +++ b/src/PhpWord/Writer/RTF/Part/AbstractPart.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Part/Document.php b/src/PhpWord/Writer/RTF/Part/Document.php index 7ed7ea27..a0a49406 100644 --- a/src/PhpWord/Writer/RTF/Part/Document.php +++ b/src/PhpWord/Writer/RTF/Part/Document.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\Writer\RTF\Style\Section as SectionStyleWriter; * RTF document part writer * * @since 0.11.0 - * @link http://www.biblioscape.com/rtf15_spec.htm#Heading24 + * @see http://www.biblioscape.com/rtf15_spec.htm#Heading24 */ class Document extends AbstractPart { diff --git a/src/PhpWord/Writer/RTF/Part/Header.php b/src/PhpWord/Writer/RTF/Part/Header.php index a399ccdc..73f1351f 100644 --- a/src/PhpWord/Writer/RTF/Part/Header.php +++ b/src/PhpWord/Writer/RTF/Part/Header.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -33,7 +33,7 @@ use PhpOffice\PhpWord\Style\Font; * - List table (not supported yet) * * @since 0.11.0 - * @link http://www.biblioscape.com/rtf15_spec.htm#Heading6 + * @see http://www.biblioscape.com/rtf15_spec.htm#Heading6 */ class Header extends AbstractPart { diff --git a/src/PhpWord/Writer/RTF/Style/AbstractStyle.php b/src/PhpWord/Writer/RTF/Style/AbstractStyle.php index fa7351e9..80523610 100644 --- a/src/PhpWord/Writer/RTF/Style/AbstractStyle.php +++ b/src/PhpWord/Writer/RTF/Style/AbstractStyle.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Style/Border.php b/src/PhpWord/Writer/RTF/Style/Border.php index 2913a18c..e63d767f 100644 --- a/src/PhpWord/Writer/RTF/Style/Border.php +++ b/src/PhpWord/Writer/RTF/Style/Border.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Style/Font.php b/src/PhpWord/Writer/RTF/Style/Font.php index 4f78719f..3338368a 100644 --- a/src/PhpWord/Writer/RTF/Style/Font.php +++ b/src/PhpWord/Writer/RTF/Style/Font.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Style/Paragraph.php b/src/PhpWord/Writer/RTF/Style/Paragraph.php index a758a488..61b61fd7 100644 --- a/src/PhpWord/Writer/RTF/Style/Paragraph.php +++ b/src/PhpWord/Writer/RTF/Style/Paragraph.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Style/Section.php b/src/PhpWord/Writer/RTF/Style/Section.php index b64e17d9..8f073716 100644 --- a/src/PhpWord/Writer/RTF/Style/Section.php +++ b/src/PhpWord/Writer/RTF/Style/Section.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007.php b/src/PhpWord/Writer/Word2007.php index 0a25c12c..fcef982f 100644 --- a/src/PhpWord/Writer/Word2007.php +++ b/src/PhpWord/Writer/Word2007.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php index 2f44c704..07ffc286 100644 --- a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php +++ b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Bookmark.php b/src/PhpWord/Writer/Word2007/Element/Bookmark.php index 8ecb1e99..4b0b78a7 100644 --- a/src/PhpWord/Writer/Word2007/Element/Bookmark.php +++ b/src/PhpWord/Writer/Word2007/Element/Bookmark.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Chart.php b/src/PhpWord/Writer/Word2007/Element/Chart.php index 284b6bc1..591799ab 100644 --- a/src/PhpWord/Writer/Word2007/Element/Chart.php +++ b/src/PhpWord/Writer/Word2007/Element/Chart.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/CheckBox.php b/src/PhpWord/Writer/Word2007/Element/CheckBox.php index ce2ebb3e..31dcb867 100644 --- a/src/PhpWord/Writer/Word2007/Element/CheckBox.php +++ b/src/PhpWord/Writer/Word2007/Element/CheckBox.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Container.php b/src/PhpWord/Writer/Word2007/Element/Container.php index 7b40e199..47dae29b 100644 --- a/src/PhpWord/Writer/Word2007/Element/Container.php +++ b/src/PhpWord/Writer/Word2007/Element/Container.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Endnote.php b/src/PhpWord/Writer/Word2007/Element/Endnote.php index 946c1419..ebfe35c1 100644 --- a/src/PhpWord/Writer/Word2007/Element/Endnote.php +++ b/src/PhpWord/Writer/Word2007/Element/Endnote.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Field.php b/src/PhpWord/Writer/Word2007/Element/Field.php index a0db34f7..75d4983f 100644 --- a/src/PhpWord/Writer/Word2007/Element/Field.php +++ b/src/PhpWord/Writer/Word2007/Element/Field.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Footnote.php b/src/PhpWord/Writer/Word2007/Element/Footnote.php index ee844534..65ef40c7 100644 --- a/src/PhpWord/Writer/Word2007/Element/Footnote.php +++ b/src/PhpWord/Writer/Word2007/Element/Footnote.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/FormField.php b/src/PhpWord/Writer/Word2007/Element/FormField.php index db7ebaa4..91fb28ab 100644 --- a/src/PhpWord/Writer/Word2007/Element/FormField.php +++ b/src/PhpWord/Writer/Word2007/Element/FormField.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -27,7 +27,7 @@ use PhpOffice\PhpWord\Settings; * Note: DropDown is active when document protection is set to `forms` * * @since 0.12.0 - * @link http://www.datypic.com/sc/ooxml/t-w_CT_FFData.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_FFData.html * @SuppressWarnings(PHPMD.UnusedPrivateMethod) */ class FormField extends Text @@ -109,7 +109,7 @@ class FormField extends Text /** * Write textinput. * - * @link http://www.datypic.com/sc/ooxml/t-w_CT_FFTextInput.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_FFTextInput.html * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\FormField $element */ @@ -125,7 +125,7 @@ class FormField extends Text /** * Write checkbox. * - * @link http://www.datypic.com/sc/ooxml/t-w_CT_FFCheckBox.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_FFCheckBox.html * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\FormField $element */ @@ -148,7 +148,7 @@ class FormField extends Text /** * Write dropdown. * - * @link http://www.datypic.com/sc/ooxml/t-w_CT_FFDDList.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_FFDDList.html * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\FormField $element */ diff --git a/src/PhpWord/Writer/Word2007/Element/Image.php b/src/PhpWord/Writer/Word2007/Element/Image.php index dd0f7756..7e33f75e 100644 --- a/src/PhpWord/Writer/Word2007/Element/Image.php +++ b/src/PhpWord/Writer/Word2007/Element/Image.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Line.php b/src/PhpWord/Writer/Word2007/Element/Line.php index 1f853a20..9b1a160d 100644 --- a/src/PhpWord/Writer/Word2007/Element/Line.php +++ b/src/PhpWord/Writer/Word2007/Element/Line.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Link.php b/src/PhpWord/Writer/Word2007/Element/Link.php index 6edc4f2c..8ea3f53c 100644 --- a/src/PhpWord/Writer/Word2007/Element/Link.php +++ b/src/PhpWord/Writer/Word2007/Element/Link.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/ListItem.php b/src/PhpWord/Writer/Word2007/Element/ListItem.php index 2584fff1..c1aa0ce3 100644 --- a/src/PhpWord/Writer/Word2007/Element/ListItem.php +++ b/src/PhpWord/Writer/Word2007/Element/ListItem.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/ListItemRun.php b/src/PhpWord/Writer/Word2007/Element/ListItemRun.php index c0e34093..e6ed2b46 100644 --- a/src/PhpWord/Writer/Word2007/Element/ListItemRun.php +++ b/src/PhpWord/Writer/Word2007/Element/ListItemRun.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Object.php b/src/PhpWord/Writer/Word2007/Element/Object.php index 54d1869b..8231ec0c 100644 --- a/src/PhpWord/Writer/Word2007/Element/Object.php +++ b/src/PhpWord/Writer/Word2007/Element/Object.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/PageBreak.php b/src/PhpWord/Writer/Word2007/Element/PageBreak.php index a7087fd2..04ff29d4 100644 --- a/src/PhpWord/Writer/Word2007/Element/PageBreak.php +++ b/src/PhpWord/Writer/Word2007/Element/PageBreak.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/ParagraphAlignment.php b/src/PhpWord/Writer/Word2007/Element/ParagraphAlignment.php index 2f67ffb1..0dafa4a0 100644 --- a/src/PhpWord/Writer/Word2007/Element/ParagraphAlignment.php +++ b/src/PhpWord/Writer/Word2007/Element/ParagraphAlignment.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/PreserveText.php b/src/PhpWord/Writer/Word2007/Element/PreserveText.php index dba02197..92b9ea40 100644 --- a/src/PhpWord/Writer/Word2007/Element/PreserveText.php +++ b/src/PhpWord/Writer/Word2007/Element/PreserveText.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/SDT.php b/src/PhpWord/Writer/Word2007/Element/SDT.php index 2badb761..e77f87e9 100644 --- a/src/PhpWord/Writer/Word2007/Element/SDT.php +++ b/src/PhpWord/Writer/Word2007/Element/SDT.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -24,7 +24,7 @@ use PhpOffice\PhpWord\Element\SDT as SDTElement; * Structured document tag element writer * * @since 0.12.0 - * @link http://www.datypic.com/sc/ooxml/t-w_CT_SdtBlock.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_SdtBlock.html * @SuppressWarnings(PHPMD.UnusedPrivateMethod) */ class SDT extends Text @@ -68,7 +68,7 @@ class SDT extends Text /** * Write combo box. * - * @link http://www.datypic.com/sc/ooxml/t-w_CT_SdtComboBox.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_SdtComboBox.html * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\SDT $element */ @@ -87,7 +87,7 @@ class SDT extends Text /** * Write drop down list. * - * @link http://www.datypic.com/sc/ooxml/t-w_CT_SdtDropDownList.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_SdtDropDownList.html * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\SDT $element */ @@ -99,7 +99,7 @@ class SDT extends Text /** * Write date. * - * @link http://www.datypic.com/sc/ooxml/t-w_CT_SdtDate.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_SdtDate.html * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\SDT $element */ diff --git a/src/PhpWord/Writer/Word2007/Element/Shape.php b/src/PhpWord/Writer/Word2007/Element/Shape.php index 8f5bf651..e384db06 100644 --- a/src/PhpWord/Writer/Word2007/Element/Shape.php +++ b/src/PhpWord/Writer/Word2007/Element/Shape.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/TOC.php b/src/PhpWord/Writer/Word2007/Element/TOC.php index fd33f268..a679188f 100644 --- a/src/PhpWord/Writer/Word2007/Element/TOC.php +++ b/src/PhpWord/Writer/Word2007/Element/TOC.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Table.php b/src/PhpWord/Writer/Word2007/Element/Table.php index 40d4cb64..c0590772 100644 --- a/src/PhpWord/Writer/Word2007/Element/Table.php +++ b/src/PhpWord/Writer/Word2007/Element/Table.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/TableAlignment.php b/src/PhpWord/Writer/Word2007/Element/TableAlignment.php index 926f6840..44450fd6 100644 --- a/src/PhpWord/Writer/Word2007/Element/TableAlignment.php +++ b/src/PhpWord/Writer/Word2007/Element/TableAlignment.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Text.php b/src/PhpWord/Writer/Word2007/Element/Text.php index 6b85c566..694a834a 100644 --- a/src/PhpWord/Writer/Word2007/Element/Text.php +++ b/src/PhpWord/Writer/Word2007/Element/Text.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/TextBox.php b/src/PhpWord/Writer/Word2007/Element/TextBox.php index 57273094..3780c698 100644 --- a/src/PhpWord/Writer/Word2007/Element/TextBox.php +++ b/src/PhpWord/Writer/Word2007/Element/TextBox.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/TextBreak.php b/src/PhpWord/Writer/Word2007/Element/TextBreak.php index 474f42cc..161a528e 100644 --- a/src/PhpWord/Writer/Word2007/Element/TextBreak.php +++ b/src/PhpWord/Writer/Word2007/Element/TextBreak.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/TextRun.php b/src/PhpWord/Writer/Word2007/Element/TextRun.php index 8f359021..9fd70b13 100644 --- a/src/PhpWord/Writer/Word2007/Element/TextRun.php +++ b/src/PhpWord/Writer/Word2007/Element/TextRun.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Title.php b/src/PhpWord/Writer/Word2007/Element/Title.php index 479bdd40..63ed94de 100644 --- a/src/PhpWord/Writer/Word2007/Element/Title.php +++ b/src/PhpWord/Writer/Word2007/Element/Title.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/AbstractPart.php b/src/PhpWord/Writer/Word2007/Part/AbstractPart.php index a78a9bc3..0b9d8b88 100644 --- a/src/PhpWord/Writer/Word2007/Part/AbstractPart.php +++ b/src/PhpWord/Writer/Word2007/Part/AbstractPart.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Chart.php b/src/PhpWord/Writer/Word2007/Part/Chart.php index eec09e9d..2f162108 100644 --- a/src/PhpWord/Writer/Word2007/Part/Chart.php +++ b/src/PhpWord/Writer/Word2007/Part/Chart.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -24,7 +24,7 @@ use PhpOffice\PhpWord\Element\Chart as ChartElement; * Word2007 chart part writer: word/charts/chartx.xml * * @since 0.12.0 - * @link http://www.datypic.com/sc/ooxml/e-draw-chart_chartSpace.html + * @see http://www.datypic.com/sc/ooxml/e-draw-chart_chartSpace.html */ class Chart extends AbstractPart { @@ -94,7 +94,7 @@ class Chart extends AbstractPart /** * Write chart * - * @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_Chart.html + * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_Chart.html * @param \PhpOffice\Common\XMLWriter $xmlWriter */ private function writeChart(XMLWriter $xmlWriter) @@ -111,14 +111,14 @@ class Chart extends AbstractPart /** * Write plot area. * - * @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_PlotArea.html - * @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_PieChart.html - * @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_DoughnutChart.html - * @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_BarChart.html - * @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_LineChart.html - * @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_AreaChart.html - * @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_RadarChart.html - * @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_ScatterChart.html + * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_PlotArea.html + * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_PieChart.html + * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_DoughnutChart.html + * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_BarChart.html + * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_LineChart.html + * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_AreaChart.html + * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_RadarChart.html + * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_ScatterChart.html * @param \PhpOffice\Common\XMLWriter $xmlWriter */ private function writePlotArea(XMLWriter $xmlWriter) @@ -253,7 +253,7 @@ class Chart extends AbstractPart /** * Write axis * - * @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_CatAx.html + * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_CatAx.html * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param string $type */ @@ -295,7 +295,7 @@ class Chart extends AbstractPart /** * Write shape * - * @link http://www.datypic.com/sc/ooxml/t-a_CT_ShapeProperties.html + * @see http://www.datypic.com/sc/ooxml/t-a_CT_ShapeProperties.html * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param bool $line */ diff --git a/src/PhpWord/Writer/Word2007/Part/Comments.php b/src/PhpWord/Writer/Word2007/Part/Comments.php index 30374a84..b2b49864 100644 --- a/src/PhpWord/Writer/Word2007/Part/Comments.php +++ b/src/PhpWord/Writer/Word2007/Part/Comments.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/ContentTypes.php b/src/PhpWord/Writer/Word2007/Part/ContentTypes.php index b2f55d32..9be988d3 100644 --- a/src/PhpWord/Writer/Word2007/Part/ContentTypes.php +++ b/src/PhpWord/Writer/Word2007/Part/ContentTypes.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/DocPropsApp.php b/src/PhpWord/Writer/Word2007/Part/DocPropsApp.php index eb397a2a..dbd55187 100644 --- a/src/PhpWord/Writer/Word2007/Part/DocPropsApp.php +++ b/src/PhpWord/Writer/Word2007/Part/DocPropsApp.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/DocPropsCore.php b/src/PhpWord/Writer/Word2007/Part/DocPropsCore.php index 0ce58337..fdabee36 100644 --- a/src/PhpWord/Writer/Word2007/Part/DocPropsCore.php +++ b/src/PhpWord/Writer/Word2007/Part/DocPropsCore.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php b/src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php index bb5c3b2a..212e9d27 100644 --- a/src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php +++ b/src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Document.php b/src/PhpWord/Writer/Word2007/Part/Document.php index a8318f5c..72e4fcd8 100644 --- a/src/PhpWord/Writer/Word2007/Part/Document.php +++ b/src/PhpWord/Writer/Word2007/Part/Document.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Endnotes.php b/src/PhpWord/Writer/Word2007/Part/Endnotes.php index d975354e..289119db 100644 --- a/src/PhpWord/Writer/Word2007/Part/Endnotes.php +++ b/src/PhpWord/Writer/Word2007/Part/Endnotes.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/FontTable.php b/src/PhpWord/Writer/Word2007/Part/FontTable.php index 85da0324..065a318e 100644 --- a/src/PhpWord/Writer/Word2007/Part/FontTable.php +++ b/src/PhpWord/Writer/Word2007/Part/FontTable.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Footer.php b/src/PhpWord/Writer/Word2007/Part/Footer.php index ce3a8b9c..cfc9dd40 100644 --- a/src/PhpWord/Writer/Word2007/Part/Footer.php +++ b/src/PhpWord/Writer/Word2007/Part/Footer.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Footnotes.php b/src/PhpWord/Writer/Word2007/Part/Footnotes.php index 61145be0..c9e3bcac 100644 --- a/src/PhpWord/Writer/Word2007/Part/Footnotes.php +++ b/src/PhpWord/Writer/Word2007/Part/Footnotes.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Header.php b/src/PhpWord/Writer/Word2007/Part/Header.php index 784f1801..5853d92f 100644 --- a/src/PhpWord/Writer/Word2007/Part/Header.php +++ b/src/PhpWord/Writer/Word2007/Part/Header.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Numbering.php b/src/PhpWord/Writer/Word2007/Part/Numbering.php index bb8ae59d..6233a6b7 100644 --- a/src/PhpWord/Writer/Word2007/Part/Numbering.php +++ b/src/PhpWord/Writer/Word2007/Part/Numbering.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Rels.php b/src/PhpWord/Writer/Word2007/Part/Rels.php index 4eb687c6..154c7e89 100644 --- a/src/PhpWord/Writer/Word2007/Part/Rels.php +++ b/src/PhpWord/Writer/Word2007/Part/Rels.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/RelsDocument.php b/src/PhpWord/Writer/Word2007/Part/RelsDocument.php index eca3686e..505aa223 100644 --- a/src/PhpWord/Writer/Word2007/Part/RelsDocument.php +++ b/src/PhpWord/Writer/Word2007/Part/RelsDocument.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/RelsPart.php b/src/PhpWord/Writer/Word2007/Part/RelsPart.php index 348558c5..e639c041 100644 --- a/src/PhpWord/Writer/Word2007/Part/RelsPart.php +++ b/src/PhpWord/Writer/Word2007/Part/RelsPart.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index f6ea65c5..fc607b49 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -23,7 +23,7 @@ use PhpOffice\PhpWord\ComplexType\TrackChangesView; /** * Word2007 settings part writer: word/settings.xml * - * @link http://www.schemacentral.com/sc/ooxml/t-w_CT_Settings.html + * @see http://www.schemacentral.com/sc/ooxml/t-w_CT_Settings.html */ class Settings extends AbstractPart { diff --git a/src/PhpWord/Writer/Word2007/Part/Styles.php b/src/PhpWord/Writer/Word2007/Part/Styles.php index 36bd095e..54930839 100644 --- a/src/PhpWord/Writer/Word2007/Part/Styles.php +++ b/src/PhpWord/Writer/Word2007/Part/Styles.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Theme.php b/src/PhpWord/Writer/Word2007/Part/Theme.php index ee3e1f45..c264140e 100644 --- a/src/PhpWord/Writer/Word2007/Part/Theme.php +++ b/src/PhpWord/Writer/Word2007/Part/Theme.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/WebSettings.php b/src/PhpWord/Writer/Word2007/Part/WebSettings.php index f0a9fa86..9f18e356 100644 --- a/src/PhpWord/Writer/Word2007/Part/WebSettings.php +++ b/src/PhpWord/Writer/Word2007/Part/WebSettings.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/AbstractStyle.php b/src/PhpWord/Writer/Word2007/Style/AbstractStyle.php index 26eb62b1..5b707ead 100644 --- a/src/PhpWord/Writer/Word2007/Style/AbstractStyle.php +++ b/src/PhpWord/Writer/Word2007/Style/AbstractStyle.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Cell.php b/src/PhpWord/Writer/Word2007/Style/Cell.php index 256bf45b..c2cf1c7c 100644 --- a/src/PhpWord/Writer/Word2007/Style/Cell.php +++ b/src/PhpWord/Writer/Word2007/Style/Cell.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Extrusion.php b/src/PhpWord/Writer/Word2007/Style/Extrusion.php index ac81bed6..e3a86a58 100644 --- a/src/PhpWord/Writer/Word2007/Style/Extrusion.php +++ b/src/PhpWord/Writer/Word2007/Style/Extrusion.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Fill.php b/src/PhpWord/Writer/Word2007/Style/Fill.php index 6edd3847..de64313b 100644 --- a/src/PhpWord/Writer/Word2007/Style/Fill.php +++ b/src/PhpWord/Writer/Word2007/Style/Fill.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Font.php b/src/PhpWord/Writer/Word2007/Style/Font.php index 193f3ba8..edd1df82 100644 --- a/src/PhpWord/Writer/Word2007/Style/Font.php +++ b/src/PhpWord/Writer/Word2007/Style/Font.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Frame.php b/src/PhpWord/Writer/Word2007/Style/Frame.php index e88334cf..da5aee1e 100644 --- a/src/PhpWord/Writer/Word2007/Style/Frame.php +++ b/src/PhpWord/Writer/Word2007/Style/Frame.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Image.php b/src/PhpWord/Writer/Word2007/Style/Image.php index 8bed7c0b..271b99df 100644 --- a/src/PhpWord/Writer/Word2007/Style/Image.php +++ b/src/PhpWord/Writer/Word2007/Style/Image.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Indentation.php b/src/PhpWord/Writer/Word2007/Style/Indentation.php index 6cf82f88..c5a598ff 100644 --- a/src/PhpWord/Writer/Word2007/Style/Indentation.php +++ b/src/PhpWord/Writer/Word2007/Style/Indentation.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Line.php b/src/PhpWord/Writer/Word2007/Style/Line.php index d3001f0d..f065e521 100644 --- a/src/PhpWord/Writer/Word2007/Style/Line.php +++ b/src/PhpWord/Writer/Word2007/Style/Line.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/LineNumbering.php b/src/PhpWord/Writer/Word2007/Style/LineNumbering.php index a5c2c738..3ed577c6 100644 --- a/src/PhpWord/Writer/Word2007/Style/LineNumbering.php +++ b/src/PhpWord/Writer/Word2007/Style/LineNumbering.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/MarginBorder.php b/src/PhpWord/Writer/Word2007/Style/MarginBorder.php index 7a4ffe2f..3d877384 100644 --- a/src/PhpWord/Writer/Word2007/Style/MarginBorder.php +++ b/src/PhpWord/Writer/Word2007/Style/MarginBorder.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Outline.php b/src/PhpWord/Writer/Word2007/Style/Outline.php index cbb6f283..9ae61f39 100644 --- a/src/PhpWord/Writer/Word2007/Style/Outline.php +++ b/src/PhpWord/Writer/Word2007/Style/Outline.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Paragraph.php b/src/PhpWord/Writer/Word2007/Style/Paragraph.php index b58dc361..ad3ab27a 100644 --- a/src/PhpWord/Writer/Word2007/Style/Paragraph.php +++ b/src/PhpWord/Writer/Word2007/Style/Paragraph.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Row.php b/src/PhpWord/Writer/Word2007/Style/Row.php index 1ecf6cf6..f57094db 100644 --- a/src/PhpWord/Writer/Word2007/Style/Row.php +++ b/src/PhpWord/Writer/Word2007/Style/Row.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Section.php b/src/PhpWord/Writer/Word2007/Style/Section.php index 64c8dc71..ef50c111 100644 --- a/src/PhpWord/Writer/Word2007/Style/Section.php +++ b/src/PhpWord/Writer/Word2007/Style/Section.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Shading.php b/src/PhpWord/Writer/Word2007/Style/Shading.php index 3a260def..a8e6592a 100644 --- a/src/PhpWord/Writer/Word2007/Style/Shading.php +++ b/src/PhpWord/Writer/Word2007/Style/Shading.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Shadow.php b/src/PhpWord/Writer/Word2007/Style/Shadow.php index a9159ecc..5efc38c4 100644 --- a/src/PhpWord/Writer/Word2007/Style/Shadow.php +++ b/src/PhpWord/Writer/Word2007/Style/Shadow.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Shape.php b/src/PhpWord/Writer/Word2007/Style/Shape.php index faae22bf..aad42ae7 100644 --- a/src/PhpWord/Writer/Word2007/Style/Shape.php +++ b/src/PhpWord/Writer/Word2007/Style/Shape.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Spacing.php b/src/PhpWord/Writer/Word2007/Style/Spacing.php index d225ef56..8db78161 100644 --- a/src/PhpWord/Writer/Word2007/Style/Spacing.php +++ b/src/PhpWord/Writer/Word2007/Style/Spacing.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Tab.php b/src/PhpWord/Writer/Word2007/Style/Tab.php index 13a70bca..7b0a0ab5 100644 --- a/src/PhpWord/Writer/Word2007/Style/Tab.php +++ b/src/PhpWord/Writer/Word2007/Style/Tab.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Table.php b/src/PhpWord/Writer/Word2007/Style/Table.php index ce0b0cab..620e4fbf 100644 --- a/src/PhpWord/Writer/Word2007/Style/Table.php +++ b/src/PhpWord/Writer/Word2007/Style/Table.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/TextBox.php b/src/PhpWord/Writer/Word2007/Style/TextBox.php index 6e94cb0f..cd92f845 100644 --- a/src/PhpWord/Writer/Word2007/Style/TextBox.php +++ b/src/PhpWord/Writer/Word2007/Style/TextBox.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/WriterInterface.php b/src/PhpWord/Writer/WriterInterface.php index 09f87617..b5f08199 100644 --- a/src/PhpWord/Writer/WriterInterface.php +++ b/src/PhpWord/Writer/WriterInterface.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Collection/CollectionTest.php b/tests/PhpWord/Collection/CollectionTest.php index 18dfeb70..22f89b72 100644 --- a/tests/PhpWord/Collection/CollectionTest.php +++ b/tests/PhpWord/Collection/CollectionTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/ComplexType/FootnotePropertiesTest.php b/tests/PhpWord/ComplexType/FootnotePropertiesTest.php index 003f22e4..ed68821f 100644 --- a/tests/PhpWord/ComplexType/FootnotePropertiesTest.php +++ b/tests/PhpWord/ComplexType/FootnotePropertiesTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/AbstractElementTest.php b/tests/PhpWord/Element/AbstractElementTest.php index 80de38bf..458b94c8 100644 --- a/tests/PhpWord/Element/AbstractElementTest.php +++ b/tests/PhpWord/Element/AbstractElementTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/CellTest.php b/tests/PhpWord/Element/CellTest.php index 3b8d84a9..aff208c4 100644 --- a/tests/PhpWord/Element/CellTest.php +++ b/tests/PhpWord/Element/CellTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/CheckBoxTest.php b/tests/PhpWord/Element/CheckBoxTest.php index 630fc77f..fb71b8c2 100644 --- a/tests/PhpWord/Element/CheckBoxTest.php +++ b/tests/PhpWord/Element/CheckBoxTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/CommentTest.php b/tests/PhpWord/Element/CommentTest.php index 08783e99..a6388588 100644 --- a/tests/PhpWord/Element/CommentTest.php +++ b/tests/PhpWord/Element/CommentTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/FieldTest.php b/tests/PhpWord/Element/FieldTest.php index e3494004..1bd0c216 100644 --- a/tests/PhpWord/Element/FieldTest.php +++ b/tests/PhpWord/Element/FieldTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/FooterTest.php b/tests/PhpWord/Element/FooterTest.php index c30103c0..2938ae5e 100644 --- a/tests/PhpWord/Element/FooterTest.php +++ b/tests/PhpWord/Element/FooterTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/FootnoteTest.php b/tests/PhpWord/Element/FootnoteTest.php index a5f233d6..b02ab5c6 100644 --- a/tests/PhpWord/Element/FootnoteTest.php +++ b/tests/PhpWord/Element/FootnoteTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/HeaderTest.php b/tests/PhpWord/Element/HeaderTest.php index 8f5f1fea..13ace285 100644 --- a/tests/PhpWord/Element/HeaderTest.php +++ b/tests/PhpWord/Element/HeaderTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/ImageTest.php b/tests/PhpWord/Element/ImageTest.php index df2aad98..80e0bcfc 100644 --- a/tests/PhpWord/Element/ImageTest.php +++ b/tests/PhpWord/Element/ImageTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/LineTest.php b/tests/PhpWord/Element/LineTest.php index c7e52f83..a6e3f79b 100644 --- a/tests/PhpWord/Element/LineTest.php +++ b/tests/PhpWord/Element/LineTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/LinkTest.php b/tests/PhpWord/Element/LinkTest.php index 793e4c9b..48b576c3 100644 --- a/tests/PhpWord/Element/LinkTest.php +++ b/tests/PhpWord/Element/LinkTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/ListItemRunTest.php b/tests/PhpWord/Element/ListItemRunTest.php index fe9f5bbe..0c4c1ac9 100644 --- a/tests/PhpWord/Element/ListItemRunTest.php +++ b/tests/PhpWord/Element/ListItemRunTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/ListItemTest.php b/tests/PhpWord/Element/ListItemTest.php index 9e5beb4b..775a97d4 100644 --- a/tests/PhpWord/Element/ListItemTest.php +++ b/tests/PhpWord/Element/ListItemTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/ObjectTest.php b/tests/PhpWord/Element/ObjectTest.php index 4c50f6ad..87af5c5c 100644 --- a/tests/PhpWord/Element/ObjectTest.php +++ b/tests/PhpWord/Element/ObjectTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/PageBreakTest.php b/tests/PhpWord/Element/PageBreakTest.php index 66b10a6f..69a71204 100644 --- a/tests/PhpWord/Element/PageBreakTest.php +++ b/tests/PhpWord/Element/PageBreakTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/PreserveTextTest.php b/tests/PhpWord/Element/PreserveTextTest.php index 37979cad..a47cc77c 100644 --- a/tests/PhpWord/Element/PreserveTextTest.php +++ b/tests/PhpWord/Element/PreserveTextTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/RowTest.php b/tests/PhpWord/Element/RowTest.php index 6625e61a..cb365dad 100644 --- a/tests/PhpWord/Element/RowTest.php +++ b/tests/PhpWord/Element/RowTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/SDTTest.php b/tests/PhpWord/Element/SDTTest.php index 40da2cf3..fc3682b6 100644 --- a/tests/PhpWord/Element/SDTTest.php +++ b/tests/PhpWord/Element/SDTTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/SectionTest.php b/tests/PhpWord/Element/SectionTest.php index fbdf2fa8..8cd2961f 100644 --- a/tests/PhpWord/Element/SectionTest.php +++ b/tests/PhpWord/Element/SectionTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/TOCTest.php b/tests/PhpWord/Element/TOCTest.php index 4a4d253c..655d567c 100644 --- a/tests/PhpWord/Element/TOCTest.php +++ b/tests/PhpWord/Element/TOCTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/TableTest.php b/tests/PhpWord/Element/TableTest.php index e23427eb..3085aee2 100644 --- a/tests/PhpWord/Element/TableTest.php +++ b/tests/PhpWord/Element/TableTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/TextBoxTest.php b/tests/PhpWord/Element/TextBoxTest.php index b616ae16..cc61e20d 100644 --- a/tests/PhpWord/Element/TextBoxTest.php +++ b/tests/PhpWord/Element/TextBoxTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/TextBreakTest.php b/tests/PhpWord/Element/TextBreakTest.php index cc760877..62186244 100644 --- a/tests/PhpWord/Element/TextBreakTest.php +++ b/tests/PhpWord/Element/TextBreakTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/TextRunTest.php b/tests/PhpWord/Element/TextRunTest.php index d8a68eca..59db597c 100644 --- a/tests/PhpWord/Element/TextRunTest.php +++ b/tests/PhpWord/Element/TextRunTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/TextTest.php b/tests/PhpWord/Element/TextTest.php index 0ce7c474..9723a2e1 100644 --- a/tests/PhpWord/Element/TextTest.php +++ b/tests/PhpWord/Element/TextTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/TitleTest.php b/tests/PhpWord/Element/TitleTest.php index 2e7ebe40..500de133 100644 --- a/tests/PhpWord/Element/TitleTest.php +++ b/tests/PhpWord/Element/TitleTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Exception/CopyFileExceptionTest.php b/tests/PhpWord/Exception/CopyFileExceptionTest.php index 11d88f0a..9d921740 100644 --- a/tests/PhpWord/Exception/CopyFileExceptionTest.php +++ b/tests/PhpWord/Exception/CopyFileExceptionTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php b/tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php index e0823a85..91c7012f 100644 --- a/tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php +++ b/tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Exception/ExceptionTest.php b/tests/PhpWord/Exception/ExceptionTest.php index c620c7e8..28b15702 100644 --- a/tests/PhpWord/Exception/ExceptionTest.php +++ b/tests/PhpWord/Exception/ExceptionTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Exception/InvalidImageExceptionTest.php b/tests/PhpWord/Exception/InvalidImageExceptionTest.php index d6efe909..dfaadbd7 100644 --- a/tests/PhpWord/Exception/InvalidImageExceptionTest.php +++ b/tests/PhpWord/Exception/InvalidImageExceptionTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Exception/InvalidStyleExceptionTest.php b/tests/PhpWord/Exception/InvalidStyleExceptionTest.php index e9d79b05..77ee8571 100644 --- a/tests/PhpWord/Exception/InvalidStyleExceptionTest.php +++ b/tests/PhpWord/Exception/InvalidStyleExceptionTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php b/tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php index c52d3766..50b4806d 100644 --- a/tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php +++ b/tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/IOFactoryTest.php b/tests/PhpWord/IOFactoryTest.php index 7a711734..6dbb006e 100644 --- a/tests/PhpWord/IOFactoryTest.php +++ b/tests/PhpWord/IOFactoryTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/MediaTest.php b/tests/PhpWord/MediaTest.php index e2262352..d045abcd 100644 --- a/tests/PhpWord/MediaTest.php +++ b/tests/PhpWord/MediaTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Metadata/DocInfoTest.php b/tests/PhpWord/Metadata/DocInfoTest.php index a1ea7a0e..5443f0b2 100644 --- a/tests/PhpWord/Metadata/DocInfoTest.php +++ b/tests/PhpWord/Metadata/DocInfoTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Metadata/SettingsTest.php b/tests/PhpWord/Metadata/SettingsTest.php index b726a49a..6f7ad9b6 100644 --- a/tests/PhpWord/Metadata/SettingsTest.php +++ b/tests/PhpWord/Metadata/SettingsTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/PhpWordTest.php b/tests/PhpWord/PhpWordTest.php index c44b7926..01d7342e 100644 --- a/tests/PhpWord/PhpWordTest.php +++ b/tests/PhpWord/PhpWordTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Reader/HTMLTest.php b/tests/PhpWord/Reader/HTMLTest.php index 50510232..24751cac 100644 --- a/tests/PhpWord/Reader/HTMLTest.php +++ b/tests/PhpWord/Reader/HTMLTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Reader/MsDocTest.php b/tests/PhpWord/Reader/MsDocTest.php index ad2afb56..ed16e64b 100644 --- a/tests/PhpWord/Reader/MsDocTest.php +++ b/tests/PhpWord/Reader/MsDocTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Reader/ODTextTest.php b/tests/PhpWord/Reader/ODTextTest.php index 63a1c149..d00657de 100644 --- a/tests/PhpWord/Reader/ODTextTest.php +++ b/tests/PhpWord/Reader/ODTextTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Reader/RTFTest.php b/tests/PhpWord/Reader/RTFTest.php index aab4072c..58154ee3 100644 --- a/tests/PhpWord/Reader/RTFTest.php +++ b/tests/PhpWord/Reader/RTFTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Reader/Word2007Test.php b/tests/PhpWord/Reader/Word2007Test.php index 5421cf98..627bc66e 100644 --- a/tests/PhpWord/Reader/Word2007Test.php +++ b/tests/PhpWord/Reader/Word2007Test.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/SettingsTest.php b/tests/PhpWord/SettingsTest.php index 0d32eab3..6fd2f52b 100644 --- a/tests/PhpWord/SettingsTest.php +++ b/tests/PhpWord/SettingsTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Shared/ConverterTest.php b/tests/PhpWord/Shared/ConverterTest.php index 6f2e63c8..a2031787 100644 --- a/tests/PhpWord/Shared/ConverterTest.php +++ b/tests/PhpWord/Shared/ConverterTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index 9e40cfc9..602b644d 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Shared/ZipArchiveTest.php b/tests/PhpWord/Shared/ZipArchiveTest.php index 156c016c..689f122b 100644 --- a/tests/PhpWord/Shared/ZipArchiveTest.php +++ b/tests/PhpWord/Shared/ZipArchiveTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/AbstractStyleTest.php b/tests/PhpWord/Style/AbstractStyleTest.php index 39d55fbd..ab3ea14e 100644 --- a/tests/PhpWord/Style/AbstractStyleTest.php +++ b/tests/PhpWord/Style/AbstractStyleTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/CellTest.php b/tests/PhpWord/Style/CellTest.php index d531f506..71b32a65 100644 --- a/tests/PhpWord/Style/CellTest.php +++ b/tests/PhpWord/Style/CellTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/FontTest.php b/tests/PhpWord/Style/FontTest.php index cc25fa66..ce7be26d 100644 --- a/tests/PhpWord/Style/FontTest.php +++ b/tests/PhpWord/Style/FontTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/ImageTest.php b/tests/PhpWord/Style/ImageTest.php index 6543a2b3..decc13b1 100644 --- a/tests/PhpWord/Style/ImageTest.php +++ b/tests/PhpWord/Style/ImageTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/IndentationTest.php b/tests/PhpWord/Style/IndentationTest.php index 01ba2aae..db079704 100644 --- a/tests/PhpWord/Style/IndentationTest.php +++ b/tests/PhpWord/Style/IndentationTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/LineNumberingTest.php b/tests/PhpWord/Style/LineNumberingTest.php index 9e7d6e71..56440529 100644 --- a/tests/PhpWord/Style/LineNumberingTest.php +++ b/tests/PhpWord/Style/LineNumberingTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/LineTest.php b/tests/PhpWord/Style/LineTest.php index 1cb30b38..21489caf 100644 --- a/tests/PhpWord/Style/LineTest.php +++ b/tests/PhpWord/Style/LineTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/ListItemTest.php b/tests/PhpWord/Style/ListItemTest.php index d99cb475..a2e4eb74 100644 --- a/tests/PhpWord/Style/ListItemTest.php +++ b/tests/PhpWord/Style/ListItemTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/NumberingLevelTest.php b/tests/PhpWord/Style/NumberingLevelTest.php index 9d7a0748..402d936b 100644 --- a/tests/PhpWord/Style/NumberingLevelTest.php +++ b/tests/PhpWord/Style/NumberingLevelTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/NumberingTest.php b/tests/PhpWord/Style/NumberingTest.php index 41933531..ad57ebff 100644 --- a/tests/PhpWord/Style/NumberingTest.php +++ b/tests/PhpWord/Style/NumberingTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/PaperTest.php b/tests/PhpWord/Style/PaperTest.php index d5dfab05..7d12410c 100644 --- a/tests/PhpWord/Style/PaperTest.php +++ b/tests/PhpWord/Style/PaperTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/ParagraphTest.php b/tests/PhpWord/Style/ParagraphTest.php index a403dc00..e77aa894 100644 --- a/tests/PhpWord/Style/ParagraphTest.php +++ b/tests/PhpWord/Style/ParagraphTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/RowTest.php b/tests/PhpWord/Style/RowTest.php index 972c6340..db98d0a9 100644 --- a/tests/PhpWord/Style/RowTest.php +++ b/tests/PhpWord/Style/RowTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/SectionTest.php b/tests/PhpWord/Style/SectionTest.php index 830423ac..89c4640a 100644 --- a/tests/PhpWord/Style/SectionTest.php +++ b/tests/PhpWord/Style/SectionTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/ShadingTest.php b/tests/PhpWord/Style/ShadingTest.php index 82522384..fd0aaf5e 100644 --- a/tests/PhpWord/Style/ShadingTest.php +++ b/tests/PhpWord/Style/ShadingTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/SpacingTest.php b/tests/PhpWord/Style/SpacingTest.php index 6307a53f..f147ae61 100644 --- a/tests/PhpWord/Style/SpacingTest.php +++ b/tests/PhpWord/Style/SpacingTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/TOCTest.php b/tests/PhpWord/Style/TOCTest.php index ce5484cc..ec01acd9 100644 --- a/tests/PhpWord/Style/TOCTest.php +++ b/tests/PhpWord/Style/TOCTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/TabTest.php b/tests/PhpWord/Style/TabTest.php index 49a7192f..8102369d 100644 --- a/tests/PhpWord/Style/TabTest.php +++ b/tests/PhpWord/Style/TabTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/TableTest.php b/tests/PhpWord/Style/TableTest.php index ee2a9c7f..ee020dd9 100644 --- a/tests/PhpWord/Style/TableTest.php +++ b/tests/PhpWord/Style/TableTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/TextBoxTest.php b/tests/PhpWord/Style/TextBoxTest.php index 9e25b8cd..a91b5b28 100644 --- a/tests/PhpWord/Style/TextBoxTest.php +++ b/tests/PhpWord/Style/TextBoxTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/StyleTest.php b/tests/PhpWord/StyleTest.php index 48b3c3cd..aa46c6b1 100644 --- a/tests/PhpWord/StyleTest.php +++ b/tests/PhpWord/StyleTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/TemplateProcessorTest.php b/tests/PhpWord/TemplateProcessorTest.php index 0cac9931..4bf69f5a 100644 --- a/tests/PhpWord/TemplateProcessorTest.php +++ b/tests/PhpWord/TemplateProcessorTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/HTML/ElementTest.php b/tests/PhpWord/Writer/HTML/ElementTest.php index f92eacd6..0778650e 100644 --- a/tests/PhpWord/Writer/HTML/ElementTest.php +++ b/tests/PhpWord/Writer/HTML/ElementTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/HTML/PartTest.php b/tests/PhpWord/Writer/HTML/PartTest.php index 544c6708..a4a6264e 100644 --- a/tests/PhpWord/Writer/HTML/PartTest.php +++ b/tests/PhpWord/Writer/HTML/PartTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/HTML/StyleTest.php b/tests/PhpWord/Writer/HTML/StyleTest.php index ddb7cdd3..7548ff02 100644 --- a/tests/PhpWord/Writer/HTML/StyleTest.php +++ b/tests/PhpWord/Writer/HTML/StyleTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/HTMLTest.php b/tests/PhpWord/Writer/HTMLTest.php index a2fe8395..69cd5a97 100644 --- a/tests/PhpWord/Writer/HTMLTest.php +++ b/tests/PhpWord/Writer/HTMLTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/ODText/ElementTest.php b/tests/PhpWord/Writer/ODText/ElementTest.php index 5b5f7363..ef4e68b0 100644 --- a/tests/PhpWord/Writer/ODText/ElementTest.php +++ b/tests/PhpWord/Writer/ODText/ElementTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php b/tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php index 14f4cb1a..5ca980f2 100644 --- a/tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php +++ b/tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/ODText/Part/ContentTest.php b/tests/PhpWord/Writer/ODText/Part/ContentTest.php index 9d0daedf..048c5242 100644 --- a/tests/PhpWord/Writer/ODText/Part/ContentTest.php +++ b/tests/PhpWord/Writer/ODText/Part/ContentTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/ODText/StyleTest.php b/tests/PhpWord/Writer/ODText/StyleTest.php index e086ea0f..1a0c3ccd 100644 --- a/tests/PhpWord/Writer/ODText/StyleTest.php +++ b/tests/PhpWord/Writer/ODText/StyleTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/ODTextTest.php b/tests/PhpWord/Writer/ODTextTest.php index ec36b4e8..d35a4ec7 100644 --- a/tests/PhpWord/Writer/ODTextTest.php +++ b/tests/PhpWord/Writer/ODTextTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/PDF/DomPDFTest.php b/tests/PhpWord/Writer/PDF/DomPDFTest.php index e4c4ee52..7831f472 100644 --- a/tests/PhpWord/Writer/PDF/DomPDFTest.php +++ b/tests/PhpWord/Writer/PDF/DomPDFTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/PDF/MPDFTest.php b/tests/PhpWord/Writer/PDF/MPDFTest.php index e829e68f..62411b97 100644 --- a/tests/PhpWord/Writer/PDF/MPDFTest.php +++ b/tests/PhpWord/Writer/PDF/MPDFTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/PDF/TCPDFTest.php b/tests/PhpWord/Writer/PDF/TCPDFTest.php index a7bb2a31..d5bd534b 100644 --- a/tests/PhpWord/Writer/PDF/TCPDFTest.php +++ b/tests/PhpWord/Writer/PDF/TCPDFTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/PDFTest.php b/tests/PhpWord/Writer/PDFTest.php index eb763f79..f1a908a9 100644 --- a/tests/PhpWord/Writer/PDFTest.php +++ b/tests/PhpWord/Writer/PDFTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/RTF/ElementTest.php b/tests/PhpWord/Writer/RTF/ElementTest.php index 31998350..17a9c22f 100644 --- a/tests/PhpWord/Writer/RTF/ElementTest.php +++ b/tests/PhpWord/Writer/RTF/ElementTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/RTF/StyleTest.php b/tests/PhpWord/Writer/RTF/StyleTest.php index bd48814c..4e3a0eed 100644 --- a/tests/PhpWord/Writer/RTF/StyleTest.php +++ b/tests/PhpWord/Writer/RTF/StyleTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/RTFTest.php b/tests/PhpWord/Writer/RTFTest.php index c2b30920..ec83f7b1 100644 --- a/tests/PhpWord/Writer/RTFTest.php +++ b/tests/PhpWord/Writer/RTFTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/ElementTest.php b/tests/PhpWord/Writer/Word2007/ElementTest.php index 4730ebfc..6186695b 100644 --- a/tests/PhpWord/Writer/Word2007/ElementTest.php +++ b/tests/PhpWord/Writer/Word2007/ElementTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php b/tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php index e231f1c8..47f65861 100644 --- a/tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php b/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php index 8e3be114..4a4fd308 100644 --- a/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php index 6103d4c8..d194814c 100644 --- a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/Part/FooterTest.php b/tests/PhpWord/Writer/Word2007/Part/FooterTest.php index 1fb81e8d..98fb003e 100644 --- a/tests/PhpWord/Writer/Word2007/Part/FooterTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/FooterTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php b/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php index 0ecea19e..e557d9c2 100644 --- a/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/Part/HeaderTest.php b/tests/PhpWord/Writer/Word2007/Part/HeaderTest.php index 0418ccec..7830469c 100644 --- a/tests/PhpWord/Writer/Word2007/Part/HeaderTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/HeaderTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php b/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php index 3eeb37cf..0f1ae523 100644 --- a/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php index f88ebe2e..fcb4ccc6 100644 --- a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/Part/StylesTest.php b/tests/PhpWord/Writer/Word2007/Part/StylesTest.php index 0478d0e4..cba0bfb3 100644 --- a/tests/PhpWord/Writer/Word2007/Part/StylesTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/StylesTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/PartTest.php b/tests/PhpWord/Writer/Word2007/PartTest.php index 0c8568aa..3261db4f 100644 --- a/tests/PhpWord/Writer/Word2007/PartTest.php +++ b/tests/PhpWord/Writer/Word2007/PartTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/Style/FontTest.php b/tests/PhpWord/Writer/Word2007/Style/FontTest.php index 32a0c923..f406bc05 100644 --- a/tests/PhpWord/Writer/Word2007/Style/FontTest.php +++ b/tests/PhpWord/Writer/Word2007/Style/FontTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/StyleTest.php b/tests/PhpWord/Writer/Word2007/StyleTest.php index 474d2410..05785b0c 100644 --- a/tests/PhpWord/Writer/Word2007/StyleTest.php +++ b/tests/PhpWord/Writer/Word2007/StyleTest.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007Test.php b/tests/PhpWord/Writer/Word2007Test.php index e7708961..88a522a9 100644 --- a/tests/PhpWord/Writer/Word2007Test.php +++ b/tests/PhpWord/Writer/Word2007Test.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/_includes/TestHelperDOCX.php b/tests/PhpWord/_includes/TestHelperDOCX.php index d33b78c9..bef060ee 100644 --- a/tests/PhpWord/_includes/TestHelperDOCX.php +++ b/tests/PhpWord/_includes/TestHelperDOCX.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/_includes/XmlDocument.php b/tests/PhpWord/_includes/XmlDocument.php index 353d3132..ef56ed15 100644 --- a/tests/PhpWord/_includes/XmlDocument.php +++ b/tests/PhpWord/_includes/XmlDocument.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 1fcdbc40..7126c204 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -10,7 +10,7 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. test bootstrap * - * @link https://github.com/PHPOffice/PHPWord + * @see https://github.com/PHPOffice/PHPWord * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ From 6657f0eec3236c0e201782b70cd84522bc7b5bfe Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 26 Sep 2017 22:46:46 +0200 Subject: [PATCH 101/370] fix doc --- docs/elements.rst | 6 +++--- src/PhpWord/Element/AbstractElement.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/elements.rst b/docs/elements.rst index a35eb654..848e3f98 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -135,12 +135,12 @@ Text breaks are empty new lines. To add text breaks, use the following syntax. A Page breaks ~~~~~~~~~~~ -There are two ways to insert a page breaks, using the ``addPageBreak`` +There are two ways to insert a page break, using the ``addPageBreak`` method or using the ``pageBreakBefore`` style of paragraph. -:: code-block:: php +.. code-block:: php - \\$section->addPageBreak(); + $section->addPageBreak(); Lists ----- diff --git a/src/PhpWord/Element/AbstractElement.php b/src/PhpWord/Element/AbstractElement.php index 792a340f..93e0b09e 100644 --- a/src/PhpWord/Element/AbstractElement.php +++ b/src/PhpWord/Element/AbstractElement.php @@ -73,7 +73,7 @@ abstract class AbstractElement /** * Unique Id for element * - * @var int + * @var string */ protected $elementId; From 75a3fb8e4081ec3b164d2ebef52fc8512b8d9eb2 Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 27 Sep 2017 00:27:33 +0200 Subject: [PATCH 102/370] Improve code coverage --- tests/PhpWord/Element/BookmarkTest.php | 38 +++++++++++++++++++++++++ tests/PhpWord/Element/CommentTest.php | 20 +++++++++++++ tests/PhpWord/Element/ObjectTest.php | 15 +++++++++- tests/PhpWord/Element/SectionTest.php | 11 +++++++ tests/PhpWord/Metadata/SettingsTest.php | 18 ++++++++++++ 5 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 tests/PhpWord/Element/BookmarkTest.php diff --git a/tests/PhpWord/Element/BookmarkTest.php b/tests/PhpWord/Element/BookmarkTest.php new file mode 100644 index 00000000..da86a62e --- /dev/null +++ b/tests/PhpWord/Element/BookmarkTest.php @@ -0,0 +1,38 @@ +assertInstanceOf('PhpOffice\\PhpWord\\Element\\Bookmark', $oBookmark); + $this->assertEquals($bookmarkName, $oBookmark->getName()); + } +} diff --git a/tests/PhpWord/Element/CommentTest.php b/tests/PhpWord/Element/CommentTest.php index a6388588..fd2c814d 100644 --- a/tests/PhpWord/Element/CommentTest.php +++ b/tests/PhpWord/Element/CommentTest.php @@ -80,4 +80,24 @@ class CommentTest extends \PHPUnit_Framework_TestCase $oComment->setRelationId($iVal); $this->assertEquals($iVal, $oComment->getRelationId()); } + + /** + * @expectedException \InvalidArgumentException + */ + public function testExceptionOnCommentStartOnComment() + { + $dummyComment = new Comment('Test User', new \DateTime(), 'my_initials'); + $oComment = new Comment('Test User', new \DateTime(), 'my_initials'); + $oComment->setCommentRangeStart($dummyComment); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testExceptionOnCommentEndOnComment() + { + $dummyComment = new Comment('Test User', new \DateTime(), 'my_initials'); + $oComment = new Comment('Test User', new \DateTime(), 'my_initials'); + $oComment->setCommentRangeEnd($dummyComment); + } } diff --git a/tests/PhpWord/Element/ObjectTest.php b/tests/PhpWord/Element/ObjectTest.php index 87af5c5c..51ed19b5 100644 --- a/tests/PhpWord/Element/ObjectTest.php +++ b/tests/PhpWord/Element/ObjectTest.php @@ -26,9 +26,22 @@ namespace PhpOffice\PhpWord\Element; class ObjectTest extends \PHPUnit_Framework_TestCase { /** - * Create new instance with supported files + * Create new instance with supported files, 4 character extention */ public function testConstructWithSupportedFiles() + { + $src = __DIR__ . '/../_files/documents/reader.docx'; + $oObject = new Object($src); + + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Object', $oObject); + $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Image', $oObject->getStyle()); + $this->assertEquals($src, $oObject->getSource()); + } + + /** + * Create new instance with supported files + */ + public function testConstructWithSupportedFilesLong() { $src = __DIR__ . '/../_files/documents/sheet.xls'; $oObject = new Object($src); diff --git a/tests/PhpWord/Element/SectionTest.php b/tests/PhpWord/Element/SectionTest.php index 8cd2961f..aebfc9b7 100644 --- a/tests/PhpWord/Element/SectionTest.php +++ b/tests/PhpWord/Element/SectionTest.php @@ -129,6 +129,17 @@ class SectionTest extends \PHPUnit_Framework_TestCase $this->assertFalse($object->hasDifferentFirstPage()); } + /** + * @covers ::addHeader + * @covers ::hasDifferentFirstPage + */ + public function testHasDifferentFirstPageFooter() + { + $object = new Section(1); + $object->addFooter(Header::FIRST); + $this->assertTrue($object->hasDifferentFirstPage()); + } + /** * @covers ::addHeader * @covers ::hasDifferentFirstPage diff --git a/tests/PhpWord/Metadata/SettingsTest.php b/tests/PhpWord/Metadata/SettingsTest.php index 6f7ad9b6..6f493d04 100644 --- a/tests/PhpWord/Metadata/SettingsTest.php +++ b/tests/PhpWord/Metadata/SettingsTest.php @@ -116,6 +116,24 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertEquals(ProofState::DIRTY, $oSettings->getProofState()->getSpelling()); } + /** + * @expectedException \InvalidArgumentException + */ + public function testWrongProofStateGrammar() + { + $proofState = new ProofState(); + $proofState->setGrammar('wrong'); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testWrongProofStateSpelling() + { + $proofState = new ProofState(); + $proofState->setSpelling('wrong'); + } + /** * Zoom as percentage */ From 0beeb275fec44b0db8caaf54e13e1aa612f544e4 Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 27 Sep 2017 00:40:08 +0200 Subject: [PATCH 103/370] Add support for changing the document language (#1108) --- CHANGELOG.md | 2 +- docs/general.rst | 19 ++ docs/styles.rst | 11 +- samples/Sample_01_SimpleText.php | 11 + samples/Sample_10_EastAsianFontStyle.php | 2 +- src/PhpWord/ComplexType/TrackChangesView.php | 4 +- src/PhpWord/Element/AbstractElement.php | 2 +- src/PhpWord/Element/Bookmark.php | 2 - src/PhpWord/Element/CheckBox.php | 1 - src/PhpWord/Element/Comment.php | 1 - src/PhpWord/Element/FormField.php | 3 +- src/PhpWord/Element/Link.php | 1 - src/PhpWord/Element/PreserveText.php | 1 - src/PhpWord/Element/SDT.php | 1 - src/PhpWord/Element/TOC.php | 4 +- src/PhpWord/Element/TrackChange.php | 2 +- src/PhpWord/Metadata/Settings.php | 28 +++ src/PhpWord/Reader/Word2007/AbstractPart.php | 29 ++- src/PhpWord/Reader/Word2007/Settings.php | 41 +++- src/PhpWord/Style/AbstractStyle.php | 2 +- src/PhpWord/Style/Font.php | 33 +++ src/PhpWord/Style/Language.php | 218 ++++++++++++++++++ src/PhpWord/Style/ListItem.php | 3 +- src/PhpWord/Style/Paragraph.php | 34 ++- src/PhpWord/Style/TextBox.php | 3 +- src/PhpWord/Writer/ODText/Part/Styles.php | 17 +- src/PhpWord/Writer/RTF/Part/Document.php | 6 +- src/PhpWord/Writer/Word2007/Part/Settings.php | 27 ++- src/PhpWord/Writer/Word2007/Part/Styles.php | 9 + .../Writer/Word2007/Style/AbstractStyle.php | 2 +- src/PhpWord/Writer/Word2007/Style/Font.php | 10 + .../Writer/Word2007/Style/Paragraph.php | 5 +- .../ComplexType/FootnotePropertiesTest.php | 4 +- tests/PhpWord/ComplexType/ProofStateTest.php | 61 +++++ tests/PhpWord/Style/FontTest.php | 1 + tests/PhpWord/Style/LanguageTest.php | 62 +++++ tests/PhpWord/Style/ParagraphTest.php | 1 + .../Writer/Word2007/Part/SettingsTest.php | 27 ++- 38 files changed, 625 insertions(+), 65 deletions(-) create mode 100644 src/PhpWord/Style/Language.php create mode 100644 tests/PhpWord/ComplexType/ProofStateTest.php create mode 100644 tests/PhpWord/Style/LanguageTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 52bd6aac..f963a3cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,8 +14,8 @@ This is the last version to support PHP 5.3 - Introduced the `\PhpOffice\PhpWord\SimpleType\NumberFormat` simple type. - @troosan - Support for ContextualSpacing - @postHawk #1088 - Possiblity to hide spelling and/or grammatical errors - @troosan #542 +- Possiblity to set default document language as well as changing the language for each text element - @troosan #1108 - Support for Comments - @troosan #1067 -- Add support for changing the document language - @troosan #1108 ### Fixed - Loosen dependency to Zend diff --git a/docs/general.rst b/docs/general.rst index 87fecb77..5b5c5d9e 100644 --- a/docs/general.rst +++ b/docs/general.rst @@ -201,6 +201,25 @@ The default symbol to represent a decimal figure is the ``.`` in english. In fre $phpWord->getSettings()->setDecimalSymbol(','); +Document Language +~~~~~~~~~~~~~~~~~ +The default language of the document can be change with the following. + +.. code-block:: php + + $phpWord->getSettings()->setThemeFontLang(new Language(Language::FR_BE)); + +``Languge`` has 3 parameters, one for Latin languages, one for East Asian languages and one for Complex (Bi-Directional) languages. +A couple of language codes are provided in the ``PhpOffice\PhpWord\ComplexType\Language`` class but any valid code/ID can be used. + +In case you are generating an RTF document the Language need to be set differently. + +.. code-block:: php + + $lang = new Language(); + $lang->setLangId(Language::EN_GB_ID); + $phpWord->getSettings()->setThemeFontLang($lang); + Document information -------------------- diff --git a/docs/styles.rst b/docs/styles.rst index 4f8a53fe..e8d2aec8 100644 --- a/docs/styles.rst +++ b/docs/styles.rst @@ -55,6 +55,8 @@ Available Font style options: - ``subScript``. Subscript, *true* or *false*. - ``superScript``. Superscript, *true* or *false*. - ``underline``. Underline, *dash*, *dotted*, etc. +- ``lang``. Language, either a language code like *en-US*, *fr-BE*, etc. or an object (or as an array) if you need to set eastAsian or bidirectional languages + See ``\PhpOffice\PhpWord\Style\Language`` class for some language codes. .. _paragraph-style: @@ -64,7 +66,7 @@ Paragraph Available Paragraph style options: - ``alignment``. Supports all alignment modes since 1st Edition of ECMA-376 standard up till ISO/IEC 29500:2012. -See ``\PhpOffice\PhpWord\SimpleType\Jc`` class for the details. + See ``\PhpOffice\PhpWord\SimpleType\Jc`` class for the details. - ``basedOn``. Parent style. - ``hanging``. Hanging by how much. - ``indent``. Indent by how much. @@ -87,7 +89,7 @@ Table Available Table style options: - ``alignment``. Supports all alignment modes since 1st Edition of ECMA-376 standard up till ISO/IEC 29500:2012. -See ``\PhpOffice\PhpWord\SimpleType\JcTable`` and ``\PhpOffice\PhpWord\SimpleType\Jc`` classes for the details. + See ``\PhpOffice\PhpWord\SimpleType\JcTable`` and ``\PhpOffice\PhpWord\SimpleType\Jc`` classes for the details. - ``bgColor``. Background color, e.g. '9966CC'. - ``border(Top|Right|Bottom|Left)Color``. Border color, e.g. '9966CC'. - ``border(Top|Right|Bottom|Left)Size``. Border size in twips. @@ -106,7 +108,8 @@ Available Cell style options: - ``border(Top|Right|Bottom|Left)Color``. Border color, e.g. '9966CC'. - ``border(Top|Right|Bottom|Left)Size``. Border size in twips. - ``gridSpan``. Number of columns spanned. -- ``textDirection(btLr|tbRl)``. Direction of text. You can use constants ``\PhpOffice\PhpWord\Style\Cell::TEXT_DIR_BTLR`` and ``\PhpOffice\PhpWord\Style\Cell::TEXT_DIR_TBRL`` +- ``textDirection(btLr|tbRl)``. Direction of text. + You can use constants ``\PhpOffice\PhpWord\Style\Cell::TEXT_DIR_BTLR`` and ``\PhpOffice\PhpWord\Style\Cell::TEXT_DIR_TBRL`` - ``valign``. Vertical alignment, *top*, *center*, *both*, *bottom*. - ``vMerge``. *restart* or *continue*. - ``width``. Cell width in twips. @@ -133,7 +136,7 @@ Numbering level Available NumberingLevel style options: - ``alignment``. Supports all alignment modes since 1st Edition of ECMA-376 standard up till ISO/IEC 29500:2012. -See ``\PhpOffice\PhpWord\SimpleType\Jc`` class for the details. + See ``\PhpOffice\PhpWord\SimpleType\Jc`` class for the details. - ``font``. Font name. - ``format``. Numbering format bullet\|decimal\|upperRoman\|lowerRoman\|upperLetter\|lowerLetter. - ``hanging``. See paragraph style. diff --git a/samples/Sample_01_SimpleText.php b/samples/Sample_01_SimpleText.php index 1e51b2c0..fae6c210 100644 --- a/samples/Sample_01_SimpleText.php +++ b/samples/Sample_01_SimpleText.php @@ -1,9 +1,16 @@ getSettings()->setThemeFontLang($languageEnGb); $fontStyleName = 'rStyle'; $phpWord->addFontStyle($fontStyleName, array('bold' => true, 'italic' => true, 'size' => 16, 'allCaps' => true, 'doubleStrikethrough' => true)); @@ -20,6 +27,10 @@ $section = $phpWord->addSection(); $section->addTitle('Welcome to PhpWord', 1); $section->addText('Hello World!'); +// $pStyle = new Font(); +// $pStyle->setLang() +$section->addText('Ce texte-ci est en français.', array('lang' => \PhpOffice\PhpWord\Style\Language::FR_BE)); + // Two text break $section->addTextBreak(2); diff --git a/samples/Sample_10_EastAsianFontStyle.php b/samples/Sample_10_EastAsianFontStyle.php index 2541af86..87345ae0 100644 --- a/samples/Sample_10_EastAsianFontStyle.php +++ b/samples/Sample_10_EastAsianFontStyle.php @@ -7,7 +7,7 @@ $phpWord = new \PhpOffice\PhpWord\PhpWord(); $section = $phpWord->addSection(); $header = array('size' => 16, 'bold' => true); //1.Use EastAisa FontStyle -$section->addText('中文楷体样式测试', array('name' => '楷体', 'size' => 16, 'color' => '1B2232')); +$section->addText('中文楷体样式测试', array('name' => '楷体', 'size' => 16, 'color' => '1B2232', 'lang' => array('latin' => 'en-US', 'eastAsia' => 'zh-CN'))); // Save file echo write($phpWord, basename(__FILE__, '.php'), $writers); diff --git a/src/PhpWord/ComplexType/TrackChangesView.php b/src/PhpWord/ComplexType/TrackChangesView.php index ea26bc3c..9c8948ae 100644 --- a/src/PhpWord/ComplexType/TrackChangesView.php +++ b/src/PhpWord/ComplexType/TrackChangesView.php @@ -135,10 +135,10 @@ final class TrackChangesView /** * Set Display Formatting Revisions * - * @param boolean $insDel + * @param boolean|null $formatting * Set to true to show formatting revisions */ - public function setFormatting($formatting) + public function setFormatting($formatting = null) { $this->formatting = $formatting === null ? true : $formatting; } diff --git a/src/PhpWord/Element/AbstractElement.php b/src/PhpWord/Element/AbstractElement.php index f657dd1b..4ff4978a 100644 --- a/src/PhpWord/Element/AbstractElement.php +++ b/src/PhpWord/Element/AbstractElement.php @@ -231,7 +231,7 @@ abstract class AbstractElement /** * Get element unique ID * - * @return string + * @return integer */ public function getElementId() { diff --git a/src/PhpWord/Element/Bookmark.php b/src/PhpWord/Element/Bookmark.php index c865893f..4df06afb 100644 --- a/src/PhpWord/Element/Bookmark.php +++ b/src/PhpWord/Element/Bookmark.php @@ -45,9 +45,7 @@ class Bookmark extends AbstractElement */ public function __construct($name) { - $this->name = CommonText::toUTF8($name); - return $this; } /** diff --git a/src/PhpWord/Element/CheckBox.php b/src/PhpWord/Element/CheckBox.php index 3fc578ef..b049c7f1 100644 --- a/src/PhpWord/Element/CheckBox.php +++ b/src/PhpWord/Element/CheckBox.php @@ -40,7 +40,6 @@ class CheckBox extends Text * @param string $text * @param mixed $fontStyle * @param mixed $paragraphStyle - * @return self */ public function __construct($name = null, $text = null, $fontStyle = null, $paragraphStyle = null) { diff --git a/src/PhpWord/Element/Comment.php b/src/PhpWord/Element/Comment.php index 685ed296..5e0ebe63 100644 --- a/src/PhpWord/Element/Comment.php +++ b/src/PhpWord/Element/Comment.php @@ -61,7 +61,6 @@ class Comment extends TrackChange { parent::__construct($author, $date); $this->initials = $initials; - return $this; } /** diff --git a/src/PhpWord/Element/FormField.php b/src/PhpWord/Element/FormField.php index c7cb44d2..414714a8 100644 --- a/src/PhpWord/Element/FormField.php +++ b/src/PhpWord/Element/FormField.php @@ -35,7 +35,7 @@ class FormField extends Text /** * Form field name * - * @var string + * @var string|bool|int */ private $name; @@ -70,7 +70,6 @@ class FormField extends Text * @param string $type * @param mixed $fontStyle * @param mixed $paragraphStyle - * @return self */ public function __construct($type, $fontStyle = null, $paragraphStyle = null) { diff --git a/src/PhpWord/Element/Link.php b/src/PhpWord/Element/Link.php index 4a72e167..6641b46d 100644 --- a/src/PhpWord/Element/Link.php +++ b/src/PhpWord/Element/Link.php @@ -83,7 +83,6 @@ class Link extends AbstractElement $this->fontStyle = $this->setNewStyle(new Font('text'), $fontStyle); $this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle); $this->internal = $internal; - return $this; } /** diff --git a/src/PhpWord/Element/PreserveText.php b/src/PhpWord/Element/PreserveText.php index 65e17e35..813c1396 100644 --- a/src/PhpWord/Element/PreserveText.php +++ b/src/PhpWord/Element/PreserveText.php @@ -54,7 +54,6 @@ class PreserveText extends AbstractElement * @param string $text * @param mixed $fontStyle * @param mixed $paragraphStyle - * @return self */ public function __construct($text = null, $fontStyle = null, $paragraphStyle = null) { diff --git a/src/PhpWord/Element/SDT.php b/src/PhpWord/Element/SDT.php index 58a477d9..b0c68b0f 100644 --- a/src/PhpWord/Element/SDT.php +++ b/src/PhpWord/Element/SDT.php @@ -51,7 +51,6 @@ class SDT extends Text * @param string $type * @param mixed $fontStyle * @param mixed $paragraphStyle - * @return self */ public function __construct($type, $fontStyle = null, $paragraphStyle = null) { diff --git a/src/PhpWord/Element/TOC.php b/src/PhpWord/Element/TOC.php index 54ae3844..d3ab2be1 100644 --- a/src/PhpWord/Element/TOC.php +++ b/src/PhpWord/Element/TOC.php @@ -36,7 +36,7 @@ class TOC extends AbstractElement /** * Font style * - * @var \PhpOffice\PhpWord\Style\Font|array|string + * @var \PhpOffice\PhpWord\Style\Font|string */ private $fontStyle; @@ -121,7 +121,7 @@ class TOC extends AbstractElement /** * Get Font Style * - * @return \PhpOffice\PhpWord\Style\Font + * @return \PhpOffice\PhpWord\Style\Font|string */ public function getStyleFont() { diff --git a/src/PhpWord/Element/TrackChange.php b/src/PhpWord/Element/TrackChange.php index 782e6f35..1df7148d 100644 --- a/src/PhpWord/Element/TrackChange.php +++ b/src/PhpWord/Element/TrackChange.php @@ -45,7 +45,7 @@ class TrackChange extends AbstractContainer * Create a new TrackChange Element * * @param string $author - * @param DateTime $date + * @param \DateTime $date */ public function __construct($author, \DateTime $date) { diff --git a/src/PhpWord/Metadata/Settings.php b/src/PhpWord/Metadata/Settings.php index cd0eaabe..64788cc3 100644 --- a/src/PhpWord/Metadata/Settings.php +++ b/src/PhpWord/Metadata/Settings.php @@ -19,6 +19,7 @@ namespace PhpOffice\PhpWord\Metadata; use PhpOffice\PhpWord\ComplexType\ProofState; use PhpOffice\PhpWord\SimpleType\Zoom; use PhpOffice\PhpWord\ComplexType\TrackChangesView; +use PhpOffice\PhpWord\Style\Language; /** * Setting class @@ -100,6 +101,13 @@ class Settings */ private $evenAndOddHeaders = false; + /** + * Theme Font Languages + * + * @var Language + */ + private $themeFontLang; + /** * Radix Point for Field Code Evaluation * @@ -291,6 +299,26 @@ class Settings } } + /** + * Returns the Language + * + * @return Language + */ + public function getThemeFontLang() + { + return $this->themeFontLang; + } + + /** + * sets the Language for this document + * + * @param Language $themeFontLang + */ + public function setThemeFontLang($themeFontLang) + { + $this->themeFontLang = $themeFontLang; + } + /** * Returns the Radix Point for Field Code Evaluation * diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index 5aafcb0d..c94a3546 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -314,18 +314,20 @@ abstract class AbstractPart $styleNode = $xmlReader->getElement('w:pPr', $domNode); $styleDefs = array( - 'styleName' => array(self::READ_VALUE, 'w:pStyle'), - 'alignment' => array(self::READ_VALUE, 'w:jc'), - 'basedOn' => array(self::READ_VALUE, 'w:basedOn'), - 'next' => array(self::READ_VALUE, 'w:next'), - 'indent' => array(self::READ_VALUE, 'w:ind', 'w:left'), - 'hanging' => array(self::READ_VALUE, 'w:ind', 'w:hanging'), - 'spaceAfter' => array(self::READ_VALUE, 'w:spacing', 'w:after'), - 'spaceBefore' => array(self::READ_VALUE, 'w:spacing', 'w:before'), - 'widowControl' => array(self::READ_FALSE, 'w:widowControl'), - 'keepNext' => array(self::READ_TRUE, 'w:keepNext'), - 'keepLines' => array(self::READ_TRUE, 'w:keepLines'), - 'pageBreakBefore' => array(self::READ_TRUE, 'w:pageBreakBefore'), + 'styleName' => array(self::READ_VALUE, 'w:pStyle'), + 'alignment' => array(self::READ_VALUE, 'w:jc'), + 'basedOn' => array(self::READ_VALUE, 'w:basedOn'), + 'next' => array(self::READ_VALUE, 'w:next'), + 'indent' => array(self::READ_VALUE, 'w:ind', 'w:left'), + 'hanging' => array(self::READ_VALUE, 'w:ind', 'w:hanging'), + 'spaceAfter' => array(self::READ_VALUE, 'w:spacing', 'w:after'), + 'spaceBefore' => array(self::READ_VALUE, 'w:spacing', 'w:before'), + 'widowControl' => array(self::READ_FALSE, 'w:widowControl'), + 'keepNext' => array(self::READ_TRUE, 'w:keepNext'), + 'keepLines' => array(self::READ_TRUE, 'w:keepLines'), + 'pageBreakBefore' => array(self::READ_TRUE, 'w:pageBreakBefore'), + 'contextualSpacing' => array(self::READ_TRUE, 'w:contextualSpacing'), + 'bidi' => array(self::READ_TRUE, 'w:bidi'), ); return $this->readStyleDefs($xmlReader, $styleNode, $styleDefs); @@ -369,6 +371,9 @@ abstract class AbstractPart 'subScript' => array(self::READ_EQUAL, 'w:vertAlign', 'w:val', 'subscript'), 'fgColor' => array(self::READ_VALUE, 'w:highlight'), 'rtl' => array(self::READ_TRUE, 'w:rtl'), + 'font-latin' => array(self::READ_VALUE, 'w:font', 'w:val'), + 'font-eastAsia' => array(self::READ_VALUE, 'w:font', 'w:eastAsia'), + 'font-bidi' => array(self::READ_VALUE, 'w:font', 'w:bidi'), ); return $this->readStyleDefs($xmlReader, $styleNode, $styleDefs); diff --git a/src/PhpWord/Reader/Word2007/Settings.php b/src/PhpWord/Reader/Word2007/Settings.php index 7ade4dc5..581d6b3d 100644 --- a/src/PhpWord/Reader/Word2007/Settings.php +++ b/src/PhpWord/Reader/Word2007/Settings.php @@ -18,8 +18,9 @@ namespace PhpOffice\PhpWord\Reader\Word2007; use PhpOffice\Common\XMLReader; -use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\ComplexType\TrackChangesView; +use PhpOffice\PhpWord\PhpWord; +use PhpOffice\PhpWord\Style\Language; /** * Settings reader @@ -66,6 +67,28 @@ class Settings extends AbstractPart } } + /** + * Sets the document Language + * + * @param XMLReader $xmlReader + * @param PhpWord $phpWord + * @param \DOMNode $node + */ + protected function setThemeFontLang(XMLReader $xmlReader, PhpWord $phpWord, \DOMElement $node) + { + + $val = $xmlReader->getAttribute('w:val', $node); + $eastAsia = $xmlReader->getAttribute('w:eastAsia', $node); + $bidi = $xmlReader->getAttribute('w:bidi', $node); + + $themeFontLang = new Language(); + $themeFontLang->setLatin($val); + $themeFontLang->setLatin($eastAsia); + $themeFontLang->setLatin($bidi); + + $phpWord->getSettings()->setThemeFontLang($themeFontLang); + } + /** * Sets the document protection * @@ -73,7 +96,7 @@ class Settings extends AbstractPart * @param PhpWord $phpWord * @param \DOMNode $node */ - protected function setDocumentProtection(XMLReader $xmlReader, PhpWord $phpWord, \DOMNode $node) + protected function setDocumentProtection(XMLReader $xmlReader, PhpWord $phpWord, \DOMElement $node) { $documentProtection = $phpWord->getSettings()->getDocumentProtection(); @@ -88,17 +111,17 @@ class Settings extends AbstractPart * @param PhpWord $phpWord * @param \DOMNode $node */ - protected function setProofState(XMLReader $xmlReader, PhpWord $phpWord, \DOMNode $node) + protected function setProofState(XMLReader $xmlReader, PhpWord $phpWord, \DOMElement $node) { $proofState = $phpWord->getSettings()->getProofState(); $spelling = $xmlReader->getAttribute('w:spelling', $node); $grammar = $xmlReader->getAttribute('w:grammar', $node); - if ($spelling != null) { + if ($spelling !== null) { $proofState->setSpelling($spelling); } - if ($grammar != null) { + if ($grammar !== null) { $proofState->setGrammar($grammar); } } @@ -110,13 +133,13 @@ class Settings extends AbstractPart * @param PhpWord $phpWord * @param \DOMNode $node */ - protected function setZoom(XMLReader $xmlReader, PhpWord $phpWord, \DOMNode $node) + protected function setZoom(XMLReader $xmlReader, PhpWord $phpWord, \DOMElement $node) { $percent = $xmlReader->getAttribute('w:percent', $node); $val = $xmlReader->getAttribute('w:val', $node); - if ($percent != null || $val != null) { - $phpWord->getSettings()->setZoom($percent == null ? $val : $percent); + if ($percent !== null || $val !== null) { + $phpWord->getSettings()->setZoom($percent === null ? $val : $percent); } } @@ -127,7 +150,7 @@ class Settings extends AbstractPart * @param PhpWord $phpWord * @param \DOMNode $node */ - protected function setRevisionView(XMLReader $xmlReader, PhpWord $phpWord, \DOMNode $node) + protected function setRevisionView(XMLReader $xmlReader, PhpWord $phpWord, \DOMElement $node) { $revisionView = new TrackChangesView(); $revisionView->setMarkup($xmlReader->getAttribute('w:markup', $node)); diff --git a/src/PhpWord/Style/AbstractStyle.php b/src/PhpWord/Style/AbstractStyle.php index 05c79ea2..e2b6dce9 100644 --- a/src/PhpWord/Style/AbstractStyle.php +++ b/src/PhpWord/Style/AbstractStyle.php @@ -329,7 +329,7 @@ abstract class AbstractStyle protected function setPairedVal(&$property, &$pairProperty, $value) { $property = $this->setBoolVal($value, $property); - if ($value == true) { + if ($value === true) { $pairProperty = false; } diff --git a/src/PhpWord/Style/Font.php b/src/PhpWord/Style/Font.php index 5cc80fb3..19f2758d 100644 --- a/src/PhpWord/Style/Font.php +++ b/src/PhpWord/Style/Font.php @@ -228,6 +228,12 @@ class Font extends AbstractStyle */ private $rtl = false; + /** + * Languages + * @var \PhpOffice\PhpWord\Style\Language + */ + private $lang; + /** * Create new font style * @@ -276,6 +282,7 @@ class Font extends AbstractStyle 'paragraph' => $this->getParagraph(), 'rtl' => $this->isRTL(), 'shading' => $this->getShading(), + 'lang' => $this->getLang(), ); return $styles; @@ -783,6 +790,32 @@ class Font extends AbstractStyle return $this; } + /** + * Get language + * + * @return \PhpOffice\PhpWord\Style\Language + */ + public function getLang() + { + return $this->lang; + } + + /** + * Set language + * + * @param mixed $value + * @return self + */ + public function setLang($value = null) + { + if (is_string($value) && $value != '') { + $value = new Language($value); + } + $this->setObjectVal($value, 'Language', $this->lang); + + return $this; + } + /** * Get bold * diff --git a/src/PhpWord/Style/Language.php b/src/PhpWord/Style/Language.php new file mode 100644 index 00000000..4e9220fd --- /dev/null +++ b/src/PhpWord/Style/Language.php @@ -0,0 +1,218 @@ +setLatin($latin); + } + if (!empty($eastAsia)) { + $this->setEastAsia($eastAsia); + } + if (!empty($bidirectional)) { + $this->setBidirectional($bidirectional); + } + } + + /** + * Set the Latin Language + * + * @param string $latin + * The value for the latin language + * @return self + */ + public function setLatin($latin) + { + $this->validateLocale($latin); + $this->latin = $latin; + return $this; + } + + /** + * Get the Latin Language + * + * @return string|null + */ + public function getLatin() + { + return $this->latin; + } + + /** + * Set the Language ID + * + * @param int $langId + * The value for the language ID + * @return self + * @see https://technet.microsoft.com/en-us/library/cc287874(v=office.12).aspx + */ + public function setLangId($langId) + { + $this->langId = $langId; + return $this; + } + + /** + * Get the Language ID + * + * @return int + */ + public function getLangId() + { + return $this->langId; + } + + /** + * Set the East Asian Language + * + * @param string $eastAsia + * The value for the east asian language + * @return self + */ + public function setEastAsia($eastAsia) + { + $this->validateLocale($eastAsia); + $this->eastAsia = $eastAsia; + return $this; + } + + /** + * Get the East Asian Language + * + * @return string|null + */ + public function getEastAsia() + { + return $this->eastAsia; + } + + /** + * Set the Complex Script Language + * + * @param string $bidirectional + * The value for the complex script language + * @return self + */ + public function setBidirectional($bidirectional) + { + $this->validateLocale($bidirectional); + $this->bidirectional = $bidirectional; + return $this; + } + + /** + * Get the Complex Script Language + * + * @return string|null + */ + public function getBidirectional() + { + return $this->bidirectional; + } + + /** + * Validates that the language passed is in the format xx-xx + * + * @param string $locale + * @return boolean + */ + private function validateLocale($locale) + { + if ($locale !== null && strstr($locale, '-') === false) { + throw new \InvalidArgumentException($locale . ' is not a valid language code'); + } + } +} diff --git a/src/PhpWord/Style/ListItem.php b/src/PhpWord/Style/ListItem.php index 18ea0bf2..61a8349b 100644 --- a/src/PhpWord/Style/ListItem.php +++ b/src/PhpWord/Style/ListItem.php @@ -247,11 +247,12 @@ class ListItem extends AbstractStyle // Populate style and register to global Style register $style = $listTypeStyles[$this->listType]; + $numProperties = count($properties); foreach ($style['levels'] as $key => $value) { $level = array(); $levelProperties = explode(', ', $value); $level['level'] = $key; - for ($i = 0; $i < count($properties); $i++) { + for ($i = 0; $i < $numProperties; $i++) { $property = $properties[$i]; $level[$property] = $levelProperties[$i]; } diff --git a/src/PhpWord/Style/Paragraph.php b/src/PhpWord/Style/Paragraph.php index 8d342550..169f2cda 100644 --- a/src/PhpWord/Style/Paragraph.php +++ b/src/PhpWord/Style/Paragraph.php @@ -165,6 +165,13 @@ class Paragraph extends Border */ private $contextualSpacing = false; + /** + * Right to Left Paragraph Layout + * + * @var bool + */ + private $bidi = false; + /** * Set Style value * @@ -216,6 +223,7 @@ class Paragraph extends Border 'tabs' => $this->getTabs(), 'shading' => $this->getShading(), 'contextualSpacing' => $this->hasContextualSpacing(), + 'bidi' => $this->isBidi(), ); return $styles; @@ -739,7 +747,7 @@ class Paragraph extends Border return $this; } - + /** * Get contextualSpacing * @@ -762,4 +770,28 @@ class Paragraph extends Border return $this; } + + /** + * Get bidirectional + * + * @return bool + */ + public function isBidi() + { + return $this->bidi; + } + + /** + * Set bidi + * + * @param bool $bidi + * Set to true to write from right to left + * @return self + */ + public function setBidi($bidi) + { + $this->bidi = $bidi; + + return $this; + } } diff --git a/src/PhpWord/Style/TextBox.php b/src/PhpWord/Style/TextBox.php index 600fb8ea..6783cd18 100644 --- a/src/PhpWord/Style/TextBox.php +++ b/src/PhpWord/Style/TextBox.php @@ -183,7 +183,8 @@ class TextBox extends Image { $hasInnerMargins = false; $margins = $this->getInnerMargin(); - for ($i = 0; $i < count($margins); $i++) { + $numMargins = count($margins); + for ($i = 0; $i < $numMargins; $i++) { if ($margins[$i] !== null) { $hasInnerMargins = true; } diff --git a/src/PhpWord/Writer/ODText/Part/Styles.php b/src/PhpWord/Writer/ODText/Part/Styles.php index b50be0e8..ee22aaab 100644 --- a/src/PhpWord/Writer/ODText/Part/Styles.php +++ b/src/PhpWord/Writer/ODText/Part/Styles.php @@ -81,22 +81,27 @@ class Styles extends AbstractPart $xmlWriter->writeAttribute('style:writing-mode', 'page'); $xmlWriter->endElement(); // style:paragraph-properties + $language = $this->getParentWriter()->getPhpWord()->getSettings()->getThemeFontLang(); + $latinLang = $language != null && is_string($language->getLatin()) ? explode('-', $language->getLatin()) : array('fr', 'FR'); + $asianLang = $language != null && is_string($language->getEastAsia()) ? explode('-', $language->getEastAsia()) : array('zh', 'CN'); + $complexLang = $language != null && is_string($language->getBidirectional()) ? explode('-', $language->getBidirectional()) : array('hi', 'IN'); + // Font $xmlWriter->startElement('style:text-properties'); $xmlWriter->writeAttribute('style:use-window-font-color', 'true'); $xmlWriter->writeAttribute('style:font-name', Settings::getDefaultFontName()); $xmlWriter->writeAttribute('fo:font-size', Settings::getDefaultFontSize() . 'pt'); - $xmlWriter->writeAttribute('fo:language', 'fr'); - $xmlWriter->writeAttribute('fo:country', 'FR'); + $xmlWriter->writeAttribute('fo:language', $latinLang[0]); + $xmlWriter->writeAttribute('fo:country', $latinLang[1]); $xmlWriter->writeAttribute('style:letter-kerning', 'true'); $xmlWriter->writeAttribute('style:font-name-asian', Settings::getDefaultFontName() . '2'); $xmlWriter->writeAttribute('style:font-size-asian', Settings::getDefaultFontSize() . 'pt'); - $xmlWriter->writeAttribute('style:language-asian', 'zh'); - $xmlWriter->writeAttribute('style:country-asian', 'CN'); + $xmlWriter->writeAttribute('style:language-asian', $asianLang[0]); + $xmlWriter->writeAttribute('style:country-asian', $asianLang[1]); $xmlWriter->writeAttribute('style:font-name-complex', Settings::getDefaultFontName() . '2'); $xmlWriter->writeAttribute('style:font-size-complex', Settings::getDefaultFontSize() . 'pt'); - $xmlWriter->writeAttribute('style:language-complex', 'hi'); - $xmlWriter->writeAttribute('style:country-complex', 'IN'); + $xmlWriter->writeAttribute('style:language-complex', $complexLang[0]); + $xmlWriter->writeAttribute('style:country-complex', $complexLang[1]); $xmlWriter->writeAttribute('fo:hyphenate', 'false'); $xmlWriter->writeAttribute('fo:hyphenation-remain-char-count', '2'); $xmlWriter->writeAttribute('fo:hyphenation-push-char-count', '2'); diff --git a/src/PhpWord/Writer/RTF/Part/Document.php b/src/PhpWord/Writer/RTF/Part/Document.php index 24ee7b0a..97b2f1b6 100644 --- a/src/PhpWord/Writer/RTF/Part/Document.php +++ b/src/PhpWord/Writer/RTF/Part/Document.php @@ -86,6 +86,10 @@ class Document extends AbstractPart */ private function writeFormatting() { + $docSettings = $this->getParentWriter()->getPhpWord()->getSettings(); + // Applies a language to a text run (defaults to 1036 : French (France)) + $langId = $docSettings->getThemeFontLang() != null && $docSettings->getThemeFontLang()->getLangId() != null ? $docSettings->getThemeFontLang()->getLangId() : 1036; + $content = ''; $content .= '\deftab720'; // Set the default tab size (720 twips) @@ -94,7 +98,7 @@ class Document extends AbstractPart $content .= '\uc1'; // Set the numberof bytes that follows a unicode character $content .= '\pard'; // Resets to default paragraph properties. $content .= '\nowidctlpar'; // No widow/orphan control - $content .= '\lang1036'; // Applies a language to a text run (1036 : French (France)) + $content .= '\lang' . $langId; $content .= '\kerning1'; // Point size (in half-points) above which to kern character pairs $content .= '\fs' . (Settings::getDefaultFontSize() * 2); // Set the font size in half-points $content .= PHP_EOL; diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index d2cb8117..eca70d29 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -17,9 +17,9 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Part; -use PhpOffice\PhpWord\Settings as DocumentSettings; use PhpOffice\PhpWord\ComplexType\ProofState; use PhpOffice\PhpWord\ComplexType\TrackChangesView; +use PhpOffice\PhpWord\Style\Language; /** * Word2007 settings part writer: word/settings.xml @@ -110,7 +110,6 @@ class Settings extends AbstractPart 'w:defaultTabStop' => array('@attributes' => array('w:val' => '708')), 'w:hyphenationZone' => array('@attributes' => array('w:val' => '425')), 'w:characterSpacingControl' => array('@attributes' => array('w:val' => 'doNotCompress')), - 'w:themeFontLang' => array('@attributes' => array('w:val' => 'en-US')), 'w:decimalSymbol' => array('@attributes' => array('w:val' => $documentSettings->getDecimalSymbol())), 'w:listSeparator' => array('@attributes' => array('w:val' => ';')), 'w:compat' => array(), @@ -152,6 +151,7 @@ class Settings extends AbstractPart $this->setOnOffValue('w:doNotTrackFormatting', $documentSettings->hasDoNotTrackFormatting()); $this->setOnOffValue('w:evenAndOddHeaders', $documentSettings->hasEvenAndOddHeaders()); + $this->setThemeFontLang($documentSettings->getThemeFontLang()); $this->setRevisionView($documentSettings->getRevisionView()); $this->setDocumentProtection($documentSettings->getDocumentProtection()); $this->setProofState($documentSettings->getProofState()); @@ -179,7 +179,7 @@ class Settings extends AbstractPart /** * Get protection settings. * - * @param \PhpOffice\PhpWord\Metadata\Settings $documentProtection + * @param \PhpOffice\PhpWord\Metadata\Protection $documentProtection * @return void */ private function setDocumentProtection($documentProtection) @@ -212,9 +212,9 @@ class Settings extends AbstractPart } /** - * Set the Proof state + * Set the Revision View * - * @param ProofState $proofState + * @param TrackChangesView $trackChangesView */ private function setRevisionView(TrackChangesView $trackChangesView = null) { @@ -229,6 +229,23 @@ class Settings extends AbstractPart } } + /** + * Sets the language + * + * @param Language $language + */ + private function setThemeFontLang(Language $language = null) + { + $latinLanguage = ($language == null || $language->getLatin() === null) ? 'en-US' : $language->getLatin(); + $lang = array(); + $lang['w:val'] = $latinLanguage; + if ($language != null) { + $lang['w:eastAsia'] = $language->getEastAsia() === null ? 'x-none' : $language->getEastAsia(); + $lang['w:bidi'] = $language->getBidirectional() === null ? 'x-none' : $language->getBidirectional(); + } + $this->settings['w:themeFontLang'] = array('@attributes' => $lang); + } + /** * Set the magnification * diff --git a/src/PhpWord/Writer/Word2007/Part/Styles.php b/src/PhpWord/Writer/Word2007/Part/Styles.php index 01b84c08..7795d56b 100644 --- a/src/PhpWord/Writer/Word2007/Part/Styles.php +++ b/src/PhpWord/Writer/Word2007/Part/Styles.php @@ -85,6 +85,8 @@ class Styles extends AbstractPart { $fontName = PhpWordSettings::getDefaultFontName(); $fontSize = PhpWordSettings::getDefaultFontSize(); + $language = $this->getParentWriter()->getPhpWord()->getSettings()->getThemeFontLang(); + $latinLanguage = ($language == null || $language->getLatin() === null) ? 'en-US' : $language->getLatin(); // Default font $xmlWriter->startElement('w:docDefaults'); @@ -102,6 +104,13 @@ class Styles extends AbstractPart $xmlWriter->startElement('w:szCs'); $xmlWriter->writeAttribute('w:val', $fontSize * 2); $xmlWriter->endElement(); // w:szCs + $xmlWriter->startElement('w:lang'); + $xmlWriter->writeAttribute('w:val', $latinLanguage); + if ($language != null) { + $xmlWriter->writeAttributeIf($language->getEastAsia() !== null, 'w:eastAsia', $language->getEastAsia()); + $xmlWriter->writeAttributeIf($language->getBidirectional() !== null, 'w:bidi', $language->getBidirectional()); + } + $xmlWriter->endElement(); // w:lang $xmlWriter->endElement(); // w:rPr $xmlWriter->endElement(); // w:rPrDefault $xmlWriter->endElement(); // w:docDefaults diff --git a/src/PhpWord/Writer/Word2007/Style/AbstractStyle.php b/src/PhpWord/Writer/Word2007/Style/AbstractStyle.php index d0ee5a0d..0b8b0a52 100644 --- a/src/PhpWord/Writer/Word2007/Style/AbstractStyle.php +++ b/src/PhpWord/Writer/Word2007/Style/AbstractStyle.php @@ -71,7 +71,7 @@ abstract class AbstractStyle /** * Get Style * - * @return \PhpOffice\PhpWord\Style\AbstractStyle + * @return string|\PhpOffice\PhpWord\Style\AbstractStyle */ protected function getStyle() { diff --git a/src/PhpWord/Writer/Word2007/Style/Font.php b/src/PhpWord/Writer/Word2007/Style/Font.php index 97cf3088..2248a448 100644 --- a/src/PhpWord/Writer/Word2007/Style/Font.php +++ b/src/PhpWord/Writer/Word2007/Style/Font.php @@ -86,6 +86,16 @@ class Font extends AbstractStyle $xmlWriter->endElement(); } + //Language + $language = $style->getLang(); + if ($language != null && ($language->getLatin() !== null || $language->getEastAsia() !== null || $language->getBidirectional() !== null)) { + $xmlWriter->startElement('w:lang'); + $xmlWriter->writeAttributeIf($language->getLatin() !== null, 'w:val', $language->getLatin()); + $xmlWriter->writeAttributeIf($language->getEastAsia() !== null, 'w:eastAsia', $language->getEastAsia()); + $xmlWriter->writeAttributeIf($language->getBidirectional() !== null, 'w:bidi', $language->getBidirectional()); + $xmlWriter->endElement(); + } + // Color $color = $style->getColor(); $xmlWriter->writeElementIf($color !== null, 'w:color', 'w:val', $color); diff --git a/src/PhpWord/Writer/Word2007/Style/Paragraph.php b/src/PhpWord/Writer/Word2007/Style/Paragraph.php index 787f2a5f..32f8abba 100644 --- a/src/PhpWord/Writer/Word2007/Style/Paragraph.php +++ b/src/PhpWord/Writer/Word2007/Style/Paragraph.php @@ -106,7 +106,10 @@ class Paragraph extends AbstractStyle } $xmlWriter->endElement(); } - + + //Right to left + $xmlWriter->writeElementIf($styles['bidi'] === true, 'w:bidi'); + //Paragraph contextualSpacing $xmlWriter->writeElementIf($styles['contextualSpacing'] === true, 'w:contextualSpacing'); diff --git a/tests/PhpWord/ComplexType/FootnotePropertiesTest.php b/tests/PhpWord/ComplexType/FootnotePropertiesTest.php index 39392fcd..aa46d89b 100644 --- a/tests/PhpWord/ComplexType/FootnotePropertiesTest.php +++ b/tests/PhpWord/ComplexType/FootnotePropertiesTest.php @@ -21,9 +21,9 @@ use PhpOffice\PhpWord\ComplexType\FootnoteProperties; use PhpOffice\PhpWord\SimpleType\NumberFormat; /** - * Test class for PhpOffice\PhpWord\SimpleType\FootnoteProperties + * Test class for PhpOffice\PhpWord\ComplexType\FootnoteProperties * - * @coversDefaultClass \PhpOffice\PhpWord\SimpleType\FootnoteProperties + * @coversDefaultClass \PhpOffice\PhpWord\ComplexType\FootnoteProperties * @runTestsInSeparateProcesses */ class FootnotePropertiesTest extends \PHPUnit_Framework_TestCase diff --git a/tests/PhpWord/ComplexType/ProofStateTest.php b/tests/PhpWord/ComplexType/ProofStateTest.php new file mode 100644 index 00000000..0b7e74ca --- /dev/null +++ b/tests/PhpWord/ComplexType/ProofStateTest.php @@ -0,0 +1,61 @@ +setGrammar(ProofState::CLEAN); + $pState->setSpelling(ProofState::DIRTY); + + $this->assertEquals(ProofState::CLEAN, $pState->getGrammar()); + $this->assertEquals(ProofState::DIRTY, $pState->getSpelling()); + } + + /** + * Test throws exception if wrong grammar proof state value given + * + * @expectedException \InvalidArgumentException + */ + public function testWrongGrammar() + { + $pState = new ProofState(); + $pState->setGrammar('Wrong'); + } + + /** + * Test throws exception if wrong spelling proof state value given + * + * @expectedException \InvalidArgumentException + */ + public function testWrongSpelling() + { + $pState= new ProofState(); + $pState->setSpelling('Wrong'); + } +} diff --git a/tests/PhpWord/Style/FontTest.php b/tests/PhpWord/Style/FontTest.php index 61648d4e..c8fd4dab 100644 --- a/tests/PhpWord/Style/FontTest.php +++ b/tests/PhpWord/Style/FontTest.php @@ -74,6 +74,7 @@ class FontTest extends \PHPUnit_Framework_TestCase 'scale' => null, 'spacing' => null, 'kerning' => null, + 'lang' => null, ); foreach ($attributes as $key => $default) { $get = is_bool($default) ? "is{$key}" : "get{$key}"; diff --git a/tests/PhpWord/Style/LanguageTest.php b/tests/PhpWord/Style/LanguageTest.php new file mode 100644 index 00000000..bd466956 --- /dev/null +++ b/tests/PhpWord/Style/LanguageTest.php @@ -0,0 +1,62 @@ + array(null, 'fr-BE'), + 'eastAsia' => array(null, 'ja-JP'), + 'bidirectional' => array(null, 'ar-SA'), + 'langId' => array(null, 1036), + ); + foreach ($properties as $property => $value) { + list($default, $expected) = $value; + $get = "get{$property}"; + $set = "set{$property}"; + + $this->assertEquals($default, $object->$get()); // Default value + + $object->$set($expected); + + $this->assertEquals($expected, $object->$get()); // New value + } + } + + /** + * Test throws exception if wrong locale is given + * + * @expectedException \InvalidArgumentException + */ + public function testWrongLanguage() + { + $language = new Language(); + $language->setLatin('fr'); + } +} diff --git a/tests/PhpWord/Style/ParagraphTest.php b/tests/PhpWord/Style/ParagraphTest.php index 86d6e896..b78c557a 100644 --- a/tests/PhpWord/Style/ParagraphTest.php +++ b/tests/PhpWord/Style/ParagraphTest.php @@ -80,6 +80,7 @@ class ParagraphTest extends \PHPUnit_Framework_TestCase 'keepLines' => true, 'pageBreakBefore' => true, 'contextualSpacing' => true, + 'bidi' => true, ); foreach ($attributes as $key => $value) { $get = $this->findGetter($key, $value, $object); diff --git a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php index 828e1283..99c66680 100644 --- a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php @@ -16,11 +16,12 @@ */ namespace PhpOffice\PhpWord\Writer\Word2007\Part; +use PhpOffice\PhpWord\ComplexType\TrackChangesView; use PhpOffice\PhpWord\PhpWord; -use PhpOffice\PhpWord\TestHelperDOCX; use PhpOffice\PhpWord\Settings; use PhpOffice\PhpWord\SimpleType\Zoom; -use PhpOffice\PhpWord\ComplexType\TrackChangesView; +use PhpOffice\PhpWord\Style\Language; +use PhpOffice\PhpWord\TestHelperDOCX; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Settings @@ -73,7 +74,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase /** * Test language */ - public function testLanguage() + public function testDefaultLanguage() { $phpWord = new PhpWord(); @@ -88,6 +89,26 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertEquals('en-US', $element->getAttribute('w:val')); } + /** + * Test language + */ + public function testLanguage() + { + $phpWord = new PhpWord(); + $phpWord->getSettings()->setThemeFontLang(new Language(Language::DE_DE, Language::KO_KR, Language::HE_IL)); + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:themeFontLang'; + $this->assertTrue($doc->elementExists($path, $file)); + $element = $doc->getElement($path, $file); + + $this->assertEquals(Language::DE_DE, $element->getAttribute('w:val')); + $this->assertEquals(Language::KO_KR, $element->getAttribute('w:eastAsia')); + $this->assertEquals(Language::HE_IL, $element->getAttribute('w:bidi')); + } + /** * Test spelling */ From 4084d4f191202c40789c4b0396122e353a019106 Mon Sep 17 00:00:00 2001 From: Kai Gohegan Date: Mon, 9 Oct 2017 13:19:23 +0100 Subject: [PATCH 104/370] Update AbstractContainer.php Suppressing the PHP warning doesn't seem to work. Padding the $args array does. --- src/PhpWord/Element/AbstractContainer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Element/AbstractContainer.php b/src/PhpWord/Element/AbstractContainer.php index d5b4cc62..328b2d35 100644 --- a/src/PhpWord/Element/AbstractContainer.php +++ b/src/PhpWord/Element/AbstractContainer.php @@ -98,7 +98,7 @@ abstract class AbstractContainer extends AbstractElement // Special case for TextBreak // @todo Remove the `$count` parameter in 1.0.0 to make this element similiar to other elements? if ($element == 'TextBreak') { - @list($count, $fontStyle, $paragraphStyle) = $args; // Suppress error + list($count, $fontStyle, $paragraphStyle) = array_pad($args, 3, null); if ($count === null) { $count = 1; } From 87a355bb821753882bee9310d00b5aed75f65c61 Mon Sep 17 00:00:00 2001 From: Nilton Date: Sat, 21 Oct 2017 00:07:52 +0200 Subject: [PATCH 105/370] Bring back b, i, and --- src/PhpWord/Shared/Html.php | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index d03d0adf..a0deb7b1 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -119,9 +119,12 @@ class Html 'h6' => array('Heading', null, $element, $styles, null, 'Heading6', null), '#text' => array('Text', $node, $element, $styles, null, null, null), 'strong' => array('Property', null, null, $styles, null, 'bold', true), + 'b' => array('Property', null, null, $styles, null, 'bold', true), 'em' => array('Property', null, null, $styles, null, 'italic', true), + 'i' => array('Property', null, null, $styles, null, 'italic', true), 'sup' => array('Property', null, null, $styles, null, 'superScript', true), 'sub' => array('Property', null, null, $styles, null, 'subScript', true), + 'span' => array('Property', null, null, $styles, null, 'span', $node), 'table' => array('Table', $node, $element, $styles, null, 'addTable', true), 'tr' => array('Table', $node, $element, $styles, null, 'addRow', true), 'td' => array('Table', $node, $element, $styles, null, 'addCell', true), @@ -251,7 +254,16 @@ class Html */ private static function parseProperty(&$styles, $argument1, $argument2) { - $styles['font'][$argument1] = $argument2; + if ($argument1 !== 'span') { + $styles['font'][$argument1] = $argument2; + } else { + if (!is_null($argument2->attributes)) { + $nodeAttr = $argument2->attributes->getNamedItem('style'); + if (!is_null($nodeAttr) && property_exists($nodeAttr, 'value')) { + $styles['font'] = self::parseStyle($nodeAttr, $styles['font']); + } + } + } return null; } @@ -369,6 +381,20 @@ class Html case 'background-color': $styles['bgColor'] = trim($cValue, "#"); break; + case 'font-weight': + $tValue = false; + if (preg_match('#bold#', $cValue)) { + $tValue = true; // also match bolder + } + $styles['bold'] = $tValue; + break; + case 'font-style': + $tValue = false; + if (preg_match('#(?:italic|oblique)#', $cValue)) { + $tValue = true; + } + $styles['italic'] = $tValue; + break; } } From 0f50b6dc61ee6745c1022906305f0b4b3a3bd9cf Mon Sep 17 00:00:00 2001 From: troosan Date: Mon, 23 Oct 2017 23:05:29 +0200 Subject: [PATCH 106/370] update documentation --- composer.json | 3 +++ docs/conf.py | 6 +++--- docs/elements.rst | 2 +- docs/installing.rst | 2 +- docs/references.rst | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index ab8b6aa6..5b5a91d2 100644 --- a/composer.json +++ b/composer.json @@ -29,6 +29,9 @@ { "name": "Roman Syroeshko", "homepage": "http://ru.linkedin.com/pub/roman-syroeshko/34/a53/994/" + }, + { + "name": "Antoine de Troostembergh" } ], "require": { diff --git a/docs/conf.py b/docs/conf.py index e9b1c59e..6b7cf8e8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -41,14 +41,14 @@ master_doc = 'index' # General information about the project. project = u'PHPWord' -copyright = u'2014-2015, PHPWord Contributors' +copyright = u'2014-2017, PHPWord Contributors' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = '0.13.0' +version = '0.14.0' # The full version, including alpha/beta/rc tags. release = version @@ -120,7 +120,7 @@ html_theme = 'default' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +#html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. diff --git a/docs/elements.rst b/docs/elements.rst index 848e3f98..124f4431 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -432,7 +432,7 @@ Comments --------- Comments can be added to a document by using ``addComment``. -The comment can contain formatted text. Once the comment has been added, it can be linked to any to any element. +The comment can contain formatted text. Once the comment has been added, it can be linked to any element with ``setCommentStart``. .. code-block:: php diff --git a/docs/installing.rst b/docs/installing.rst index 9593484a..37e4d379 100644 --- a/docs/installing.rst +++ b/docs/installing.rst @@ -34,7 +34,7 @@ Example: { "require": { - "phpoffice/phpword": "v0.13.*" + "phpoffice/phpword": "v0.14.*" } } diff --git a/docs/references.rst b/docs/references.rst index 9c4e06a8..a17f558d 100644 --- a/docs/references.rst +++ b/docs/references.rst @@ -4,7 +4,7 @@ References ========== ISO/IEC 29500, Third edition, 2012-09-01 ---------------------- +---------------------------------------- - `Part 1: Fundamentals and Markup Language Reference `__ From 3cbc65bae4843a4535d1ba538ccbaf5d81e18e07 Mon Sep 17 00:00:00 2001 From: lightbringer Date: Sat, 28 Oct 2017 18:56:16 +1100 Subject: [PATCH 107/370] 489: Fix z-index size too big in 64bit OS --- src/PhpWord/Writer/Word2007/Style/Frame.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/PhpWord/Writer/Word2007/Style/Frame.php b/src/PhpWord/Writer/Word2007/Style/Frame.php index 9c6ddaef..abbf07ac 100644 --- a/src/PhpWord/Writer/Word2007/Style/Frame.php +++ b/src/PhpWord/Writer/Word2007/Style/Frame.php @@ -28,6 +28,8 @@ use PhpOffice\PhpWord\Writer\Word2007\Element\ParagraphAlignment; */ class Frame extends AbstractStyle { + const PHP_32BIT_INT_MAX = 2147483647; + /** * Write style. * @@ -41,7 +43,8 @@ class Frame extends AbstractStyle } $xmlWriter = $this->getXmlWriter(); - $zIndices = array(FrameStyle::WRAP_INFRONT => PHP_INT_MAX, FrameStyle::WRAP_BEHIND => -PHP_INT_MAX); + $maxZIndex = min(PHP_INT_MAX, self::PHP_32BIT_INT_MAX); + $zIndices = array(FrameStyle::WRAP_INFRONT => $maxZIndex, FrameStyle::WRAP_BEHIND => -$maxZIndex); $properties = array( 'width' => 'width', From 0459670a9c0517872f513a484eae36285c6239b4 Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 4 Nov 2017 22:44:12 +0100 Subject: [PATCH 108/370] Enable php-cs-fixer in build & fix resulting warnings (#1099) * enable php 7.1 build * upgrade to dompdf/dompdf 0.8.* * update phpunit & hide output during tests * run code coverage analysis on 1 build only * Add php-cs * Update Copyright --- .gitignore | 1 + .php_cs.dist | 146 + .travis.yml | 30 +- .travis_shell_after_success.sh | 2 +- bootstrap.php | 4 +- composer.json | 8 +- docs/elements.rst | 6 +- run_tests.sh | 14 + samples/Sample_01_SimpleText.php | 2 +- samples/Sample_02_TabStops.php | 2 +- samples/Sample_07_TemplateCloneRow.php | 124 +- samples/Sample_08_ParagraphPagination.php | 2 +- samples/Sample_09_Tables.php | 11 +- samples/Sample_13_Images.php | 2 +- samples/Sample_37_Comments.php | 3 +- samples/Sample_Header.php | 4 +- samples/index.php | 8 +- src/PhpWord/Collection/AbstractCollection.php | 9 +- src/PhpWord/Collection/Bookmarks.php | 4 +- src/PhpWord/Collection/Charts.php | 4 +- src/PhpWord/Collection/Comments.php | 4 +- src/PhpWord/Collection/Endnotes.php | 4 +- src/PhpWord/Collection/Footnotes.php | 4 +- src/PhpWord/Collection/Titles.php | 4 +- .../ComplexType/FootnoteProperties.php | 26 +- src/PhpWord/ComplexType/ProofState.php | 12 +- src/PhpWord/ComplexType/TrackChangesView.php | 36 +- src/PhpWord/Element/AbstractContainer.php | 14 +- src/PhpWord/Element/AbstractElement.php | 33 +- src/PhpWord/Element/Bookmark.php | 4 +- src/PhpWord/Element/Cell.php | 4 +- src/PhpWord/Element/Chart.php | 6 +- src/PhpWord/Element/CheckBox.php | 4 +- src/PhpWord/Element/Comment.php | 4 +- src/PhpWord/Element/Endnote.php | 4 +- src/PhpWord/Element/Field.php | 60 +- src/PhpWord/Element/Footer.php | 11 +- src/PhpWord/Element/Footnote.php | 4 +- src/PhpWord/Element/FormField.php | 6 +- src/PhpWord/Element/Header.php | 4 +- src/PhpWord/Element/Image.php | 51 +- src/PhpWord/Element/Line.php | 4 +- src/PhpWord/Element/Link.php | 5 +- src/PhpWord/Element/ListItem.php | 4 +- src/PhpWord/Element/ListItemRun.php | 10 +- src/PhpWord/Element/Object.php | 9 +- src/PhpWord/Element/PageBreak.php | 4 +- src/PhpWord/Element/PreserveText.php | 5 +- src/PhpWord/Element/Row.php | 4 +- src/PhpWord/Element/SDT.php | 4 +- src/PhpWord/Element/Section.php | 22 +- src/PhpWord/Element/Shape.php | 4 +- src/PhpWord/Element/TOC.php | 11 +- src/PhpWord/Element/Table.php | 5 +- src/PhpWord/Element/Text.php | 8 +- src/PhpWord/Element/TextBox.php | 4 +- src/PhpWord/Element/TextBreak.php | 8 +- src/PhpWord/Element/TextRun.php | 4 +- src/PhpWord/Element/Title.php | 6 +- src/PhpWord/Element/TrackChange.php | 6 +- src/PhpWord/Escaper/AbstractEscaper.php | 4 +- src/PhpWord/Escaper/EscaperInterface.php | 4 +- src/PhpWord/Escaper/RegExp.php | 4 +- src/PhpWord/Escaper/Rtf.php | 13 +- src/PhpWord/Escaper/Xml.php | 4 +- src/PhpWord/Exception/CopyFileException.php | 12 +- .../CreateTemporaryFileException.php | 8 +- src/PhpWord/Exception/Exception.php | 4 +- .../Exception/InvalidImageException.php | 4 +- .../Exception/InvalidObjectException.php | 4 +- .../Exception/InvalidStyleException.php | 4 +- .../UnsupportedImageTypeException.php | 4 +- src/PhpWord/IOFactory.php | 23 +- src/PhpWord/Media.php | 58 +- src/PhpWord/Metadata/Compatibility.php | 8 +- src/PhpWord/Metadata/DocInfo.php | 39 +- src/PhpWord/Metadata/Protection.php | 8 +- src/PhpWord/Metadata/Settings.php | 54 +- src/PhpWord/PhpWord.php | 23 +- src/PhpWord/Reader/AbstractReader.php | 13 +- src/PhpWord/Reader/HTML.php | 4 +- src/PhpWord/Reader/MsDoc.php | 93 +- src/PhpWord/Reader/ODText.php | 7 +- src/PhpWord/Reader/ODText/AbstractPart.php | 4 +- src/PhpWord/Reader/ODText/Content.php | 7 +- src/PhpWord/Reader/ODText/Meta.php | 8 +- src/PhpWord/Reader/RTF.php | 4 +- src/PhpWord/Reader/RTF/Document.php | 49 +- src/PhpWord/Reader/ReaderInterface.php | 6 +- src/PhpWord/Reader/Word2007.php | 7 +- src/PhpWord/Reader/Word2007/AbstractPart.php | 35 +- src/PhpWord/Reader/Word2007/DocPropsApp.php | 4 +- src/PhpWord/Reader/Word2007/DocPropsCore.php | 21 +- .../Reader/Word2007/DocPropsCustom.php | 5 +- src/PhpWord/Reader/Word2007/Document.php | 10 +- src/PhpWord/Reader/Word2007/Endnotes.php | 4 +- src/PhpWord/Reader/Word2007/Footnotes.php | 5 +- src/PhpWord/Reader/Word2007/Numbering.php | 7 +- src/PhpWord/Reader/Word2007/Settings.php | 13 +- src/PhpWord/Reader/Word2007/Styles.php | 7 +- src/PhpWord/Settings.php | 42 +- src/PhpWord/Shared/AbstractEnum.php | 7 +- src/PhpWord/Shared/Converter.php | 18 +- src/PhpWord/Shared/Html.php | 23 +- src/PhpWord/Shared/OLERead.php | 5 +- src/PhpWord/Shared/PCLZip/pclzip.lib.php | 10562 ++++++++-------- src/PhpWord/Shared/ZipArchive.php | 19 +- src/PhpWord/SimpleType/Jc.php | 6 +- src/PhpWord/SimpleType/JcTable.php | 4 +- src/PhpWord/SimpleType/NumberFormat.php | 4 +- src/PhpWord/SimpleType/Zoom.php | 4 +- src/PhpWord/Style.php | 10 +- src/PhpWord/Style/AbstractStyle.php | 20 +- src/PhpWord/Style/Border.php | 6 +- src/PhpWord/Style/Cell.php | 12 +- src/PhpWord/Style/Chart.php | 5 +- src/PhpWord/Style/Extrusion.php | 6 +- src/PhpWord/Style/Fill.php | 8 +- src/PhpWord/Style/Font.php | 20 +- src/PhpWord/Style/Frame.php | 4 +- src/PhpWord/Style/Image.php | 5 +- src/PhpWord/Style/Indentation.php | 6 +- src/PhpWord/Style/Language.php | 17 +- src/PhpWord/Style/Line.php | 19 +- src/PhpWord/Style/LineNumbering.php | 12 +- src/PhpWord/Style/ListItem.php | 29 +- src/PhpWord/Style/Numbering.php | 18 +- src/PhpWord/Style/NumberingLevel.php | 67 +- src/PhpWord/Style/Outline.php | 22 +- src/PhpWord/Style/Paper.php | 4 +- src/PhpWord/Style/Paragraph.php | 22 +- src/PhpWord/Style/Row.php | 4 +- src/PhpWord/Style/Section.php | 12 +- src/PhpWord/Style/Shading.php | 12 +- src/PhpWord/Style/Shadow.php | 6 +- src/PhpWord/Style/Shape.php | 4 +- src/PhpWord/Style/Spacing.php | 6 +- src/PhpWord/Style/TOC.php | 4 +- src/PhpWord/Style/Tab.php | 38 +- src/PhpWord/Style/Table.php | 20 +- src/PhpWord/Style/TextBox.php | 13 +- src/PhpWord/Template.php | 4 +- src/PhpWord/TemplateProcessor.php | 74 +- src/PhpWord/Writer/AbstractWriter.php | 44 +- src/PhpWord/Writer/HTML.php | 9 +- .../Writer/HTML/Element/AbstractElement.php | 5 +- src/PhpWord/Writer/HTML/Element/Container.php | 4 +- src/PhpWord/Writer/HTML/Element/Endnote.php | 4 +- src/PhpWord/Writer/HTML/Element/Footnote.php | 4 +- src/PhpWord/Writer/HTML/Element/Image.php | 4 +- src/PhpWord/Writer/HTML/Element/Link.php | 4 +- src/PhpWord/Writer/HTML/Element/ListItem.php | 4 +- src/PhpWord/Writer/HTML/Element/PageBreak.php | 6 +- src/PhpWord/Writer/HTML/Element/Table.php | 4 +- src/PhpWord/Writer/HTML/Element/Text.php | 12 +- src/PhpWord/Writer/HTML/Element/TextBreak.php | 4 +- src/PhpWord/Writer/HTML/Element/TextRun.php | 4 +- src/PhpWord/Writer/HTML/Element/Title.php | 4 +- src/PhpWord/Writer/HTML/Part/AbstractPart.php | 17 +- src/PhpWord/Writer/HTML/Part/Body.php | 6 +- src/PhpWord/Writer/HTML/Part/Head.php | 28 +- .../Writer/HTML/Style/AbstractStyle.php | 5 +- src/PhpWord/Writer/HTML/Style/Font.php | 4 +- src/PhpWord/Writer/HTML/Style/Generic.php | 4 +- src/PhpWord/Writer/HTML/Style/Image.php | 4 +- src/PhpWord/Writer/HTML/Style/Paragraph.php | 8 +- src/PhpWord/Writer/ODText.php | 5 +- .../Writer/ODText/Element/AbstractElement.php | 4 +- .../Writer/ODText/Element/Container.php | 4 +- src/PhpWord/Writer/ODText/Element/Image.php | 4 +- src/PhpWord/Writer/ODText/Element/Link.php | 4 +- src/PhpWord/Writer/ODText/Element/Table.php | 4 +- src/PhpWord/Writer/ODText/Element/Text.php | 68 +- .../Writer/ODText/Element/TextBreak.php | 4 +- src/PhpWord/Writer/ODText/Element/TextRun.php | 4 +- src/PhpWord/Writer/ODText/Element/Title.php | 4 +- .../Writer/ODText/Part/AbstractPart.php | 6 +- src/PhpWord/Writer/ODText/Part/Content.php | 15 +- src/PhpWord/Writer/ODText/Part/Manifest.php | 4 +- src/PhpWord/Writer/ODText/Part/Meta.php | 5 +- src/PhpWord/Writer/ODText/Part/Mimetype.php | 4 +- src/PhpWord/Writer/ODText/Part/Styles.php | 12 +- .../Writer/ODText/Style/AbstractStyle.php | 4 +- src/PhpWord/Writer/ODText/Style/Font.php | 6 +- src/PhpWord/Writer/ODText/Style/Image.php | 6 +- src/PhpWord/Writer/ODText/Style/Paragraph.php | 6 +- src/PhpWord/Writer/ODText/Style/Section.php | 8 +- src/PhpWord/Writer/ODText/Style/Table.php | 6 +- src/PhpWord/Writer/PDF.php | 6 +- src/PhpWord/Writer/PDF/AbstractRenderer.php | 31 +- src/PhpWord/Writer/PDF/DomPDF.php | 16 +- src/PhpWord/Writer/PDF/MPDF.php | 7 +- src/PhpWord/Writer/PDF/TCPDF.php | 6 +- src/PhpWord/Writer/RTF.php | 8 +- .../Writer/RTF/Element/AbstractElement.php | 11 +- src/PhpWord/Writer/RTF/Element/Container.php | 4 +- src/PhpWord/Writer/RTF/Element/Image.php | 4 +- src/PhpWord/Writer/RTF/Element/Link.php | 4 +- src/PhpWord/Writer/RTF/Element/ListItem.php | 4 +- src/PhpWord/Writer/RTF/Element/PageBreak.php | 4 +- src/PhpWord/Writer/RTF/Element/Table.php | 4 +- src/PhpWord/Writer/RTF/Element/Text.php | 4 +- src/PhpWord/Writer/RTF/Element/TextBreak.php | 4 +- src/PhpWord/Writer/RTF/Element/TextRun.php | 4 +- src/PhpWord/Writer/RTF/Element/Title.php | 4 +- src/PhpWord/Writer/RTF/Part/AbstractPart.php | 12 +- src/PhpWord/Writer/RTF/Part/Document.php | 16 +- src/PhpWord/Writer/RTF/Part/Header.php | 11 +- .../Writer/RTF/Style/AbstractStyle.php | 4 +- src/PhpWord/Writer/RTF/Style/Border.php | 8 +- src/PhpWord/Writer/RTF/Style/Font.php | 8 +- src/PhpWord/Writer/RTF/Style/Paragraph.php | 5 +- src/PhpWord/Writer/RTF/Style/Section.php | 4 +- src/PhpWord/Writer/Word2007.php | 25 +- .../Word2007/Element/AbstractElement.php | 19 +- .../Writer/Word2007/Element/Bookmark.php | 6 +- src/PhpWord/Writer/Word2007/Element/Chart.php | 6 +- .../Writer/Word2007/Element/CheckBox.php | 12 +- .../Writer/Word2007/Element/Container.php | 6 +- .../Writer/Word2007/Element/Endnote.php | 4 +- src/PhpWord/Writer/Word2007/Element/Field.php | 32 +- .../Writer/Word2007/Element/Footnote.php | 6 +- .../Writer/Word2007/Element/FormField.php | 19 +- src/PhpWord/Writer/Word2007/Element/Image.php | 10 +- src/PhpWord/Writer/Word2007/Element/Line.php | 9 +- src/PhpWord/Writer/Word2007/Element/Link.php | 6 +- .../Writer/Word2007/Element/ListItem.php | 6 +- .../Writer/Word2007/Element/ListItemRun.php | 6 +- .../Writer/Word2007/Element/Object.php | 6 +- .../Writer/Word2007/Element/PageBreak.php | 5 +- .../Word2007/Element/ParagraphAlignment.php | 6 +- .../Writer/Word2007/Element/PreserveText.php | 6 +- src/PhpWord/Writer/Word2007/Element/SDT.php | 17 +- src/PhpWord/Writer/Word2007/Element/Shape.php | 11 +- src/PhpWord/Writer/Word2007/Element/TOC.php | 9 +- src/PhpWord/Writer/Word2007/Element/Table.php | 10 +- .../Word2007/Element/TableAlignment.php | 6 +- src/PhpWord/Writer/Word2007/Element/Text.php | 6 +- .../Writer/Word2007/Element/TextBox.php | 6 +- .../Writer/Word2007/Element/TextBreak.php | 6 +- .../Writer/Word2007/Element/TextRun.php | 6 +- src/PhpWord/Writer/Word2007/Element/Title.php | 6 +- .../Writer/Word2007/Part/AbstractPart.php | 15 +- src/PhpWord/Writer/Word2007/Part/Chart.php | 43 +- src/PhpWord/Writer/Word2007/Part/Comments.php | 5 +- .../Writer/Word2007/Part/ContentTypes.php | 25 +- .../Writer/Word2007/Part/DocPropsApp.php | 4 +- .../Writer/Word2007/Part/DocPropsCore.php | 4 +- .../Writer/Word2007/Part/DocPropsCustom.php | 4 +- src/PhpWord/Writer/Word2007/Part/Document.php | 7 +- src/PhpWord/Writer/Word2007/Part/Endnotes.php | 4 +- .../Writer/Word2007/Part/FontTable.php | 4 +- src/PhpWord/Writer/Word2007/Part/Footer.php | 4 +- .../Writer/Word2007/Part/Footnotes.php | 5 +- src/PhpWord/Writer/Word2007/Part/Header.php | 4 +- .../Writer/Word2007/Part/Numbering.php | 7 +- src/PhpWord/Writer/Word2007/Part/Rels.php | 10 +- .../Writer/Word2007/Part/RelsDocument.php | 4 +- src/PhpWord/Writer/Word2007/Part/RelsPart.php | 4 +- src/PhpWord/Writer/Word2007/Part/Settings.php | 89 +- src/PhpWord/Writer/Word2007/Part/Styles.php | 10 +- src/PhpWord/Writer/Word2007/Part/Theme.php | 5 +- .../Writer/Word2007/Part/WebSettings.php | 4 +- .../Writer/Word2007/Style/AbstractStyle.php | 15 +- src/PhpWord/Writer/Word2007/Style/Cell.php | 7 +- .../Writer/Word2007/Style/Extrusion.php | 8 +- src/PhpWord/Writer/Word2007/Style/Fill.php | 6 +- src/PhpWord/Writer/Word2007/Style/Font.php | 11 +- src/PhpWord/Writer/Word2007/Style/Frame.php | 15 +- src/PhpWord/Writer/Word2007/Style/Image.php | 4 +- .../Writer/Word2007/Style/Indentation.php | 6 +- src/PhpWord/Writer/Word2007/Style/Line.php | 7 +- .../Writer/Word2007/Style/LineNumbering.php | 7 +- .../Writer/Word2007/Style/MarginBorder.php | 14 +- src/PhpWord/Writer/Word2007/Style/Outline.php | 8 +- .../Writer/Word2007/Style/Paragraph.php | 14 +- src/PhpWord/Writer/Word2007/Style/Row.php | 7 +- src/PhpWord/Writer/Word2007/Style/Section.php | 6 +- src/PhpWord/Writer/Word2007/Style/Shading.php | 6 +- src/PhpWord/Writer/Word2007/Style/Shadow.php | 8 +- src/PhpWord/Writer/Word2007/Style/Shape.php | 6 +- src/PhpWord/Writer/Word2007/Style/Spacing.php | 6 +- src/PhpWord/Writer/Word2007/Style/Tab.php | 12 +- src/PhpWord/Writer/Word2007/Style/Table.php | 13 +- src/PhpWord/Writer/Word2007/Style/TextBox.php | 8 +- src/PhpWord/Writer/WriterInterface.php | 4 +- tests/PhpWord/Collection/CollectionTest.php | 4 +- .../ComplexType/FootnotePropertiesTest.php | 11 +- tests/PhpWord/ComplexType/ProofStateTest.php | 10 +- tests/PhpWord/Element/AbstractElementTest.php | 4 +- tests/PhpWord/Element/BookmarkTest.php | 38 + tests/PhpWord/Element/CellTest.php | 4 +- tests/PhpWord/Element/CheckBoxTest.php | 4 +- tests/PhpWord/Element/CommentTest.php | 24 +- tests/PhpWord/Element/FieldTest.php | 4 +- tests/PhpWord/Element/FooterTest.php | 4 +- tests/PhpWord/Element/FootnoteTest.php | 4 +- tests/PhpWord/Element/HeaderTest.php | 6 +- tests/PhpWord/Element/ImageTest.php | 10 +- tests/PhpWord/Element/LineTest.php | 4 +- tests/PhpWord/Element/LinkTest.php | 6 +- tests/PhpWord/Element/ListItemRunTest.php | 4 +- tests/PhpWord/Element/ListItemTest.php | 4 +- tests/PhpWord/Element/ObjectTest.php | 19 +- tests/PhpWord/Element/PageBreakTest.php | 4 +- tests/PhpWord/Element/PreserveTextTest.php | 4 +- tests/PhpWord/Element/RowTest.php | 4 +- tests/PhpWord/Element/SDTTest.php | 4 +- tests/PhpWord/Element/SectionTest.php | 15 +- tests/PhpWord/Element/TOCTest.php | 4 +- tests/PhpWord/Element/TableTest.php | 4 +- tests/PhpWord/Element/TextBoxTest.php | 4 +- tests/PhpWord/Element/TextBreakTest.php | 4 +- tests/PhpWord/Element/TextRunTest.php | 4 +- tests/PhpWord/Element/TextTest.php | 4 +- tests/PhpWord/Element/TitleTest.php | 4 +- .../Exception/CopyFileExceptionTest.php | 4 +- .../CreateTemporaryFileExceptionTest.php | 4 +- tests/PhpWord/Exception/ExceptionTest.php | 6 +- .../Exception/InvalidImageExceptionTest.php | 6 +- .../Exception/InvalidStyleExceptionTest.php | 6 +- .../UnsupportedImageTypeExceptionTest.php | 6 +- tests/PhpWord/IOFactoryTest.php | 4 +- tests/PhpWord/MediaTest.php | 6 +- tests/PhpWord/Metadata/DocInfoTest.php | 4 +- tests/PhpWord/Metadata/SettingsTest.php | 34 +- tests/PhpWord/PhpWordTest.php | 8 +- tests/PhpWord/Reader/HTMLTest.php | 4 +- tests/PhpWord/Reader/MsDocTest.php | 4 +- tests/PhpWord/Reader/ODTextTest.php | 4 +- tests/PhpWord/Reader/RTFTest.php | 4 +- tests/PhpWord/Reader/Word2007Test.php | 4 +- tests/PhpWord/SettingsTest.php | 5 +- tests/PhpWord/Shared/ConverterTest.php | 6 +- tests/PhpWord/Shared/HtmlTest.php | 4 +- tests/PhpWord/Shared/ZipArchiveTest.php | 5 +- tests/PhpWord/Style/AbstractStyleTest.php | 5 +- tests/PhpWord/Style/CellTest.php | 4 +- tests/PhpWord/Style/FontTest.php | 6 +- tests/PhpWord/Style/ImageTest.php | 4 +- tests/PhpWord/Style/IndentationTest.php | 4 +- tests/PhpWord/Style/LanguageTest.php | 4 +- tests/PhpWord/Style/LineNumberingTest.php | 4 +- tests/PhpWord/Style/LineTest.php | 4 +- tests/PhpWord/Style/ListItemTest.php | 4 +- tests/PhpWord/Style/NumberingLevelTest.php | 4 +- tests/PhpWord/Style/NumberingTest.php | 4 +- tests/PhpWord/Style/PaperTest.php | 4 +- tests/PhpWord/Style/ParagraphTest.php | 7 +- tests/PhpWord/Style/RowTest.php | 4 +- tests/PhpWord/Style/SectionTest.php | 6 +- tests/PhpWord/Style/ShadingTest.php | 4 +- tests/PhpWord/Style/SpacingTest.php | 4 +- tests/PhpWord/Style/TOCTest.php | 4 +- tests/PhpWord/Style/TabTest.php | 4 +- tests/PhpWord/Style/TableTest.php | 4 +- tests/PhpWord/Style/TextBoxTest.php | 5 +- tests/PhpWord/StyleTest.php | 4 +- tests/PhpWord/TemplateProcessorTest.php | 6 +- tests/PhpWord/Writer/HTML/ElementTest.php | 5 +- tests/PhpWord/Writer/HTML/PartTest.php | 5 +- tests/PhpWord/Writer/HTML/StyleTest.php | 5 +- tests/PhpWord/Writer/HTMLTest.php | 9 +- tests/PhpWord/Writer/ODText/ElementTest.php | 5 +- .../Writer/ODText/Part/AbstractPartTest.php | 7 +- .../Writer/ODText/Part/ContentTest.php | 5 +- tests/PhpWord/Writer/ODText/StyleTest.php | 5 +- tests/PhpWord/Writer/ODTextTest.php | 11 +- tests/PhpWord/Writer/PDF/DomPDFTest.php | 7 +- tests/PhpWord/Writer/PDF/MPDFTest.php | 7 +- tests/PhpWord/Writer/PDF/TCPDFTest.php | 7 +- tests/PhpWord/Writer/PDFTest.php | 7 +- tests/PhpWord/Writer/RTF/ElementTest.php | 5 +- tests/PhpWord/Writer/RTF/StyleTest.php | 5 +- tests/PhpWord/Writer/RTFTest.php | 11 +- tests/PhpWord/Writer/Word2007/ElementTest.php | 9 +- .../Writer/Word2007/Part/AbstractPartTest.php | 9 +- .../Writer/Word2007/Part/CommentsTest.php | 11 +- .../Writer/Word2007/Part/DocumentTest.php | 9 +- .../Writer/Word2007/Part/FooterTest.php | 5 +- .../Writer/Word2007/Part/FootnotesTest.php | 5 +- .../Writer/Word2007/Part/HeaderTest.php | 5 +- .../Writer/Word2007/Part/NumberingTest.php | 9 +- .../Writer/Word2007/Part/SettingsTest.php | 39 +- .../Writer/Word2007/Part/StylesTest.php | 12 +- tests/PhpWord/Writer/Word2007/PartTest.php | 5 +- .../Writer/Word2007/Style/FontTest.php | 5 +- tests/PhpWord/Writer/Word2007/StyleTest.php | 5 +- tests/PhpWord/Writer/Word2007Test.php | 13 +- tests/PhpWord/_includes/TestHelperDOCX.php | 11 +- tests/PhpWord/_includes/XmlDocument.php | 8 +- tests/bootstrap.php | 7 +- 392 files changed, 7171 insertions(+), 7475 deletions(-) create mode 100644 .php_cs.dist create mode 100755 run_tests.sh create mode 100644 tests/PhpWord/Element/BookmarkTest.php diff --git a/.gitignore b/.gitignore index 66e64406..42f03ebe 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ vendor phpword.ini /.buildpath /.project +/.php_cs.cache diff --git a/.php_cs.dist b/.php_cs.dist new file mode 100644 index 00000000..895ed80f --- /dev/null +++ b/.php_cs.dist @@ -0,0 +1,146 @@ +notName('pclzip.lib.php') + ->notName('OLERead.php') + ->in('samples') + ->in('src') + ->in('tests'); + +return PhpCsFixer\Config::create() + ->setRiskyAllowed(true) + ->setFinder($finder) + ->setRules(array( + 'array_syntax' => array('syntax' => 'long'), + 'binary_operator_spaces' => array('align_double_arrow' => true), + 'blank_line_after_namespace' => true, + 'blank_line_after_opening_tag' => false, + 'blank_line_before_return' => true, + 'braces' => true, + 'cast_spaces' => true, + 'class_definition' => true, + 'class_keyword_remove' => false, // ::class keyword gives us beter support in IDE + 'combine_consecutive_unsets' => true, + 'concat_space' => array('spacing' => 'one'), + 'declare_equal_normalize' => true, + 'declare_strict_types' => false, // Too early to adopt strict types + 'dir_constant' => true, + 'elseif' => true, + 'encoding' => true, + 'ereg_to_preg' => true, + 'full_opening_tag' => true, + 'function_declaration' => true, + 'function_typehint_space' => true, + 'general_phpdoc_annotation_remove' => false, // No use for that + 'hash_to_slash_comment' => true, + 'header_comment' => false, // We don't use common header in all our files + 'heredoc_to_nowdoc' => false, // Not sure about this one + 'is_null' => false, // Risky + 'include' => true, + 'indentation_type' => true, + 'line_ending' => true, + 'linebreak_after_opening_tag' => true, + 'lowercase_cast' => true, + 'lowercase_constants' => true, + 'lowercase_keywords' => true, + 'mb_str_functions' => false, // No, too dangerous to change that + 'method_argument_space' => true, + 'method_separation' => true, + 'modernize_types_casting' => true, + 'native_function_casing' => true, + 'native_function_invocation'=> false, // This is risky and seems to be micro-optimization that make code uglier so not worth it, at least for now + 'new_with_braces' => true, + 'no_alias_functions' => true, + 'no_blank_lines_after_class_opening' => true, + 'no_blank_lines_after_phpdoc' => true, + 'no_blank_lines_before_namespace' => false, // we want 1 blank line before namespace + 'no_closing_tag' => true, + 'no_empty_comment' => true, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_extra_consecutive_blank_lines' => array('break', 'continue', 'extra', 'return', 'throw', 'use', 'useTrait', 'curly_brace_block', 'parenthesis_brace_block', 'square_brace_block'), + 'no_leading_import_slash' => true, + 'no_leading_namespace_whitespace' => true, + 'no_mixed_echo_print' => true, + 'no_multiline_whitespace_around_double_arrow' => true, + 'no_multiline_whitespace_before_semicolons' => true, + 'no_php4_constructor' => true, + 'no_short_bool_cast' => true, + 'no_short_echo_tag' => true, + 'no_singleline_whitespace_before_semicolons' => true, + 'no_spaces_after_function_name' => true, + 'no_spaces_around_offset' => true, + 'no_spaces_inside_parenthesis' => true, + 'no_trailing_comma_in_list_call' => true, + 'no_trailing_comma_in_singleline_array' => true, + 'no_trailing_whitespace' => true, + 'no_trailing_whitespace_in_comment' => true, + 'no_unneeded_control_parentheses' => true, + 'no_unreachable_default_argument_value' => true, + 'no_unused_imports' => true, + 'no_useless_else' => true, + 'no_useless_return' => true, + 'no_whitespace_before_comma_in_array' => true, + 'no_whitespace_in_blank_line' => true, + 'normalize_index_brace' => true, + 'not_operator_with_space' => false, // No we prefer to keep '!' without spaces + 'not_operator_with_successor_space' => false, // idem + 'object_operator_without_whitespace' => true, + 'ordered_class_elements' => false, // We prefer to keep some freedom + 'ordered_imports' => true, + 'php_unit_construct' => true, + 'php_unit_dedicate_assert' => true, + 'php_unit_fqcn_annotation' => true, + 'php_unit_strict' => false, // We sometime actually need assertEquals + 'phpdoc_add_missing_param_annotation' => true, + 'phpdoc_align' => false, // Waste of time + 'phpdoc_annotation_without_dot' => true, + 'phpdoc_indent' => true, + 'phpdoc_inline_tag' => true, + 'phpdoc_no_access' => true, + 'phpdoc_no_alias_tag' => true, + 'phpdoc_no_empty_return' => true, + 'phpdoc_no_package' => true, + 'phpdoc_no_useless_inheritdoc' => true, + 'phpdoc_order' => true, + 'phpdoc_return_self_reference' => true, + 'phpdoc_scalar' => true, + 'phpdoc_separation' => false, + 'phpdoc_single_line_var_spacing' => true, + 'phpdoc_summary' => false, + 'phpdoc_to_comment' => true, + 'phpdoc_trim' => true, + 'phpdoc_types' => true, + 'phpdoc_var_without_name' => true, + 'pow_to_exponentiation' => false, + 'pre_increment' => false, + 'protected_to_private' => true, + 'psr0' => true, + 'psr4' => true, + 'random_api_migration' => false, // This breaks our unit tests + 'return_type_declaration' => true, + 'self_accessor' => true, + 'semicolon_after_instruction' => false, // Buggy in `samples/index.php` + 'short_scalar_cast' => true, + 'silenced_deprecation_error' => true, + 'simplified_null_return' => false, // While technically correct we prefer to be explicit when returning null + 'single_blank_line_at_eof' => true, + 'single_blank_line_before_namespace' => true, + 'single_class_element_per_statement' => true, + 'single_import_per_statement' => true, + 'single_line_after_imports' => true, + 'single_quote' => true, + 'space_after_semicolon' => true, + 'standardize_not_equals' => true, + 'strict_comparison' => false, // No, too dangerous to change that + 'strict_param' => false, // No, too dangerous to change that + 'switch_case_semicolon_to_colon' => true, + 'switch_case_space' => true, + 'ternary_operator_spaces' => true, + 'ternary_to_null_coalescing' => false, // Cannot use that with PHP 5.6 + 'trailing_comma_in_multiline_array' => true, + 'trim_array_spaces' => false, + 'unary_operator_spaces' => true, + 'visibility_required' => true, + 'whitespace_after_comma_in_array' => true, + )); diff --git a/.travis.yml b/.travis.yml index 3508dca3..0ec84081 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,12 +8,21 @@ php: - 5.5 - 5.6 - 7.0 -## - hhvm + - 7.1 matrix: + include: + - php: 5.6 + env: COVERAGE=1 allow_failures: - php: 7.0 -## - php: hhvm + - php: 7.1 + +cache: + directories: + - vendor + - $HOME/.composer/cache + - .php-cs.cache env: global: @@ -25,6 +34,8 @@ before_install: - sudo apt-get install -y graphviz before_script: + ## Deactivate xdebug if we don't do code coverage + - if [ -z "$COVERAGE" ]; then phpenv config-rm xdebug.ini ; fi ## Composer - composer self-update - composer install --prefer-source @@ -34,19 +45,20 @@ before_script: script: ## PHP_CodeSniffer - - ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip + - if [ -z "$COVERAGE" ]; then ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip ; fi + ## PHP-CS-Fixer + - if [ -n "$COVERAGE" ]; then ./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run ; fi ## PHP Mess Detector - - ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php + - if [ -z "$COVERAGE" ]; then ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php ; fi ## PHPUnit - - ./vendor/bin/phpunit -c ./ --coverage-text --coverage-html ./build/coverage + - ./vendor/bin/phpunit -c ./ $(if [ -n "$COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi) ## PHPLOC - - ./vendor/bin/phploc src/ + - if [ -z "$COVERAGE" ]; then ./vendor/bin/phploc src/ ; fi ## PHPDocumentor - - ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig" + - if [ -z "$COVERAGE" ]; then ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig" ; fi after_script: ## PHPDocumentor - bash .travis_shell_after_success.sh ## Scrutinizer - - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml + - if [ -n "$COVERAGE" ]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml ; fi diff --git a/.travis_shell_after_success.sh b/.travis_shell_after_success.sh index 35c7a338..12728526 100644 --- a/.travis_shell_after_success.sh +++ b/.travis_shell_after_success.sh @@ -5,7 +5,7 @@ echo "TRAVIS_REPO_SLUG: $TRAVIS_REPO_SLUG" echo "TRAVIS_PHP_VERSION: $TRAVIS_PHP_VERSION" echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST" -if [ "$TRAVIS_REPO_SLUG" == "PHPOffice/PHPWord" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_PHP_VERSION" == "5.5" ]; then +if [ "$TRAVIS_REPO_SLUG" == "PHPOffice/PHPWord" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then echo -e "Publishing PHPDoc...\n" diff --git a/bootstrap.php b/bootstrap.php index 11939fee..362e8b74 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. test bootstrap * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/composer.json b/composer.json index 9cc03123..ab8b6aa6 100644 --- a/composer.json +++ b/composer.json @@ -39,12 +39,14 @@ "phpoffice/common": "^0.2" }, "require-dev": { - "phpunit/phpunit": "3.7.*", + "phpunit/phpunit": "4.8.*", "phpdocumentor/phpdocumentor":"2.*", - "squizlabs/php_codesniffer": "1.*", + "twig/twig":"1.27", + "squizlabs/php_codesniffer": "^2.7", + "friendsofphp/php-cs-fixer": "^2.0", "phpmd/phpmd": "2.*", "phploc/phploc": "2.*", - "dompdf/dompdf":"0.6.*", + "dompdf/dompdf":"0.8.*", "tecnickcom/tcpdf": "6.*", "mpdf/mpdf": "5.*" }, diff --git a/docs/elements.rst b/docs/elements.rst index a35eb654..848e3f98 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -135,12 +135,12 @@ Text breaks are empty new lines. To add text breaks, use the following syntax. A Page breaks ~~~~~~~~~~~ -There are two ways to insert a page breaks, using the ``addPageBreak`` +There are two ways to insert a page break, using the ``addPageBreak`` method or using the ``pageBreakBefore`` style of paragraph. -:: code-block:: php +.. code-block:: php - \\$section->addPageBreak(); + $section->addPageBreak(); Lists ----- diff --git a/run_tests.sh b/run_tests.sh new file mode 100755 index 00000000..6b81d69c --- /dev/null +++ b/run_tests.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +## PHP_CodeSniffer +./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip + +## PHP-CS-Fixer +./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run + +## PHP Mess Detector +./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php + +## PHPUnit +./vendor/bin/phpunit -c ./ --no-coverage + diff --git a/samples/Sample_01_SimpleText.php b/samples/Sample_01_SimpleText.php index fae6c210..5a3393b3 100644 --- a/samples/Sample_01_SimpleText.php +++ b/samples/Sample_01_SimpleText.php @@ -1,6 +1,6 @@ addParagraphStyle( new \PhpOffice\PhpWord\Style\Tab('left', 1550), new \PhpOffice\PhpWord\Style\Tab('center', 3200), new \PhpOffice\PhpWord\Style\Tab('right', 5300), - ) + ), ) ); diff --git a/samples/Sample_07_TemplateCloneRow.php b/samples/Sample_07_TemplateCloneRow.php index 22a68537..e845362c 100644 --- a/samples/Sample_07_TemplateCloneRow.php +++ b/samples/Sample_07_TemplateCloneRow.php @@ -1,62 +1,62 @@ -setValue('weekday', date('l')); // On section/content -$templateProcessor->setValue('time', date('H:i')); // On footer -$templateProcessor->setValue('serverName', realpath(__DIR__)); // On header - -// Simple table -$templateProcessor->cloneRow('rowValue', 10); - -$templateProcessor->setValue('rowValue#1', 'Sun'); -$templateProcessor->setValue('rowValue#2', 'Mercury'); -$templateProcessor->setValue('rowValue#3', 'Venus'); -$templateProcessor->setValue('rowValue#4', 'Earth'); -$templateProcessor->setValue('rowValue#5', 'Mars'); -$templateProcessor->setValue('rowValue#6', 'Jupiter'); -$templateProcessor->setValue('rowValue#7', 'Saturn'); -$templateProcessor->setValue('rowValue#8', 'Uranus'); -$templateProcessor->setValue('rowValue#9', 'Neptun'); -$templateProcessor->setValue('rowValue#10', 'Pluto'); - -$templateProcessor->setValue('rowNumber#1', '1'); -$templateProcessor->setValue('rowNumber#2', '2'); -$templateProcessor->setValue('rowNumber#3', '3'); -$templateProcessor->setValue('rowNumber#4', '4'); -$templateProcessor->setValue('rowNumber#5', '5'); -$templateProcessor->setValue('rowNumber#6', '6'); -$templateProcessor->setValue('rowNumber#7', '7'); -$templateProcessor->setValue('rowNumber#8', '8'); -$templateProcessor->setValue('rowNumber#9', '9'); -$templateProcessor->setValue('rowNumber#10', '10'); - -// Table with a spanned cell -$templateProcessor->cloneRow('userId', 3); - -$templateProcessor->setValue('userId#1', '1'); -$templateProcessor->setValue('userFirstName#1', 'James'); -$templateProcessor->setValue('userName#1', 'Taylor'); -$templateProcessor->setValue('userPhone#1', '+1 428 889 773'); - -$templateProcessor->setValue('userId#2', '2'); -$templateProcessor->setValue('userFirstName#2', 'Robert'); -$templateProcessor->setValue('userName#2', 'Bell'); -$templateProcessor->setValue('userPhone#2', '+1 428 889 774'); - -$templateProcessor->setValue('userId#3', '3'); -$templateProcessor->setValue('userFirstName#3', 'Michael'); -$templateProcessor->setValue('userName#3', 'Ray'); -$templateProcessor->setValue('userPhone#3', '+1 428 889 775'); - -echo date('H:i:s'), ' Saving the result document...', EOL; -$templateProcessor->saveAs('results/Sample_07_TemplateCloneRow.docx'); - -echo getEndingNotes(array('Word2007' => 'docx')); -if (!CLI) { - include_once 'Sample_Footer.php'; -} +setValue('weekday', date('l')); // On section/content +$templateProcessor->setValue('time', date('H:i')); // On footer +$templateProcessor->setValue('serverName', realpath(__DIR__)); // On header + +// Simple table +$templateProcessor->cloneRow('rowValue', 10); + +$templateProcessor->setValue('rowValue#1', 'Sun'); +$templateProcessor->setValue('rowValue#2', 'Mercury'); +$templateProcessor->setValue('rowValue#3', 'Venus'); +$templateProcessor->setValue('rowValue#4', 'Earth'); +$templateProcessor->setValue('rowValue#5', 'Mars'); +$templateProcessor->setValue('rowValue#6', 'Jupiter'); +$templateProcessor->setValue('rowValue#7', 'Saturn'); +$templateProcessor->setValue('rowValue#8', 'Uranus'); +$templateProcessor->setValue('rowValue#9', 'Neptun'); +$templateProcessor->setValue('rowValue#10', 'Pluto'); + +$templateProcessor->setValue('rowNumber#1', '1'); +$templateProcessor->setValue('rowNumber#2', '2'); +$templateProcessor->setValue('rowNumber#3', '3'); +$templateProcessor->setValue('rowNumber#4', '4'); +$templateProcessor->setValue('rowNumber#5', '5'); +$templateProcessor->setValue('rowNumber#6', '6'); +$templateProcessor->setValue('rowNumber#7', '7'); +$templateProcessor->setValue('rowNumber#8', '8'); +$templateProcessor->setValue('rowNumber#9', '9'); +$templateProcessor->setValue('rowNumber#10', '10'); + +// Table with a spanned cell +$templateProcessor->cloneRow('userId', 3); + +$templateProcessor->setValue('userId#1', '1'); +$templateProcessor->setValue('userFirstName#1', 'James'); +$templateProcessor->setValue('userName#1', 'Taylor'); +$templateProcessor->setValue('userPhone#1', '+1 428 889 773'); + +$templateProcessor->setValue('userId#2', '2'); +$templateProcessor->setValue('userFirstName#2', 'Robert'); +$templateProcessor->setValue('userName#2', 'Bell'); +$templateProcessor->setValue('userPhone#2', '+1 428 889 774'); + +$templateProcessor->setValue('userId#3', '3'); +$templateProcessor->setValue('userFirstName#3', 'Michael'); +$templateProcessor->setValue('userName#3', 'Ray'); +$templateProcessor->setValue('userPhone#3', '+1 428 889 775'); + +echo date('H:i:s'), ' Saving the result document...', EOL; +$templateProcessor->saveAs('results/Sample_07_TemplateCloneRow.docx'); + +echo getEndingNotes(array('Word2007' => 'docx')); +if (!CLI) { + include_once 'Sample_Footer.php'; +} diff --git a/samples/Sample_08_ParagraphPagination.php b/samples/Sample_08_ParagraphPagination.php index f91b1c56..3c21b138 100644 --- a/samples/Sample_08_ParagraphPagination.php +++ b/samples/Sample_08_ParagraphPagination.php @@ -19,7 +19,7 @@ $section->addText( 'Below are the samples on how to control your paragraph ' . 'pagination. See "Line and Page Break" tab on paragraph properties ' . 'window to see the attribute set by these controls.', - array('bold' => true), + array('bold' => true), array('space' => array('before' => 360, 'after' => 480)) ); diff --git a/samples/Sample_09_Tables.php b/samples/Sample_09_Tables.php index e3edc605..c4be7c9e 100644 --- a/samples/Sample_09_Tables.php +++ b/samples/Sample_09_Tables.php @@ -46,11 +46,11 @@ for ($i = 1; $i <= 8; $i++) { $table->addCell(2000)->addText("Cell {$i}"); $table->addCell(2000)->addText("Cell {$i}"); $table->addCell(2000)->addText("Cell {$i}"); - $text = (0== $i % 2) ? 'X' : ''; + $text = (0 == $i % 2) ? 'X' : ''; $table->addCell(500)->addText($text); } -/** +/* * 3. colspan (gridSpan) and rowspan (vMerge) * --------------------- * | | B | | @@ -93,7 +93,7 @@ $table->addCell(2000, $cellVCentered)->addText('C', null, $cellHCentered); $table->addCell(2000, $cellVCentered)->addText('D', null, $cellHCentered); $table->addCell(null, $cellRowContinue); -/** +/* * 4. colspan (gridSpan) and rowspan (vMerge) * --------------------- * | | B | 1 | @@ -104,6 +104,7 @@ $table->addCell(null, $cellRowContinue); * --------------------- * @see https://github.com/PHPOffice/PHPWord/issues/806 */ + $section->addPageBreak(); $section->addText('Table with colspan and rowspan', $header); @@ -114,12 +115,12 @@ $table = $section->addTable('Colspan Rowspan'); $row = $table->addRow(); $row->addCell(null, array('vMerge' => 'restart'))->addText('A'); -$row->addCell(null, array('gridSpan' => 2, 'vMerge' => 'restart',))->addText('B'); +$row->addCell(null, array('gridSpan' => 2, 'vMerge' => 'restart'))->addText('B'); $row->addCell()->addText('1'); $row = $table->addRow(); $row->addCell(null, array('vMerge' => 'continue')); -$row->addCell(null, array('vMerge' => 'continue','gridSpan' => 2,)); +$row->addCell(null, array('vMerge' => 'continue', 'gridSpan' => 2)); $row->addCell()->addText('2'); $row = $table->addRow(); $row->addCell(null, array('vMerge' => 'continue')); diff --git a/samples/Sample_13_Images.php b/samples/Sample_13_Images.php index 1e6943db..6c7033b0 100644 --- a/samples/Sample_13_Images.php +++ b/samples/Sample_13_Images.php @@ -23,7 +23,7 @@ $section->addImage($source); // Image from string $source = 'resources/_mars.jpg'; $fileContent = file_get_contents($source); -$section->addText("Image from string"); +$section->addText('Image from string'); $section->addImage($fileContent); //Wrapping style diff --git a/samples/Sample_37_Comments.php b/samples/Sample_37_Comments.php index 670e914b..5c0e8abc 100644 --- a/samples/Sample_37_Comments.php +++ b/samples/Sample_37_Comments.php @@ -47,7 +47,7 @@ $image->setCommentRangeStart($commentOnImage); $section->addTextBreak(2); // We can also do things the other way round, link the comment to the element -$anotherText = $section->addText("another text"); +$anotherText = $section->addText('another text'); $comment1 = new \PhpOffice\PhpWord\Element\Comment('Authors name', new \DateTime(), 'my_initials'); $comment1->addText('Test', array('bold' => true)); @@ -55,7 +55,6 @@ $comment1->setStartElement($anotherText); $comment1->setEndElement($anotherText); $phpWord->addComment($comment1); - // Save file echo write($phpWord, basename(__FILE__, '.php'), $writers); if (!CLI) { diff --git a/samples/Sample_Header.php b/samples/Sample_Header.php index 90bdf4fa..1d6b14a1 100644 --- a/samples/Sample_Header.php +++ b/samples/Sample_Header.php @@ -89,8 +89,8 @@ function getEndingNotes($writers) // Do not show execution time for index if (!IS_INDEX) { - $result .= date('H:i:s') . " Done writing file(s)" . EOL; - $result .= date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB" . EOL; + $result .= date('H:i:s') . ' Done writing file(s)' . EOL; + $result .= date('H:i:s') . ' Peak memory usage: ' . (memory_get_peak_usage(true) / 1024 / 1024) . ' MB' . EOL; } // Return diff --git a/samples/index.php b/samples/index.php index a65d8fd9..3dbc09ff 100644 --- a/samples/index.php +++ b/samples/index.php @@ -13,7 +13,7 @@ $requirements = array( 'xsl' => array('PHP extension XSL (optional)', extension_loaded('xsl')), ); if (!CLI) { -?> + ?>

Welcome to PHPWord, a library written in pure PHP that provides a set of classes to write to and read from different document file formats, i.e. Office Open XML (.docx), Open Document Format (.odt), and Rich Text Format (.rtf).

 

@@ -25,14 +25,14 @@ if (!CLI) { Requirement check:"; - echo "
    "; + echo '

    Requirement check:

    '; + echo '
      '; foreach ($requirements as $key => $value) { list($label, $result) = $value; $status = $result ? 'passed' : 'failed'; echo "
    • {$label} ... {$status}
    • "; } - echo "
    "; + echo '
'; include_once 'Sample_Footer.php'; } else { echo 'Requirement check:' . PHP_EOL; diff --git a/src/PhpWord/Collection/AbstractCollection.php b/src/PhpWord/Collection/AbstractCollection.php index beff290e..61709a50 100644 --- a/src/PhpWord/Collection/AbstractCollection.php +++ b/src/PhpWord/Collection/AbstractCollection.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -51,9 +51,9 @@ abstract class AbstractCollection { if (array_key_exists($index, $this->items)) { return $this->items[$index]; - } else { - return null; } + + return null; } /** @@ -61,7 +61,6 @@ abstract class AbstractCollection * * @param int $index * @param mixed $item - * @return void */ public function setItem($index, $item) { diff --git a/src/PhpWord/Collection/Bookmarks.php b/src/PhpWord/Collection/Bookmarks.php index b263cda7..7210fb03 100644 --- a/src/PhpWord/Collection/Bookmarks.php +++ b/src/PhpWord/Collection/Bookmarks.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Collection/Charts.php b/src/PhpWord/Collection/Charts.php index 01f3f72e..56d92c94 100644 --- a/src/PhpWord/Collection/Charts.php +++ b/src/PhpWord/Collection/Charts.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Collection/Comments.php b/src/PhpWord/Collection/Comments.php index e0383814..f2fe82d9 100644 --- a/src/PhpWord/Collection/Comments.php +++ b/src/PhpWord/Collection/Comments.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Collection/Endnotes.php b/src/PhpWord/Collection/Endnotes.php index 083142ed..52a56d31 100644 --- a/src/PhpWord/Collection/Endnotes.php +++ b/src/PhpWord/Collection/Endnotes.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Collection/Footnotes.php b/src/PhpWord/Collection/Footnotes.php index 0c094a53..63989f53 100644 --- a/src/PhpWord/Collection/Footnotes.php +++ b/src/PhpWord/Collection/Footnotes.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Collection/Titles.php b/src/PhpWord/Collection/Titles.php index 80e2d9d7..9e4f12cd 100644 --- a/src/PhpWord/Collection/Titles.php +++ b/src/PhpWord/Collection/Titles.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/ComplexType/FootnoteProperties.php b/src/PhpWord/ComplexType/FootnoteProperties.php index 0c1fb40e..8cb3a869 100644 --- a/src/PhpWord/ComplexType/FootnoteProperties.php +++ b/src/PhpWord/ComplexType/FootnoteProperties.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\ComplexType; use PhpOffice\PhpWord\SimpleType\NumberFormat; @@ -25,7 +26,6 @@ use PhpOffice\PhpWord\SimpleType\NumberFormat; */ final class FootnoteProperties { - const RESTART_NUMBER_CONTINUOUS = 'continuous'; const RESTART_NUMBER_EACH_SECTION = 'eachSect'; const RESTART_NUMBER_EACH_PAGE = 'eachPage'; @@ -52,7 +52,7 @@ final class FootnoteProperties /** * Footnote and Endnote Numbering Starting Value * - * @var double + * @var float */ private $numStart; @@ -86,14 +86,15 @@ final class FootnoteProperties self::POSITION_PAGE_BOTTOM, self::POSITION_BENEATH_TEXT, self::POSITION_SECTION_END, - self::POSITION_DOC_END + self::POSITION_DOC_END, ); if (in_array($pos, $position)) { $this->pos = $pos; } else { - throw new \InvalidArgumentException("Invalid value, on of " . implode(', ', $position) . " possible"); + throw new \InvalidArgumentException('Invalid value, on of ' . implode(', ', $position) . ' possible'); } + return $this; } @@ -117,13 +118,14 @@ final class FootnoteProperties { NumberFormat::validate($numFmt); $this->numFmt = $numFmt; + return $this; } /** * Get the Footnote Numbering Format * - * @return double + * @return float */ public function getNumStart() { @@ -133,12 +135,13 @@ final class FootnoteProperties /** * Set the Footnote Numbering Format * - * @param double $numStart + * @param float $numStart * @return self */ public function setNumStart($numStart) { $this->numStart = $numStart; + return $this; } @@ -164,14 +167,15 @@ final class FootnoteProperties $restartNumbers = array( self::RESTART_NUMBER_CONTINUOUS, self::RESTART_NUMBER_EACH_SECTION, - self::RESTART_NUMBER_EACH_PAGE + self::RESTART_NUMBER_EACH_PAGE, ); if (in_array($numRestart, $restartNumbers)) { - $this->numRestart= $numRestart; + $this->numRestart = $numRestart; } else { - throw new \InvalidArgumentException("Invalid value, on of " . implode(', ', $restartNumbers) . " possible"); + throw new \InvalidArgumentException('Invalid value, on of ' . implode(', ', $restartNumbers) . ' possible'); } + return $this; } } diff --git a/src/PhpWord/ComplexType/ProofState.php b/src/PhpWord/ComplexType/ProofState.php index daa705dd..6a915da1 100644 --- a/src/PhpWord/ComplexType/ProofState.php +++ b/src/PhpWord/ComplexType/ProofState.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\ComplexType; /** @@ -23,7 +24,6 @@ namespace PhpOffice\PhpWord\ComplexType; */ final class ProofState { - /** * Check Completed */ @@ -60,8 +60,9 @@ final class ProofState if ($spelling == self::CLEAN || $spelling == self::DIRTY) { $this->spelling = $spelling; } else { - throw new \InvalidArgumentException("Invalid value, dirty or clean possible"); + throw new \InvalidArgumentException('Invalid value, dirty or clean possible'); } + return $this; } @@ -87,8 +88,9 @@ final class ProofState if ($grammar == self::CLEAN || $grammar == self::DIRTY) { $this->grammar = $grammar; } else { - throw new \InvalidArgumentException("Invalid value, dirty or clean possible"); + throw new \InvalidArgumentException('Invalid value, dirty or clean possible'); } + return $this; } diff --git a/src/PhpWord/ComplexType/TrackChangesView.php b/src/PhpWord/ComplexType/TrackChangesView.php index 9c8948ae..3fc16298 100644 --- a/src/PhpWord/ComplexType/TrackChangesView.php +++ b/src/PhpWord/ComplexType/TrackChangesView.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\ComplexType; /** @@ -23,46 +24,45 @@ namespace PhpOffice\PhpWord\ComplexType; */ final class TrackChangesView { - /** * Display Visual Indicator Of Markup Area * - * @var boolean + * @var bool */ private $markup; /** * Display Comments * - * @var boolean + * @var bool */ private $comments; /** * Display Content Revisions * - * @var boolean + * @var bool */ private $insDel; /** * Display Formatting Revisions * - * @var boolean + * @var bool */ private $formatting; /** * Display Ink Annotations * - * @var boolean + * @var bool */ private $inkAnnotations; /** * Get Display Visual Indicator Of Markup Area * - * @return boolean True if markup is shown + * @return bool True if markup is shown */ public function hasMarkup() { @@ -72,7 +72,7 @@ final class TrackChangesView /** * Set Display Visual Indicator Of Markup Area * - * @param boolean $markup + * @param bool $markup * Set to true to show markup */ public function setMarkup($markup) @@ -83,7 +83,7 @@ final class TrackChangesView /** * Get Display Comments * - * @return boolean True if comments are shown + * @return bool True if comments are shown */ public function hasComments() { @@ -93,7 +93,7 @@ final class TrackChangesView /** * Set Display Comments * - * @param boolean $comments + * @param bool $comments * Set to true to show comments */ public function setComments($comments) @@ -104,7 +104,7 @@ final class TrackChangesView /** * Get Display Content Revisions * - * @return boolean True if content revisions are shown + * @return bool True if content revisions are shown */ public function hasInsDel() { @@ -114,7 +114,7 @@ final class TrackChangesView /** * Set Display Content Revisions * - * @param boolean $insDel + * @param bool $insDel * Set to true to show content revisions */ public function setInsDel($insDel) @@ -125,7 +125,7 @@ final class TrackChangesView /** * Get Display Formatting Revisions * - * @return boolean True if formatting revisions are shown + * @return bool True if formatting revisions are shown */ public function hasFormatting() { @@ -135,7 +135,7 @@ final class TrackChangesView /** * Set Display Formatting Revisions * - * @param boolean|null $formatting + * @param bool|null $formatting * Set to true to show formatting revisions */ public function setFormatting($formatting = null) @@ -146,7 +146,7 @@ final class TrackChangesView /** * Get Display Ink Annotations * - * @return boolean True if ink annotations are shown + * @return bool True if ink annotations are shown */ public function hasInkAnnotations() { @@ -156,7 +156,7 @@ final class TrackChangesView /** * Set Display Ink Annotations * - * @param boolean $inkAnnotations + * @param bool $inkAnnotations * Set to true to show ink annotations */ public function setInkAnnotations($inkAnnotations) diff --git a/src/PhpWord/Element/AbstractContainer.php b/src/PhpWord/Element/AbstractContainer.php index d5b4cc62..75153499 100644 --- a/src/PhpWord/Element/AbstractContainer.php +++ b/src/PhpWord/Element/AbstractContainer.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -37,7 +37,7 @@ namespace PhpOffice\PhpWord\Element; * @method PageBreak addPageBreak() * @method Table addTable(mixed $style = null) * @method Image addImage(string $source, mixed $style = null, bool $isWatermark = false) - * @method Object addObject(string $source, mixed $style = null) + * @method \PhpOffice\PhpWord\Element\Object addObject(string $source, mixed $style = null) * @method TextBox addTextBox(mixed $style = null) * @method Field addField(string $type = null, array $properties = array(), array $options = array(), mixed $text = null) * @method Line addLine(mixed $lineStyle = null) @@ -83,7 +83,7 @@ abstract class AbstractContainer extends AbstractElement 'ListItem', 'ListItemRun', 'Table', 'Image', 'Object', 'Footnote', 'Endnote', 'CheckBox', 'TextBox', 'Field', 'Line', 'Shape', 'Title', 'TOC', 'PageBreak', - 'Chart', 'FormField', 'SDT', 'Comment' + 'Chart', 'FormField', 'SDT', 'Comment', ); $functions = array(); foreach ($elements as $element) { @@ -105,9 +105,8 @@ abstract class AbstractContainer extends AbstractElement for ($i = 1; $i <= $count; $i++) { $this->addElement($element, $fontStyle, $paragraphStyle); } - - // All other elements } else { + // All other elements array_unshift($args, $element); // Prepend element name to the beginning of args array return call_user_func_array(array($this, 'addElement'), $args); } @@ -181,9 +180,8 @@ abstract class AbstractContainer extends AbstractElement * * @param string $method * - * @return bool - * * @throws \BadMethodCallException + * @return bool */ private function checkValidity($method) { diff --git a/src/PhpWord/Element/AbstractElement.php b/src/PhpWord/Element/AbstractElement.php index 4ff4978a..81e18528 100644 --- a/src/PhpWord/Element/AbstractElement.php +++ b/src/PhpWord/Element/AbstractElement.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -73,7 +73,7 @@ abstract class AbstractElement /** * Unique Id for element * - * @var int + * @var string */ protected $elementId; @@ -142,7 +142,6 @@ abstract class AbstractElement * Set PhpWord as reference. * * @param \PhpOffice\PhpWord\PhpWord $phpWord - * @return void */ public function setPhpWord(PhpWord $phpWord = null) { @@ -164,7 +163,6 @@ abstract class AbstractElement * * @param string $docPart * @param int $docPartId - * @return void */ public function setDocPart($docPart, $docPartId = 1) { @@ -221,7 +219,6 @@ abstract class AbstractElement * Set element index. * * @param int $value - * @return void */ public function setElementIndex($value) { @@ -231,7 +228,7 @@ abstract class AbstractElement /** * Get element unique ID * - * @return integer + * @return int */ public function getElementId() { @@ -240,8 +237,6 @@ abstract class AbstractElement /** * Set element unique ID from 6 first digit of md5. - * - * @return void */ public function setElementId() { @@ -262,7 +257,6 @@ abstract class AbstractElement * Set relation Id. * * @param int $value - * @return void */ public function setRelationId($value) { @@ -297,9 +291,9 @@ abstract class AbstractElement public function setCommentRangeStart(Comment $value) { if ($this instanceof Comment) { - throw new \InvalidArgumentException("Cannot set a Comment on a Comment"); + throw new \InvalidArgumentException('Cannot set a Comment on a Comment'); } - $this->commentRangeStart= $value; + $this->commentRangeStart = $value; $this->commentRangeStart->setStartElement($this); } @@ -317,14 +311,13 @@ abstract class AbstractElement * Set comment end * * @param Comment $value - * @return void */ public function setCommentRangeEnd(Comment $value) { if ($this instanceof Comment) { - throw new \InvalidArgumentException("Cannot set a Comment on a Comment"); + throw new \InvalidArgumentException('Cannot set a Comment on a Comment'); } - $this->commentRangeEnd= $value; + $this->commentRangeEnd = $value; $this->commentRangeEnd->setEndElement($this); } @@ -334,7 +327,6 @@ abstract class AbstractElement * Passed parameter should be a container, except for Table (contain Row) and Row (contain Cell) * * @param \PhpOffice\PhpWord\Element\AbstractElement $container - * @return void */ public function setParentContainer(AbstractElement $container) { @@ -363,8 +355,6 @@ abstract class AbstractElement * * - Image element needs to be passed to Media object * - Icon needs to be set for Object element - * - * @return void */ private function setMediaRelation() { @@ -391,8 +381,6 @@ abstract class AbstractElement /** * Set relation Id for elements that will be registered in the Collection subnamespaces. - * - * @return void */ private function setCollectionRelation() { @@ -411,7 +399,7 @@ abstract class AbstractElement */ public function isInSection() { - return ($this->docPart == 'Section'); + return $this->docPart == 'Section'; } /** @@ -441,9 +429,8 @@ abstract class AbstractElement * @param array $enum * @param mixed $default * - * @return mixed - * * @throws \InvalidArgumentException + * @return mixed * * @todo Merge with the same method in AbstractStyle */ diff --git a/src/PhpWord/Element/Bookmark.php b/src/PhpWord/Element/Bookmark.php index 4df06afb..2eceb5ed 100644 --- a/src/PhpWord/Element/Bookmark.php +++ b/src/PhpWord/Element/Bookmark.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Cell.php b/src/PhpWord/Element/Cell.php index 28e517fd..b5250cd6 100644 --- a/src/PhpWord/Element/Cell.php +++ b/src/PhpWord/Element/Cell.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Chart.php b/src/PhpWord/Element/Chart.php index f98c1d74..c340da40 100644 --- a/src/PhpWord/Element/Chart.php +++ b/src/PhpWord/Element/Chart.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -83,7 +83,6 @@ class Chart extends AbstractElement * Set type. * * @param string $value - * @return void */ public function setType($value) { @@ -96,7 +95,6 @@ class Chart extends AbstractElement * * @param array $categories * @param array $values - * @return void */ public function addSeries($categories, $values) { diff --git a/src/PhpWord/Element/CheckBox.php b/src/PhpWord/Element/CheckBox.php index b049c7f1..e0a94fdf 100644 --- a/src/PhpWord/Element/CheckBox.php +++ b/src/PhpWord/Element/CheckBox.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Comment.php b/src/PhpWord/Element/Comment.php index 5e0ebe63..a8f39748 100644 --- a/src/PhpWord/Element/Comment.php +++ b/src/PhpWord/Element/Comment.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Endnote.php b/src/PhpWord/Element/Endnote.php index 2d8e4731..6565c039 100644 --- a/src/PhpWord/Element/Endnote.php +++ b/src/PhpWord/Element/Endnote.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Field.php b/src/PhpWord/Element/Field.php index 380d7a92..726938b5 100644 --- a/src/PhpWord/Element/Field.php +++ b/src/PhpWord/Element/Field.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -21,7 +21,7 @@ namespace PhpOffice\PhpWord\Element; * Field element * * @since 0.11.0 - * @link http://www.schemacentral.com/sc/ooxml/t-w_CT_SimpleField.html + * @see http://www.schemacentral.com/sc/ooxml/t-w_CT_SimpleField.html */ class Field extends AbstractElement { @@ -32,36 +32,36 @@ class Field extends AbstractElement * @var array */ protected $fieldsArray = array( - 'PAGE'=>array( - 'properties'=>array( + 'PAGE' => array( + 'properties' => array( 'format' => array('Arabic', 'ArabicDash', 'alphabetic', 'ALPHABETIC', 'roman', 'ROMAN'), ), - 'options'=>array('PreserveFormat') + 'options' => array('PreserveFormat'), ), - 'NUMPAGES'=>array( - 'properties'=>array( + 'NUMPAGES' => array( + 'properties' => array( 'format' => array('Arabic', 'ArabicDash', 'CardText', 'DollarText', 'Ordinal', 'OrdText', - 'alphabetic', 'ALPHABETIC', 'roman', 'ROMAN', 'Caps', 'FirstCap', 'Lower', 'Upper'), - 'numformat' => array('0', '0,00', '#.##0', '#.##0,00', '€ #.##0,00(€ #.##0,00)', '0%', '0,00%') + 'alphabetic', 'ALPHABETIC', 'roman', 'ROMAN', 'Caps', 'FirstCap', 'Lower', 'Upper', ), + 'numformat' => array('0', '0,00', '#.##0', '#.##0,00', '€ #.##0,00(€ #.##0,00)', '0%', '0,00%'), ), - 'options'=>array('PreserveFormat') + 'options' => array('PreserveFormat'), ), - 'DATE'=>array( - 'properties'=> array( - 'dateformat' =>array('d-M-yyyy', 'dddd d MMMM yyyy', 'd MMMM yyyy', 'd-M-yy', 'yyyy-MM-dd', + 'DATE' => array( + 'properties' => array( + 'dateformat' => array('d-M-yyyy', 'dddd d MMMM yyyy', 'd MMMM yyyy', 'd-M-yy', 'yyyy-MM-dd', 'd-MMM-yy', 'd/M/yyyy', 'd MMM. yy', 'd/M/yy', 'MMM-yy', 'd-M-yyy H:mm', 'd-M-yyyy H:mm:ss', - 'h:mm am/pm', 'h:mm:ss am/pm', 'HH:mm', 'HH:mm:ss') + 'h:mm am/pm', 'h:mm:ss am/pm', 'HH:mm', 'HH:mm:ss', ), ), - 'options'=>array('PreserveFormat', 'LunarCalendar', 'SakaEraCalendar', 'LastUsedFormat') + 'options' => array('PreserveFormat', 'LunarCalendar', 'SakaEraCalendar', 'LastUsedFormat'), ), - 'XE'=>array( + 'XE' => array( 'properties' => array(), - 'options' => array('Bold', 'Italic') + 'options' => array('Bold', 'Italic'), ), - 'INDEX'=>array( + 'INDEX' => array( 'properties' => array(), - 'options' => array('PreserveFormat') - ) + 'options' => array('PreserveFormat'), + ), ); /** @@ -113,9 +113,8 @@ class Field extends AbstractElement * * @param string $type * - * @return string - * * @throws \InvalidArgumentException + * @return string */ public function setType($type = null) { @@ -126,6 +125,7 @@ class Field extends AbstractElement throw new \InvalidArgumentException("Invalid type '$type'"); } } + return $this->type; } @@ -144,9 +144,8 @@ class Field extends AbstractElement * * @param array $properties * - * @return self - * * @throws \InvalidArgumentException + * @return self */ public function setProperties($properties = array()) { @@ -158,6 +157,7 @@ class Field extends AbstractElement } $this->properties = array_merge($this->properties, $properties); } + return $this->properties; } @@ -176,9 +176,8 @@ class Field extends AbstractElement * * @param array $options * - * @return self - * * @throws \InvalidArgumentException + * @return self */ public function setOptions($options = array()) { @@ -190,6 +189,7 @@ class Field extends AbstractElement } $this->options = array_merge($this->options, $options); } + return $this->options; } @@ -208,9 +208,8 @@ class Field extends AbstractElement * * @param string | TextRun $text * - * @return string | TextRun - * * @throws \InvalidArgumentException + * @return string | TextRun */ public function setText($text) { @@ -218,9 +217,10 @@ class Field extends AbstractElement if (is_string($text) || $text instanceof TextRun) { $this->text = $text; } else { - throw new \InvalidArgumentException("Invalid text"); + throw new \InvalidArgumentException('Invalid text'); } } + return $this->text; } diff --git a/src/PhpWord/Element/Footer.php b/src/PhpWord/Element/Footer.php index b3196f3f..08ff525a 100644 --- a/src/PhpWord/Element/Footer.php +++ b/src/PhpWord/Element/Footer.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,11 +26,11 @@ class Footer extends AbstractContainer * Header/footer types constants * * @var string - * @link http://www.datypic.com/sc/ooxml/t-w_ST_HdrFtr.html Header or Footer Type + * @see http://www.datypic.com/sc/ooxml/t-w_ST_HdrFtr.html Header or Footer Type */ - const AUTO = 'default'; // default and odd pages + const AUTO = 'default'; // default and odd pages const FIRST = 'first'; - const EVEN = 'even'; + const EVEN = 'even'; /** * @var string Container type @@ -64,7 +64,6 @@ class Footer extends AbstractContainer * @since 0.10.0 * * @param string $value - * @return void */ public function setType($value = self::AUTO) { diff --git a/src/PhpWord/Element/Footnote.php b/src/PhpWord/Element/Footnote.php index 73350bb7..9acdc4c3 100644 --- a/src/PhpWord/Element/Footnote.php +++ b/src/PhpWord/Element/Footnote.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/FormField.php b/src/PhpWord/Element/FormField.php index 414714a8..1e3e182c 100644 --- a/src/PhpWord/Element/FormField.php +++ b/src/PhpWord/Element/FormField.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -21,7 +21,7 @@ namespace PhpOffice\PhpWord\Element; * Form field element * * @since 0.12.0 - * @link http://www.datypic.com/sc/ooxml/t-w_CT_FFData.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_FFData.html */ class FormField extends Text { diff --git a/src/PhpWord/Element/Header.php b/src/PhpWord/Element/Header.php index d4afdb86..ee820877 100644 --- a/src/PhpWord/Element/Header.php +++ b/src/PhpWord/Element/Header.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Image.php b/src/PhpWord/Element/Image.php index 1c8c520d..c9620b6b 100644 --- a/src/PhpWord/Element/Image.php +++ b/src/PhpWord/Element/Image.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -61,7 +61,7 @@ class Image extends AbstractElement /** * Is watermark * - * @var boolean + * @var bool */ private $watermark; @@ -96,7 +96,7 @@ class Image extends AbstractElement /** * Is memory image * - * @var boolean + * @var bool */ private $memoryImage; @@ -110,7 +110,7 @@ class Image extends AbstractElement /** * Image media index * - * @var integer + * @var int */ private $mediaIndex; @@ -126,7 +126,7 @@ class Image extends AbstractElement * * @param string $source * @param mixed $style - * @param boolean $watermark + * @param bool $watermark * * @throws \PhpOffice\PhpWord\Exception\InvalidImageException * @throws \PhpOffice\PhpWord\Exception\UnsupportedImageTypeException @@ -183,7 +183,7 @@ class Image extends AbstractElement /** * Get is watermark * - * @return boolean + * @return bool */ public function isWatermark() { @@ -193,7 +193,7 @@ class Image extends AbstractElement /** * Set is watermark * - * @param boolean $value + * @param bool $value */ public function setIsWatermark($value) { @@ -243,7 +243,7 @@ class Image extends AbstractElement /** * Get is memory image * - * @return boolean + * @return bool */ public function isMemImage() { @@ -264,7 +264,6 @@ class Image extends AbstractElement * Set target file name. * * @param string $value - * @return void */ public function setTarget($value) { @@ -274,7 +273,7 @@ class Image extends AbstractElement /** * Get media index * - * @return integer + * @return int */ public function getMediaIndex() { @@ -284,8 +283,7 @@ class Image extends AbstractElement /** * Set media index. * - * @param integer $value - * @return void + * @param int $value */ public function setMediaIndex($value) { @@ -368,8 +366,6 @@ class Image extends AbstractElement /** * Check memory image, supported type, image functions, and proportional width/height. * - * @return void - * * @throws \PhpOffice\PhpWord\Exception\InvalidImageException * @throws \PhpOffice\PhpWord\Exception\UnsupportedImageTypeException */ @@ -380,7 +376,7 @@ class Image extends AbstractElement // Check image data if ($this->sourceType == self::SOURCE_ARCHIVE) { $imageData = $this->getArchiveImageSize($this->source); - } else if ($this->sourceType == self::SOURCE_STRING) { + } elseif ($this->sourceType == self::SOURCE_STRING) { $imageData = $this->getStringImageSize($this->source); } else { $imageData = @getimagesize($this->source); @@ -407,8 +403,6 @@ class Image extends AbstractElement /** * Set source type. - * - * @return void */ private function setSourceType() { @@ -443,9 +437,9 @@ class Image extends AbstractElement * * @param string $source * - * @return array|null - * * @throws \PhpOffice\PhpWord\Exception\CreateTemporaryFileException + * + * @return array|null */ private function getArchiveImageSize($source) { @@ -483,19 +477,19 @@ class Image extends AbstractElement */ private function getStringImageSize($source) { + $result = false; if (!function_exists('getimagesizefromstring')) { - $uri = 'data://application/octet-stream;base64,' . base64_encode($source); - return @getimagesize($uri); + $uri = 'data://application/octet-stream;base64,' . base64_encode($source); + $result = @getimagesize($uri); } else { - return @getimagesizefromstring($source); + $result = @getimagesizefromstring($source); } - return false; + + return $result; } /** * Set image functions and extensions. - * - * @return void */ private function setFunctions() { @@ -530,9 +524,8 @@ class Image extends AbstractElement /** * Set proportional width/height if one dimension not available. * - * @param integer $actualWidth - * @param integer $actualHeight - * @return void + * @param int $actualWidth + * @param int $actualHeight */ private function setProportionalSize($actualWidth, $actualHeight) { diff --git a/src/PhpWord/Element/Line.php b/src/PhpWord/Element/Line.php index 3e94a3a6..eba66473 100644 --- a/src/PhpWord/Element/Line.php +++ b/src/PhpWord/Element/Line.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Link.php b/src/PhpWord/Element/Link.php index 6641b46d..4637120a 100644 --- a/src/PhpWord/Element/Link.php +++ b/src/PhpWord/Element/Link.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -75,6 +75,7 @@ class Link extends AbstractElement * @param string $text * @param mixed $fontStyle * @param mixed $paragraphStyle + * @param bool $internal */ public function __construct($source, $text = null, $fontStyle = null, $paragraphStyle = null, $internal = false) { diff --git a/src/PhpWord/Element/ListItem.php b/src/PhpWord/Element/ListItem.php index 25ace090..7f665b1b 100644 --- a/src/PhpWord/Element/ListItem.php +++ b/src/PhpWord/Element/ListItem.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/ListItemRun.php b/src/PhpWord/Element/ListItemRun.php index 53440db6..5286f662 100644 --- a/src/PhpWord/Element/ListItemRun.php +++ b/src/PhpWord/Element/ListItemRun.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * -* @link https://github.com/PHPOffice/PHPWord -* @copyright 2010-2016 PHPWord contributors +* @see https://github.com/PHPOffice/PHPWord +* @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -74,10 +74,10 @@ class ListItemRun extends TextRun return $this->style; } - /** + /** * Get ListItem depth. - * - * @return int + * + * @return int */ public function getDepth() { diff --git a/src/PhpWord/Element/Object.php b/src/PhpWord/Element/Object.php index 7285030c..8fe83224 100644 --- a/src/PhpWord/Element/Object.php +++ b/src/PhpWord/Element/Object.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -84,9 +84,9 @@ class Object extends AbstractElement $this->icon = realpath(__DIR__ . "/../resources/{$ext}.png"); return $this; - } else { - throw new InvalidObjectException(); } + + throw new InvalidObjectException(); } /** @@ -133,7 +133,6 @@ class Object extends AbstractElement * Set Image Relation ID. * * @param int $rId - * @return void */ public function setImageRelationId($rId) { diff --git a/src/PhpWord/Element/PageBreak.php b/src/PhpWord/Element/PageBreak.php index d9d4bc64..e41e807b 100644 --- a/src/PhpWord/Element/PageBreak.php +++ b/src/PhpWord/Element/PageBreak.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/PreserveText.php b/src/PhpWord/Element/PreserveText.php index 813c1396..ad20d7a3 100644 --- a/src/PhpWord/Element/PreserveText.php +++ b/src/PhpWord/Element/PreserveText.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -47,7 +47,6 @@ class PreserveText extends AbstractElement */ private $paragraphStyle; - /** * Create a new Preserve Text Element * diff --git a/src/PhpWord/Element/Row.php b/src/PhpWord/Element/Row.php index 05fde7e4..2e89b354 100644 --- a/src/PhpWord/Element/Row.php +++ b/src/PhpWord/Element/Row.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/SDT.php b/src/PhpWord/Element/SDT.php index b0c68b0f..88ee7238 100644 --- a/src/PhpWord/Element/SDT.php +++ b/src/PhpWord/Element/SDT.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Section.php b/src/PhpWord/Element/Section.php index e9beffcf..ffc98435 100644 --- a/src/PhpWord/Element/Section.php +++ b/src/PhpWord/Element/Section.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -73,7 +73,6 @@ class Section extends AbstractContainer * Set section style. * * @param array $style - * @return void */ public function setStyle($style = null) { @@ -172,7 +171,7 @@ class Section extends AbstractContainer * If any of the Header instances have a type of Header::FIRST then this method returns true. * False otherwise. * - * @return boolean + * @return bool */ public function hasDifferentFirstPage() { @@ -186,6 +185,7 @@ class Section extends AbstractContainer return true; } } + return false; } @@ -195,11 +195,11 @@ class Section extends AbstractContainer * @since 0.10.0 * * @param string $type - * @param boolean $header - * - * @return Header|Footer + * @param bool $header * * @throws \Exception + * + * @return Header|Footer */ private function addHeaderFooter($type = Header::AUTO, $header = true) { @@ -215,10 +215,10 @@ class Section extends AbstractContainer $container->setPhpWord($this->phpWord); $collection[$index] = $container; + return $container; - } else { - throw new \Exception('Invalid header/footer type.'); } + throw new \Exception('Invalid header/footer type.'); } /** @@ -290,8 +290,8 @@ class Section extends AbstractContainer { if (empty($this->footers)) { return null; - } else { - return $this->footers[1]; } + + return $this->footers[1]; } } diff --git a/src/PhpWord/Element/Shape.php b/src/PhpWord/Element/Shape.php index 4717afb8..b553a4ac 100644 --- a/src/PhpWord/Element/Shape.php +++ b/src/PhpWord/Element/Shape.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/TOC.php b/src/PhpWord/Element/TOC.php index d3ab2be1..e3ca0a08 100644 --- a/src/PhpWord/Element/TOC.php +++ b/src/PhpWord/Element/TOC.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -54,14 +54,13 @@ class TOC extends AbstractElement */ private $maxDepth = 9; - /** * Create a new Table-of-Contents Element * * @param mixed $fontStyle * @param array $tocStyle - * @param integer $minDepth - * @param integer $maxDepth + * @param int $minDepth + * @param int $maxDepth */ public function __construct($fontStyle = null, $tocStyle = null, $minDepth = 1, $maxDepth = 9) { @@ -132,7 +131,6 @@ class TOC extends AbstractElement * Set max depth. * * @param int $value - * @return void */ public function setMaxDepth($value) { @@ -153,7 +151,6 @@ class TOC extends AbstractElement * Set min depth. * * @param int $value - * @return void */ public function setMinDepth($value) { diff --git a/src/PhpWord/Element/Table.php b/src/PhpWord/Element/Table.php index 357af37a..3a045031 100644 --- a/src/PhpWord/Element/Table.php +++ b/src/PhpWord/Element/Table.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -121,7 +121,6 @@ class Table extends AbstractElement * Set table width. * * @param int $width - * @return void */ public function setWidth($width) { diff --git a/src/PhpWord/Element/Text.php b/src/PhpWord/Element/Text.php index 0de9cdea..4de12176 100644 --- a/src/PhpWord/Element/Text.php +++ b/src/PhpWord/Element/Text.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -105,12 +105,12 @@ class Text extends AbstractElement public function setParagraphStyle($style = null) { if (is_array($style)) { - $this->paragraphStyle = new Paragraph; + $this->paragraphStyle = new Paragraph(); $this->paragraphStyle->setStyleByArray($style); } elseif ($style instanceof Paragraph) { $this->paragraphStyle = $style; } elseif (null === $style) { - $this->paragraphStyle = new Paragraph; + $this->paragraphStyle = new Paragraph(); } else { $this->paragraphStyle = $style; } diff --git a/src/PhpWord/Element/TextBox.php b/src/PhpWord/Element/TextBox.php index 4a1e5131..8058d0c9 100644 --- a/src/PhpWord/Element/TextBox.php +++ b/src/PhpWord/Element/TextBox.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/TextBreak.php b/src/PhpWord/Element/TextBreak.php index 893fa875..4cf65f35 100644 --- a/src/PhpWord/Element/TextBreak.php +++ b/src/PhpWord/Element/TextBreak.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -74,6 +74,7 @@ class TextBreak extends AbstractElement $this->fontStyle = $style; $this->setParagraphStyle($paragraphStyle); } + return $this->fontStyle; } @@ -96,13 +97,14 @@ class TextBreak extends AbstractElement public function setParagraphStyle($style = null) { if (is_array($style)) { - $this->paragraphStyle = new Paragraph; + $this->paragraphStyle = new Paragraph(); $this->paragraphStyle->setStyleByArray($style); } elseif ($style instanceof Paragraph) { $this->paragraphStyle = $style; } else { $this->paragraphStyle = $style; } + return $this->paragraphStyle; } diff --git a/src/PhpWord/Element/TextRun.php b/src/PhpWord/Element/TextRun.php index c2ce4f99..d8a898b4 100644 --- a/src/PhpWord/Element/TextRun.php +++ b/src/PhpWord/Element/TextRun.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Title.php b/src/PhpWord/Element/Title.php index eabb1feb..808af55e 100644 --- a/src/PhpWord/Element/Title.php +++ b/src/PhpWord/Element/Title.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -83,7 +83,7 @@ class Title extends AbstractElement /** * Get depth * - * @return integer + * @return int */ public function getDepth() { diff --git a/src/PhpWord/Element/TrackChange.php b/src/PhpWord/Element/TrackChange.php index 1df7148d..11cc763a 100644 --- a/src/PhpWord/Element/TrackChange.php +++ b/src/PhpWord/Element/TrackChange.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -49,9 +49,9 @@ class TrackChange extends AbstractContainer */ public function __construct($author, \DateTime $date) { - $this->author = $author; $this->date = $date; + return $this; } diff --git a/src/PhpWord/Escaper/AbstractEscaper.php b/src/PhpWord/Escaper/AbstractEscaper.php index 8ce4e301..8207e2c6 100644 --- a/src/PhpWord/Escaper/AbstractEscaper.php +++ b/src/PhpWord/Escaper/AbstractEscaper.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Escaper/EscaperInterface.php b/src/PhpWord/Escaper/EscaperInterface.php index 71cf36b4..1ef35c1b 100644 --- a/src/PhpWord/Escaper/EscaperInterface.php +++ b/src/PhpWord/Escaper/EscaperInterface.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Escaper/RegExp.php b/src/PhpWord/Escaper/RegExp.php index dfcfb1e1..2f4e12ec 100644 --- a/src/PhpWord/Escaper/RegExp.php +++ b/src/PhpWord/Escaper/RegExp.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Escaper/Rtf.php b/src/PhpWord/Escaper/Rtf.php index ec24c0af..35f91ada 100644 --- a/src/PhpWord/Escaper/Rtf.php +++ b/src/PhpWord/Escaper/Rtf.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -28,9 +28,9 @@ class Rtf extends AbstractEscaper { if (20 > $code || $code >= 80) { return '{\u' . $code . '}'; - } else { - return chr($code); } + + return chr($code); } protected function escapeMultibyteCharacter($code) @@ -40,6 +40,7 @@ class Rtf extends AbstractEscaper /** * @see http://www.randomchaos.com/documents/?source=php_and_unicode + * @param string $input */ protected function escapeSingleValue($input) { @@ -57,9 +58,9 @@ class Rtf extends AbstractEscaper if (0 == count($bytes)) { if ($asciiCode < 224) { $numberOfBytes = 2; - } else if ($asciiCode < 240) { + } elseif ($asciiCode < 240) { $numberOfBytes = 3; - } else if ($asciiCode < 248) { + } elseif ($asciiCode < 248) { $numberOfBytes = 4; } } diff --git a/src/PhpWord/Escaper/Xml.php b/src/PhpWord/Escaper/Xml.php index 3a0981aa..81cedaa9 100644 --- a/src/PhpWord/Escaper/Xml.php +++ b/src/PhpWord/Escaper/Xml.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Exception/CopyFileException.php b/src/PhpWord/Exception/CopyFileException.php index c172657f..a5c1da6a 100644 --- a/src/PhpWord/Exception/CopyFileException.php +++ b/src/PhpWord/Exception/CopyFileException.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -23,10 +23,10 @@ namespace PhpOffice\PhpWord\Exception; final class CopyFileException extends Exception { /** - * @param string $source The fully qualified source file name. - * @param string $destination The fully qualified destination file name. - * @param integer $code The user defined exception code. - * @param \Exception $previous The previous exception used for the exception chaining. + * @param string $source The fully qualified source file name + * @param string $destination The fully qualified destination file name + * @param int $code The user defined exception code + * @param \Exception $previous The previous exception used for the exception chaining */ final public function __construct($source, $destination, $code = 0, \Exception $previous = null) { diff --git a/src/PhpWord/Exception/CreateTemporaryFileException.php b/src/PhpWord/Exception/CreateTemporaryFileException.php index 67d969ba..fafc8dac 100644 --- a/src/PhpWord/Exception/CreateTemporaryFileException.php +++ b/src/PhpWord/Exception/CreateTemporaryFileException.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -23,8 +23,8 @@ namespace PhpOffice\PhpWord\Exception; final class CreateTemporaryFileException extends Exception { /** - * @param integer $code The user defined exception code. - * @param \Exception $previous The previous exception used for the exception chaining. + * @param int $code The user defined exception code + * @param \Exception $previous The previous exception used for the exception chaining */ final public function __construct($code = 0, \Exception $previous = null) { diff --git a/src/PhpWord/Exception/Exception.php b/src/PhpWord/Exception/Exception.php index a9c49f7f..b94ed1be 100644 --- a/src/PhpWord/Exception/Exception.php +++ b/src/PhpWord/Exception/Exception.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Exception/InvalidImageException.php b/src/PhpWord/Exception/InvalidImageException.php index 21c885ee..0a7b8fed 100644 --- a/src/PhpWord/Exception/InvalidImageException.php +++ b/src/PhpWord/Exception/InvalidImageException.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Exception/InvalidObjectException.php b/src/PhpWord/Exception/InvalidObjectException.php index ad564d47..54015506 100644 --- a/src/PhpWord/Exception/InvalidObjectException.php +++ b/src/PhpWord/Exception/InvalidObjectException.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Exception/InvalidStyleException.php b/src/PhpWord/Exception/InvalidStyleException.php index 44980842..e697f6cf 100644 --- a/src/PhpWord/Exception/InvalidStyleException.php +++ b/src/PhpWord/Exception/InvalidStyleException.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Exception/UnsupportedImageTypeException.php b/src/PhpWord/Exception/UnsupportedImageTypeException.php index 1b09bc8f..73b41d04 100644 --- a/src/PhpWord/Exception/UnsupportedImageTypeException.php +++ b/src/PhpWord/Exception/UnsupportedImageTypeException.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/IOFactory.php b/src/PhpWord/IOFactory.php index c868841a..eed1f163 100644 --- a/src/PhpWord/IOFactory.php +++ b/src/PhpWord/IOFactory.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -29,9 +29,9 @@ abstract class IOFactory * @param PhpWord $phpWord * @param string $name * - * @return WriterInterface - * * @throws \PhpOffice\PhpWord\Exception\Exception + * + * @return WriterInterface */ public static function createWriter(PhpWord $phpWord, $name = 'Word2007') { @@ -49,9 +49,9 @@ abstract class IOFactory * * @param string $name * - * @return ReaderInterface - * * @throws Exception + * + * @return ReaderInterface */ public static function createReader($name = 'Word2007') { @@ -65,19 +65,19 @@ abstract class IOFactory * @param string $name * @param \PhpOffice\PhpWord\PhpWord $phpWord * - * @return \PhpOffice\PhpWord\Writer\WriterInterface|\PhpOffice\PhpWord\Reader\ReaderInterface - * * @throws \PhpOffice\PhpWord\Exception\Exception + * + * @return \PhpOffice\PhpWord\Writer\WriterInterface|\PhpOffice\PhpWord\Reader\ReaderInterface */ private static function createObject($type, $name, $phpWord = null) { $class = "PhpOffice\\PhpWord\\{$type}\\{$name}"; if (class_exists($class) && self::isConcreteClass($class)) { return new $class($phpWord); - } else { - throw new Exception("\"{$name}\" is not a valid {$type}."); } + throw new Exception("\"{$name}\" is not a valid {$type}."); } + /** * Loads PhpWord from file * @@ -89,8 +89,10 @@ abstract class IOFactory { /** @var \PhpOffice\PhpWord\Reader\ReaderInterface $reader */ $reader = self::createReader($readerName); + return $reader->load($filename); } + /** * Check if it's a concrete class (not abstract nor interface) * @@ -100,6 +102,7 @@ abstract class IOFactory private static function isConcreteClass($class) { $reflection = new \ReflectionClass($class); + return !$reflection->isAbstract() && !$reflection->isInterface(); } } diff --git a/src/PhpWord/Media.php b/src/PhpWord/Media.php index df337854..d9879010 100644 --- a/src/PhpWord/Media.php +++ b/src/PhpWord/Media.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -43,9 +43,9 @@ class Media * @param string $source * @param \PhpOffice\PhpWord\Element\Image $image * - * @return integer - * * @throws \PhpOffice\PhpWord\Exception\Exception + * + * @return int */ public static function addElement($container, $mediaType, $source, Image $image = null) { @@ -83,12 +83,10 @@ class Media $image->setTarget($target); $image->setMediaIndex($mediaTypeCount); break; - // Objects case 'object': $target = "{$container}_oleObject{$mediaTypeCount}.bin"; break; - // Links case 'link': $target = $source; @@ -100,15 +98,17 @@ class Media $mediaData['type'] = $mediaType; $mediaData['rID'] = $rId; self::$elements[$container][$mediaId] = $mediaData; + return $rId; - } else { - $mediaData = self::$elements[$container][$mediaId]; - if (!is_null($image)) { - $image->setTarget($mediaData['target']); - $image->setMediaIndex($mediaData['mediaIndex']); - } - return $mediaData['rID']; } + + $mediaData = self::$elements[$container][$mediaId]; + if (!is_null($image)) { + $image->setTarget($mediaData['target']); + $image->setMediaIndex($mediaData['mediaIndex']); + } + + return $mediaData['rID']; } /** @@ -116,7 +116,7 @@ class Media * * @param string $container section|headerx|footerx|footnote|endnote * @param string $mediaType image|object|link - * @return integer + * @return int * @since 0.10.0 */ public static function countElements($container, $mediaType = null) @@ -157,13 +157,15 @@ class Media $elements[$key] = $val; } } + return $elements; - } else { - if (!isset(self::$elements[$container])) { - return $elements; - } - return self::getElementsByType($container, $type); } + + if (!isset(self::$elements[$container])) { + return $elements; + } + + return self::getElementsByType($container, $type); } /** @@ -208,7 +210,7 @@ class Media * @param string $type * @param \PhpOffice\PhpWord\Element\Image $image * - * @return integer + * @return int * * @codeCoverageIgnore */ @@ -224,7 +226,7 @@ class Media * * @param string $linkSrc * - * @return integer + * @return int * * @codeCoverageIgnore */ @@ -256,7 +258,7 @@ class Media * * @param string $key * - * @return integer + * @return int * * @codeCoverageIgnore */ @@ -270,11 +272,11 @@ class Media * * @deprecated 0.10.0 * - * @param integer $headerCount + * @param int $headerCount * @param string $src * @param \PhpOffice\PhpWord\Element\Image $image * - * @return integer + * @return int * * @codeCoverageIgnore */ @@ -290,7 +292,7 @@ class Media * * @param string $key * - * @return integer + * @return int * * @codeCoverageIgnore */ @@ -318,11 +320,11 @@ class Media * * @deprecated 0.10.0 * - * @param integer $footerCount + * @param int $footerCount * @param string $src * @param \PhpOffice\PhpWord\Element\Image $image * - * @return integer + * @return int * * @codeCoverageIgnore */ @@ -338,7 +340,7 @@ class Media * * @param string $key * - * @return integer + * @return int * * @codeCoverageIgnore */ diff --git a/src/PhpWord/Metadata/Compatibility.php b/src/PhpWord/Metadata/Compatibility.php index eb93274d..69f6f98a 100644 --- a/src/PhpWord/Metadata/Compatibility.php +++ b/src/PhpWord/Metadata/Compatibility.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -21,7 +21,7 @@ namespace PhpOffice\PhpWord\Metadata; * Compatibility setting class * * @since 0.12.0 - * @link http://www.datypic.com/sc/ooxml/t-w_CT_Compat.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_Compat.html */ class Compatibility { @@ -33,7 +33,7 @@ class Compatibility * 15 = 2013 * * @var int - * @link http://msdn.microsoft.com/en-us/library/dd909048%28v=office.12%29.aspx + * @see http://msdn.microsoft.com/en-us/library/dd909048%28v=office.12%29.aspx */ private $ooxmlVersion = 12; diff --git a/src/PhpWord/Metadata/DocInfo.php b/src/PhpWord/Metadata/DocInfo.php index 63a7d515..0508dcd0 100644 --- a/src/PhpWord/Metadata/DocInfo.php +++ b/src/PhpWord/Metadata/DocInfo.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -119,17 +119,17 @@ class DocInfo */ public function __construct() { - $this->creator = ''; + $this->creator = ''; $this->lastModifiedBy = $this->creator; - $this->created = time(); - $this->modified = time(); - $this->title = ''; - $this->subject = ''; - $this->description = ''; - $this->keywords = ''; - $this->category = ''; - $this->company = ''; - $this->manager = ''; + $this->created = time(); + $this->modified = time(); + $this->title = ''; + $this->subject = ''; + $this->description = ''; + $this->keywords = ''; + $this->category = ''; + $this->company = ''; + $this->manager = ''; } /** @@ -399,7 +399,7 @@ class DocInfo * Check if a Custom Property is defined * * @param string $propertyName - * @return boolean + * @return bool */ public function isCustomPropertySet($propertyName) { @@ -416,9 +416,9 @@ class DocInfo { if ($this->isCustomPropertySet($propertyName)) { return $this->customProperties[$propertyName]['value']; - } else { - return null; } + + return null; } /** @@ -431,9 +431,9 @@ class DocInfo { if ($this->isCustomPropertySet($propertyName)) { return $this->customProperties[$propertyName]['type']; - } else { - return null; } + + return null; } /** @@ -456,7 +456,7 @@ class DocInfo self::PROPERTY_TYPE_FLOAT, self::PROPERTY_TYPE_STRING, self::PROPERTY_TYPE_DATE, - self::PROPERTY_TYPE_BOOLEAN + self::PROPERTY_TYPE_BOOLEAN, ); if (($propertyType === null) || (!in_array($propertyType, $propertyTypes))) { if ($propertyValue === null) { @@ -474,8 +474,9 @@ class DocInfo $this->customProperties[$propertyName] = array( 'value' => $propertyValue, - 'type' => $propertyType + 'type' => $propertyType, ); + return $this; } diff --git a/src/PhpWord/Metadata/Protection.php b/src/PhpWord/Metadata/Protection.php index 0e2ee7c1..ef5063f8 100644 --- a/src/PhpWord/Metadata/Protection.php +++ b/src/PhpWord/Metadata/Protection.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -21,7 +21,7 @@ namespace PhpOffice\PhpWord\Metadata; * Document protection class * * @since 0.12.0 - * @link http://www.datypic.com/sc/ooxml/t-w_CT_DocProtect.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_DocProtect.html * @todo Password! */ class Protection @@ -30,7 +30,7 @@ class Protection * Editing restriction readOnly|comments|trackedChanges|forms * * @var string - * @link http://www.datypic.com/sc/ooxml/a-w_edit-1.html + * @see http://www.datypic.com/sc/ooxml/a-w_edit-1.html */ private $editing; diff --git a/src/PhpWord/Metadata/Settings.php b/src/PhpWord/Metadata/Settings.php index 64788cc3..85c0659d 100644 --- a/src/PhpWord/Metadata/Settings.php +++ b/src/PhpWord/Metadata/Settings.php @@ -10,30 +10,30 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Metadata; use PhpOffice\PhpWord\ComplexType\ProofState; -use PhpOffice\PhpWord\SimpleType\Zoom; use PhpOffice\PhpWord\ComplexType\TrackChangesView; +use PhpOffice\PhpWord\SimpleType\Zoom; use PhpOffice\PhpWord\Style\Language; /** * Setting class * * @since 0.14.0 - * @link http://www.datypic.com/sc/ooxml/t-w_CT_Settings.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_Settings.html */ class Settings { - /** * Magnification Setting * - * @link http://www.datypic.com/sc/ooxml/e-w_zoom-1.html + * @see http://www.datypic.com/sc/ooxml/e-w_zoom-1.html * @var mixed either integer, in which case it treated as a percent, or one of PhpOffice\PhpWord\SimpleType\Zoom */ private $zoom = 100; @@ -41,14 +41,14 @@ class Settings /** * Hide spelling errors * - * @var boolean + * @var bool */ private $hideSpellingErrors = false; /** * Hide grammatical errors * - * @var boolean + * @var bool */ private $hideGrammaticalErrors = false; @@ -62,21 +62,21 @@ class Settings /** * Track Revisions to Document * - * @var boolean + * @var bool */ private $trackRevisions = false; /** * Do Not Use Move Syntax When Tracking Revisions * - * @var boolean + * @var bool */ private $doNotTrackMoves = false; /** * Do Not Track Formatting Revisions When Tracking Revisions * - * @var boolean + * @var bool */ private $doNotTrackFormatting = false; @@ -103,7 +103,7 @@ class Settings /** * Theme Font Languages - * + * * @var Language */ private $themeFontLang; @@ -123,6 +123,7 @@ class Settings if ($this->documentProtection == null) { $this->documentProtection = new Protection(); } + return $this->documentProtection; } @@ -142,6 +143,7 @@ class Settings if ($this->proofState == null) { $this->proofState = new ProofState(); } + return $this->proofState; } @@ -156,7 +158,7 @@ class Settings /** * Are spelling errors hidden * - * @return boolean + * @return bool */ public function hasHideSpellingErrors() { @@ -166,7 +168,7 @@ class Settings /** * Hide spelling errors * - * @param boolean $hideSpellingErrors + * @param bool $hideSpellingErrors */ public function setHideSpellingErrors($hideSpellingErrors) { @@ -176,7 +178,7 @@ class Settings /** * Are grammatical errors hidden * - * @return boolean + * @return bool */ public function hasHideGrammaticalErrors() { @@ -186,7 +188,7 @@ class Settings /** * Hide grammatical errors * - * @param boolean $hideGrammaticalErrors + * @param bool $hideGrammaticalErrors */ public function setHideGrammaticalErrors($hideGrammaticalErrors) { @@ -194,7 +196,7 @@ class Settings } /** - * @return boolean + * @return bool */ public function hasEvenAndOddHeaders() { @@ -202,7 +204,7 @@ class Settings } /** - * @param boolean $evenAndOddHeaders + * @param bool $evenAndOddHeaders */ public function setEvenAndOddHeaders($evenAndOddHeaders) { @@ -230,7 +232,7 @@ class Settings } /** - * @return boolean + * @return bool */ public function hasTrackRevisions() { @@ -238,7 +240,7 @@ class Settings } /** - * @param boolean $trackRevisions + * @param bool $trackRevisions */ public function setTrackRevisions($trackRevisions) { @@ -246,7 +248,7 @@ class Settings } /** - * @return boolean + * @return bool */ public function hasDoNotTrackMoves() { @@ -254,7 +256,7 @@ class Settings } /** - * @param boolean $doNotTrackMoves + * @param bool $doNotTrackMoves */ public function setDoNotTrackMoves($doNotTrackMoves) { @@ -262,7 +264,7 @@ class Settings } /** - * @return boolean + * @return bool */ public function hasDoNotTrackFormatting() { @@ -270,7 +272,7 @@ class Settings } /** - * @param boolean $doNotTrackFormatting + * @param bool $doNotTrackFormatting */ public function setDoNotTrackFormatting($doNotTrackFormatting) { @@ -301,7 +303,7 @@ class Settings /** * Returns the Language - * + * * @return Language */ public function getThemeFontLang() @@ -311,7 +313,7 @@ class Settings /** * sets the Language for this document - * + * * @param Language $themeFontLang */ public function setThemeFontLang($themeFontLang) diff --git a/src/PhpWord/PhpWord.php b/src/PhpWord/PhpWord.php index 1571537e..d7c2348a 100644 --- a/src/PhpWord/PhpWord.php +++ b/src/PhpWord/PhpWord.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -108,9 +108,9 @@ class PhpWord * @param mixed $function * @param mixed $args * - * @return mixed - * * @throws \BadMethodCallException + * + * @return mixed */ public function __call($function, $args) { @@ -241,7 +241,6 @@ class PhpWord * Set default font name. * * @param string $fontName - * @return void */ public function setDefaultFontName($fontName) { @@ -251,7 +250,7 @@ class PhpWord /** * Get default font size * - * @return integer + * @return int */ public function getDefaultFontSize() { @@ -262,7 +261,6 @@ class PhpWord * Set default font size. * * @param int $fontSize - * @return void */ public function setDefaultFontSize($fontSize) { @@ -285,21 +283,20 @@ class PhpWord * * @deprecated 0.12.0 Use `new TemplateProcessor($documentTemplate)` instead. * - * @param string $filename Fully qualified filename. - * - * @return TemplateProcessor + * @param string $filename Fully qualified filename * * @throws \PhpOffice\PhpWord\Exception\Exception * + * @return TemplateProcessor + * * @codeCoverageIgnore */ public function loadTemplate($filename) { if (file_exists($filename)) { return new TemplateProcessor($filename); - } else { - throw new Exception("Template file {$filename} not found."); } + throw new Exception("Template file {$filename} not found."); } /** @@ -325,7 +322,7 @@ class PhpWord $writer = IOFactory::createWriter($this, $format); if ($download === true) { - header("Content-Description: File Transfer"); + header('Content-Description: File Transfer'); header('Content-Disposition: attachment; filename="' . $filename . '"'); header('Content-Type: ' . $mime[$format]); header('Content-Transfer-Encoding: binary'); diff --git a/src/PhpWord/Reader/AbstractReader.php b/src/PhpWord/Reader/AbstractReader.php index 93288c3b..f59a9556 100644 --- a/src/PhpWord/Reader/AbstractReader.php +++ b/src/PhpWord/Reader/AbstractReader.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -62,6 +62,7 @@ abstract class AbstractReader implements ReaderInterface public function setReadDataOnly($value = true) { $this->readDataOnly = $value; + return $this; } @@ -70,21 +71,21 @@ abstract class AbstractReader implements ReaderInterface * * @param string $filename * - * @return resource - * * @throws \PhpOffice\PhpWord\Exception\Exception + * + * @return resource */ protected function openFile($filename) { // Check if file exists if (!file_exists($filename) || !is_readable($filename)) { - throw new Exception("Could not open " . $filename . " for reading! File does not exist."); + throw new Exception("Could not open $filename for reading! File does not exist."); } // Open file $this->fileHandle = fopen($filename, 'r'); if ($this->fileHandle === false) { - throw new Exception("Could not open file " . $filename . " for reading."); + throw new Exception("Could not open file $filename for reading."); } } diff --git a/src/PhpWord/Reader/HTML.php b/src/PhpWord/Reader/HTML.php index 824573e9..4e8b5e82 100644 --- a/src/PhpWord/Reader/HTML.php +++ b/src/PhpWord/Reader/HTML.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/MsDoc.php b/src/PhpWord/Reader/MsDoc.php index b3fdd9d4..9baacb51 100644 --- a/src/PhpWord/Reader/MsDoc.php +++ b/src/PhpWord/Reader/MsDoc.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -19,8 +19,8 @@ namespace PhpOffice\PhpWord\Reader; use PhpOffice\Common\Drawing; use PhpOffice\PhpWord\PhpWord; -use PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\Shared\OLERead; +use PhpOffice\PhpWord\Style; /** * Reader for Word97 @@ -164,13 +164,14 @@ class MsDoc extends AbstractReader implements ReaderInterface $arrayCP[$inc] = self::getInt4d($data, $posMem); $posMem += 4; } + return $arrayCP; } /** - * - * @link http://msdn.microsoft.com/en-us/library/dd949344%28v=office.12%29.aspx - * @link https://igor.io/2012/09/24/binary-parsing.html + * @see http://msdn.microsoft.com/en-us/library/dd949344%28v=office.12%29.aspx + * @see https://igor.io/2012/09/24/binary-parsing.html + * @param string $data */ private function readFib($data) { @@ -1095,6 +1096,7 @@ class MsDoc extends AbstractReader implements ReaderInterface $this->arrayFib['lcbColorSchemeMapping'] = self::getInt4d($data, $pos); $pos += 4; } + return $pos; } @@ -1107,11 +1109,11 @@ class MsDoc extends AbstractReader implements ReaderInterface $this->readRecordPlcfSed(); // reading paragraphs - //@link https://github.com/notmasteryet/CompoundFile/blob/ec118f354efebdee9102e41b5b7084fce81125b0/WordFileReader/WordDocument.cs#L86 + //@see https://github.com/notmasteryet/CompoundFile/blob/ec118f354efebdee9102e41b5b7084fce81125b0/WordFileReader/WordDocument.cs#L86 $this->readRecordPlcfBtePapx(); // reading character formattings - //@link https://github.com/notmasteryet/CompoundFile/blob/ec118f354efebdee9102e41b5b7084fce81125b0/WordFileReader/WordDocument.cs#L94 + //@see https://github.com/notmasteryet/CompoundFile/blob/ec118f354efebdee9102e41b5b7084fce81125b0/WordFileReader/WordDocument.cs#L94 $this->readRecordPlcfBteChpx(); $this->generatePhpWord(); @@ -1119,7 +1121,7 @@ class MsDoc extends AbstractReader implements ReaderInterface /** * Section and information about them - * @link : http://msdn.microsoft.com/en-us/library/dd924458%28v=office.12%29.aspx + * @see : http://msdn.microsoft.com/en-us/library/dd924458%28v=office.12%29.aspx */ private function readRecordPlcfSed() { @@ -1133,7 +1135,7 @@ class MsDoc extends AbstractReader implements ReaderInterface $posMem += 4; // PlcfSed : aSed - //@link : http://msdn.microsoft.com/en-us/library/dd950194%28v=office.12%29.aspx + //@see : http://msdn.microsoft.com/en-us/library/dd950194%28v=office.12%29.aspx $numSed = $this->getNumInLcb($this->arrayFib['lcbPlcfSed'], 12); $aSed = array(); @@ -1164,7 +1166,7 @@ class MsDoc extends AbstractReader implements ReaderInterface /** * Specifies the fonts that are used in the document - * @link : http://msdn.microsoft.com/en-us/library/dd943880%28v=office.12%29.aspx + * @see : http://msdn.microsoft.com/en-us/library/dd943880%28v=office.12%29.aspx */ private function readRecordSttbfFfn() { @@ -1215,7 +1217,7 @@ class MsDoc extends AbstractReader implements ReaderInterface } $this->arrayFonts[] = array( 'main' => $xszFfn, - 'alt' => $xszAlt, + 'alt' => $xszAlt, ); } } @@ -1223,7 +1225,7 @@ class MsDoc extends AbstractReader implements ReaderInterface /** * Paragraph and information about them - * @link http://msdn.microsoft.com/en-us/library/dd908569%28v=office.12%29.aspx + * @see http://msdn.microsoft.com/en-us/library/dd908569%28v=office.12%29.aspx */ private function readRecordPlcfBtePapx() { @@ -1247,7 +1249,7 @@ class MsDoc extends AbstractReader implements ReaderInterface } $arrayRGB = array(); for ($inc = 1; $inc <= $numRun; $inc++) { - // @link http://msdn.microsoft.com/en-us/library/dd925804(v=office.12).aspx + // @see http://msdn.microsoft.com/en-us/library/dd925804(v=office.12).aspx $arrayRGB[$inc] = self::getInt1d($this->dataWorkDocument, $offset); $offset += 1; // reserved @@ -1426,7 +1428,7 @@ class MsDoc extends AbstractReader implements ReaderInterface } else { if ($istd > 0) { // @todo : Determining Properties of a Paragraph Style - # @link http://msdn.microsoft.com/en-us/library/dd948631%28v=office.12%29.aspx + # @see http://msdn.microsoft.com/en-us/library/dd948631%28v=office.12%29.aspx } } }*/ @@ -1435,7 +1437,7 @@ class MsDoc extends AbstractReader implements ReaderInterface /** * Character formatting properties to text in a document - * @link http://msdn.microsoft.com/en-us/library/dd907108%28v=office.12%29.aspx + * @see http://msdn.microsoft.com/en-us/library/dd907108%28v=office.12%29.aspx */ private function readRecordPlcfBteChpx() { @@ -1453,7 +1455,7 @@ class MsDoc extends AbstractReader implements ReaderInterface $offset = $offsetBase; // ChpxFkp - // @link : http://msdn.microsoft.com/en-us/library/dd910989%28v=office.12%29.aspx + // @see : http://msdn.microsoft.com/en-us/library/dd910989%28v=office.12%29.aspx $numRGFC = self::getInt1d($this->dataWorkDocument, $offset + 511); $arrayRGFC = array(); for ($inc = 0; $inc <= $numRGFC; $inc++) { @@ -1471,12 +1473,12 @@ class MsDoc extends AbstractReader implements ReaderInterface foreach ($arrayRGB as $keyRGB => $rgb) { $oStyle = new \stdClass(); $oStyle->pos_start = $start; - $oStyle->pos_len = (int)ceil((($arrayRGFC[$keyRGB] -1) - $arrayRGFC[$keyRGB -1]) / 2); + $oStyle->pos_len = (int) ceil((($arrayRGFC[$keyRGB] - 1) - $arrayRGFC[$keyRGB - 1]) / 2); $start += $oStyle->pos_len; if ($rgb > 0) { // Chp Structure - // @link : http://msdn.microsoft.com/en-us/library/dd772849%28v=office.12%29.aspx + // @see : http://msdn.microsoft.com/en-us/library/dd772849%28v=office.12%29.aspx $posRGB = $offsetBase + $rgb * 2; $cb = self::getInt1d($this->dataWorkDocument, $posRGB); @@ -1500,12 +1502,13 @@ class MsDoc extends AbstractReader implements ReaderInterface $oSprm->f = ($sprm / 512) & 0x0001; $oSprm->sgc = ($sprm / 1024) & 0x0007; $oSprm->spra = ($sprm / 8192); + return $oSprm; } /** * @param string $data - * @param integer $pos + * @param int $pos * @param \stdClass $oSprm * @return array */ @@ -1558,16 +1561,17 @@ class MsDoc extends AbstractReader implements ReaderInterface } return array( - 'length' => $length, + 'length' => $length, 'operand' => $operand, ); } /** - * @param $data integer - * @param $pos integer + * @param $data int + * @param $pos int + * @param $cbNum int * @return \stdClass - * @link http://msdn.microsoft.com/en-us/library/dd772849%28v=office.12%29.aspx + * @see http://msdn.microsoft.com/en-us/library/dd772849%28v=office.12%29.aspx */ private function readPrl($data, $pos, $cbNum) { @@ -1732,7 +1736,7 @@ class MsDoc extends AbstractReader implements ReaderInterface } break; // sprmCIco - //@link http://msdn.microsoft.com/en-us/library/dd773060%28v=office.12%29.aspx + //@see http://msdn.microsoft.com/en-us/library/dd773060%28v=office.12%29.aspx case 0x42: switch (dechex($operand)) { case 0x00: @@ -1787,7 +1791,7 @@ class MsDoc extends AbstractReader implements ReaderInterface break; // sprmCHps case 0x43: - $oStylePrl->styleFont['size'] = dechex($operand/2); + $oStylePrl->styleFont['size'] = dechex($operand / 2); break; // sprmCIss case 0x48: @@ -1838,7 +1842,7 @@ class MsDoc extends AbstractReader implements ReaderInterface case 0x61: break; // sprmCShd80 - //@link http://msdn.microsoft.com/en-us/library/dd923447%28v=office.12%29.aspx + //@see http://msdn.microsoft.com/en-us/library/dd923447%28v=office.12%29.aspx case 0x66: // $operand = self::getInt2d($data, $pos); $pos += 2; @@ -1848,7 +1852,7 @@ class MsDoc extends AbstractReader implements ReaderInterface // $icoFore = ($operand >> 11) && bindec('11111'); break; // sprmCCv - //@link : http://msdn.microsoft.com/en-us/library/dd952824%28v=office.12%29.aspx + //@see : http://msdn.microsoft.com/en-us/library/dd952824%28v=office.12%29.aspx case 0x70: $red = str_pad(dechex(self::getInt1d($this->dataWorkDocument, $pos)), 2, '0', STR_PAD_LEFT); $pos += 1; @@ -1857,7 +1861,7 @@ class MsDoc extends AbstractReader implements ReaderInterface $blue = str_pad(dechex(self::getInt1d($this->dataWorkDocument, $pos)), 2, '0', STR_PAD_LEFT); $pos += 1; $pos += 1; - $oStylePrl->styleFont['color'] = $red.$green.$blue; + $oStylePrl->styleFont['color'] = $red . $green . $blue; $cbNum -= 4; break; default: @@ -1950,7 +1954,7 @@ class MsDoc extends AbstractReader implements ReaderInterface // HFD > clsid $sprmCPicLocation += 16; // HFD > hyperlink - //@link : http://msdn.microsoft.com/en-us/library/dd909835%28v=office.12%29.aspx + //@see : http://msdn.microsoft.com/en-us/library/dd909835%28v=office.12%29.aspx $streamVersion = self::getInt4d($this->dataData, $sprmCPicLocation); $sprmCPicLocation += 4; $data = self::getInt4d($this->dataData, $sprmCPicLocation); @@ -2018,8 +2022,8 @@ class MsDoc extends AbstractReader implements ReaderInterface }*/ } else { // Pictures - //@link : http://msdn.microsoft.com/en-us/library/dd925458%28v=office.12%29.aspx - //@link : http://msdn.microsoft.com/en-us/library/dd926136%28v=office.12%29.aspx + //@see : http://msdn.microsoft.com/en-us/library/dd925458%28v=office.12%29.aspx + //@see : http://msdn.microsoft.com/en-us/library/dd926136%28v=office.12%29.aspx // PICF : lcb $sprmCPicLocation += 4; // PICF : cbHeader @@ -2106,13 +2110,13 @@ class MsDoc extends AbstractReader implements ReaderInterface $sprmCPicLocation += $shapeRH['recLen']; } // picture : rgfb - //@link : http://msdn.microsoft.com/en-us/library/dd950560%28v=office.12%29.aspx + //@see : http://msdn.microsoft.com/en-us/library/dd950560%28v=office.12%29.aspx $fileBlockRH = $this->loadRecordHeader($this->dataData, $sprmCPicLocation); while ($fileBlockRH['recType'] == 0xF007 || ($fileBlockRH['recType'] >= 0xF018 && $fileBlockRH['recType'] <= 0xF117)) { $sprmCPicLocation += 8; switch ($fileBlockRH['recType']) { // OfficeArtFBSE - //@link : http://msdn.microsoft.com/en-us/library/dd944923%28v=office.12%29.aspx + //@see : http://msdn.microsoft.com/en-us/library/dd944923%28v=office.12%29.aspx case 0xF007: // btWin32 $sprmCPicLocation += 1; @@ -2147,7 +2151,7 @@ class MsDoc extends AbstractReader implements ReaderInterface } } // embeddedBlip - //@link : http://msdn.microsoft.com/en-us/library/dd910081%28v=office.12%29.aspx + //@see : http://msdn.microsoft.com/en-us/library/dd910081%28v=office.12%29.aspx $embeddedBlipRH = $this->loadRecordHeader($this->dataData, $sprmCPicLocation); switch ($embeddedBlipRH['recType']) { case self::OFFICEARTBLIPJPG: @@ -2192,13 +2196,14 @@ class MsDoc extends AbstractReader implements ReaderInterface } $oStylePrl->length = $pos - $posStart; + return $oStylePrl; } /** * Read a record header * @param string $stream - * @param integer $pos + * @param int $pos * @return array */ private function loadRecordHeader($stream, $pos) @@ -2206,11 +2211,12 @@ class MsDoc extends AbstractReader implements ReaderInterface $rec = self::getInt2d($stream, $pos); $recType = self::getInt2d($stream, $pos + 2); $recLen = self::getInt4d($stream, $pos + 4); + return array( - 'recVer' => ($rec >> 0) & bindec('1111'), + 'recVer' => ($rec >> 0) & bindec('1111'), 'recInstance' => ($rec >> 4) & bindec('111111111111'), - 'recType' => $recType, - 'recLen' => $recLen, + 'recType' => $recType, + 'recLen' => $recLen, ); } @@ -2273,7 +2279,7 @@ class MsDoc extends AbstractReader implements ReaderInterface } if (ord($sText[0]) == 1) { if (isset($oCharacters->style->image)) { - $fileImage = tempnam(sys_get_temp_dir(), 'PHPWord_MsDoc').'.'.$oCharacters->style->image['format']; + $fileImage = tempnam(sys_get_temp_dir(), 'PHPWord_MsDoc') . '.' . $oCharacters->style->image['format']; file_put_contents($fileImage, $oCharacters->style->image['data']); $oSection->addImage($fileImage, array('width' => $oCharacters->style->image['width'], 'height' => $oCharacters->style->image['height'])); // print_r('>addImage<'.$fileImage.'>'.EOL); @@ -2308,7 +2314,7 @@ class MsDoc extends AbstractReader implements ReaderInterface */ public static function getInt2d($data, $pos) { - return ord($data[$pos]) | (ord($data[$pos+1]) << 8); + return ord($data[$pos]) | (ord($data[$pos + 1]) << 8); } /** @@ -2320,7 +2326,7 @@ class MsDoc extends AbstractReader implements ReaderInterface */ public static function getInt3d($data, $pos) { - return ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16); + return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16); } /** @@ -2342,6 +2348,7 @@ class MsDoc extends AbstractReader implements ReaderInterface } else { $ord24 = ($or24 & 127) << 24; } - return ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | $ord24; + + return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16) | $ord24; } } diff --git a/src/PhpWord/Reader/ODText.php b/src/PhpWord/Reader/ODText.php index e8c86886..5a22b4ba 100644 --- a/src/PhpWord/Reader/ODText.php +++ b/src/PhpWord/Reader/ODText.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -40,7 +40,7 @@ class ODText extends AbstractReader implements ReaderInterface $readerParts = array( 'content.xml' => 'Content', - 'meta.xml' => 'Meta', + 'meta.xml' => 'Meta', ); foreach ($readerParts as $xmlFile => $partName) { @@ -58,7 +58,6 @@ class ODText extends AbstractReader implements ReaderInterface * @param string $partName * @param string $docFile * @param string $xmlFile - * @return void */ private function readPart(PhpWord $phpWord, $relationships, $partName, $docFile, $xmlFile) { diff --git a/src/PhpWord/Reader/ODText/AbstractPart.php b/src/PhpWord/Reader/ODText/AbstractPart.php index 5ec2f22d..bdac3b6f 100644 --- a/src/PhpWord/Reader/ODText/AbstractPart.php +++ b/src/PhpWord/Reader/ODText/AbstractPart.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/ODText/Content.php b/src/PhpWord/Reader/ODText/Content.php index 0e11147b..8843d8a2 100644 --- a/src/PhpWord/Reader/ODText/Content.php +++ b/src/PhpWord/Reader/ODText/Content.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -31,7 +31,6 @@ class Content extends AbstractPart * Read content.xml. * * @param \PhpOffice\PhpWord\PhpWord $phpWord - * @return void */ public function read(PhpWord $phpWord) { @@ -48,11 +47,9 @@ class Content extends AbstractPart $depth = $xmlReader->getAttribute('text:outline-level', $node); $section->addTitle($node->nodeValue, $depth); break; - case 'text:p': // Paragraph $section->addText($node->nodeValue); break; - case 'text:list': // List $listItems = $xmlReader->getElements('text:list-item/text:p', $node); foreach ($listItems as $listItem) { diff --git a/src/PhpWord/Reader/ODText/Meta.php b/src/PhpWord/Reader/ODText/Meta.php index 9533c38b..98832d17 100644 --- a/src/PhpWord/Reader/ODText/Meta.php +++ b/src/PhpWord/Reader/ODText/Meta.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -31,7 +31,6 @@ class Meta extends AbstractPart * Read meta.xml. * * @param \PhpOffice\PhpWord\PhpWord $phpWord - * @return void * @todo Process property type */ public function read(PhpWord $phpWord) @@ -70,9 +69,8 @@ class Meta extends AbstractPart if (in_array($property, array('Category', 'Company', 'Manager'))) { $method = "set{$property}"; $docProps->$method($propertyNode->nodeValue); - - // Set other custom properties } else { + // Set other custom properties $docProps->setCustomProperty($property, $propertyNode->nodeValue); } } diff --git a/src/PhpWord/Reader/RTF.php b/src/PhpWord/Reader/RTF.php index b6d2e21e..2d09a04d 100644 --- a/src/PhpWord/Reader/RTF.php +++ b/src/PhpWord/Reader/RTF.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/RTF/Document.php b/src/PhpWord/Reader/RTF/Document.php index 4e0f2c35..be16d707 100644 --- a/src/PhpWord/Reader/RTF/Document.php +++ b/src/PhpWord/Reader/RTF/Document.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -131,7 +131,6 @@ class Document * - Pushes every other character into the text queue * * @param \PhpOffice\PhpWord\PhpWord $phpWord - * @return void * @todo Use `fread` stream for scalability */ public function read(PhpWord $phpWord) @@ -153,7 +152,7 @@ class Document // Walk each characters while ($this->offset < $this->length) { - $char = $this->rtf[$this->offset]; + $char = $this->rtf[$this->offset]; $ascii = ord($char); if (isset($markers[$ascii])) { // Marker found: {, }, \, LF, or CR @@ -163,7 +162,7 @@ class Document if (false === $this->isControl) { // Non control word: Push character $this->pushText($char); } else { - if (preg_match("/^[a-zA-Z0-9-]?$/", $char)) { // No delimiter: Buffer control + if (preg_match('/^[a-zA-Z0-9-]?$/', $char)) { // No delimiter: Buffer control $this->control .= $char; $this->isFirst = false; } else { // Delimiter found: Parse buffered control @@ -184,8 +183,6 @@ class Document /** * Mark opening braket `{` character. - * - * @return void */ private function markOpening() { @@ -195,8 +192,6 @@ class Document /** * Mark closing braket `}` character. - * - * @return void */ private function markClosing() { @@ -206,8 +201,6 @@ class Document /** * Mark backslash `\` character. - * - * @return void */ private function markBackslash() { @@ -223,8 +216,6 @@ class Document /** * Mark newline character: Flush control word because it's not possible to span multiline. - * - * @return void */ private function markNewline() { @@ -237,7 +228,6 @@ class Document * Flush control word or text. * * @param bool $isControl - * @return void */ private function flush($isControl = false) { @@ -252,11 +242,10 @@ class Document * Flush control word. * * @param bool $isControl - * @return void */ private function flushControl($isControl = false) { - if (1 === preg_match("/^([A-Za-z]+)(-?[0-9]*) ?$/", $this->control, $match)) { + if (1 === preg_match('/^([A-Za-z]+)(-?[0-9]*) ?$/', $this->control, $match)) { list(, $control, $parameter) = $match; $this->parseControl($control, $parameter); } @@ -268,8 +257,6 @@ class Document /** * Flush text in queue. - * - * @return void */ private function flushText() { @@ -296,7 +283,6 @@ class Document * Reset control word and first char state. * * @param bool $value - * @return void */ private function setControl($value) { @@ -308,14 +294,13 @@ class Document * Push text into queue. * * @param string $char - * @return void */ private function pushText($char) { if ('<' == $char) { - $this->text .= "<"; + $this->text .= '<'; } elseif ('>' == $char) { - $this->text .= ">"; + $this->text .= '>'; } else { $this->text .= $char; } @@ -326,19 +311,18 @@ class Document * * @param string $control * @param string $parameter - * @return void */ private function parseControl($control, $parameter) { $controls = array( 'par' => array(self::PARA, 'paragraph', true), - 'b' => array(self::STYL, 'font', 'bold', true), - 'i' => array(self::STYL, 'font', 'italic', true), - 'u' => array(self::STYL, 'font', 'underline', true), - 'strike' => array(self::STYL, 'font', 'strikethrough',true), - 'fs' => array(self::STYL, 'font', 'size', $parameter), - 'qc' => array(self::STYL, 'paragraph', 'alignment', Jc::CENTER), - 'sa' => array(self::STYL, 'paragraph', 'spaceAfter', $parameter), + 'b' => array(self::STYL, 'font', 'bold', true), + 'i' => array(self::STYL, 'font', 'italic', true), + 'u' => array(self::STYL, 'font', 'underline', true), + 'strike' => array(self::STYL, 'font', 'strikethrough', true), + 'fs' => array(self::STYL, 'font', 'size', $parameter), + 'qc' => array(self::STYL, 'paragraph', 'alignment', Jc::CENTER), + 'sa' => array(self::STYL, 'paragraph', 'spaceAfter', $parameter), 'fonttbl' => array(self::SKIP, 'fonttbl', null), 'colortbl' => array(self::SKIP, 'colortbl', null), 'info' => array(self::SKIP, 'info', null), @@ -366,7 +350,6 @@ class Document * Read paragraph. * * @param array $directives - * @return void */ private function readParagraph($directives) { @@ -379,7 +362,6 @@ class Document * Read style. * * @param array $directives - * @return void */ private function readStyle($directives) { @@ -391,7 +373,6 @@ class Document * Read skip. * * @param array $directives - * @return void */ private function readSkip($directives) { @@ -402,8 +383,6 @@ class Document /** * Read text. - * - * @return void */ private function readText() { diff --git a/src/PhpWord/Reader/ReaderInterface.php b/src/PhpWord/Reader/ReaderInterface.php index 4f5231a7..3b2e357b 100644 --- a/src/PhpWord/Reader/ReaderInterface.php +++ b/src/PhpWord/Reader/ReaderInterface.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -28,7 +28,7 @@ interface ReaderInterface * Can the current ReaderInterface read the file? * * @param string $filename - * @return boolean + * @return bool */ public function canRead($filename); diff --git a/src/PhpWord/Reader/Word2007.php b/src/PhpWord/Reader/Word2007.php index d203dd29..9f9fce08 100644 --- a/src/PhpWord/Reader/Word2007.php +++ b/src/PhpWord/Reader/Word2007.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -55,7 +55,7 @@ class Word2007 extends AbstractReader implements ReaderInterface array('stepPart' => 'document', 'stepItems' => array( 'endnotes' => 'Endnotes', 'footnotes' => 'Footnotes', - 'settings' => 'Settings', + 'settings' => 'Settings', )), ); @@ -83,7 +83,6 @@ class Word2007 extends AbstractReader implements ReaderInterface * @param string $partName * @param string $docFile * @param string $xmlFile - * @return void */ private function readPart(PhpWord $phpWord, $relationships, $partName, $docFile, $xmlFile) { diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index c94a3546..21e12902 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -36,9 +36,9 @@ abstract class AbstractPart */ const READ_VALUE = 'attributeValue'; // Read attribute value const READ_EQUAL = 'attributeEquals'; // Read `true` when attribute value equals specified value - const READ_TRUE = 'attributeTrue'; // Read `true` when element exists + const READ_TRUE = 'attributeTrue'; // Read `true` when element exists const READ_FALSE = 'attributeFalse'; // Read `false` when element exists - const READ_SIZE = 'attributeMultiplyByTwo'; // Read special attribute value for Font::$size + const READ_SIZE = 'attributeMultiplyByTwo'; // Read special attribute value for Font::$size /** * Document file @@ -82,7 +82,6 @@ abstract class AbstractPart * Set relationships. * * @param array $value - * @return void */ public function setRels($value) { @@ -96,7 +95,6 @@ abstract class AbstractPart * @param \DOMElement $domNode * @param mixed $parent * @param string $docPart - * @return void * * @todo Get font style for preserve text */ @@ -137,9 +135,8 @@ abstract class AbstractPart } } $parent->addPreserveText($textContent, $fontStyle, $paragraphStyle); - - // List item } elseif ($xmlReader->elementExists('w:pPr/w:numPr', $domNode)) { + // List item $textContent = ''; $numId = $xmlReader->getAttribute('w:val', $domNode, 'w:pPr/w:numPr/w:numId'); $levelId = $xmlReader->getAttribute('w:val', $domNode, 'w:pPr/w:numPr/w:ilvl'); @@ -148,18 +145,16 @@ abstract class AbstractPart $textContent .= $xmlReader->getValue('w:t', $node); } $parent->addListItem($textContent, $levelId, null, "PHPWordList{$numId}", $paragraphStyle); - - // Heading } elseif (!empty($headingMatches)) { + // Heading $textContent = ''; $nodes = $xmlReader->getElements('w:r', $domNode); foreach ($nodes as $node) { $textContent .= $xmlReader->getValue('w:t', $node); } $parent->addTitle($textContent, $headingMatches[1]); - - // Text and TextRun } else { + // Text and TextRun $runCount = $xmlReader->countElements('w:r', $domNode); $linkCount = $xmlReader->countElements('w:hyperlink', $domNode); $runLinkCount = $runCount + $linkCount; @@ -185,7 +180,6 @@ abstract class AbstractPart * @param mixed $parent * @param string $docPart * @param mixed $paragraphStyle - * @return void * * @todo Footnote paragraph style */ @@ -205,25 +199,22 @@ abstract class AbstractPart $parent->addLink($target, $textContent, $fontStyle, $paragraphStyle); } } else { - // Footnote if ($xmlReader->elementExists('w:footnoteReference', $domNode)) { + // Footnote $parent->addFootnote(); - - // Endnote } elseif ($xmlReader->elementExists('w:endnoteReference', $domNode)) { + // Endnote $parent->addEndnote(); - - // Image } elseif ($xmlReader->elementExists('w:pict', $domNode)) { + // Image $rId = $xmlReader->getAttribute('r:id', $domNode, 'w:pict/v:shape/v:imagedata'); $target = $this->getMediaTarget($docPart, $rId); if (!is_null($target)) { $imageSource = "zip://{$this->docFile}#{$target}"; $parent->addImage($imageSource); } - - // Object } elseif ($xmlReader->elementExists('w:object', $domNode)) { + // Object $rId = $xmlReader->getAttribute('r:id', $domNode, 'w:object/o:OLEObject'); // $rIdIcon = $xmlReader->getAttribute('r:id', $domNode, 'w:object/v:shape/v:imagedata'); $target = $this->getMediaTarget($docPart, $rId); @@ -231,9 +222,8 @@ abstract class AbstractPart $textContent = ""; $parent->addText($textContent, $fontStyle, $paragraphStyle); } - - // TextRun } else { + // TextRun $textContent = $xmlReader->getValue('w:t', $domNode); $parent->addText($textContent, $fontStyle, $paragraphStyle); } @@ -247,7 +237,6 @@ abstract class AbstractPart * @param \DOMElement $domNode * @param mixed $parent * @param string $docPart - * @return void */ protected function readTable(XMLReader $xmlReader, \DOMElement $domNode, $parent, $docPart = 'document') { diff --git a/src/PhpWord/Reader/Word2007/DocPropsApp.php b/src/PhpWord/Reader/Word2007/DocPropsApp.php index 6b1410a5..df34c9c3 100644 --- a/src/PhpWord/Reader/Word2007/DocPropsApp.php +++ b/src/PhpWord/Reader/Word2007/DocPropsApp.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/Word2007/DocPropsCore.php b/src/PhpWord/Reader/Word2007/DocPropsCore.php index 417a93bd..f82c6b4b 100644 --- a/src/PhpWord/Reader/Word2007/DocPropsCore.php +++ b/src/PhpWord/Reader/Word2007/DocPropsCore.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -33,15 +33,15 @@ class DocPropsCore extends AbstractPart * @var array */ protected $mapping = array( - 'dc:creator' => 'setCreator', - 'dc:title' => 'setTitle', - 'dc:description' => 'setDescription', - 'dc:subject' => 'setSubject', - 'cp:keywords' => 'setKeywords', - 'cp:category' => 'setCategory', + 'dc:creator' => 'setCreator', + 'dc:title' => 'setTitle', + 'dc:description' => 'setDescription', + 'dc:subject' => 'setSubject', + 'cp:keywords' => 'setKeywords', + 'cp:category' => 'setCategory', 'cp:lastModifiedBy' => 'setLastModifiedBy', - 'dcterms:created' => 'setCreated', - 'dcterms:modified' => 'setModified', + 'dcterms:created' => 'setCreated', + 'dcterms:modified' => 'setModified', ); /** @@ -55,7 +55,6 @@ class DocPropsCore extends AbstractPart * Read core/extended document properties. * * @param \PhpOffice\PhpWord\PhpWord $phpWord - * @return void */ public function read(PhpWord $phpWord) { diff --git a/src/PhpWord/Reader/Word2007/DocPropsCustom.php b/src/PhpWord/Reader/Word2007/DocPropsCustom.php index 979a2441..a3d6b90b 100644 --- a/src/PhpWord/Reader/Word2007/DocPropsCustom.php +++ b/src/PhpWord/Reader/Word2007/DocPropsCustom.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -32,7 +32,6 @@ class DocPropsCustom extends AbstractPart * Read custom document properties. * * @param \PhpOffice\PhpWord\PhpWord $phpWord - * @return void */ public function read(PhpWord $phpWord) { diff --git a/src/PhpWord/Reader/Word2007/Document.php b/src/PhpWord/Reader/Word2007/Document.php index e5063fd9..ff094bcc 100644 --- a/src/PhpWord/Reader/Word2007/Document.php +++ b/src/PhpWord/Reader/Word2007/Document.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -40,7 +40,6 @@ class Document extends AbstractPart * Read document.xml. * * @param \PhpOffice\PhpWord\PhpWord $phpWord - * @return void */ public function read(PhpWord $phpWord) { @@ -66,7 +65,6 @@ class Document extends AbstractPart * * @param array $settings * @param \PhpOffice\PhpWord\Element\Section &$section - * @return void */ private function readHeaderFooter($settings, Section &$section) { @@ -131,7 +129,7 @@ class Document extends AbstractPart $id = $xmlReader->getAttribute('r:id', $node); $styles['hf'][$id] = array( 'method' => str_replace('w:', '', str_replace('Reference', '', $node->nodeName)), - 'type' => $xmlReader->getAttribute('w:type', $node), + 'type' => $xmlReader->getAttribute('w:type', $node), ); } } @@ -145,7 +143,6 @@ class Document extends AbstractPart * @param \PhpOffice\Common\XMLReader $xmlReader * @param \DOMElement $node * @param \PhpOffice\PhpWord\Element\Section &$section - * @return void * * @todo */ @@ -175,7 +172,6 @@ class Document extends AbstractPart * @param \PhpOffice\Common\XMLReader $xmlReader * @param \DOMElement $node * @param \PhpOffice\PhpWord\Element\Section &$section - * @return void */ private function readWSectPrNode(XMLReader $xmlReader, \DOMElement $node, Section &$section) { diff --git a/src/PhpWord/Reader/Word2007/Endnotes.php b/src/PhpWord/Reader/Word2007/Endnotes.php index 7bcafc6a..0f46cb2f 100644 --- a/src/PhpWord/Reader/Word2007/Endnotes.php +++ b/src/PhpWord/Reader/Word2007/Endnotes.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/Word2007/Footnotes.php b/src/PhpWord/Reader/Word2007/Footnotes.php index 3d85af71..61988723 100644 --- a/src/PhpWord/Reader/Word2007/Footnotes.php +++ b/src/PhpWord/Reader/Word2007/Footnotes.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -45,7 +45,6 @@ class Footnotes extends AbstractPart * Read (footnotes|endnotes).xml. * * @param \PhpOffice\PhpWord\PhpWord $phpWord - * @return void */ public function read(PhpWord $phpWord) { diff --git a/src/PhpWord/Reader/Word2007/Numbering.php b/src/PhpWord/Reader/Word2007/Numbering.php index a00a6307..c2a81dd5 100644 --- a/src/PhpWord/Reader/Word2007/Numbering.php +++ b/src/PhpWord/Reader/Word2007/Numbering.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -31,7 +31,6 @@ class Numbering extends AbstractPart * Read numbering.xml. * * @param \PhpOffice\PhpWord\PhpWord $phpWord - * @return void */ public function read(PhpWord $phpWord) { @@ -92,7 +91,7 @@ class Numbering extends AbstractPart * * @param \PhpOffice\Common\XMLReader $xmlReader * @param \DOMElement $subnode - * @param integer $levelId + * @param int $levelId * @return array */ private function readLevel(XMLReader $xmlReader, \DOMElement $subnode, $levelId) diff --git a/src/PhpWord/Reader/Word2007/Settings.php b/src/PhpWord/Reader/Word2007/Settings.php index 581d6b3d..2580209e 100644 --- a/src/PhpWord/Reader/Word2007/Settings.php +++ b/src/PhpWord/Reader/Word2007/Settings.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -29,14 +29,12 @@ use PhpOffice\PhpWord\Style\Language; */ class Settings extends AbstractPart { - private static $booleanProperties = array('hideSpellingErrors', 'hideGrammaticalErrors', 'trackRevisions', 'doNotTrackMoves', 'doNotTrackFormatting', 'evenAndOddHeaders'); /** * Read settings.xml. * * @param \PhpOffice\PhpWord\PhpWord $phpWord - * @return void */ public function read(PhpWord $phpWord) { @@ -58,9 +56,9 @@ class Settings extends AbstractPart } else { $docSettings->$method(true); } - } else if (method_exists($this, $method)) { + } elseif (method_exists($this, $method)) { $this->$method($xmlReader, $phpWord, $node); - } else if (method_exists($docSettings, $method)) { + } elseif (method_exists($docSettings, $method)) { $docSettings->$method($value); } } @@ -69,14 +67,13 @@ class Settings extends AbstractPart /** * Sets the document Language - * + * * @param XMLReader $xmlReader * @param PhpWord $phpWord * @param \DOMNode $node */ protected function setThemeFontLang(XMLReader $xmlReader, PhpWord $phpWord, \DOMElement $node) { - $val = $xmlReader->getAttribute('w:val', $node); $eastAsia = $xmlReader->getAttribute('w:eastAsia', $node); $bidi = $xmlReader->getAttribute('w:bidi', $node); diff --git a/src/PhpWord/Reader/Word2007/Styles.php b/src/PhpWord/Reader/Word2007/Styles.php index c38ca144..b8e6f22b 100644 --- a/src/PhpWord/Reader/Word2007/Styles.php +++ b/src/PhpWord/Reader/Word2007/Styles.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -31,7 +31,6 @@ class Styles extends AbstractPart * Read styles.xml. * * @param \PhpOffice\PhpWord\PhpWord $phpWord - * @return void */ public function read(PhpWord $phpWord) { @@ -64,14 +63,12 @@ class Styles extends AbstractPart } } break; - case 'character': $fontStyle = $this->readFontStyle($xmlReader, $node); if (!empty($fontStyle)) { $phpWord->addFontStyle($name, $fontStyle); } break; - case 'table': $tStyle = $this->readTableStyle($xmlReader, $node); if (!empty($tStyle)) { diff --git a/src/PhpWord/Settings.php b/src/PhpWord/Settings.php index 5309baf7..91efa1a6 100644 --- a/src/PhpWord/Settings.php +++ b/src/PhpWord/Settings.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -30,8 +30,8 @@ class Settings * @const string */ const ZIPARCHIVE = 'ZipArchive'; - const PCLZIP = 'PclZip'; - const OLD_LIB = 'PhpOffice\\PhpWord\\Shared\\ZipArchive'; // @deprecated 0.11 + const PCLZIP = 'PclZip'; + const OLD_LIB = 'PhpOffice\\PhpWord\\Shared\\ZipArchive'; // @deprecated 0.11 /** * PDF rendering libraries @@ -39,8 +39,8 @@ class Settings * @const string */ const PDF_RENDERER_DOMPDF = 'DomPDF'; - const PDF_RENDERER_TCPDF = 'TCPDF'; - const PDF_RENDERER_MPDF = 'MPDF'; + const PDF_RENDERER_TCPDF = 'TCPDF'; + const PDF_RENDERER_MPDF = 'MPDF'; /** * Measurement units multiplication factor @@ -53,12 +53,12 @@ class Settings * * @const string */ - const UNIT_TWIP = 'twip'; // = 1/20 point - const UNIT_CM = 'cm'; - const UNIT_MM = 'mm'; - const UNIT_INCH = 'inch'; + const UNIT_TWIP = 'twip'; // = 1/20 point + const UNIT_CM = 'cm'; + const UNIT_MM = 'mm'; + const UNIT_INCH = 'inch'; const UNIT_POINT = 'point'; // = 1/72 inch - const UNIT_PICA = 'pica'; // = 1/6 inch = 12 points + const UNIT_PICA = 'pica'; // = 1/6 inch = 12 points /** * Default font settings @@ -154,7 +154,7 @@ class Settings */ public static function setCompatibility($compatibility) { - $compatibility = (bool)$compatibility; + $compatibility = (bool) $compatibility; self::$xmlWriterCompatibility = $compatibility; return true; @@ -180,6 +180,7 @@ class Settings { if (in_array($zipClass, array(self::PCLZIP, self::ZIPARCHIVE, self::OLD_LIB))) { self::$zipClass = $zipClass; + return true; } @@ -229,7 +230,6 @@ class Settings return true; } - /** * Return the directory path to the PDF Rendering Library. * @@ -275,7 +275,7 @@ class Settings public static function setMeasurementUnit($value) { $units = array(self::UNIT_TWIP, self::UNIT_CM, self::UNIT_MM, self::UNIT_INCH, - self::UNIT_POINT, self::UNIT_PICA); + self::UNIT_POINT, self::UNIT_PICA, ); if (!in_array($value, $units)) { return false; } @@ -289,9 +289,7 @@ class Settings * * @since 0.12.0 * - * @param string $tempDir The user defined path to temporary directory. - * - * @return void + * @param string $tempDir The user defined path to temporary directory */ public static function setTempDir($tempDir) { @@ -319,7 +317,7 @@ class Settings /** * @since 0.13.0 * - * @return boolean + * @return bool * * @codeCoverageIgnore */ @@ -331,7 +329,7 @@ class Settings /** * @since 0.13.0 * - * @param boolean $outputEscapingEnabled + * @param bool $outputEscapingEnabled * * @codeCoverageIgnore */ @@ -360,6 +358,7 @@ class Settings { if (is_string($value) && trim($value) !== '') { self::$defaultFontName = $value; + return true; } @@ -369,7 +368,7 @@ class Settings /** * Get default font size * - * @return integer + * @return int */ public static function getDefaultFontSize() { @@ -384,9 +383,10 @@ class Settings */ public static function setDefaultFontSize($value) { - $value = intval($value); + $value = (int) $value; if ($value > 0) { self::$defaultFontSize = $value; + return true; } diff --git a/src/PhpWord/Shared/AbstractEnum.php b/src/PhpWord/Shared/AbstractEnum.php index 35a5749a..d7839c4f 100644 --- a/src/PhpWord/Shared/AbstractEnum.php +++ b/src/PhpWord/Shared/AbstractEnum.php @@ -3,7 +3,6 @@ namespace PhpOffice\PhpWord\Shared; abstract class AbstractEnum { - private static $constCacheArray = null; private static function getConstants() @@ -12,10 +11,11 @@ abstract class AbstractEnum self::$constCacheArray = array(); } $calledClass = get_called_class(); - if (! array_key_exists($calledClass, self::$constCacheArray)) { + if (!array_key_exists($calledClass, self::$constCacheArray)) { $reflect = new \ReflectionClass($calledClass); self::$constCacheArray[$calledClass] = $reflect->getConstants(); } + return self::$constCacheArray[$calledClass]; } @@ -33,11 +33,12 @@ abstract class AbstractEnum * Returns true the value is valid for this enum * * @param strign $value - * @return boolean true if value is valid + * @return bool true if value is valid */ public static function isValid($value) { $values = array_values(self::getConstants()); + return in_array($value, $values, true); } diff --git a/src/PhpWord/Shared/Converter.php b/src/PhpWord/Shared/Converter.php index e5cb5b25..6ba2b567 100644 --- a/src/PhpWord/Shared/Converter.php +++ b/src/PhpWord/Shared/Converter.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -22,12 +22,12 @@ namespace PhpOffice\PhpWord\Shared; */ class Converter { - const INCH_TO_CM = 2.54; - const INCH_TO_TWIP = 1440; - const INCH_TO_PIXEL = 96; - const INCH_TO_POINT = 72; - const PIXEL_TO_EMU = 9525; - const DEGREE_TO_ANGLE = 60000; + const INCH_TO_CM = 2.54; + const INCH_TO_TWIP = 1440; + const INCH_TO_PIXEL = 96; + const INCH_TO_POINT = 72; + const PIXEL_TO_EMU = 9525; + const DEGREE_TO_ANGLE = 60000; /** * Convert centimeter to twip @@ -235,7 +235,7 @@ class Converter */ public static function degreeToAngle($degree = 1) { - return (int)round($degree * self::DEGREE_TO_ANGLE); + return (int) round($degree * self::DEGREE_TO_ANGLE); } /** diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index d03d0adf..670ba6e5 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -34,7 +34,6 @@ class Html * @param \PhpOffice\PhpWord\Element\AbstractContainer $element Where the parts need to be added * @param string $html The code to parse * @param bool $fullHTML If it's a full HTML, no need to add 'body' tag - * @return void */ public static function addHtml($element, $html, $fullHTML = false) { @@ -95,7 +94,6 @@ class Html * @param \PhpOffice\PhpWord\Element\AbstractContainer $element object to add an element corresponding with the node * @param array $styles Array with all styles * @param array $data Array to transport data to a next level in the DOM tree, for example level of listitems - * @return void */ protected static function parseNode($node, $element, $styles = array(), $data = array()) { @@ -169,7 +167,6 @@ class Html * @param \PhpOffice\PhpWord\Element\AbstractContainer $element * @param array $styles * @param array $data - * @return void */ private static function parseChildNodes($node, $element, $styles, $data) { @@ -226,7 +223,6 @@ class Html * @param \DOMNode $node * @param \PhpOffice\PhpWord\Element\AbstractContainer $element * @param array &$styles - * @return null */ private static function parseText($node, $element, &$styles) { @@ -235,7 +231,7 @@ class Html // 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']); + $element->addText($node->nodeValue, $styles['font'], $styles['paragraph']); // } return null; @@ -247,7 +243,6 @@ class Html * @param array &$styles * @param string $argument1 Style name * @param string $argument2 Style value - * @return null */ private static function parseProperty(&$styles, $argument1, $argument2) { @@ -275,14 +270,14 @@ class Html // $attributes = $node->attributes; // if ($attributes->getNamedItem('width') !== null) { - // $newElement->setWidth($attributes->getNamedItem('width')->value); + // $newElement->setWidth($attributes->getNamedItem('width')->value); // } // if ($attributes->getNamedItem('height') !== null) { - // $newElement->setHeight($attributes->getNamedItem('height')->value); + // $newElement->setHeight($attributes->getNamedItem('height')->value); // } // if ($attributes->getNamedItem('width') !== null) { - // $newElement=$element->addCell($width=$attributes->getNamedItem('width')->value); + // $newElement=$element->addCell($width=$attributes->getNamedItem('width')->value); // } return $newElement; @@ -294,7 +289,6 @@ class Html * @param array &$styles * @param array &$data * @param string $argument1 List type - * @return null */ private static function parseList(&$styles, &$data, $argument1) { @@ -315,7 +309,6 @@ class Html * @param \PhpOffice\PhpWord\Element\AbstractContainer $element * @param array &$styles * @param array $data - * @return null * * @todo This function is almost the same like `parseChildNodes`. Merged? * @todo As soon as ListItem inherits from AbstractContainer or TextRun delete parsing part of childNodes @@ -364,10 +357,10 @@ class Html $styles['alignment'] = $cValue; // todo: any mapping? break; case 'color': - $styles['color'] = trim($cValue, "#"); + $styles['color'] = trim($cValue, '#'); break; case 'background-color': - $styles['bgColor'] = trim($cValue, "#"); + $styles['bgColor'] = trim($cValue, '#'); break; } } diff --git a/src/PhpWord/Shared/OLERead.php b/src/PhpWord/Shared/OLERead.php index aa671522..e4efd7da 100644 --- a/src/PhpWord/Shared/OLERead.php +++ b/src/PhpWord/Shared/OLERead.php @@ -10,11 +10,10 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ - namespace PhpOffice\PhpWord\Shared; use PhpOffice\PhpWord\Exception\Exception; diff --git a/src/PhpWord/Shared/PCLZip/pclzip.lib.php b/src/PhpWord/Shared/PCLZip/pclzip.lib.php index 4e2a496f..0a69f687 100644 --- a/src/PhpWord/Shared/PCLZip/pclzip.lib.php +++ b/src/PhpWord/Shared/PCLZip/pclzip.lib.php @@ -25,4926 +25,2241 @@ // $Id: pclzip.lib.php,v 1.60 2009/09/30 21:01:04 vblavet Exp $ // -------------------------------------------------------------------------------- - // ----- Constants - if (!defined('PCLZIP_READ_BLOCK_SIZE')) { - define( 'PCLZIP_READ_BLOCK_SIZE', 2048 ); - } +// ----- Constants +if (!defined('PCLZIP_READ_BLOCK_SIZE')) { + define('PCLZIP_READ_BLOCK_SIZE', 2048); +} - // ----- File list separator - // In version 1.x of PclZip, the separator for file list is a space - // (which is not a very smart choice, specifically for windows paths !). - // A better separator should be a comma (,). This constant gives you the - // abilty to change that. - // However notice that changing this value, may have impact on existing - // scripts, using space separated filenames. - // Recommanded values for compatibility with older versions : - //define( 'PCLZIP_SEPARATOR', ' ' ); - // Recommanded values for smart separation of filenames. - if (!defined('PCLZIP_SEPARATOR')) { - define( 'PCLZIP_SEPARATOR', ',' ); - } +// ----- File list separator +// In version 1.x of PclZip, the separator for file list is a space +// (which is not a very smart choice, specifically for windows paths !). +// A better separator should be a comma (,). This constant gives you the +// abilty to change that. +// However notice that changing this value, may have impact on existing +// scripts, using space separated filenames. +// Recommanded values for compatibility with older versions : +//define( 'PCLZIP_SEPARATOR', ' ' ); +// Recommanded values for smart separation of filenames. +if (!defined('PCLZIP_SEPARATOR')) { + define('PCLZIP_SEPARATOR', ','); +} - // ----- Error configuration - // 0 : PclZip Class integrated error handling - // 1 : PclError external library error handling. By enabling this - // you must ensure that you have included PclError library. - // [2,...] : reserved for futur use - if (!defined('PCLZIP_ERROR_EXTERNAL')) { - define( 'PCLZIP_ERROR_EXTERNAL', 0 ); - } +// ----- Error configuration +// 0 : PclZip Class integrated error handling +// 1 : PclError external library error handling. By enabling this +// you must ensure that you have included PclError library. +// [2,...] : reserved for futur use +if (!defined('PCLZIP_ERROR_EXTERNAL')) { + define('PCLZIP_ERROR_EXTERNAL', 0); +} - // ----- Optional static temporary directory - // By default temporary files are generated in the script current - // path. - // If defined : - // - MUST BE terminated by a '/'. - // - MUST be a valid, already created directory - // Samples : - // define( 'PCLZIP_TEMPORARY_DIR', '/temp/' ); - // define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' ); - if (!defined('PCLZIP_TEMPORARY_DIR')) { - define( 'PCLZIP_TEMPORARY_DIR', '' ); - } +// ----- Optional static temporary directory +// By default temporary files are generated in the script current +// path. +// If defined : +// - MUST BE terminated by a '/'. +// - MUST be a valid, already created directory +// Samples : +// define( 'PCLZIP_TEMPORARY_DIR', '/temp/' ); +// define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' ); +if (!defined('PCLZIP_TEMPORARY_DIR')) { + define('PCLZIP_TEMPORARY_DIR', ''); +} - // ----- Optional threshold ratio for use of temporary files - // Pclzip sense the size of the file to add/extract and decide to - // use or not temporary file. The algorythm is looking for - // memory_limit of PHP and apply a ratio. - // threshold = memory_limit * ratio. - // Recommended values are under 0.5. Default 0.47. - // Samples : - // define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.5 ); - if (!defined('PCLZIP_TEMPORARY_FILE_RATIO')) { - define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.47 ); - } +// ----- Optional threshold ratio for use of temporary files +// Pclzip sense the size of the file to add/extract and decide to +// use or not temporary file. The algorythm is looking for +// memory_limit of PHP and apply a ratio. +// threshold = memory_limit * ratio. +// Recommended values are under 0.5. Default 0.47. +// Samples : +// define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.5 ); +if (!defined('PCLZIP_TEMPORARY_FILE_RATIO')) { + define('PCLZIP_TEMPORARY_FILE_RATIO', 0.47); +} // -------------------------------------------------------------------------------- // ***** UNDER THIS LINE NOTHING NEEDS TO BE MODIFIED ***** // -------------------------------------------------------------------------------- - // ----- Global variables - $g_pclzip_version = "2.8.2"; +// ----- Global variables +$g_pclzip_version = "2.8.2"; - // ----- Error codes - // -1 : Unable to open file in binary write mode - // -2 : Unable to open file in binary read mode - // -3 : Invalid parameters - // -4 : File does not exist - // -5 : Filename is too long (max. 255) - // -6 : Not a valid zip file - // -7 : Invalid extracted file size - // -8 : Unable to create directory - // -9 : Invalid archive extension - // -10 : Invalid archive format - // -11 : Unable to delete file (unlink) - // -12 : Unable to rename file (rename) - // -13 : Invalid header checksum - // -14 : Invalid archive size - define( 'PCLZIP_ERR_USER_ABORTED', 2 ); - define( 'PCLZIP_ERR_NO_ERROR', 0 ); - define( 'PCLZIP_ERR_WRITE_OPEN_FAIL', -1 ); - define( 'PCLZIP_ERR_READ_OPEN_FAIL', -2 ); - define( 'PCLZIP_ERR_INVALID_PARAMETER', -3 ); - define( 'PCLZIP_ERR_MISSING_FILE', -4 ); - define( 'PCLZIP_ERR_FILENAME_TOO_LONG', -5 ); - define( 'PCLZIP_ERR_INVALID_ZIP', -6 ); - define( 'PCLZIP_ERR_BAD_EXTRACTED_FILE', -7 ); - define( 'PCLZIP_ERR_DIR_CREATE_FAIL', -8 ); - define( 'PCLZIP_ERR_BAD_EXTENSION', -9 ); - define( 'PCLZIP_ERR_BAD_FORMAT', -10 ); - define( 'PCLZIP_ERR_DELETE_FILE_FAIL', -11 ); - define( 'PCLZIP_ERR_RENAME_FILE_FAIL', -12 ); - define( 'PCLZIP_ERR_BAD_CHECKSUM', -13 ); - define( 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14 ); - define( 'PCLZIP_ERR_MISSING_OPTION_VALUE', -15 ); - define( 'PCLZIP_ERR_INVALID_OPTION_VALUE', -16 ); - define( 'PCLZIP_ERR_ALREADY_A_DIRECTORY', -17 ); - define( 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', -18 ); - define( 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', -19 ); - define( 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', -20 ); - define( 'PCLZIP_ERR_DIRECTORY_RESTRICTION', -21 ); +// ----- Error codes +// -1 : Unable to open file in binary write mode +// -2 : Unable to open file in binary read mode +// -3 : Invalid parameters +// -4 : File does not exist +// -5 : Filename is too long (max. 255) +// -6 : Not a valid zip file +// -7 : Invalid extracted file size +// -8 : Unable to create directory +// -9 : Invalid archive extension +// -10 : Invalid archive format +// -11 : Unable to delete file (unlink) +// -12 : Unable to rename file (rename) +// -13 : Invalid header checksum +// -14 : Invalid archive size +define('PCLZIP_ERR_USER_ABORTED', 2); +define('PCLZIP_ERR_NO_ERROR', 0); +define('PCLZIP_ERR_WRITE_OPEN_FAIL', -1); +define('PCLZIP_ERR_READ_OPEN_FAIL', -2); +define('PCLZIP_ERR_INVALID_PARAMETER', -3); +define('PCLZIP_ERR_MISSING_FILE', -4); +define('PCLZIP_ERR_FILENAME_TOO_LONG', -5); +define('PCLZIP_ERR_INVALID_ZIP', -6); +define('PCLZIP_ERR_BAD_EXTRACTED_FILE', -7); +define('PCLZIP_ERR_DIR_CREATE_FAIL', -8); +define('PCLZIP_ERR_BAD_EXTENSION', -9); +define('PCLZIP_ERR_BAD_FORMAT', -10); +define('PCLZIP_ERR_DELETE_FILE_FAIL', -11); +define('PCLZIP_ERR_RENAME_FILE_FAIL', -12); +define('PCLZIP_ERR_BAD_CHECKSUM', -13); +define('PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14); +define('PCLZIP_ERR_MISSING_OPTION_VALUE', -15); +define('PCLZIP_ERR_INVALID_OPTION_VALUE', -16); +define('PCLZIP_ERR_ALREADY_A_DIRECTORY', -17); +define('PCLZIP_ERR_UNSUPPORTED_COMPRESSION', -18); +define('PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', -19); +define('PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', -20); +define('PCLZIP_ERR_DIRECTORY_RESTRICTION', -21); - // ----- Options values - define( 'PCLZIP_OPT_PATH', 77001 ); - define( 'PCLZIP_OPT_ADD_PATH', 77002 ); - define( 'PCLZIP_OPT_REMOVE_PATH', 77003 ); - define( 'PCLZIP_OPT_REMOVE_ALL_PATH', 77004 ); - define( 'PCLZIP_OPT_SET_CHMOD', 77005 ); - define( 'PCLZIP_OPT_EXTRACT_AS_STRING', 77006 ); - define( 'PCLZIP_OPT_NO_COMPRESSION', 77007 ); - define( 'PCLZIP_OPT_BY_NAME', 77008 ); - define( 'PCLZIP_OPT_BY_INDEX', 77009 ); - define( 'PCLZIP_OPT_BY_EREG', 77010 ); - define( 'PCLZIP_OPT_BY_PREG', 77011 ); - define( 'PCLZIP_OPT_COMMENT', 77012 ); - define( 'PCLZIP_OPT_ADD_COMMENT', 77013 ); - define( 'PCLZIP_OPT_PREPEND_COMMENT', 77014 ); - define( 'PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015 ); - define( 'PCLZIP_OPT_REPLACE_NEWER', 77016 ); - define( 'PCLZIP_OPT_STOP_ON_ERROR', 77017 ); - // Having big trouble with crypt. Need to multiply 2 long int - // which is not correctly supported by PHP ... - //define( 'PCLZIP_OPT_CRYPT', 77018 ); - define( 'PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019 ); - define( 'PCLZIP_OPT_TEMP_FILE_THRESHOLD', 77020 ); - define( 'PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD', 77020 ); // alias - define( 'PCLZIP_OPT_TEMP_FILE_ON', 77021 ); - define( 'PCLZIP_OPT_ADD_TEMP_FILE_ON', 77021 ); // alias - define( 'PCLZIP_OPT_TEMP_FILE_OFF', 77022 ); - define( 'PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022 ); // alias +// ----- Options values +define('PCLZIP_OPT_PATH', 77001); +define('PCLZIP_OPT_ADD_PATH', 77002); +define('PCLZIP_OPT_REMOVE_PATH', 77003); +define('PCLZIP_OPT_REMOVE_ALL_PATH', 77004); +define('PCLZIP_OPT_SET_CHMOD', 77005); +define('PCLZIP_OPT_EXTRACT_AS_STRING', 77006); +define('PCLZIP_OPT_NO_COMPRESSION', 77007); +define('PCLZIP_OPT_BY_NAME', 77008); +define('PCLZIP_OPT_BY_INDEX', 77009); +define('PCLZIP_OPT_BY_EREG', 77010); +define('PCLZIP_OPT_BY_PREG', 77011); +define('PCLZIP_OPT_COMMENT', 77012); +define('PCLZIP_OPT_ADD_COMMENT', 77013); +define('PCLZIP_OPT_PREPEND_COMMENT', 77014); +define('PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015); +define('PCLZIP_OPT_REPLACE_NEWER', 77016); +define('PCLZIP_OPT_STOP_ON_ERROR', 77017); +// Having big trouble with crypt. Need to multiply 2 long int +// which is not correctly supported by PHP ... +//define( 'PCLZIP_OPT_CRYPT', 77018 ); +define('PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019); +define('PCLZIP_OPT_TEMP_FILE_THRESHOLD', 77020); +define('PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD', 77020); // alias +define('PCLZIP_OPT_TEMP_FILE_ON', 77021); +define('PCLZIP_OPT_ADD_TEMP_FILE_ON', 77021); // alias +define('PCLZIP_OPT_TEMP_FILE_OFF', 77022); +define('PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022); // alias - // ----- File description attributes - define( 'PCLZIP_ATT_FILE_NAME', 79001 ); - define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 ); - define( 'PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003 ); - define( 'PCLZIP_ATT_FILE_MTIME', 79004 ); - define( 'PCLZIP_ATT_FILE_CONTENT', 79005 ); - define( 'PCLZIP_ATT_FILE_COMMENT', 79006 ); +// ----- File description attributes +define('PCLZIP_ATT_FILE_NAME', 79001); +define('PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002); +define('PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003); +define('PCLZIP_ATT_FILE_MTIME', 79004); +define('PCLZIP_ATT_FILE_CONTENT', 79005); +define('PCLZIP_ATT_FILE_COMMENT', 79006); - // ----- Call backs values - define( 'PCLZIP_CB_PRE_EXTRACT', 78001 ); - define( 'PCLZIP_CB_POST_EXTRACT', 78002 ); - define( 'PCLZIP_CB_PRE_ADD', 78003 ); - define( 'PCLZIP_CB_POST_ADD', 78004 ); - /* For futur use - define( 'PCLZIP_CB_PRE_LIST', 78005 ); - define( 'PCLZIP_CB_POST_LIST', 78006 ); - define( 'PCLZIP_CB_PRE_DELETE', 78007 ); - define( 'PCLZIP_CB_POST_DELETE', 78008 ); - */ +// ----- Call backs values +define('PCLZIP_CB_PRE_EXTRACT', 78001); +define('PCLZIP_CB_POST_EXTRACT', 78002); +define('PCLZIP_CB_PRE_ADD', 78003); +define('PCLZIP_CB_POST_ADD', 78004); +/* For futur use +define( 'PCLZIP_CB_PRE_LIST', 78005 ); +define( 'PCLZIP_CB_POST_LIST', 78006 ); +define( 'PCLZIP_CB_PRE_DELETE', 78007 ); +define( 'PCLZIP_CB_POST_DELETE', 78008 ); +*/ - // -------------------------------------------------------------------------------- - // Class : PclZip - // Description : - // PclZip is the class that represent a Zip archive. - // The public methods allow the manipulation of the archive. - // Attributes : - // Attributes must not be accessed directly. - // Methods : - // PclZip() : Object creator - // create() : Creates the Zip archive - // listContent() : List the content of the Zip archive - // extract() : Extract the content of the archive - // properties() : List the properties of the archive - // -------------------------------------------------------------------------------- - class PclZip - { +// -------------------------------------------------------------------------------- +// Class : PclZip +// Description : +// PclZip is the class that represent a Zip archive. +// The public methods allow the manipulation of the archive. +// Attributes : +// Attributes must not be accessed directly. +// Methods : +// PclZip() : Object creator +// create() : Creates the Zip archive +// listContent() : List the content of the Zip archive +// extract() : Extract the content of the archive +// properties() : List the properties of the archive +// -------------------------------------------------------------------------------- +class PclZip +{ // ----- Filename of the zip file - var $zipname = ''; + public $zipname = ''; // ----- File descriptor of the zip file - var $zip_fd = 0; + public $zip_fd = 0; // ----- Internal error handling - var $error_code = 1; - var $error_string = ''; + public $error_code = 1; + public $error_string = ''; // ----- Current status of the magic_quotes_runtime // This value store the php configuration for magic_quotes // The class can then disable the magic_quotes and reset it after - var $magic_quotes_status; + public $magic_quotes_status; - // -------------------------------------------------------------------------------- - // Function : PclZip() - // Description : - // Creates a PclZip object and set the name of the associated Zip archive - // filename. - // Note that no real action is taken, if the archive does not exist it is not - // created. Use create() for that. - // -------------------------------------------------------------------------------- - function PclZip($p_zipname) - { - - // ----- Tests the zlib - if (!function_exists('gzopen')) + // -------------------------------------------------------------------------------- + // Function : PclZip() + // Description : + // Creates a PclZip object and set the name of the associated Zip archive + // filename. + // Note that no real action is taken, if the archive does not exist it is not + // created. Use create() for that. + // -------------------------------------------------------------------------------- + public function __construct($p_zipname) { - die('Abort '.basename(__FILE__).' : Missing zlib extensions'); - } - // ----- Set the attributes - $this->zipname = $p_zipname; - $this->zip_fd = 0; - $this->magic_quotes_status = -1; - - // ----- Return - return; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : - // create($p_filelist, $p_add_dir="", $p_remove_dir="") - // create($p_filelist, $p_option, $p_option_value, ...) - // Description : - // This method supports two different synopsis. The first one is historical. - // This method creates a Zip Archive. The Zip file is created in the - // filesystem. The files and directories indicated in $p_filelist - // are added in the archive. See the parameters description for the - // supported format of $p_filelist. - // When a directory is in the list, the directory and its content is added - // in the archive. - // In this synopsis, the function takes an optional variable list of - // options. See bellow the supported options. - // Parameters : - // $p_filelist : An array containing file or directory names, or - // a string containing one filename or one directory name, or - // a string containing a list of filenames and/or directory - // names separated by spaces. - // $p_add_dir : A path to add before the real path of the archived file, - // in order to have it memorized in the archive. - // $p_remove_dir : A path to remove from the real path of the file to archive, - // in order to have a shorter path memorized in the archive. - // When $p_add_dir and $p_remove_dir are set, $p_remove_dir - // is removed first, before $p_add_dir is added. - // Options : - // PCLZIP_OPT_ADD_PATH : - // PCLZIP_OPT_REMOVE_PATH : - // PCLZIP_OPT_REMOVE_ALL_PATH : - // PCLZIP_OPT_COMMENT : - // PCLZIP_CB_PRE_ADD : - // PCLZIP_CB_POST_ADD : - // Return Values : - // 0 on failure, - // The list of the added files, with a status of the add action. - // (see PclZip::listContent() for list entry format) - // -------------------------------------------------------------------------------- - function create($p_filelist) - { - $v_result=1; - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Set default values - $v_options = array(); - $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE; - - // ----- Look for variable options arguments - $v_size = func_num_args(); - - // ----- Look for arguments - if ($v_size > 1) { - // ----- Get the arguments - $v_arg_list = func_get_args(); - - // ----- Remove from the options list the first argument - array_shift($v_arg_list); - $v_size--; - - // ----- Look for first arg - if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { - - // ----- Parse the options - $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, - array (PCLZIP_OPT_REMOVE_PATH => 'optional', - PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', - PCLZIP_OPT_ADD_PATH => 'optional', - PCLZIP_CB_PRE_ADD => 'optional', - PCLZIP_CB_POST_ADD => 'optional', - PCLZIP_OPT_NO_COMPRESSION => 'optional', - PCLZIP_OPT_COMMENT => 'optional', - PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', - PCLZIP_OPT_TEMP_FILE_ON => 'optional', - PCLZIP_OPT_TEMP_FILE_OFF => 'optional' - //, PCLZIP_OPT_CRYPT => 'optional' - )); - if ($v_result != 1) { - return 0; - } - } - - // ----- Look for 2 args - // Here we need to support the first historic synopsis of the - // method. - else { - - // ----- Get the first argument - $v_options[PCLZIP_OPT_ADD_PATH] = $v_arg_list[0]; - - // ----- Look for the optional second argument - if ($v_size == 2) { - $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1]; - } - else if ($v_size > 2) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, - "Invalid number / type of arguments"); - return 0; - } - } - } - - // ----- Look for default option values - $this->privOptionDefaultThreshold($v_options); - - // ----- Init - $v_string_list = array(); - $v_att_list = array(); - $v_filedescr_list = array(); - $p_result_list = array(); - - // ----- Look if the $p_filelist is really an array - if (is_array($p_filelist)) { - - // ----- Look if the first element is also an array - // This will mean that this is a file description entry - if (isset($p_filelist[0]) && is_array($p_filelist[0])) { - $v_att_list = $p_filelist; - } - - // ----- The list is a list of string names - else { - $v_string_list = $p_filelist; - } - } - - // ----- Look if the $p_filelist is a string - else if (is_string($p_filelist)) { - // ----- Create a list from the string - $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist); - } - - // ----- Invalid variable type for $p_filelist - else { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist"); - return 0; - } - - // ----- Reformat the string list - if (sizeof($v_string_list) != 0) { - foreach ($v_string_list as $v_string) { - if ($v_string != '') { - $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string; - } - else { - } - } - } - - // ----- For each file in the list check the attributes - $v_supported_attributes - = array ( PCLZIP_ATT_FILE_NAME => 'mandatory' - ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional' - ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional' - ,PCLZIP_ATT_FILE_MTIME => 'optional' - ,PCLZIP_ATT_FILE_CONTENT => 'optional' - ,PCLZIP_ATT_FILE_COMMENT => 'optional' - ); - foreach ($v_att_list as $v_entry) { - $v_result = $this->privFileDescrParseAtt($v_entry, - $v_filedescr_list[], - $v_options, - $v_supported_attributes); - if ($v_result != 1) { - return 0; - } - } - - // ----- Expand the filelist (expand directories) - $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options); - if ($v_result != 1) { - return 0; - } - - // ----- Call the create fct - $v_result = $this->privCreate($v_filedescr_list, $p_result_list, $v_options); - if ($v_result != 1) { - return 0; - } - - // ----- Return - return $p_result_list; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : - // add($p_filelist, $p_add_dir="", $p_remove_dir="") - // add($p_filelist, $p_option, $p_option_value, ...) - // Description : - // This method supports two synopsis. The first one is historical. - // This methods add the list of files in an existing archive. - // If a file with the same name already exists, it is added at the end of the - // archive, the first one is still present. - // If the archive does not exist, it is created. - // Parameters : - // $p_filelist : An array containing file or directory names, or - // a string containing one filename or one directory name, or - // a string containing a list of filenames and/or directory - // names separated by spaces. - // $p_add_dir : A path to add before the real path of the archived file, - // in order to have it memorized in the archive. - // $p_remove_dir : A path to remove from the real path of the file to archive, - // in order to have a shorter path memorized in the archive. - // When $p_add_dir and $p_remove_dir are set, $p_remove_dir - // is removed first, before $p_add_dir is added. - // Options : - // PCLZIP_OPT_ADD_PATH : - // PCLZIP_OPT_REMOVE_PATH : - // PCLZIP_OPT_REMOVE_ALL_PATH : - // PCLZIP_OPT_COMMENT : - // PCLZIP_OPT_ADD_COMMENT : - // PCLZIP_OPT_PREPEND_COMMENT : - // PCLZIP_CB_PRE_ADD : - // PCLZIP_CB_POST_ADD : - // Return Values : - // 0 on failure, - // The list of the added files, with a status of the add action. - // (see PclZip::listContent() for list entry format) - // -------------------------------------------------------------------------------- - function add($p_filelist) - { - $v_result=1; - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Set default values - $v_options = array(); - $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE; - - // ----- Look for variable options arguments - $v_size = func_num_args(); - - // ----- Look for arguments - if ($v_size > 1) { - // ----- Get the arguments - $v_arg_list = func_get_args(); - - // ----- Remove form the options list the first argument - array_shift($v_arg_list); - $v_size--; - - // ----- Look for first arg - if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { - - // ----- Parse the options - $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, - array (PCLZIP_OPT_REMOVE_PATH => 'optional', - PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', - PCLZIP_OPT_ADD_PATH => 'optional', - PCLZIP_CB_PRE_ADD => 'optional', - PCLZIP_CB_POST_ADD => 'optional', - PCLZIP_OPT_NO_COMPRESSION => 'optional', - PCLZIP_OPT_COMMENT => 'optional', - PCLZIP_OPT_ADD_COMMENT => 'optional', - PCLZIP_OPT_PREPEND_COMMENT => 'optional', - PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', - PCLZIP_OPT_TEMP_FILE_ON => 'optional', - PCLZIP_OPT_TEMP_FILE_OFF => 'optional' - //, PCLZIP_OPT_CRYPT => 'optional' - )); - if ($v_result != 1) { - return 0; - } - } - - // ----- Look for 2 args - // Here we need to support the first historic synopsis of the - // method. - else { - - // ----- Get the first argument - $v_options[PCLZIP_OPT_ADD_PATH] = $v_add_path = $v_arg_list[0]; - - // ----- Look for the optional second argument - if ($v_size == 2) { - $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1]; - } - else if ($v_size > 2) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); - - // ----- Return - return 0; - } - } - } - - // ----- Look for default option values - $this->privOptionDefaultThreshold($v_options); - - // ----- Init - $v_string_list = array(); - $v_att_list = array(); - $v_filedescr_list = array(); - $p_result_list = array(); - - // ----- Look if the $p_filelist is really an array - if (is_array($p_filelist)) { - - // ----- Look if the first element is also an array - // This will mean that this is a file description entry - if (isset($p_filelist[0]) && is_array($p_filelist[0])) { - $v_att_list = $p_filelist; - } - - // ----- The list is a list of string names - else { - $v_string_list = $p_filelist; - } - } - - // ----- Look if the $p_filelist is a string - else if (is_string($p_filelist)) { - // ----- Create a list from the string - $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist); - } - - // ----- Invalid variable type for $p_filelist - else { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '".gettype($p_filelist)."' for p_filelist"); - return 0; - } - - // ----- Reformat the string list - if (sizeof($v_string_list) != 0) { - foreach ($v_string_list as $v_string) { - $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string; - } - } - - // ----- For each file in the list check the attributes - $v_supported_attributes - = array ( PCLZIP_ATT_FILE_NAME => 'mandatory' - ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional' - ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional' - ,PCLZIP_ATT_FILE_MTIME => 'optional' - ,PCLZIP_ATT_FILE_CONTENT => 'optional' - ,PCLZIP_ATT_FILE_COMMENT => 'optional' - ); - foreach ($v_att_list as $v_entry) { - $v_result = $this->privFileDescrParseAtt($v_entry, - $v_filedescr_list[], - $v_options, - $v_supported_attributes); - if ($v_result != 1) { - return 0; - } - } - - // ----- Expand the filelist (expand directories) - $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options); - if ($v_result != 1) { - return 0; - } - - // ----- Call the create fct - $v_result = $this->privAdd($v_filedescr_list, $p_result_list, $v_options); - if ($v_result != 1) { - return 0; - } - - // ----- Return - return $p_result_list; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : listContent() - // Description : - // This public method, gives the list of the files and directories, with their - // properties. - // The properties of each entries in the list are (used also in other functions) : - // filename : Name of the file. For a create or add action it is the filename - // given by the user. For an extract function it is the filename - // of the extracted file. - // stored_filename : Name of the file / directory stored in the archive. - // size : Size of the stored file. - // compressed_size : Size of the file's data compressed in the archive - // (without the headers overhead) - // mtime : Last known modification date of the file (UNIX timestamp) - // comment : Comment associated with the file - // folder : true | false - // index : index of the file in the archive - // status : status of the action (depending of the action) : - // Values are : - // ok : OK ! - // filtered : the file / dir is not extracted (filtered by user) - // already_a_directory : the file can not be extracted because a - // directory with the same name already exists - // write_protected : the file can not be extracted because a file - // with the same name already exists and is - // write protected - // newer_exist : the file was not extracted because a newer file exists - // path_creation_fail : the file is not extracted because the folder - // does not exist and can not be created - // write_error : the file was not extracted because there was a - // error while writing the file - // read_error : the file was not extracted because there was a error - // while reading the file - // invalid_header : the file was not extracted because of an archive - // format error (bad file header) - // Note that each time a method can continue operating when there - // is an action error on a file, the error is only logged in the file status. - // Return Values : - // 0 on an unrecoverable failure, - // The list of the files in the archive. - // -------------------------------------------------------------------------------- - function listContent() - { - $v_result=1; - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Check archive - if (!$this->privCheckFormat()) { - return(0); - } - - // ----- Call the extracting fct - $p_list = array(); - if (($v_result = $this->privList($p_list)) != 1) - { - unset($p_list); - return(0); - } - - // ----- Return - return $p_list; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : - // extract($p_path="./", $p_remove_path="") - // extract([$p_option, $p_option_value, ...]) - // Description : - // This method supports two synopsis. The first one is historical. - // This method extract all the files / directories from the archive to the - // folder indicated in $p_path. - // If you want to ignore the 'root' part of path of the memorized files - // you can indicate this in the optional $p_remove_path parameter. - // By default, if a newer file with the same name already exists, the - // file is not extracted. - // - // If both PCLZIP_OPT_PATH and PCLZIP_OPT_ADD_PATH aoptions - // are used, the path indicated in PCLZIP_OPT_ADD_PATH is append - // at the end of the path value of PCLZIP_OPT_PATH. - // Parameters : - // $p_path : Path where the files and directories are to be extracted - // $p_remove_path : First part ('root' part) of the memorized path - // (if any similar) to remove while extracting. - // Options : - // PCLZIP_OPT_PATH : - // PCLZIP_OPT_ADD_PATH : - // PCLZIP_OPT_REMOVE_PATH : - // PCLZIP_OPT_REMOVE_ALL_PATH : - // PCLZIP_CB_PRE_EXTRACT : - // PCLZIP_CB_POST_EXTRACT : - // Return Values : - // 0 or a negative value on failure, - // The list of the extracted files, with a status of the action. - // (see PclZip::listContent() for list entry format) - // -------------------------------------------------------------------------------- - function extract() - { - $v_result=1; - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Check archive - if (!$this->privCheckFormat()) { - return(0); - } - - // ----- Set default values - $v_options = array(); -// $v_path = "./"; - $v_path = ''; - $v_remove_path = ""; - $v_remove_all_path = false; - - // ----- Look for variable options arguments - $v_size = func_num_args(); - - // ----- Default values for option - $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE; - - // ----- Look for arguments - if ($v_size > 0) { - // ----- Get the arguments - $v_arg_list = func_get_args(); - - // ----- Look for first arg - if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { - - // ----- Parse the options - $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, - array (PCLZIP_OPT_PATH => 'optional', - PCLZIP_OPT_REMOVE_PATH => 'optional', - PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', - PCLZIP_OPT_ADD_PATH => 'optional', - PCLZIP_CB_PRE_EXTRACT => 'optional', - PCLZIP_CB_POST_EXTRACT => 'optional', - PCLZIP_OPT_SET_CHMOD => 'optional', - PCLZIP_OPT_BY_NAME => 'optional', - PCLZIP_OPT_BY_EREG => 'optional', - PCLZIP_OPT_BY_PREG => 'optional', - PCLZIP_OPT_BY_INDEX => 'optional', - PCLZIP_OPT_EXTRACT_AS_STRING => 'optional', - PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional', - PCLZIP_OPT_REPLACE_NEWER => 'optional' - ,PCLZIP_OPT_STOP_ON_ERROR => 'optional' - ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional', - PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', - PCLZIP_OPT_TEMP_FILE_ON => 'optional', - PCLZIP_OPT_TEMP_FILE_OFF => 'optional' - )); - if ($v_result != 1) { - return 0; + // ----- Tests the zlib + if (!function_exists('gzopen')) { + die('Abort ' . basename(__FILE__) . ' : Missing zlib extensions'); } - // ----- Set the arguments - if (isset($v_options[PCLZIP_OPT_PATH])) { - $v_path = $v_options[PCLZIP_OPT_PATH]; - } - if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) { - $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH]; - } - if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) { - $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH]; - } - if (isset($v_options[PCLZIP_OPT_ADD_PATH])) { - // ----- Check for '/' in last path char - if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) { - $v_path .= '/'; - } - $v_path .= $v_options[PCLZIP_OPT_ADD_PATH]; - } - } - - // ----- Look for 2 args - // Here we need to support the first historic synopsis of the - // method. - else { - - // ----- Get the first argument - $v_path = $v_arg_list[0]; - - // ----- Look for the optional second argument - if ($v_size == 2) { - $v_remove_path = $v_arg_list[1]; - } - else if ($v_size > 2) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); - - // ----- Return - return 0; - } - } - } - - // ----- Look for default option values - $this->privOptionDefaultThreshold($v_options); - - // ----- Trace - - // ----- Call the extracting fct - $p_list = array(); - $v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, - $v_remove_all_path, $v_options); - if ($v_result < 1) { - unset($p_list); - return(0); - } - - // ----- Return - return $p_list; - } - // -------------------------------------------------------------------------------- - - - // -------------------------------------------------------------------------------- - // Function : - // extractByIndex($p_index, $p_path="./", $p_remove_path="") - // extractByIndex($p_index, [$p_option, $p_option_value, ...]) - // Description : - // This method supports two synopsis. The first one is historical. - // This method is doing a partial extract of the archive. - // The extracted files or folders are identified by their index in the - // archive (from 0 to n). - // Note that if the index identify a folder, only the folder entry is - // extracted, not all the files included in the archive. - // Parameters : - // $p_index : A single index (integer) or a string of indexes of files to - // extract. The form of the string is "0,4-6,8-12" with only numbers - // and '-' for range or ',' to separate ranges. No spaces or ';' - // are allowed. - // $p_path : Path where the files and directories are to be extracted - // $p_remove_path : First part ('root' part) of the memorized path - // (if any similar) to remove while extracting. - // Options : - // PCLZIP_OPT_PATH : - // PCLZIP_OPT_ADD_PATH : - // PCLZIP_OPT_REMOVE_PATH : - // PCLZIP_OPT_REMOVE_ALL_PATH : - // PCLZIP_OPT_EXTRACT_AS_STRING : The files are extracted as strings and - // not as files. - // The resulting content is in a new field 'content' in the file - // structure. - // This option must be used alone (any other options are ignored). - // PCLZIP_CB_PRE_EXTRACT : - // PCLZIP_CB_POST_EXTRACT : - // Return Values : - // 0 on failure, - // The list of the extracted files, with a status of the action. - // (see PclZip::listContent() for list entry format) - // -------------------------------------------------------------------------------- - //function extractByIndex($p_index, options...) - function extractByIndex($p_index) - { - $v_result=1; - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Check archive - if (!$this->privCheckFormat()) { - return(0); - } - - // ----- Set default values - $v_options = array(); -// $v_path = "./"; - $v_path = ''; - $v_remove_path = ""; - $v_remove_all_path = false; - - // ----- Look for variable options arguments - $v_size = func_num_args(); - - // ----- Default values for option - $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE; - - // ----- Look for arguments - if ($v_size > 1) { - // ----- Get the arguments - $v_arg_list = func_get_args(); - - // ----- Remove form the options list the first argument - array_shift($v_arg_list); - $v_size--; - - // ----- Look for first arg - if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { - - // ----- Parse the options - $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, - array (PCLZIP_OPT_PATH => 'optional', - PCLZIP_OPT_REMOVE_PATH => 'optional', - PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', - PCLZIP_OPT_EXTRACT_AS_STRING => 'optional', - PCLZIP_OPT_ADD_PATH => 'optional', - PCLZIP_CB_PRE_EXTRACT => 'optional', - PCLZIP_CB_POST_EXTRACT => 'optional', - PCLZIP_OPT_SET_CHMOD => 'optional', - PCLZIP_OPT_REPLACE_NEWER => 'optional' - ,PCLZIP_OPT_STOP_ON_ERROR => 'optional' - ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional', - PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', - PCLZIP_OPT_TEMP_FILE_ON => 'optional', - PCLZIP_OPT_TEMP_FILE_OFF => 'optional' - )); - if ($v_result != 1) { - return 0; - } - - // ----- Set the arguments - if (isset($v_options[PCLZIP_OPT_PATH])) { - $v_path = $v_options[PCLZIP_OPT_PATH]; - } - if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) { - $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH]; - } - if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) { - $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH]; - } - if (isset($v_options[PCLZIP_OPT_ADD_PATH])) { - // ----- Check for '/' in last path char - if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) { - $v_path .= '/'; - } - $v_path .= $v_options[PCLZIP_OPT_ADD_PATH]; - } - if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) { - $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE; - } - else { - } - } - - // ----- Look for 2 args - // Here we need to support the first historic synopsis of the - // method. - else { - - // ----- Get the first argument - $v_path = $v_arg_list[0]; - - // ----- Look for the optional second argument - if ($v_size == 2) { - $v_remove_path = $v_arg_list[1]; - } - else if ($v_size > 2) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); - - // ----- Return - return 0; - } - } - } - - // ----- Trace - - // ----- Trick - // Here I want to reuse extractByRule(), so I need to parse the $p_index - // with privParseOptions() - $v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index); - $v_options_trick = array(); - $v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick, - array (PCLZIP_OPT_BY_INDEX => 'optional' )); - if ($v_result != 1) { - return 0; - } - $v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX]; - - // ----- Look for default option values - $this->privOptionDefaultThreshold($v_options); - - // ----- Call the extracting fct - if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) { - return(0); - } - - // ----- Return - return $p_list; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : - // delete([$p_option, $p_option_value, ...]) - // Description : - // This method removes files from the archive. - // If no parameters are given, then all the archive is emptied. - // Parameters : - // None or optional arguments. - // Options : - // PCLZIP_OPT_BY_INDEX : - // PCLZIP_OPT_BY_NAME : - // PCLZIP_OPT_BY_EREG : - // PCLZIP_OPT_BY_PREG : - // Return Values : - // 0 on failure, - // The list of the files which are still present in the archive. - // (see PclZip::listContent() for list entry format) - // -------------------------------------------------------------------------------- - function delete() - { - $v_result=1; - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Check archive - if (!$this->privCheckFormat()) { - return(0); - } - - // ----- Set default values - $v_options = array(); - - // ----- Look for variable options arguments - $v_size = func_num_args(); - - // ----- Look for arguments - if ($v_size > 0) { - // ----- Get the arguments - $v_arg_list = func_get_args(); - - // ----- Parse the options - $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, - array (PCLZIP_OPT_BY_NAME => 'optional', - PCLZIP_OPT_BY_EREG => 'optional', - PCLZIP_OPT_BY_PREG => 'optional', - PCLZIP_OPT_BY_INDEX => 'optional' )); - if ($v_result != 1) { - return 0; - } - } - - // ----- Magic quotes trick - $this->privDisableMagicQuotes(); - - // ----- Call the delete fct - $v_list = array(); - if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1) { - $this->privSwapBackMagicQuotes(); - unset($v_list); - return(0); - } - - // ----- Magic quotes trick - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_list; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : deleteByIndex() - // Description : - // ***** Deprecated ***** - // delete(PCLZIP_OPT_BY_INDEX, $p_index) should be prefered. - // -------------------------------------------------------------------------------- - function deleteByIndex($p_index) - { - - $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index); - - // ----- Return - return $p_list; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : properties() - // Description : - // This method gives the properties of the archive. - // The properties are : - // nb : Number of files in the archive - // comment : Comment associated with the archive file - // status : not_exist, ok - // Parameters : - // None - // Return Values : - // 0 on failure, - // An array with the archive properties. - // -------------------------------------------------------------------------------- - function properties() - { - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Magic quotes trick - $this->privDisableMagicQuotes(); - - // ----- Check archive - if (!$this->privCheckFormat()) { - $this->privSwapBackMagicQuotes(); - return(0); - } - - // ----- Default properties - $v_prop = array(); - $v_prop['comment'] = ''; - $v_prop['nb'] = 0; - $v_prop['status'] = 'not_exist'; - - // ----- Look if file exists - if (@is_file($this->zipname)) - { - // ----- Open the zip file - if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0) - { - $this->privSwapBackMagicQuotes(); - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode'); + // ----- Set the attributes + $this->zipname = $p_zipname; + $this->zip_fd = 0; + $this->magic_quotes_status = -1; // ----- Return - return 0; - } - - // ----- Read the central directory informations - $v_central_dir = array(); - if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) - { - $this->privSwapBackMagicQuotes(); - return 0; - } - - // ----- Close the zip file - $this->privCloseFd(); - - // ----- Set the user attributes - $v_prop['comment'] = $v_central_dir['comment']; - $v_prop['nb'] = $v_central_dir['entries']; - $v_prop['status'] = 'ok'; + return; } + // -------------------------------------------------------------------------------- - // ----- Magic quotes trick - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_prop; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : duplicate() - // Description : - // This method creates an archive by copying the content of an other one. If - // the archive already exist, it is replaced by the new one without any warning. - // Parameters : - // $p_archive : The filename of a valid archive, or - // a valid PclZip object. - // Return Values : - // 1 on success. - // 0 or a negative value on error (error code). - // -------------------------------------------------------------------------------- - function duplicate($p_archive) - { - $v_result = 1; - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Look if the $p_archive is a PclZip object - if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip')) + // -------------------------------------------------------------------------------- + // Function : + // create($p_filelist, $p_add_dir="", $p_remove_dir="") + // create($p_filelist, $p_option, $p_option_value, ...) + // Description : + // This method supports two different synopsis. The first one is historical. + // This method creates a Zip Archive. The Zip file is created in the + // filesystem. The files and directories indicated in $p_filelist + // are added in the archive. See the parameters description for the + // supported format of $p_filelist. + // When a directory is in the list, the directory and its content is added + // in the archive. + // In this synopsis, the function takes an optional variable list of + // options. See bellow the supported options. + // Parameters : + // $p_filelist : An array containing file or directory names, or + // a string containing one filename or one directory name, or + // a string containing a list of filenames and/or directory + // names separated by spaces. + // $p_add_dir : A path to add before the real path of the archived file, + // in order to have it memorized in the archive. + // $p_remove_dir : A path to remove from the real path of the file to archive, + // in order to have a shorter path memorized in the archive. + // When $p_add_dir and $p_remove_dir are set, $p_remove_dir + // is removed first, before $p_add_dir is added. + // Options : + // PCLZIP_OPT_ADD_PATH : + // PCLZIP_OPT_REMOVE_PATH : + // PCLZIP_OPT_REMOVE_ALL_PATH : + // PCLZIP_OPT_COMMENT : + // PCLZIP_CB_PRE_ADD : + // PCLZIP_CB_POST_ADD : + // Return Values : + // 0 on failure, + // The list of the added files, with a status of the add action. + // (see PclZip::listContent() for list entry format) + // -------------------------------------------------------------------------------- + public function create($p_filelist) { - - // ----- Duplicate the archive - $v_result = $this->privDuplicate($p_archive->zipname); - } - - // ----- Look if the $p_archive is a string (so a filename) - else if (is_string($p_archive)) - { - - // ----- Check that $p_archive is a valid zip file - // TBC : Should also check the archive format - if (!is_file($p_archive)) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '".$p_archive."'"); - $v_result = PCLZIP_ERR_MISSING_FILE; - } - else { - // ----- Duplicate the archive - $v_result = $this->privDuplicate($p_archive); - } - } - - // ----- Invalid variable - else - { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add"); - $v_result = PCLZIP_ERR_INVALID_PARAMETER; - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : merge() - // Description : - // This method merge the $p_archive_to_add archive at the end of the current - // one ($this). - // If the archive ($this) does not exist, the merge becomes a duplicate. - // If the $p_archive_to_add archive does not exist, the merge is a success. - // Parameters : - // $p_archive_to_add : It can be directly the filename of a valid zip archive, - // or a PclZip object archive. - // Return Values : - // 1 on success, - // 0 or negative values on error (see below). - // -------------------------------------------------------------------------------- - function merge($p_archive_to_add) - { - $v_result = 1; - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Check archive - if (!$this->privCheckFormat()) { - return(0); - } - - // ----- Look if the $p_archive_to_add is a PclZip object - if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip')) - { - - // ----- Merge the archive - $v_result = $this->privMerge($p_archive_to_add); - } - - // ----- Look if the $p_archive_to_add is a string (so a filename) - else if (is_string($p_archive_to_add)) - { - - // ----- Create a temporary archive - $v_object_archive = new PclZip($p_archive_to_add); - - // ----- Merge the archive - $v_result = $this->privMerge($v_object_archive); - } - - // ----- Invalid variable - else - { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add"); - $v_result = PCLZIP_ERR_INVALID_PARAMETER; - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - - - // -------------------------------------------------------------------------------- - // Function : errorCode() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - function errorCode() - { - if (PCLZIP_ERROR_EXTERNAL == 1) { - return(PclErrorCode()); - } - else { - return($this->error_code); - } - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : errorName() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - function errorName($p_with_code=false) - { - $v_name = array ( PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR', - PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL', - PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL', - PCLZIP_ERR_INVALID_PARAMETER => 'PCLZIP_ERR_INVALID_PARAMETER', - PCLZIP_ERR_MISSING_FILE => 'PCLZIP_ERR_MISSING_FILE', - PCLZIP_ERR_FILENAME_TOO_LONG => 'PCLZIP_ERR_FILENAME_TOO_LONG', - PCLZIP_ERR_INVALID_ZIP => 'PCLZIP_ERR_INVALID_ZIP', - PCLZIP_ERR_BAD_EXTRACTED_FILE => 'PCLZIP_ERR_BAD_EXTRACTED_FILE', - PCLZIP_ERR_DIR_CREATE_FAIL => 'PCLZIP_ERR_DIR_CREATE_FAIL', - PCLZIP_ERR_BAD_EXTENSION => 'PCLZIP_ERR_BAD_EXTENSION', - PCLZIP_ERR_BAD_FORMAT => 'PCLZIP_ERR_BAD_FORMAT', - PCLZIP_ERR_DELETE_FILE_FAIL => 'PCLZIP_ERR_DELETE_FILE_FAIL', - PCLZIP_ERR_RENAME_FILE_FAIL => 'PCLZIP_ERR_RENAME_FILE_FAIL', - PCLZIP_ERR_BAD_CHECKSUM => 'PCLZIP_ERR_BAD_CHECKSUM', - PCLZIP_ERR_INVALID_ARCHIVE_ZIP => 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', - PCLZIP_ERR_MISSING_OPTION_VALUE => 'PCLZIP_ERR_MISSING_OPTION_VALUE', - PCLZIP_ERR_INVALID_OPTION_VALUE => 'PCLZIP_ERR_INVALID_OPTION_VALUE', - PCLZIP_ERR_UNSUPPORTED_COMPRESSION => 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', - PCLZIP_ERR_UNSUPPORTED_ENCRYPTION => 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION' - ,PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE => 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE' - ,PCLZIP_ERR_DIRECTORY_RESTRICTION => 'PCLZIP_ERR_DIRECTORY_RESTRICTION' - ); - - if (isset($v_name[$this->error_code])) { - $v_value = $v_name[$this->error_code]; - } - else { - $v_value = 'NoName'; - } - - if ($p_with_code) { - return($v_value.' ('.$this->error_code.')'); - } - else { - return($v_value); - } - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : errorInfo() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - function errorInfo($p_full=false) - { - if (PCLZIP_ERROR_EXTERNAL == 1) { - return(PclErrorString()); - } - else { - if ($p_full) { - return($this->errorName(true)." : ".$this->error_string); - } - else { - return($this->error_string." [code ".$this->error_code."]"); - } - } - } - // -------------------------------------------------------------------------------- - - -// -------------------------------------------------------------------------------- -// ***** UNDER THIS LINE ARE DEFINED PRIVATE INTERNAL FUNCTIONS ***** -// ***** ***** -// ***** THESES FUNCTIONS MUST NOT BE USED DIRECTLY ***** -// -------------------------------------------------------------------------------- - - - - // -------------------------------------------------------------------------------- - // Function : privCheckFormat() - // Description : - // This method check that the archive exists and is a valid zip archive. - // Several level of check exists. (futur) - // Parameters : - // $p_level : Level of check. Default 0. - // 0 : Check the first bytes (magic codes) (default value)) - // 1 : 0 + Check the central directory (futur) - // 2 : 1 + Check each file header (futur) - // Return Values : - // true on success, - // false on error, the error code is set. - // -------------------------------------------------------------------------------- - function privCheckFormat($p_level=0) - { - $v_result = true; - - // ----- Reset the file system cache - clearstatcache(); - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Look if the file exits - if (!is_file($this->zipname)) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '".$this->zipname."'"); - return(false); - } - - // ----- Check that the file is readeable - if (!is_readable($this->zipname)) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '".$this->zipname."'"); - return(false); - } - - // ----- Check the magic code - // TBC - - // ----- Check the central header - // TBC - - // ----- Check each file header - // TBC - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privParseOptions() - // Description : - // This internal methods reads the variable list of arguments ($p_options_list, - // $p_size) and generate an array with the options and values ($v_result_list). - // $v_requested_options contains the options that can be present and those that - // must be present. - // $v_requested_options is an array, with the option value as key, and 'optional', - // or 'mandatory' as value. - // Parameters : - // See above. - // Return Values : - // 1 on success. - // 0 on failure. - // -------------------------------------------------------------------------------- - function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options=false) - { - $v_result=1; - - // ----- Read the options - $i=0; - while ($i<$p_size) { - - // ----- Check if the option is supported - if (!isset($v_requested_options[$p_options_list[$i]])) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '".$p_options_list[$i]."' for this method"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Look for next option - switch ($p_options_list[$i]) { - // ----- Look for options that request a path value - case PCLZIP_OPT_PATH : - case PCLZIP_OPT_REMOVE_PATH : - case PCLZIP_OPT_ADD_PATH : - // ----- Check the number of parameters - if (($i+1) >= $p_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Get the value - $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE); - $i++; - break; - - case PCLZIP_OPT_TEMP_FILE_THRESHOLD : - // ----- Check the number of parameters - if (($i+1) >= $p_size) { - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - return PclZip::errorCode(); - } - - // ----- Check for incompatible options - if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'"); - return PclZip::errorCode(); - } - - // ----- Check the value - $v_value = $p_options_list[$i+1]; - if ((!is_integer($v_value)) || ($v_value<0)) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - return PclZip::errorCode(); - } - - // ----- Get the value (and convert it in bytes) - $v_result_list[$p_options_list[$i]] = $v_value*1048576; - $i++; - break; - - case PCLZIP_OPT_TEMP_FILE_ON : - // ----- Check for incompatible options - if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'"); - return PclZip::errorCode(); - } - - $v_result_list[$p_options_list[$i]] = true; - break; - - case PCLZIP_OPT_TEMP_FILE_OFF : - // ----- Check for incompatible options - if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_ON])) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_ON'"); - return PclZip::errorCode(); - } - // ----- Check for incompatible options - if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_THRESHOLD'"); - return PclZip::errorCode(); - } - - $v_result_list[$p_options_list[$i]] = true; - break; - - case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION : - // ----- Check the number of parameters - if (($i+1) >= $p_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Get the value - if ( is_string($p_options_list[$i+1]) - && ($p_options_list[$i+1] != '')) { - $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE); - $i++; - } - else { - } - break; - - // ----- Look for options that request an array of string for value - case PCLZIP_OPT_BY_NAME : - // ----- Check the number of parameters - if (($i+1) >= $p_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Get the value - if (is_string($p_options_list[$i+1])) { - $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1]; - } - else if (is_array($p_options_list[$i+1])) { - $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; - } - else { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - - // ----- Return - return PclZip::errorCode(); - } - $i++; - break; - - // ----- Look for options that request an EREG or PREG expression - case PCLZIP_OPT_BY_EREG : - // ereg() is deprecated starting with PHP 5.3. Move PCLZIP_OPT_BY_EREG - // to PCLZIP_OPT_BY_PREG - $p_options_list[$i] = PCLZIP_OPT_BY_PREG; - case PCLZIP_OPT_BY_PREG : - //case PCLZIP_OPT_CRYPT : - // ----- Check the number of parameters - if (($i+1) >= $p_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Get the value - if (is_string($p_options_list[$i+1])) { - $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; - } - else { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - - // ----- Return - return PclZip::errorCode(); - } - $i++; - break; - - // ----- Look for options that takes a string - case PCLZIP_OPT_COMMENT : - case PCLZIP_OPT_ADD_COMMENT : - case PCLZIP_OPT_PREPEND_COMMENT : - // ----- Check the number of parameters - if (($i+1) >= $p_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, - "Missing parameter value for option '" - .PclZipUtilOptionText($p_options_list[$i]) - ."'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Get the value - if (is_string($p_options_list[$i+1])) { - $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; - } - else { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, - "Wrong parameter value for option '" - .PclZipUtilOptionText($p_options_list[$i]) - ."'"); - - // ----- Return - return PclZip::errorCode(); - } - $i++; - break; - - // ----- Look for options that request an array of index - case PCLZIP_OPT_BY_INDEX : - // ----- Check the number of parameters - if (($i+1) >= $p_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Get the value - $v_work_list = array(); - if (is_string($p_options_list[$i+1])) { - - // ----- Remove spaces - $p_options_list[$i+1] = strtr($p_options_list[$i+1], ' ', ''); - - // ----- Parse items - $v_work_list = explode(",", $p_options_list[$i+1]); - } - else if (is_integer($p_options_list[$i+1])) { - $v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1]; - } - else if (is_array($p_options_list[$i+1])) { - $v_work_list = $p_options_list[$i+1]; - } - else { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Reduce the index list - // each index item in the list must be a couple with a start and - // an end value : [0,3], [5-5], [8-10], ... - // ----- Check the format of each item - $v_sort_flag=false; - $v_sort_value=0; - for ($j=0; $j= $p_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Get the value - $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1]; - $i++; - break; - - // ----- Look for options that request a call-back - case PCLZIP_CB_PRE_EXTRACT : - case PCLZIP_CB_POST_EXTRACT : - case PCLZIP_CB_PRE_ADD : - case PCLZIP_CB_POST_ADD : - /* for futur use - case PCLZIP_CB_PRE_DELETE : - case PCLZIP_CB_POST_DELETE : - case PCLZIP_CB_PRE_LIST : - case PCLZIP_CB_POST_LIST : - */ - // ----- Check the number of parameters - if (($i+1) >= $p_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Get the value - $v_function_name = $p_options_list[$i+1]; - - // ----- Check that the value is a valid existing function - if (!function_exists($v_function_name)) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '".$v_function_name."()' is not an existing function for option '".PclZipUtilOptionText($p_options_list[$i])."'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Set the attribute - $v_result_list[$p_options_list[$i]] = $v_function_name; - $i++; - break; - - default : - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, - "Unknown parameter '" - .$p_options_list[$i]."'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Next options - $i++; - } - - // ----- Look for mandatory options - if ($v_requested_options !== false) { - for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) { - // ----- Look for mandatory option - if ($v_requested_options[$key] == 'mandatory') { - // ----- Look if present - if (!isset($v_result_list[$key])) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")"); - - // ----- Return - return PclZip::errorCode(); - } - } - } - } - - // ----- Look for default values - if (!isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) { - - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privOptionDefaultThreshold() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privOptionDefaultThreshold(&$p_options) - { - $v_result=1; - - if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) - || isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) { - return $v_result; - } - - // ----- Get 'memory_limit' configuration value - $v_memory_limit = ini_get('memory_limit'); - $v_memory_limit = trim($v_memory_limit); - $last = strtolower(substr($v_memory_limit, -1)); - - if($last == 'g') - //$v_memory_limit = $v_memory_limit*1024*1024*1024; - $v_memory_limit = $v_memory_limit*1073741824; - if($last == 'm') - //$v_memory_limit = $v_memory_limit*1024*1024; - $v_memory_limit = $v_memory_limit*1048576; - if($last == 'k') - $v_memory_limit = $v_memory_limit*1024; - - $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO); - - - // ----- Sanity check : No threshold if value lower than 1M - if ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] < 1048576) { - unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]); - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privFileDescrParseAtt() - // Description : - // Parameters : - // Return Values : - // 1 on success. - // 0 on failure. - // -------------------------------------------------------------------------------- - function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options=false) - { - $v_result=1; - - // ----- For each file in the list check the attributes - foreach ($p_file_list as $v_key => $v_value) { - - // ----- Check if the option is supported - if (!isset($v_requested_options[$v_key])) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file attribute '".$v_key."' for this file"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Look for attribute - switch ($v_key) { - case PCLZIP_ATT_FILE_NAME : - if (!is_string($v_value)) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'"); - return PclZip::errorCode(); - } - - $p_filedescr['filename'] = PclZipUtilPathReduction($v_value); - - if ($p_filedescr['filename'] == '') { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'"); - return PclZip::errorCode(); - } - - break; - - case PCLZIP_ATT_FILE_NEW_SHORT_NAME : - if (!is_string($v_value)) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'"); - return PclZip::errorCode(); - } - - $p_filedescr['new_short_name'] = PclZipUtilPathReduction($v_value); - - if ($p_filedescr['new_short_name'] == '') { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty short filename for attribute '".PclZipUtilOptionText($v_key)."'"); - return PclZip::errorCode(); - } - break; - - case PCLZIP_ATT_FILE_NEW_FULL_NAME : - if (!is_string($v_value)) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'"); - return PclZip::errorCode(); - } - - $p_filedescr['new_full_name'] = PclZipUtilPathReduction($v_value); - - if ($p_filedescr['new_full_name'] == '') { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty full filename for attribute '".PclZipUtilOptionText($v_key)."'"); - return PclZip::errorCode(); - } - break; - - // ----- Look for options that takes a string - case PCLZIP_ATT_FILE_COMMENT : - if (!is_string($v_value)) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'"); - return PclZip::errorCode(); - } - - $p_filedescr['comment'] = $v_value; - break; - - case PCLZIP_ATT_FILE_MTIME : - if (!is_integer($v_value)) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". Integer expected for attribute '".PclZipUtilOptionText($v_key)."'"); - return PclZip::errorCode(); - } - - $p_filedescr['mtime'] = $v_value; - break; - - case PCLZIP_ATT_FILE_CONTENT : - $p_filedescr['content'] = $v_value; - break; - - default : - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, - "Unknown parameter '".$v_key."'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Look for mandatory options - if ($v_requested_options !== false) { - for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) { - // ----- Look for mandatory option - if ($v_requested_options[$key] == 'mandatory') { - // ----- Look if present - if (!isset($p_file_list[$key])) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")"); - return PclZip::errorCode(); - } - } - } - } - - // end foreach - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privFileDescrExpand() - // Description : - // This method look for each item of the list to see if its a file, a folder - // or a string to be added as file. For any other type of files (link, other) - // just ignore the item. - // Then prepare the information that will be stored for that file. - // When its a folder, expand the folder with all the files that are in that - // folder (recursively). - // Parameters : - // Return Values : - // 1 on success. - // 0 on failure. - // -------------------------------------------------------------------------------- - function privFileDescrExpand(&$p_filedescr_list, &$p_options) - { - $v_result=1; - - // ----- Create a result list - $v_result_list = array(); - - // ----- Look each entry - for ($i=0; $iprivCalculateStoredFilename($v_descr, $p_options); - - // ----- Add the descriptor in result list - $v_result_list[sizeof($v_result_list)] = $v_descr; - - // ----- Look for folder - if ($v_descr['type'] == 'folder') { - // ----- List of items in folder - $v_dirlist_descr = array(); - $v_dirlist_nb = 0; - if ($v_folder_handler = @opendir($v_descr['filename'])) { - while (($v_item_handler = @readdir($v_folder_handler)) !== false) { - - // ----- Skip '.' and '..' - if (($v_item_handler == '.') || ($v_item_handler == '..')) { - continue; - } - - // ----- Compose the full filename - $v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler; - - // ----- Look for different stored filename - // Because the name of the folder was changed, the name of the - // files/sub-folders also change - if (($v_descr['stored_filename'] != $v_descr['filename']) - && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) { - if ($v_descr['stored_filename'] != '') { - $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler; - } - else { - $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_item_handler; - } - } - - $v_dirlist_nb++; - } - - @closedir($v_folder_handler); - } - else { - // TBC : unable to open folder in read mode - } - - // ----- Expand each element of the list - if ($v_dirlist_nb != 0) { - // ----- Expand - if (($v_result = $this->privFileDescrExpand($v_dirlist_descr, $p_options)) != 1) { - return $v_result; - } - - // ----- Concat the resulting list - $v_result_list = array_merge($v_result_list, $v_dirlist_descr); - } - else { - } - - // ----- Free local array - unset($v_dirlist_descr); - } - } - - // ----- Get the result list - $p_filedescr_list = $v_result_list; - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privCreate() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privCreate($p_filedescr_list, &$p_result_list, &$p_options) - { - $v_result=1; - $v_list_detail = array(); - - // ----- Magic quotes trick - $this->privDisableMagicQuotes(); - - // ----- Open the file in write mode - if (($v_result = $this->privOpenFd('wb')) != 1) - { - // ----- Return - return $v_result; - } - - // ----- Add the list of files - $v_result = $this->privAddList($p_filedescr_list, $p_result_list, $p_options); - - // ----- Close - $this->privCloseFd(); - - // ----- Magic quotes trick - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privAdd() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privAdd($p_filedescr_list, &$p_result_list, &$p_options) - { - $v_result=1; - $v_list_detail = array(); - - // ----- Look if the archive exists or is empty - if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0)) - { - - // ----- Do a create - $v_result = $this->privCreate($p_filedescr_list, $p_result_list, $p_options); - - // ----- Return - return $v_result; - } - // ----- Magic quotes trick - $this->privDisableMagicQuotes(); - - // ----- Open the zip file - if (($v_result=$this->privOpenFd('rb')) != 1) - { - // ----- Magic quotes trick - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_result; - } - - // ----- Read the central directory informations - $v_central_dir = array(); - if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) - { - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - return $v_result; - } - - // ----- Go to beginning of File - @rewind($this->zip_fd); - - // ----- Creates a temporay file - $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp'; - - // ----- Open the temporary file in write mode - if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0) - { - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Copy the files from the archive to the temporary file - // TBC : Here I should better append the file and go back to erase the central dir - $v_size = $v_central_dir['offset']; - while ($v_size != 0) - { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = fread($this->zip_fd, $v_read_size); - @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Swap the file descriptor - // Here is a trick : I swap the temporary fd with the zip fd, in order to use - // the following methods on the temporary fil and not the real archive - $v_swap = $this->zip_fd; - $this->zip_fd = $v_zip_temp_fd; - $v_zip_temp_fd = $v_swap; - - // ----- Add the files - $v_header_list = array(); - if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1) - { - fclose($v_zip_temp_fd); - $this->privCloseFd(); - @unlink($v_zip_temp_name); - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_result; - } - - // ----- Store the offset of the central dir - $v_offset = @ftell($this->zip_fd); - - // ----- Copy the block of file headers from the old archive - $v_size = $v_central_dir['size']; - while ($v_size != 0) - { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($v_zip_temp_fd, $v_read_size); - @fwrite($this->zip_fd, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Create the Central Dir files header - for ($i=0, $v_count=0; $iprivWriteCentralFileHeader($v_header_list[$i])) != 1) { - fclose($v_zip_temp_fd); - $this->privCloseFd(); - @unlink($v_zip_temp_name); - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_result; - } - $v_count++; - } - - // ----- Transform the header to a 'usable' info - $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); - } - - // ----- Zip file comment - $v_comment = $v_central_dir['comment']; - if (isset($p_options[PCLZIP_OPT_COMMENT])) { - $v_comment = $p_options[PCLZIP_OPT_COMMENT]; - } - if (isset($p_options[PCLZIP_OPT_ADD_COMMENT])) { - $v_comment = $v_comment.$p_options[PCLZIP_OPT_ADD_COMMENT]; - } - if (isset($p_options[PCLZIP_OPT_PREPEND_COMMENT])) { - $v_comment = $p_options[PCLZIP_OPT_PREPEND_COMMENT].$v_comment; - } - - // ----- Calculate the size of the central header - $v_size = @ftell($this->zip_fd)-$v_offset; - - // ----- Create the central dir footer - if (($v_result = $this->privWriteCentralHeader($v_count+$v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1) - { - // ----- Reset the file list - unset($v_header_list); - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_result; - } - - // ----- Swap back the file descriptor - $v_swap = $this->zip_fd; - $this->zip_fd = $v_zip_temp_fd; - $v_zip_temp_fd = $v_swap; - - // ----- Close - $this->privCloseFd(); - - // ----- Close the temporary file - @fclose($v_zip_temp_fd); - - // ----- Magic quotes trick - $this->privSwapBackMagicQuotes(); - - // ----- Delete the zip file - // TBC : I should test the result ... - @unlink($this->zipname); - - // ----- Rename the temporary file - // TBC : I should test the result ... - //@rename($v_zip_temp_name, $this->zipname); - PclZipUtilRename($v_zip_temp_name, $this->zipname); - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privOpenFd() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - function privOpenFd($p_mode) - { - $v_result=1; - - // ----- Look if already open - if ($this->zip_fd != 0) - { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Zip file \''.$this->zipname.'\' already open'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Open the zip file - if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0) - { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in '.$p_mode.' mode'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privCloseFd() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - function privCloseFd() - { - $v_result=1; - - if ($this->zip_fd != 0) - @fclose($this->zip_fd); - $this->zip_fd = 0; - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privAddList() - // Description : - // $p_add_dir and $p_remove_dir will give the ability to memorize a path which is - // different from the real path of the file. This is usefull if you want to have PclTar - // running in any directory, and memorize relative path from an other directory. - // Parameters : - // $p_list : An array containing the file or directory names to add in the tar - // $p_result_list : list of added files with their properties (specially the status field) - // $p_add_dir : Path to add in the filename path archived - // $p_remove_dir : Path to remove in the filename path archived - // Return Values : - // -------------------------------------------------------------------------------- -// function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options) - function privAddList($p_filedescr_list, &$p_result_list, &$p_options) - { - $v_result=1; - - // ----- Add the files - $v_header_list = array(); - if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1) - { - // ----- Return - return $v_result; - } - - // ----- Store the offset of the central dir - $v_offset = @ftell($this->zip_fd); - - // ----- Create the Central Dir files header - for ($i=0,$v_count=0; $iprivWriteCentralFileHeader($v_header_list[$i])) != 1) { - // ----- Return - return $v_result; - } - $v_count++; - } - - // ----- Transform the header to a 'usable' info - $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); - } - - // ----- Zip file comment - $v_comment = ''; - if (isset($p_options[PCLZIP_OPT_COMMENT])) { - $v_comment = $p_options[PCLZIP_OPT_COMMENT]; - } - - // ----- Calculate the size of the central header - $v_size = @ftell($this->zip_fd)-$v_offset; - - // ----- Create the central dir footer - if (($v_result = $this->privWriteCentralHeader($v_count, $v_size, $v_offset, $v_comment)) != 1) - { - // ----- Reset the file list - unset($v_header_list); - - // ----- Return - return $v_result; - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privAddFileList() - // Description : - // Parameters : - // $p_filedescr_list : An array containing the file description - // or directory names to add in the zip - // $p_result_list : list of added files with their properties (specially the status field) - // Return Values : - // -------------------------------------------------------------------------------- - function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options) - { - $v_result=1; - $v_header = array(); - - // ----- Recuperate the current number of elt in list - $v_nb = sizeof($p_result_list); - - // ----- Loop on the files - for ($j=0; ($jprivAddFile($p_filedescr_list[$j], $v_header, - $p_options); - if ($v_result != 1) { - return $v_result; - } - - // ----- Store the file infos - $p_result_list[$v_nb++] = $v_header; - } - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privAddFile() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privAddFile($p_filedescr, &$p_header, &$p_options) - { - $v_result=1; - - // ----- Working variable - $p_filename = $p_filedescr['filename']; - - // TBC : Already done in the fileAtt check ... ? - if ($p_filename == "") { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file list parameter (invalid or empty list)"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Look for a stored different filename - /* TBC : Removed - if (isset($p_filedescr['stored_filename'])) { - $v_stored_filename = $p_filedescr['stored_filename']; - } - else { - $v_stored_filename = $p_filedescr['stored_filename']; - } - */ - - // ----- Set the file properties - clearstatcache(); - $p_header['version'] = 20; - $p_header['version_extracted'] = 10; - $p_header['flag'] = 0; - $p_header['compression'] = 0; - $p_header['crc'] = 0; - $p_header['compressed_size'] = 0; - $p_header['filename_len'] = strlen($p_filename); - $p_header['extra_len'] = 0; - $p_header['disk'] = 0; - $p_header['internal'] = 0; - $p_header['offset'] = 0; - $p_header['filename'] = $p_filename; -// TBC : Removed $p_header['stored_filename'] = $v_stored_filename; - $p_header['stored_filename'] = $p_filedescr['stored_filename']; - $p_header['extra'] = ''; - $p_header['status'] = 'ok'; - $p_header['index'] = -1; - - // ----- Look for regular file - if ($p_filedescr['type']=='file') { - $p_header['external'] = 0x00000000; - $p_header['size'] = filesize($p_filename); - } - - // ----- Look for regular folder - else if ($p_filedescr['type']=='folder') { - $p_header['external'] = 0x00000010; - $p_header['mtime'] = filemtime($p_filename); - $p_header['size'] = filesize($p_filename); - } - - // ----- Look for virtual file - else if ($p_filedescr['type'] == 'virtual_file') { - $p_header['external'] = 0x00000000; - $p_header['size'] = strlen($p_filedescr['content']); - } - - - // ----- Look for filetime - if (isset($p_filedescr['mtime'])) { - $p_header['mtime'] = $p_filedescr['mtime']; - } - else if ($p_filedescr['type'] == 'virtual_file') { - $p_header['mtime'] = time(); - } - else { - $p_header['mtime'] = filemtime($p_filename); - } - - // ------ Look for file comment - if (isset($p_filedescr['comment'])) { - $p_header['comment_len'] = strlen($p_filedescr['comment']); - $p_header['comment'] = $p_filedescr['comment']; - } - else { - $p_header['comment_len'] = 0; - $p_header['comment'] = ''; - } - - // ----- Look for pre-add callback - if (isset($p_options[PCLZIP_CB_PRE_ADD])) { - - // ----- Generate a local information - $v_local_header = array(); - $this->privConvertHeader2FileInfo($p_header, $v_local_header); - - // ----- Call the callback - // Here I do not use call_user_func() because I need to send a reference to the - // header. -// eval('$v_result = '.$p_options[PCLZIP_CB_PRE_ADD].'(PCLZIP_CB_PRE_ADD, $v_local_header);'); - $v_result = $p_options[PCLZIP_CB_PRE_ADD](PCLZIP_CB_PRE_ADD, $v_local_header); - if ($v_result == 0) { - // ----- Change the file status - $p_header['status'] = "skipped"; $v_result = 1; - } - // ----- Update the informations - // Only some fields can be modified - if ($p_header['stored_filename'] != $v_local_header['stored_filename']) { - $p_header['stored_filename'] = PclZipUtilPathReduction($v_local_header['stored_filename']); - } - } + // ----- Reset the error handler + $this->privErrorReset(); - // ----- Look for empty stored filename - if ($p_header['stored_filename'] == "") { - $p_header['status'] = "filtered"; - } + // ----- Set default values + $v_options = array(); + $v_options[PCLZIP_OPT_NO_COMPRESSION] = false; - // ----- Check the path length - if (strlen($p_header['stored_filename']) > 0xFF) { - $p_header['status'] = 'filename_too_long'; - } + // ----- Look for variable options arguments + $v_size = func_num_args(); - // ----- Look if no error, or file not skipped - if ($p_header['status'] == 'ok') { + // ----- Look for arguments + if ($v_size > 1) { + // ----- Get the arguments + $v_arg_list = func_get_args(); - // ----- Look for a file - if ($p_filedescr['type'] == 'file') { - // ----- Look for using temporary file to zip - if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) - && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) - || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) - && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])) ) ) { - $v_result = $this->privAddFileUsingTempFile($p_filedescr, $p_header, $p_options); - if ($v_result < PCLZIP_ERR_NO_ERROR) { - return $v_result; - } + // ----- Remove from the options list the first argument + array_shift($v_arg_list); + $v_size--; + + // ----- Look for first arg + if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { + + // ----- Parse the options + $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array( + PCLZIP_OPT_REMOVE_PATH => 'optional', + PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', + PCLZIP_OPT_ADD_PATH => 'optional', + PCLZIP_CB_PRE_ADD => 'optional', + PCLZIP_CB_POST_ADD => 'optional', + PCLZIP_OPT_NO_COMPRESSION => 'optional', + PCLZIP_OPT_COMMENT => 'optional', + PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', + PCLZIP_OPT_TEMP_FILE_ON => 'optional', + PCLZIP_OPT_TEMP_FILE_OFF => 'optional' + //, PCLZIP_OPT_CRYPT => 'optional' + )); + if ($v_result != 1) { + return 0; + } + + // ----- Look for 2 args + // Here we need to support the first historic synopsis of the + // method. + } else { + + // ----- Get the first argument + $v_options[PCLZIP_OPT_ADD_PATH] = $v_arg_list[0]; + + // ----- Look for the optional second argument + if ($v_size == 2) { + $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1]; + } elseif ($v_size > 2) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); + + return 0; + } + } } - // ----- Use "in memory" zip algo - else { + // ----- Look for default option values + $this->privOptionDefaultThreshold($v_options); - // ----- Open the source file - if (($v_file = @fopen($p_filename, "rb")) == 0) { - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode"); - return PclZip::errorCode(); + // ----- Init + $v_string_list = array(); + $v_att_list = array(); + $v_filedescr_list = array(); + $p_result_list = array(); + + // ----- Look if the $p_filelist is really an array + if (is_array($p_filelist)) { + + // ----- Look if the first element is also an array + // This will mean that this is a file description entry + if (isset($p_filelist[0]) && is_array($p_filelist[0])) { + $v_att_list = $p_filelist; + + // ----- The list is a list of string names + } else { + $v_string_list = $p_filelist; + } + + // ----- Look if the $p_filelist is a string + } elseif (is_string($p_filelist)) { + // ----- Create a list from the string + $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist); + + // ----- Invalid variable type for $p_filelist + } else { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist"); + + return 0; } - // ----- Read the file content - $v_content = @fread($v_file, $p_header['size']); - - // ----- Close the file - @fclose($v_file); - - // ----- Calculate the CRC - $p_header['crc'] = @crc32($v_content); - - // ----- Look for no compression - if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) { - // ----- Set header parameters - $p_header['compressed_size'] = $p_header['size']; - $p_header['compression'] = 0; + // ----- Reformat the string list + if (sizeof($v_string_list) != 0) { + foreach ($v_string_list as $v_string) { + if ($v_string != '') { + $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string; + } else { + } + } } - // ----- Look for normal compression - else { - // ----- Compress the content - $v_content = @gzdeflate($v_content); - - // ----- Set header parameters - $p_header['compressed_size'] = strlen($v_content); - $p_header['compression'] = 8; + // ----- For each file in the list check the attributes + $v_supported_attributes = array( + PCLZIP_ATT_FILE_NAME => 'mandatory', + PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional', + PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional', + PCLZIP_ATT_FILE_MTIME => 'optional', + PCLZIP_ATT_FILE_CONTENT => 'optional', + PCLZIP_ATT_FILE_COMMENT => 'optional' + ); + foreach ($v_att_list as $v_entry) { + $v_result = $this->privFileDescrParseAtt($v_entry, $v_filedescr_list[], $v_options, $v_supported_attributes); + if ($v_result != 1) { + return 0; + } } - // ----- Call the header generation - if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { - @fclose($v_file); - return $v_result; + // ----- Expand the filelist (expand directories) + $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options); + if ($v_result != 1) { + return 0; } - // ----- Write the compressed (or not) content - @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']); - + // ----- Call the create fct + $v_result = $this->privCreate($v_filedescr_list, $p_result_list, $v_options); + if ($v_result != 1) { + return 0; } - } - - // ----- Look for a virtual file (a file from string) - else if ($p_filedescr['type'] == 'virtual_file') { - - $v_content = $p_filedescr['content']; - - // ----- Calculate the CRC - $p_header['crc'] = @crc32($v_content); - - // ----- Look for no compression - if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) { - // ----- Set header parameters - $p_header['compressed_size'] = $p_header['size']; - $p_header['compression'] = 0; - } - - // ----- Look for normal compression - else { - // ----- Compress the content - $v_content = @gzdeflate($v_content); - - // ----- Set header parameters - $p_header['compressed_size'] = strlen($v_content); - $p_header['compression'] = 8; - } - - // ----- Call the header generation - if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { - @fclose($v_file); - return $v_result; - } - - // ----- Write the compressed (or not) content - @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']); - } - - // ----- Look for a directory - else if ($p_filedescr['type'] == 'folder') { - // ----- Look for directory last '/' - if (@substr($p_header['stored_filename'], -1) != '/') { - $p_header['stored_filename'] .= '/'; - } - - // ----- Set the file properties - $p_header['size'] = 0; - //$p_header['external'] = 0x41FF0010; // Value for a folder : to be checked - $p_header['external'] = 0x00000010; // Value for a folder : to be checked - - // ----- Call the header generation - if (($v_result = $this->privWriteFileHeader($p_header)) != 1) - { - return $v_result; - } - } - } - - // ----- Look for post-add callback - if (isset($p_options[PCLZIP_CB_POST_ADD])) { - - // ----- Generate a local information - $v_local_header = array(); - $this->privConvertHeader2FileInfo($p_header, $v_local_header); - - // ----- Call the callback - // Here I do not use call_user_func() because I need to send a reference to the - // header. -// eval('$v_result = '.$p_options[PCLZIP_CB_POST_ADD].'(PCLZIP_CB_POST_ADD, $v_local_header);'); - $v_result = $p_options[PCLZIP_CB_POST_ADD](PCLZIP_CB_POST_ADD, $v_local_header); - if ($v_result == 0) { - // ----- Ignored - $v_result = 1; - } - - // ----- Update the informations - // Nothing can be modified - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privAddFileUsingTempFile() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privAddFileUsingTempFile($p_filedescr, &$p_header, &$p_options) - { - $v_result=PCLZIP_ERR_NO_ERROR; - - // ----- Working variable - $p_filename = $p_filedescr['filename']; - - - // ----- Open the source file - if (($v_file = @fopen($p_filename, "rb")) == 0) { - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode"); - return PclZip::errorCode(); - } - - // ----- Creates a compressed temporary file - $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz'; - if (($v_file_compressed = @gzopen($v_gzip_temp_name, "wb")) == 0) { - fclose($v_file); - PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode'); - return PclZip::errorCode(); - } - - // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks - $v_size = filesize($p_filename); - while ($v_size != 0) { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($v_file, $v_read_size); - //$v_binary_data = pack('a'.$v_read_size, $v_buffer); - @gzputs($v_file_compressed, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Close the file - @fclose($v_file); - @gzclose($v_file_compressed); - - // ----- Check the minimum file size - if (filesize($v_gzip_temp_name) < 18) { - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'gzip temporary file \''.$v_gzip_temp_name.'\' has invalid filesize - should be minimum 18 bytes'); - return PclZip::errorCode(); - } - - // ----- Extract the compressed attributes - if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) { - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode'); - return PclZip::errorCode(); - } - - // ----- Read the gzip file header - $v_binary_data = @fread($v_file_compressed, 10); - $v_data_header = unpack('a1id1/a1id2/a1cm/a1flag/Vmtime/a1xfl/a1os', $v_binary_data); - - // ----- Check some parameters - $v_data_header['os'] = bin2hex($v_data_header['os']); - - // ----- Read the gzip file footer - @fseek($v_file_compressed, filesize($v_gzip_temp_name)-8); - $v_binary_data = @fread($v_file_compressed, 8); - $v_data_footer = unpack('Vcrc/Vcompressed_size', $v_binary_data); - - // ----- Set the attributes - $p_header['compression'] = ord($v_data_header['cm']); - //$p_header['mtime'] = $v_data_header['mtime']; - $p_header['crc'] = $v_data_footer['crc']; - $p_header['compressed_size'] = filesize($v_gzip_temp_name)-18; - - // ----- Close the file - @fclose($v_file_compressed); - - // ----- Call the header generation - if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { - return $v_result; - } - - // ----- Add the compressed data - if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) - { - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode'); - return PclZip::errorCode(); - } - - // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks - fseek($v_file_compressed, 10); - $v_size = $p_header['compressed_size']; - while ($v_size != 0) - { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($v_file_compressed, $v_read_size); - //$v_binary_data = pack('a'.$v_read_size, $v_buffer); - @fwrite($this->zip_fd, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Close the file - @fclose($v_file_compressed); - - // ----- Unlink the temporary file - @unlink($v_gzip_temp_name); - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privCalculateStoredFilename() - // Description : - // Based on file descriptor properties and global options, this method - // calculate the filename that will be stored in the archive. - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privCalculateStoredFilename(&$p_filedescr, &$p_options) - { - $v_result=1; - - // ----- Working variables - $p_filename = $p_filedescr['filename']; - if (isset($p_options[PCLZIP_OPT_ADD_PATH])) { - $p_add_dir = $p_options[PCLZIP_OPT_ADD_PATH]; - } - else { - $p_add_dir = ''; - } - if (isset($p_options[PCLZIP_OPT_REMOVE_PATH])) { - $p_remove_dir = $p_options[PCLZIP_OPT_REMOVE_PATH]; - } - else { - $p_remove_dir = ''; - } - if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) { - $p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH]; - } - else { - $p_remove_all_dir = 0; - } - - - // ----- Look for full name change - if (isset($p_filedescr['new_full_name'])) { - // ----- Remove drive letter if any - $v_stored_filename = PclZipUtilTranslateWinPath($p_filedescr['new_full_name']); - } - - // ----- Look for path and/or short name change - else { - - // ----- Look for short name change - // Its when we cahnge just the filename but not the path - if (isset($p_filedescr['new_short_name'])) { - $v_path_info = pathinfo($p_filename); - $v_dir = ''; - if ($v_path_info['dirname'] != '') { - $v_dir = $v_path_info['dirname'].'/'; - } - $v_stored_filename = $v_dir.$p_filedescr['new_short_name']; - } - else { - // ----- Calculate the stored filename - $v_stored_filename = $p_filename; - } - - // ----- Look for all path to remove - if ($p_remove_all_dir) { - $v_stored_filename = basename($p_filename); - } - // ----- Look for partial path remove - else if ($p_remove_dir != "") { - if (substr($p_remove_dir, -1) != '/') - $p_remove_dir .= "/"; - - if ( (substr($p_filename, 0, 2) == "./") - || (substr($p_remove_dir, 0, 2) == "./")) { - - if ( (substr($p_filename, 0, 2) == "./") - && (substr($p_remove_dir, 0, 2) != "./")) { - $p_remove_dir = "./".$p_remove_dir; - } - if ( (substr($p_filename, 0, 2) != "./") - && (substr($p_remove_dir, 0, 2) == "./")) { - $p_remove_dir = substr($p_remove_dir, 2); - } - } - - $v_compare = PclZipUtilPathInclusion($p_remove_dir, - $v_stored_filename); - if ($v_compare > 0) { - if ($v_compare == 2) { - $v_stored_filename = ""; - } - else { - $v_stored_filename = substr($v_stored_filename, - strlen($p_remove_dir)); - } - } - } - - // ----- Remove drive letter if any - $v_stored_filename = PclZipUtilTranslateWinPath($v_stored_filename); - - // ----- Look for path to add - if ($p_add_dir != "") { - if (substr($p_add_dir, -1) == "/") - $v_stored_filename = $p_add_dir.$v_stored_filename; - else - $v_stored_filename = $p_add_dir."/".$v_stored_filename; - } - } - - // ----- Filename (reduce the path of stored name) - $v_stored_filename = PclZipUtilPathReduction($v_stored_filename); - $p_filedescr['stored_filename'] = $v_stored_filename; - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privWriteFileHeader() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privWriteFileHeader(&$p_header) - { - $v_result=1; - - // ----- Store the offset position of the file - $p_header['offset'] = ftell($this->zip_fd); - - // ----- Transform UNIX mtime to DOS format mdate/mtime - $v_date = getdate($p_header['mtime']); - $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2; - $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; - - // ----- Packed data - $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50, - $p_header['version_extracted'], $p_header['flag'], - $p_header['compression'], $v_mtime, $v_mdate, - $p_header['crc'], $p_header['compressed_size'], - $p_header['size'], - strlen($p_header['stored_filename']), - $p_header['extra_len']); - - // ----- Write the first 148 bytes of the header in the archive - fputs($this->zip_fd, $v_binary_data, 30); - - // ----- Write the variable fields - if (strlen($p_header['stored_filename']) != 0) - { - fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); - } - if ($p_header['extra_len'] != 0) - { - fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']); - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privWriteCentralFileHeader() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privWriteCentralFileHeader(&$p_header) - { - $v_result=1; - - // TBC - //for(reset($p_header); $key = key($p_header); next($p_header)) { - //} - - // ----- Transform UNIX mtime to DOS format mdate/mtime - $v_date = getdate($p_header['mtime']); - $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2; - $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; - - - // ----- Packed data - $v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50, - $p_header['version'], $p_header['version_extracted'], - $p_header['flag'], $p_header['compression'], - $v_mtime, $v_mdate, $p_header['crc'], - $p_header['compressed_size'], $p_header['size'], - strlen($p_header['stored_filename']), - $p_header['extra_len'], $p_header['comment_len'], - $p_header['disk'], $p_header['internal'], - $p_header['external'], $p_header['offset']); - - // ----- Write the 42 bytes of the header in the zip file - fputs($this->zip_fd, $v_binary_data, 46); - - // ----- Write the variable fields - if (strlen($p_header['stored_filename']) != 0) - { - fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); - } - if ($p_header['extra_len'] != 0) - { - fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']); - } - if ($p_header['comment_len'] != 0) - { - fputs($this->zip_fd, $p_header['comment'], $p_header['comment_len']); - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privWriteCentralHeader() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment) - { - $v_result=1; - - // ----- Packed data - $v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries, - $p_nb_entries, $p_size, - $p_offset, strlen($p_comment)); - - // ----- Write the 22 bytes of the header in the zip file - fputs($this->zip_fd, $v_binary_data, 22); - - // ----- Write the variable fields - if (strlen($p_comment) != 0) - { - fputs($this->zip_fd, $p_comment, strlen($p_comment)); - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privList() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privList(&$p_list) - { - $v_result=1; - - // ----- Magic quotes trick - $this->privDisableMagicQuotes(); - - // ----- Open the zip file - if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0) - { - // ----- Magic quotes trick - $this->privSwapBackMagicQuotes(); - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read the central directory informations - $v_central_dir = array(); - if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) - { - $this->privSwapBackMagicQuotes(); - return $v_result; - } - - // ----- Go to beginning of Central Dir - @rewind($this->zip_fd); - if (@fseek($this->zip_fd, $v_central_dir['offset'])) - { - $this->privSwapBackMagicQuotes(); - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read each entry - for ($i=0; $i<$v_central_dir['entries']; $i++) - { - // ----- Read the file header - if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1) - { - $this->privSwapBackMagicQuotes(); - return $v_result; - } - $v_header['index'] = $i; - - // ----- Get the only interesting attributes - $this->privConvertHeader2FileInfo($v_header, $p_list[$i]); - unset($v_header); - } - - // ----- Close the zip file - $this->privCloseFd(); - - // ----- Magic quotes trick - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privConvertHeader2FileInfo() - // Description : - // This function takes the file informations from the central directory - // entries and extract the interesting parameters that will be given back. - // The resulting file infos are set in the array $p_info - // $p_info['filename'] : Filename with full path. Given by user (add), - // extracted in the filesystem (extract). - // $p_info['stored_filename'] : Stored filename in the archive. - // $p_info['size'] = Size of the file. - // $p_info['compressed_size'] = Compressed size of the file. - // $p_info['mtime'] = Last modification date of the file. - // $p_info['comment'] = Comment associated with the file. - // $p_info['folder'] = true/false : indicates if the entry is a folder or not. - // $p_info['status'] = status of the action on the file. - // $p_info['crc'] = CRC of the file content. - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privConvertHeader2FileInfo($p_header, &$p_info) - { - $v_result=1; - - // ----- Get the interesting attributes - $v_temp_path = PclZipUtilPathReduction($p_header['filename']); - $p_info['filename'] = $v_temp_path; - $v_temp_path = PclZipUtilPathReduction($p_header['stored_filename']); - $p_info['stored_filename'] = $v_temp_path; - $p_info['size'] = $p_header['size']; - $p_info['compressed_size'] = $p_header['compressed_size']; - $p_info['mtime'] = $p_header['mtime']; - $p_info['comment'] = $p_header['comment']; - $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010); - $p_info['index'] = $p_header['index']; - $p_info['status'] = $p_header['status']; - $p_info['crc'] = $p_header['crc']; - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privExtractByRule() - // Description : - // Extract a file or directory depending of rules (by index, by name, ...) - // Parameters : - // $p_file_list : An array where will be placed the properties of each - // extracted file - // $p_path : Path to add while writing the extracted files - // $p_remove_path : Path to remove (from the file memorized path) while writing the - // extracted files. If the path does not match the file path, - // the file is extracted with its memorized path. - // $p_remove_path does not apply to 'list' mode. - // $p_path and $p_remove_path are commulative. - // Return Values : - // 1 on success,0 or less on error (see error code list) - // -------------------------------------------------------------------------------- - function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options) - { - $v_result=1; - - // ----- Magic quotes trick - $this->privDisableMagicQuotes(); - - // ----- Check the path - if ( ($p_path == "") - || ( (substr($p_path, 0, 1) != "/") - && (substr($p_path, 0, 3) != "../") - && (substr($p_path,1,2)!=":/"))) - $p_path = "./".$p_path; - - // ----- Reduce the path last (and duplicated) '/' - if (($p_path != "./") && ($p_path != "/")) - { - // ----- Look for the path end '/' - while (substr($p_path, -1) == "/") - { - $p_path = substr($p_path, 0, strlen($p_path)-1); - } - } - - // ----- Look for path to remove format (should end by /) - if (($p_remove_path != "") && (substr($p_remove_path, -1) != '/')) - { - $p_remove_path .= '/'; - } - $p_remove_path_size = strlen($p_remove_path); - - // ----- Open the zip file - if (($v_result = $this->privOpenFd('rb')) != 1) - { - $this->privSwapBackMagicQuotes(); - return $v_result; - } - - // ----- Read the central directory informations - $v_central_dir = array(); - if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) - { - // ----- Close the zip file - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - return $v_result; - } - - // ----- Start at beginning of Central Dir - $v_pos_entry = $v_central_dir['offset']; - - // ----- Read each entry - $j_start = 0; - for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) - { - - // ----- Read next Central dir entry - @rewind($this->zip_fd); - if (@fseek($this->zip_fd, $v_pos_entry)) - { - // ----- Close the zip file - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read the file header - $v_header = array(); - if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1) - { - // ----- Close the zip file - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - return $v_result; - } - - // ----- Store the index - $v_header['index'] = $i; - - // ----- Store the file position - $v_pos_entry = ftell($this->zip_fd); - - // ----- Look for the specific extract rules - $v_extract = false; - - // ----- Look for extract by name rule - if ( (isset($p_options[PCLZIP_OPT_BY_NAME])) - && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { - - // ----- Look if the filename is in the list - for ($j=0; ($j strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) - && (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) { - $v_extract = true; - } - } - // ----- Look for a filename - elseif ($v_header['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) { - $v_extract = true; - } - } - } - - // ----- Look for extract by ereg rule - // ereg() is deprecated with PHP 5.3 - /* - else if ( (isset($p_options[PCLZIP_OPT_BY_EREG])) - && ($p_options[PCLZIP_OPT_BY_EREG] != "")) { - - if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header['stored_filename'])) { - $v_extract = true; - } - } - */ - - // ----- Look for extract by preg rule - else if ( (isset($p_options[PCLZIP_OPT_BY_PREG])) - && ($p_options[PCLZIP_OPT_BY_PREG] != "")) { - - if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) { - $v_extract = true; - } - } - - // ----- Look for extract by index rule - else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX])) - && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { - - // ----- Look if the index is in the list - for ($j=$j_start; ($j=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { - $v_extract = true; - } - if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { - $j_start = $j+1; - } - - if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) { - break; - } - } - } - - // ----- Look for no rule, which means extract all the archive - else { - $v_extract = true; - } - - // ----- Check compression method - if ( ($v_extract) - && ( ($v_header['compression'] != 8) - && ($v_header['compression'] != 0))) { - $v_header['status'] = 'unsupported_compression'; - - // ----- Look for PCLZIP_OPT_STOP_ON_ERROR - if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { - - $this->privSwapBackMagicQuotes(); - - PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION, - "Filename '".$v_header['stored_filename']."' is " - ."compressed by an unsupported compression " - ."method (".$v_header['compression'].") "); - - return PclZip::errorCode(); - } - } - - // ----- Check encrypted files - if (($v_extract) && (($v_header['flag'] & 1) == 1)) { - $v_header['status'] = 'unsupported_encryption'; - - // ----- Look for PCLZIP_OPT_STOP_ON_ERROR - if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { - - $this->privSwapBackMagicQuotes(); - - PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, - "Unsupported encryption for " - ." filename '".$v_header['stored_filename'] - ."'"); - - return PclZip::errorCode(); - } + return $p_result_list; } + // -------------------------------------------------------------------------------- - // ----- Look for real extraction - if (($v_extract) && ($v_header['status'] != 'ok')) { - $v_result = $this->privConvertHeader2FileInfo($v_header, - $p_file_list[$v_nb_extracted++]); - if ($v_result != 1) { - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - return $v_result; - } - - $v_extract = false; - } - - // ----- Look for real extraction - if ($v_extract) - { - - // ----- Go to the file position - @rewind($this->zip_fd); - if (@fseek($this->zip_fd, $v_header['offset'])) - { - // ----- Close the zip file - $this->privCloseFd(); - - $this->privSwapBackMagicQuotes(); - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Look for extraction as string - if ($p_options[PCLZIP_OPT_EXTRACT_AS_STRING]) { - - $v_string = ''; - - // ----- Extracting the file - $v_result1 = $this->privExtractFileAsString($v_header, $v_string, $p_options); - if ($v_result1 < 1) { - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - return $v_result1; - } - - // ----- Get the only interesting attributes - if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted])) != 1) - { - // ----- Close the zip file - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - return $v_result; - } - - // ----- Set the file content - $p_file_list[$v_nb_extracted]['content'] = $v_string; - - // ----- Next extracted file - $v_nb_extracted++; - - // ----- Look for user callback abort - if ($v_result1 == 2) { - break; - } - } - // ----- Look for extraction in standard output - elseif ( (isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) - && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) { - // ----- Extracting the file in standard output - $v_result1 = $this->privExtractFileInOutput($v_header, $p_options); - if ($v_result1 < 1) { - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - return $v_result1; - } - - // ----- Get the only interesting attributes - if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) { - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - return $v_result; - } - - // ----- Look for user callback abort - if ($v_result1 == 2) { - break; - } - } - // ----- Look for normal extraction - else { - // ----- Extracting the file - $v_result1 = $this->privExtractFile($v_header, - $p_path, $p_remove_path, - $p_remove_all_path, - $p_options); - if ($v_result1 < 1) { - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - return $v_result1; - } - - // ----- Get the only interesting attributes - if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) - { - // ----- Close the zip file - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - return $v_result; - } - - // ----- Look for user callback abort - if ($v_result1 == 2) { - break; - } - } - } - } - - // ----- Close the zip file - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privExtractFile() - // Description : - // Parameters : - // Return Values : - // - // 1 : ... ? - // PCLZIP_ERR_USER_ABORTED(2) : User ask for extraction stop in callback - // -------------------------------------------------------------------------------- - function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options) - { - $v_result=1; - - // ----- Read the file header - if (($v_result = $this->privReadFileHeader($v_header)) != 1) + // -------------------------------------------------------------------------------- + // Function : + // add($p_filelist, $p_add_dir="", $p_remove_dir="") + // add($p_filelist, $p_option, $p_option_value, ...) + // Description : + // This method supports two synopsis. The first one is historical. + // This methods add the list of files in an existing archive. + // If a file with the same name already exists, it is added at the end of the + // archive, the first one is still present. + // If the archive does not exist, it is created. + // Parameters : + // $p_filelist : An array containing file or directory names, or + // a string containing one filename or one directory name, or + // a string containing a list of filenames and/or directory + // names separated by spaces. + // $p_add_dir : A path to add before the real path of the archived file, + // in order to have it memorized in the archive. + // $p_remove_dir : A path to remove from the real path of the file to archive, + // in order to have a shorter path memorized in the archive. + // When $p_add_dir and $p_remove_dir are set, $p_remove_dir + // is removed first, before $p_add_dir is added. + // Options : + // PCLZIP_OPT_ADD_PATH : + // PCLZIP_OPT_REMOVE_PATH : + // PCLZIP_OPT_REMOVE_ALL_PATH : + // PCLZIP_OPT_COMMENT : + // PCLZIP_OPT_ADD_COMMENT : + // PCLZIP_OPT_PREPEND_COMMENT : + // PCLZIP_CB_PRE_ADD : + // PCLZIP_CB_POST_ADD : + // Return Values : + // 0 on failure, + // The list of the added files, with a status of the add action. + // (see PclZip::listContent() for list entry format) + // -------------------------------------------------------------------------------- + public function add($p_filelist) { - // ----- Return - return $v_result; - } + $v_result = 1; + // ----- Reset the error handler + $this->privErrorReset(); - // ----- Check that the file header is coherent with $p_entry info - if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { - // TBC - } + // ----- Set default values + $v_options = array(); + $v_options[PCLZIP_OPT_NO_COMPRESSION] = false; - // ----- Look for all path to remove - if ($p_remove_all_path == true) { - // ----- Look for folder entry that not need to be extracted - if (($p_entry['external']&0x00000010)==0x00000010) { + // ----- Look for variable options arguments + $v_size = func_num_args(); - $p_entry['status'] = "filtered"; + // ----- Look for arguments + if ($v_size > 1) { + // ----- Get the arguments + $v_arg_list = func_get_args(); - return $v_result; + // ----- Remove form the options list the first argument + array_shift($v_arg_list); + $v_size--; + + // ----- Look for first arg + if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { + + // ----- Parse the options + $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array( + PCLZIP_OPT_REMOVE_PATH => 'optional', + PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', + PCLZIP_OPT_ADD_PATH => 'optional', + PCLZIP_CB_PRE_ADD => 'optional', + PCLZIP_CB_POST_ADD => 'optional', + PCLZIP_OPT_NO_COMPRESSION => 'optional', + PCLZIP_OPT_COMMENT => 'optional', + PCLZIP_OPT_ADD_COMMENT => 'optional', + PCLZIP_OPT_PREPEND_COMMENT => 'optional', + PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', + PCLZIP_OPT_TEMP_FILE_ON => 'optional', + PCLZIP_OPT_TEMP_FILE_OFF => 'optional' + //, PCLZIP_OPT_CRYPT => 'optional' + )); + if ($v_result != 1) { + return 0; + } + + // ----- Look for 2 args + // Here we need to support the first historic synopsis of the + // method. + } else { + + // ----- Get the first argument + $v_options[PCLZIP_OPT_ADD_PATH] = $v_add_path = $v_arg_list[0]; + + // ----- Look for the optional second argument + if ($v_size == 2) { + $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1]; + } elseif ($v_size > 2) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); + + // ----- Return + return 0; + } + } } - // ----- Get the basename of the path - $p_entry['filename'] = basename($p_entry['filename']); - } + // ----- Look for default option values + $this->privOptionDefaultThreshold($v_options); - // ----- Look for path to remove - else if ($p_remove_path != "") - { - if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2) - { + // ----- Init + $v_string_list = array(); + $v_att_list = array(); + $v_filedescr_list = array(); + $p_result_list = array(); - // ----- Change the file status - $p_entry['status'] = "filtered"; + // ----- Look if the $p_filelist is really an array + if (is_array($p_filelist)) { + + // ----- Look if the first element is also an array + // This will mean that this is a file description entry + if (isset($p_filelist[0]) && is_array($p_filelist[0])) { + $v_att_list = $p_filelist; + + // ----- The list is a list of string names + } else { + $v_string_list = $p_filelist; + } + + // ----- Look if the $p_filelist is a string + } elseif (is_string($p_filelist)) { + // ----- Create a list from the string + $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist); + + // ----- Invalid variable type for $p_filelist + } else { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '" . gettype($p_filelist) . "' for p_filelist"); + + return 0; + } + + // ----- Reformat the string list + if (sizeof($v_string_list) != 0) { + foreach ($v_string_list as $v_string) { + $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string; + } + } + + // ----- For each file in the list check the attributes + $v_supported_attributes = array( + PCLZIP_ATT_FILE_NAME => 'mandatory', + PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional', + PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional', + PCLZIP_ATT_FILE_MTIME => 'optional', + PCLZIP_ATT_FILE_CONTENT => 'optional', + PCLZIP_ATT_FILE_COMMENT => 'optional' + ); + foreach ($v_att_list as $v_entry) { + $v_result = $this->privFileDescrParseAtt($v_entry, $v_filedescr_list[], $v_options, $v_supported_attributes); + if ($v_result != 1) { + return 0; + } + } + + // ----- Expand the filelist (expand directories) + $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options); + if ($v_result != 1) { + return 0; + } + + // ----- Call the create fct + $v_result = $this->privAdd($v_filedescr_list, $p_result_list, $v_options); + if ($v_result != 1) { + return 0; + } // ----- Return - return $v_result; - } - - $p_remove_path_size = strlen($p_remove_path); - if (substr($p_entry['filename'], 0, $p_remove_path_size) == $p_remove_path) - { - - // ----- Remove the path - $p_entry['filename'] = substr($p_entry['filename'], $p_remove_path_size); - - } + return $p_result_list; } + // -------------------------------------------------------------------------------- - // ----- Add the path - if ($p_path != '') { - $p_entry['filename'] = $p_path."/".$p_entry['filename']; - } - - // ----- Check a base_dir_restriction - if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) { - $v_inclusion - = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION], - $p_entry['filename']); - if ($v_inclusion == 0) { - - PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION, - "Filename '".$p_entry['filename']."' is " - ."outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION"); - - return PclZip::errorCode(); - } - } - - // ----- Look for pre-extract callback - if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) { - - // ----- Generate a local information - $v_local_header = array(); - $this->privConvertHeader2FileInfo($p_entry, $v_local_header); - - // ----- Call the callback - // Here I do not use call_user_func() because I need to send a reference to the - // header. -// eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);'); - $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header); - if ($v_result == 0) { - // ----- Change the file status - $p_entry['status'] = "skipped"; - $v_result = 1; - } - - // ----- Look for abort result - if ($v_result == 2) { - // ----- This status is internal and will be changed in 'skipped' - $p_entry['status'] = "aborted"; - $v_result = PCLZIP_ERR_USER_ABORTED; - } - - // ----- Update the informations - // Only some fields can be modified - $p_entry['filename'] = $v_local_header['filename']; - } - - - // ----- Look if extraction should be done - if ($p_entry['status'] == 'ok') { - - // ----- Look for specific actions while the file exist - if (file_exists($p_entry['filename'])) + // -------------------------------------------------------------------------------- + // Function : listContent() + // Description : + // This public method, gives the list of the files and directories, with their + // properties. + // The properties of each entries in the list are (used also in other functions) : + // filename : Name of the file. For a create or add action it is the filename + // given by the user. For an extract function it is the filename + // of the extracted file. + // stored_filename : Name of the file / directory stored in the archive. + // size : Size of the stored file. + // compressed_size : Size of the file's data compressed in the archive + // (without the headers overhead) + // mtime : Last known modification date of the file (UNIX timestamp) + // comment : Comment associated with the file + // folder : true | false + // index : index of the file in the archive + // status : status of the action (depending of the action) : + // Values are : + // ok : OK ! + // filtered : the file / dir is not extracted (filtered by user) + // already_a_directory : the file can not be extracted because a + // directory with the same name already exists + // write_protected : the file can not be extracted because a file + // with the same name already exists and is + // write protected + // newer_exist : the file was not extracted because a newer file exists + // path_creation_fail : the file is not extracted because the folder + // does not exist and can not be created + // write_error : the file was not extracted because there was a + // error while writing the file + // read_error : the file was not extracted because there was a error + // while reading the file + // invalid_header : the file was not extracted because of an archive + // format error (bad file header) + // Note that each time a method can continue operating when there + // is an action error on a file, the error is only logged in the file status. + // Return Values : + // 0 on an unrecoverable failure, + // The list of the files in the archive. + // -------------------------------------------------------------------------------- + public function listContent() { - - // ----- Look if file is a directory - if (is_dir($p_entry['filename'])) - { - - // ----- Change the file status - $p_entry['status'] = "already_a_directory"; - - // ----- Look for PCLZIP_OPT_STOP_ON_ERROR - // For historical reason first PclZip implementation does not stop - // when this kind of error occurs. - if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { - - PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY, - "Filename '".$p_entry['filename']."' is " - ."already used by an existing directory"); - - return PclZip::errorCode(); - } - } - // ----- Look if file is write protected - else if (!is_writeable($p_entry['filename'])) - { - - // ----- Change the file status - $p_entry['status'] = "write_protected"; - - // ----- Look for PCLZIP_OPT_STOP_ON_ERROR - // For historical reason first PclZip implementation does not stop - // when this kind of error occurs. - if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { - - PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, - "Filename '".$p_entry['filename']."' exists " - ."and is write protected"); - - return PclZip::errorCode(); - } - } - - // ----- Look if the extracted file is older - else if (filemtime($p_entry['filename']) > $p_entry['mtime']) - { - // ----- Change the file status - if ( (isset($p_options[PCLZIP_OPT_REPLACE_NEWER])) - && ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) { - } - else { - $p_entry['status'] = "newer_exist"; - - // ----- Look for PCLZIP_OPT_STOP_ON_ERROR - // For historical reason first PclZip implementation does not stop - // when this kind of error occurs. - if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { - - PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, - "Newer version of '".$p_entry['filename']."' exists " - ."and option PCLZIP_OPT_REPLACE_NEWER is not selected"); - - return PclZip::errorCode(); - } - } - } - else { - } - } - - // ----- Check the directory availability and create it if necessary - else { - if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/')) - $v_dir_to_check = $p_entry['filename']; - else if (!strstr($p_entry['filename'], "/")) - $v_dir_to_check = ""; - else - $v_dir_to_check = dirname($p_entry['filename']); - - if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) { - - // ----- Change the file status - $p_entry['status'] = "path_creation_fail"; - - // ----- Return - //return $v_result; - $v_result = 1; - } - } - } - - // ----- Look if extraction should be done - if ($p_entry['status'] == 'ok') { - - // ----- Do the extraction (if not a folder) - if (!(($p_entry['external']&0x00000010)==0x00000010)) - { - // ----- Look for not compressed file - if ($p_entry['compression'] == 0) { - - // ----- Opening destination file - if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) - { - - // ----- Change the file status - $p_entry['status'] = "write_error"; - - // ----- Return - return $v_result; - } - - - // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks - $v_size = $p_entry['compressed_size']; - while ($v_size != 0) - { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($this->zip_fd, $v_read_size); - /* Try to speed up the code - $v_binary_data = pack('a'.$v_read_size, $v_buffer); - @fwrite($v_dest_file, $v_binary_data, $v_read_size); - */ - @fwrite($v_dest_file, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Closing the destination file - fclose($v_dest_file); - - // ----- Change the file mtime - touch($p_entry['filename'], $p_entry['mtime']); - - - } - else { - // ----- TBC - // Need to be finished - if (($p_entry['flag'] & 1) == 1) { - PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, 'File \''.$p_entry['filename'].'\' is encrypted. Encrypted files are not supported.'); - return PclZip::errorCode(); - } - - - // ----- Look for using temporary file to unzip - if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) - && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) - || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) - && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])) ) ) { - $v_result = $this->privExtractFileUsingTempFile($p_entry, $p_options); - if ($v_result < PCLZIP_ERR_NO_ERROR) { - return $v_result; - } - } - - // ----- Look for extract in memory - else { - - - // ----- Read the compressed file in a buffer (one shot) - $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); - - // ----- Decompress the file - $v_file_content = @gzinflate($v_buffer); - unset($v_buffer); - if ($v_file_content === FALSE) { - - // ----- Change the file status - // TBC - $p_entry['status'] = "error"; - - return $v_result; - } - - // ----- Opening destination file - if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { - - // ----- Change the file status - $p_entry['status'] = "write_error"; - - return $v_result; - } - - // ----- Write the uncompressed data - @fwrite($v_dest_file, $v_file_content, $p_entry['size']); - unset($v_file_content); - - // ----- Closing the destination file - @fclose($v_dest_file); - - } - - // ----- Change the file mtime - @touch($p_entry['filename'], $p_entry['mtime']); - } - - // ----- Look for chmod option - if (isset($p_options[PCLZIP_OPT_SET_CHMOD])) { - - // ----- Change the mode of the file - @chmod($p_entry['filename'], $p_options[PCLZIP_OPT_SET_CHMOD]); - } - - } - } - - // ----- Change abort status - if ($p_entry['status'] == "aborted") { - $p_entry['status'] = "skipped"; - } - - // ----- Look for post-extract callback - elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { - - // ----- Generate a local information - $v_local_header = array(); - $this->privConvertHeader2FileInfo($p_entry, $v_local_header); - - // ----- Call the callback - // Here I do not use call_user_func() because I need to send a reference to the - // header. -// eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);'); - $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header); - - // ----- Look for abort result - if ($v_result == 2) { - $v_result = PCLZIP_ERR_USER_ABORTED; - } - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privExtractFileUsingTempFile() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privExtractFileUsingTempFile(&$p_entry, &$p_options) - { - $v_result=1; - - // ----- Creates a temporary file - $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz'; - if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) { - fclose($v_file); - PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode'); - return PclZip::errorCode(); - } - - - // ----- Write gz file format header - $v_binary_data = pack('va1a1Va1a1', 0x8b1f, Chr($p_entry['compression']), Chr(0x00), time(), Chr(0x00), Chr(3)); - @fwrite($v_dest_file, $v_binary_data, 10); - - // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks - $v_size = $p_entry['compressed_size']; - while ($v_size != 0) - { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($this->zip_fd, $v_read_size); - //$v_binary_data = pack('a'.$v_read_size, $v_buffer); - @fwrite($v_dest_file, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Write gz file format footer - $v_binary_data = pack('VV', $p_entry['crc'], $p_entry['size']); - @fwrite($v_dest_file, $v_binary_data, 8); - - // ----- Close the temporary file - @fclose($v_dest_file); - - // ----- Opening destination file - if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { - $p_entry['status'] = "write_error"; - return $v_result; - } - - // ----- Open the temporary gz file - if (($v_src_file = @gzopen($v_gzip_temp_name, 'rb')) == 0) { - @fclose($v_dest_file); - $p_entry['status'] = "read_error"; - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode'); - return PclZip::errorCode(); - } - - - // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks - $v_size = $p_entry['size']; - while ($v_size != 0) { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @gzread($v_src_file, $v_read_size); - //$v_binary_data = pack('a'.$v_read_size, $v_buffer); - @fwrite($v_dest_file, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - @fclose($v_dest_file); - @gzclose($v_src_file); - - // ----- Delete the temporary file - @unlink($v_gzip_temp_name); - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privExtractFileInOutput() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privExtractFileInOutput(&$p_entry, &$p_options) - { - $v_result=1; - - // ----- Read the file header - if (($v_result = $this->privReadFileHeader($v_header)) != 1) { - return $v_result; - } - - - // ----- Check that the file header is coherent with $p_entry info - if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { - // TBC - } - - // ----- Look for pre-extract callback - if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) { - - // ----- Generate a local information - $v_local_header = array(); - $this->privConvertHeader2FileInfo($p_entry, $v_local_header); - - // ----- Call the callback - // Here I do not use call_user_func() because I need to send a reference to the - // header. -// eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);'); - $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header); - if ($v_result == 0) { - // ----- Change the file status - $p_entry['status'] = "skipped"; $v_result = 1; - } - // ----- Look for abort result - if ($v_result == 2) { - // ----- This status is internal and will be changed in 'skipped' - $p_entry['status'] = "aborted"; - $v_result = PCLZIP_ERR_USER_ABORTED; - } + // ----- Reset the error handler + $this->privErrorReset(); - // ----- Update the informations - // Only some fields can be modified - $p_entry['filename'] = $v_local_header['filename']; - } - - // ----- Trace - - // ----- Look if extraction should be done - if ($p_entry['status'] == 'ok') { - - // ----- Do the extraction (if not a folder) - if (!(($p_entry['external']&0x00000010)==0x00000010)) { - // ----- Look for not compressed file - if ($p_entry['compressed_size'] == $p_entry['size']) { - - // ----- Read the file in a buffer (one shot) - $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); - - // ----- Send the file to the output - echo $v_buffer; - unset($v_buffer); + // ----- Check archive + if (!$this->privCheckFormat()) { + return (0); } - else { - // ----- Read the compressed file in a buffer (one shot) - $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); + // ----- Call the extracting fct + $p_list = array(); + if (($v_result = $this->privList($p_list)) != 1) { + unset($p_list); - // ----- Decompress the file - $v_file_content = gzinflate($v_buffer); - unset($v_buffer); - - // ----- Send the file to the output - echo $v_file_content; - unset($v_file_content); + return (0); } - } + + // ----- Return + return $p_list; } + // -------------------------------------------------------------------------------- - // ----- Change abort status - if ($p_entry['status'] == "aborted") { - $p_entry['status'] = "skipped"; - } - - // ----- Look for post-extract callback - elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { - - // ----- Generate a local information - $v_local_header = array(); - $this->privConvertHeader2FileInfo($p_entry, $v_local_header); - - // ----- Call the callback - // Here I do not use call_user_func() because I need to send a reference to the - // header. -// eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);'); - $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header); - - // ----- Look for abort result - if ($v_result == 2) { - $v_result = PCLZIP_ERR_USER_ABORTED; - } - } - - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privExtractFileAsString() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privExtractFileAsString(&$p_entry, &$p_string, &$p_options) - { - $v_result=1; - - // ----- Read the file header - $v_header = array(); - if (($v_result = $this->privReadFileHeader($v_header)) != 1) + // -------------------------------------------------------------------------------- + // Function : + // extract($p_path="./", $p_remove_path="") + // extract([$p_option, $p_option_value, ...]) + // Description : + // This method supports two synopsis. The first one is historical. + // This method extract all the files / directories from the archive to the + // folder indicated in $p_path. + // If you want to ignore the 'root' part of path of the memorized files + // you can indicate this in the optional $p_remove_path parameter. + // By default, if a newer file with the same name already exists, the + // file is not extracted. + // + // If both PCLZIP_OPT_PATH and PCLZIP_OPT_ADD_PATH aoptions + // are used, the path indicated in PCLZIP_OPT_ADD_PATH is append + // at the end of the path value of PCLZIP_OPT_PATH. + // Parameters : + // $p_path : Path where the files and directories are to be extracted + // $p_remove_path : First part ('root' part) of the memorized path + // (if any similar) to remove while extracting. + // Options : + // PCLZIP_OPT_PATH : + // PCLZIP_OPT_ADD_PATH : + // PCLZIP_OPT_REMOVE_PATH : + // PCLZIP_OPT_REMOVE_ALL_PATH : + // PCLZIP_CB_PRE_EXTRACT : + // PCLZIP_CB_POST_EXTRACT : + // Return Values : + // 0 or a negative value on failure, + // The list of the extracted files, with a status of the action. + // (see PclZip::listContent() for list entry format) + // -------------------------------------------------------------------------------- + public function extract() { - // ----- Return - return $v_result; - } - - - // ----- Check that the file header is coherent with $p_entry info - if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { - // TBC - } - - // ----- Look for pre-extract callback - if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) { - - // ----- Generate a local information - $v_local_header = array(); - $this->privConvertHeader2FileInfo($p_entry, $v_local_header); - - // ----- Call the callback - // Here I do not use call_user_func() because I need to send a reference to the - // header. -// eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);'); - $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header); - if ($v_result == 0) { - // ----- Change the file status - $p_entry['status'] = "skipped"; $v_result = 1; - } - // ----- Look for abort result - if ($v_result == 2) { - // ----- This status is internal and will be changed in 'skipped' - $p_entry['status'] = "aborted"; - $v_result = PCLZIP_ERR_USER_ABORTED; - } + // ----- Reset the error handler + $this->privErrorReset(); - // ----- Update the informations - // Only some fields can be modified - $p_entry['filename'] = $v_local_header['filename']; - } - - - // ----- Look if extraction should be done - if ($p_entry['status'] == 'ok') { - - // ----- Do the extraction (if not a folder) - if (!(($p_entry['external']&0x00000010)==0x00000010)) { - // ----- Look for not compressed file - // if ($p_entry['compressed_size'] == $p_entry['size']) - if ($p_entry['compression'] == 0) { - - // ----- Reading the file - $p_string = @fread($this->zip_fd, $p_entry['compressed_size']); + // ----- Check archive + if (!$this->privCheckFormat()) { + return (0); } - else { - // ----- Reading the file - $v_data = @fread($this->zip_fd, $p_entry['compressed_size']); + // ----- Set default values + $v_options = array(); + // $v_path = "./"; + $v_path = ''; + $v_remove_path = ""; + $v_remove_all_path = false; - // ----- Decompress the file - if (($p_string = @gzinflate($v_data)) === FALSE) { - // TBC - } + // ----- Look for variable options arguments + $v_size = func_num_args(); + + // ----- Default values for option + $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = false; + + // ----- Look for arguments + if ($v_size > 0) { + // ----- Get the arguments + $v_arg_list = func_get_args(); + + // ----- Look for first arg + if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { + + // ----- Parse the options + $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array( + PCLZIP_OPT_PATH => 'optional', + PCLZIP_OPT_REMOVE_PATH => 'optional', + PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', + PCLZIP_OPT_ADD_PATH => 'optional', + PCLZIP_CB_PRE_EXTRACT => 'optional', + PCLZIP_CB_POST_EXTRACT => 'optional', + PCLZIP_OPT_SET_CHMOD => 'optional', + PCLZIP_OPT_BY_NAME => 'optional', + PCLZIP_OPT_BY_EREG => 'optional', + PCLZIP_OPT_BY_PREG => 'optional', + PCLZIP_OPT_BY_INDEX => 'optional', + PCLZIP_OPT_EXTRACT_AS_STRING => 'optional', + PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional', + PCLZIP_OPT_REPLACE_NEWER => 'optional', + PCLZIP_OPT_STOP_ON_ERROR => 'optional', + PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional', + PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', + PCLZIP_OPT_TEMP_FILE_ON => 'optional', + PCLZIP_OPT_TEMP_FILE_OFF => 'optional' + )); + if ($v_result != 1) { + return 0; + } + + // ----- Set the arguments + if (isset($v_options[PCLZIP_OPT_PATH])) { + $v_path = $v_options[PCLZIP_OPT_PATH]; + } + if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) { + $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH]; + } + if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) { + $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH]; + } + if (isset($v_options[PCLZIP_OPT_ADD_PATH])) { + // ----- Check for '/' in last path char + if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) { + $v_path .= '/'; + } + $v_path .= $v_options[PCLZIP_OPT_ADD_PATH]; + } + + // ----- Look for 2 args + // Here we need to support the first historic synopsis of the + // method. + } else { + + // ----- Get the first argument + $v_path = $v_arg_list[0]; + + // ----- Look for the optional second argument + if ($v_size == 2) { + $v_remove_path = $v_arg_list[1]; + } elseif ($v_size > 2) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); + + // ----- Return + return 0; + } + } + } + + // ----- Look for default option values + $this->privOptionDefaultThreshold($v_options); + + // ----- Trace + + // ----- Call the extracting fct + $p_list = array(); + $v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options); + if ($v_result < 1) { + unset($p_list); + + return (0); + } + + // ----- Return + return $p_list; + } + // -------------------------------------------------------------------------------- + + + // -------------------------------------------------------------------------------- + // Function : + // extractByIndex($p_index, $p_path="./", $p_remove_path="") + // extractByIndex($p_index, [$p_option, $p_option_value, ...]) + // Description : + // This method supports two synopsis. The first one is historical. + // This method is doing a partial extract of the archive. + // The extracted files or folders are identified by their index in the + // archive (from 0 to n). + // Note that if the index identify a folder, only the folder entry is + // extracted, not all the files included in the archive. + // Parameters : + // $p_index : A single index (integer) or a string of indexes of files to + // extract. The form of the string is "0,4-6,8-12" with only numbers + // and '-' for range or ',' to separate ranges. No spaces or ';' + // are allowed. + // $p_path : Path where the files and directories are to be extracted + // $p_remove_path : First part ('root' part) of the memorized path + // (if any similar) to remove while extracting. + // Options : + // PCLZIP_OPT_PATH : + // PCLZIP_OPT_ADD_PATH : + // PCLZIP_OPT_REMOVE_PATH : + // PCLZIP_OPT_REMOVE_ALL_PATH : + // PCLZIP_OPT_EXTRACT_AS_STRING : The files are extracted as strings and + // not as files. + // The resulting content is in a new field 'content' in the file + // structure. + // This option must be used alone (any other options are ignored). + // PCLZIP_CB_PRE_EXTRACT : + // PCLZIP_CB_POST_EXTRACT : + // Return Values : + // 0 on failure, + // The list of the extracted files, with a status of the action. + // (see PclZip::listContent() for list entry format) + // -------------------------------------------------------------------------------- + //function extractByIndex($p_index, options...) + public function extractByIndex($p_index) + { + $v_result = 1; + + // ----- Reset the error handler + $this->privErrorReset(); + + // ----- Check archive + if (!$this->privCheckFormat()) { + return (0); + } + + // ----- Set default values + $v_options = array(); + // $v_path = "./"; + $v_path = ''; + $v_remove_path = ""; + $v_remove_all_path = false; + + // ----- Look for variable options arguments + $v_size = func_num_args(); + + // ----- Default values for option + $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = false; + + // ----- Look for arguments + if ($v_size > 1) { + // ----- Get the arguments + $v_arg_list = func_get_args(); + + // ----- Remove form the options list the first argument + array_shift($v_arg_list); + $v_size--; + + // ----- Look for first arg + if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { + + // ----- Parse the options + $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array( + PCLZIP_OPT_PATH => 'optional', + PCLZIP_OPT_REMOVE_PATH => 'optional', + PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', + PCLZIP_OPT_EXTRACT_AS_STRING => 'optional', + PCLZIP_OPT_ADD_PATH => 'optional', + PCLZIP_CB_PRE_EXTRACT => 'optional', + PCLZIP_CB_POST_EXTRACT => 'optional', + PCLZIP_OPT_SET_CHMOD => 'optional', + PCLZIP_OPT_REPLACE_NEWER => 'optional', + PCLZIP_OPT_STOP_ON_ERROR => 'optional', + PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional', + PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', + PCLZIP_OPT_TEMP_FILE_ON => 'optional', + PCLZIP_OPT_TEMP_FILE_OFF => 'optional' + )); + if ($v_result != 1) { + return 0; + } + + // ----- Set the arguments + if (isset($v_options[PCLZIP_OPT_PATH])) { + $v_path = $v_options[PCLZIP_OPT_PATH]; + } + if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) { + $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH]; + } + if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) { + $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH]; + } + if (isset($v_options[PCLZIP_OPT_ADD_PATH])) { + // ----- Check for '/' in last path char + if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) { + $v_path .= '/'; + } + $v_path .= $v_options[PCLZIP_OPT_ADD_PATH]; + } + if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) { + $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = false; + } else { + } + + // ----- Look for 2 args + // Here we need to support the first historic synopsis of the + // method. + } else { + + // ----- Get the first argument + $v_path = $v_arg_list[0]; + + // ----- Look for the optional second argument + if ($v_size == 2) { + $v_remove_path = $v_arg_list[1]; + } elseif ($v_size > 2) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); + + // ----- Return + return 0; + } + } } // ----- Trace - } - else { - // TBC : error : can not extract a folder in a string - } - } - - // ----- Change abort status - if ($p_entry['status'] == "aborted") { - $p_entry['status'] = "skipped"; - } - - // ----- Look for post-extract callback - elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { - - // ----- Generate a local information - $v_local_header = array(); - $this->privConvertHeader2FileInfo($p_entry, $v_local_header); - - // ----- Swap the content to header - $v_local_header['content'] = $p_string; - $p_string = ''; - - // ----- Call the callback - // Here I do not use call_user_func() because I need to send a reference to the - // header. -// eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);'); - $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header); - - // ----- Swap back the content to header - $p_string = $v_local_header['content']; - unset($v_local_header['content']); - - // ----- Look for abort result - if ($v_result == 2) { - $v_result = PCLZIP_ERR_USER_ABORTED; - } - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privReadFileHeader() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privReadFileHeader(&$p_header) - { - $v_result=1; - - // ----- Read the 4 bytes signature - $v_binary_data = @fread($this->zip_fd, 4); - $v_data = unpack('Vid', $v_binary_data); - - // ----- Check signature - if ($v_data['id'] != 0x04034b50) - { - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read the first 42 bytes of the header - $v_binary_data = fread($this->zip_fd, 26); - - // ----- Look for invalid block size - if (strlen($v_binary_data) != 26) - { - $p_header['filename'] = ""; - $p_header['status'] = "invalid_header"; - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data)); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Extract the values - $v_data = unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $v_binary_data); - - // ----- Get filename - $p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']); - - // ----- Get extra_fields - if ($v_data['extra_len'] != 0) { - $p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']); - } - else { - $p_header['extra'] = ''; - } - - // ----- Extract properties - $p_header['version_extracted'] = $v_data['version']; - $p_header['compression'] = $v_data['compression']; - $p_header['size'] = $v_data['size']; - $p_header['compressed_size'] = $v_data['compressed_size']; - $p_header['crc'] = $v_data['crc']; - $p_header['flag'] = $v_data['flag']; - $p_header['filename_len'] = $v_data['filename_len']; - - // ----- Recuperate date in UNIX format - $p_header['mdate'] = $v_data['mdate']; - $p_header['mtime'] = $v_data['mtime']; - if ($p_header['mdate'] && $p_header['mtime']) - { - // ----- Extract time - $v_hour = ($p_header['mtime'] & 0xF800) >> 11; - $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; - $v_seconde = ($p_header['mtime'] & 0x001F)*2; - - // ----- Extract date - $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; - $v_month = ($p_header['mdate'] & 0x01E0) >> 5; - $v_day = $p_header['mdate'] & 0x001F; - - // ----- Get UNIX date format - $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year); - - } - else - { - $p_header['mtime'] = time(); - } - - // TBC - //for(reset($v_data); $key = key($v_data); next($v_data)) { - //} - - // ----- Set the stored filename - $p_header['stored_filename'] = $p_header['filename']; - - // ----- Set the status field - $p_header['status'] = "ok"; - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privReadCentralFileHeader() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privReadCentralFileHeader(&$p_header) - { - $v_result=1; - - // ----- Read the 4 bytes signature - $v_binary_data = @fread($this->zip_fd, 4); - $v_data = unpack('Vid', $v_binary_data); - - // ----- Check signature - if ($v_data['id'] != 0x02014b50) - { - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read the first 42 bytes of the header - $v_binary_data = fread($this->zip_fd, 42); - - // ----- Look for invalid block size - if (strlen($v_binary_data) != 42) - { - $p_header['filename'] = ""; - $p_header['status'] = "invalid_header"; - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data)); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Extract the values - $p_header = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v_binary_data); - - // ----- Get filename - if ($p_header['filename_len'] != 0) - $p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']); - else - $p_header['filename'] = ''; - - // ----- Get extra - if ($p_header['extra_len'] != 0) - $p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']); - else - $p_header['extra'] = ''; - - // ----- Get comment - if ($p_header['comment_len'] != 0) - $p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']); - else - $p_header['comment'] = ''; - - // ----- Extract properties - - // ----- Recuperate date in UNIX format - //if ($p_header['mdate'] && $p_header['mtime']) - // TBC : bug : this was ignoring time with 0/0/0 - if (1) - { - // ----- Extract time - $v_hour = ($p_header['mtime'] & 0xF800) >> 11; - $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; - $v_seconde = ($p_header['mtime'] & 0x001F)*2; - - // ----- Extract date - $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; - $v_month = ($p_header['mdate'] & 0x01E0) >> 5; - $v_day = $p_header['mdate'] & 0x001F; - - // ----- Get UNIX date format - $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year); - - } - else - { - $p_header['mtime'] = time(); - } - - // ----- Set the stored filename - $p_header['stored_filename'] = $p_header['filename']; - - // ----- Set default status to ok - $p_header['status'] = 'ok'; - - // ----- Look if it is a directory - if (substr($p_header['filename'], -1) == '/') { - //$p_header['external'] = 0x41FF0010; - $p_header['external'] = 0x00000010; - } - - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privCheckFileHeaders() - // Description : - // Parameters : - // Return Values : - // 1 on success, - // 0 on error; - // -------------------------------------------------------------------------------- - function privCheckFileHeaders(&$p_local_header, &$p_central_header) - { - $v_result=1; - - // ----- Check the static values - // TBC - if ($p_local_header['filename'] != $p_central_header['filename']) { - } - if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) { - } - if ($p_local_header['flag'] != $p_central_header['flag']) { - } - if ($p_local_header['compression'] != $p_central_header['compression']) { - } - if ($p_local_header['mtime'] != $p_central_header['mtime']) { - } - if ($p_local_header['filename_len'] != $p_central_header['filename_len']) { - } - - // ----- Look for flag bit 3 - if (($p_local_header['flag'] & 8) == 8) { - $p_local_header['size'] = $p_central_header['size']; - $p_local_header['compressed_size'] = $p_central_header['compressed_size']; - $p_local_header['crc'] = $p_central_header['crc']; - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privReadEndCentralDir() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privReadEndCentralDir(&$p_central_dir) - { - $v_result=1; - - // ----- Go to the end of the zip file - $v_size = filesize($this->zipname); - @fseek($this->zip_fd, $v_size); - if (@ftell($this->zip_fd) != $v_size) - { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of the archive \''.$this->zipname.'\''); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- First try : look if this is an archive with no commentaries (most of the time) - // in this case the end of central dir is at 22 bytes of the file end - $v_found = 0; - if ($v_size > 26) { - @fseek($this->zip_fd, $v_size-22); - if (($v_pos = @ftell($this->zip_fd)) != ($v_size-22)) - { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\''); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read for bytes - $v_binary_data = @fread($this->zip_fd, 4); - $v_data = @unpack('Vid', $v_binary_data); - - // ----- Check signature - if ($v_data['id'] == 0x06054b50) { - $v_found = 1; - } - - $v_pos = ftell($this->zip_fd); - } - - // ----- Go back to the maximum possible size of the Central Dir End Record - if (!$v_found) { - $v_maximum_size = 65557; // 0xFFFF + 22; - if ($v_maximum_size > $v_size) - $v_maximum_size = $v_size; - @fseek($this->zip_fd, $v_size-$v_maximum_size); - if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size)) - { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\''); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read byte per byte in order to find the signature - $v_pos = ftell($this->zip_fd); - $v_bytes = 0x00000000; - while ($v_pos < $v_size) - { - // ----- Read a byte - $v_byte = @fread($this->zip_fd, 1); - - // ----- Add the byte - //$v_bytes = ($v_bytes << 8) | Ord($v_byte); - // Note we mask the old value down such that once shifted we can never end up with more than a 32bit number - // Otherwise on systems where we have 64bit integers the check below for the magic number will fail. - $v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); - - // ----- Compare the bytes - if ($v_bytes == 0x504b0506) - { - $v_pos++; - break; + // ----- Trick + // Here I want to reuse extractByRule(), so I need to parse the $p_index + // with privParseOptions() + $v_arg_trick = array( + PCLZIP_OPT_BY_INDEX, + $p_index + ); + $v_options_trick = array(); + $v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick, array( + PCLZIP_OPT_BY_INDEX => 'optional' + )); + if ($v_result != 1) { + return 0; + } + $v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX]; + + // ----- Look for default option values + $this->privOptionDefaultThreshold($v_options); + + // ----- Call the extracting fct + if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) { + return (0); } - $v_pos++; - } - - // ----- Look if not found end of central dir - if ($v_pos == $v_size) - { - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Unable to find End of Central Dir Record signature"); - // ----- Return - return PclZip::errorCode(); - } + return $p_list; } + // -------------------------------------------------------------------------------- - // ----- Read the first 18 bytes of the header - $v_binary_data = fread($this->zip_fd, 18); - - // ----- Look for invalid block size - if (strlen($v_binary_data) != 18) + // -------------------------------------------------------------------------------- + // Function : + // delete([$p_option, $p_option_value, ...]) + // Description : + // This method removes files from the archive. + // If no parameters are given, then all the archive is emptied. + // Parameters : + // None or optional arguments. + // Options : + // PCLZIP_OPT_BY_INDEX : + // PCLZIP_OPT_BY_NAME : + // PCLZIP_OPT_BY_EREG : + // PCLZIP_OPT_BY_PREG : + // Return Values : + // 0 on failure, + // The list of the files which are still present in the archive. + // (see PclZip::listContent() for list entry format) + // -------------------------------------------------------------------------------- + public function delete() { + $v_result = 1; - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Central Dir Record size : ".strlen($v_binary_data)); + // ----- Reset the error handler + $this->privErrorReset(); - // ----- Return - return PclZip::errorCode(); - } - - // ----- Extract the values - $v_data = unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', $v_binary_data); - - // ----- Check the global size - if (($v_pos + $v_data['comment_size'] + 18) != $v_size) { - - // ----- Removed in release 2.2 see readme file - // The check of the file size is a little too strict. - // Some bugs where found when a zip is encrypted/decrypted with 'crypt'. - // While decrypted, zip has training 0 bytes - if (0) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, - 'The central dir is not at the end of the archive.' - .' Some trailing bytes exists after the archive.'); - - // ----- Return - return PclZip::errorCode(); - } - } - - // ----- Get comment - if ($v_data['comment_size'] != 0) { - $p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']); - } - else - $p_central_dir['comment'] = ''; - - $p_central_dir['entries'] = $v_data['entries']; - $p_central_dir['disk_entries'] = $v_data['disk_entries']; - $p_central_dir['offset'] = $v_data['offset']; - $p_central_dir['size'] = $v_data['size']; - $p_central_dir['disk'] = $v_data['disk']; - $p_central_dir['disk_start'] = $v_data['disk_start']; - - // TBC - //for(reset($p_central_dir); $key = key($p_central_dir); next($p_central_dir)) { - //} - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privDeleteByRule() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privDeleteByRule(&$p_result_list, &$p_options) - { - $v_result=1; - $v_list_detail = array(); - - // ----- Open the zip file - if (($v_result=$this->privOpenFd('rb')) != 1) - { - // ----- Return - return $v_result; - } - - // ----- Read the central directory informations - $v_central_dir = array(); - if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) - { - $this->privCloseFd(); - return $v_result; - } - - // ----- Go to beginning of File - @rewind($this->zip_fd); - - // ----- Scan all the files - // ----- Start at beginning of Central Dir - $v_pos_entry = $v_central_dir['offset']; - @rewind($this->zip_fd); - if (@fseek($this->zip_fd, $v_pos_entry)) - { - // ----- Close the zip file - $this->privCloseFd(); - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read each entry - $v_header_list = array(); - $j_start = 0; - for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) - { - - // ----- Read the file header - $v_header_list[$v_nb_extracted] = array(); - if (($v_result = $this->privReadCentralFileHeader($v_header_list[$v_nb_extracted])) != 1) - { - // ----- Close the zip file - $this->privCloseFd(); - - return $v_result; - } - - - // ----- Store the index - $v_header_list[$v_nb_extracted]['index'] = $i; - - // ----- Look for the specific extract rules - $v_found = false; - - // ----- Look for extract by name rule - if ( (isset($p_options[PCLZIP_OPT_BY_NAME])) - && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { - - // ----- Look if the filename is in the list - for ($j=0; ($j strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) - && (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) { - $v_found = true; - } - elseif ( (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */ - && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) { - $v_found = true; - } - } - // ----- Look for a filename - elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) { - $v_found = true; - } - } - } - - // ----- Look for extract by ereg rule - // ereg() is deprecated with PHP 5.3 - /* - else if ( (isset($p_options[PCLZIP_OPT_BY_EREG])) - && ($p_options[PCLZIP_OPT_BY_EREG] != "")) { - - if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header_list[$v_nb_extracted]['stored_filename'])) { - $v_found = true; - } - } - */ - - // ----- Look for extract by preg rule - else if ( (isset($p_options[PCLZIP_OPT_BY_PREG])) - && ($p_options[PCLZIP_OPT_BY_PREG] != "")) { - - if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) { - $v_found = true; - } - } - - // ----- Look for extract by index rule - else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX])) - && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { - - // ----- Look if the index is in the list - for ($j=$j_start; ($j=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { - $v_found = true; - } - if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { - $j_start = $j+1; - } - - if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) { - break; - } - } - } - else { - $v_found = true; - } - - // ----- Look for deletion - if ($v_found) - { - unset($v_header_list[$v_nb_extracted]); - } - else - { - $v_nb_extracted++; - } - } - - // ----- Look if something need to be deleted - if ($v_nb_extracted > 0) { - - // ----- Creates a temporay file - $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp'; - - // ----- Creates a temporary zip archive - $v_temp_zip = new PclZip($v_zip_temp_name); - - // ----- Open the temporary zip file in write mode - if (($v_result = $v_temp_zip->privOpenFd('wb')) != 1) { - $this->privCloseFd(); - - // ----- Return - return $v_result; + // ----- Check archive + if (!$this->privCheckFormat()) { + return (0); } - // ----- Look which file need to be kept - for ($i=0; $izip_fd); - if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) { - // ----- Close the zip file - $this->privCloseFd(); - $v_temp_zip->privCloseFd(); - @unlink($v_zip_temp_name); + // ----- Look for variable options arguments + $v_size = func_num_args(); + + // ----- Look for arguments + if ($v_size > 0) { + // ----- Get the arguments + $v_arg_list = func_get_args(); + + // ----- Parse the options + $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array( + PCLZIP_OPT_BY_NAME => 'optional', + PCLZIP_OPT_BY_EREG => 'optional', + PCLZIP_OPT_BY_PREG => 'optional', + PCLZIP_OPT_BY_INDEX => 'optional' + )); + if ($v_result != 1) { + return 0; + } + } + + // ----- Magic quotes trick + $this->privDisableMagicQuotes(); + + // ----- Call the delete fct + $v_list = array(); + if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1) { + $this->privSwapBackMagicQuotes(); + unset($v_list); + + return (0); + } + + // ----- Magic quotes trick + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_list; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : deleteByIndex() + // Description : + // ***** Deprecated ***** + // delete(PCLZIP_OPT_BY_INDEX, $p_index) should be prefered. + // -------------------------------------------------------------------------------- + public function deleteByIndex($p_index) + { + + $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index); + + // ----- Return + return $p_list; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : properties() + // Description : + // This method gives the properties of the archive. + // The properties are : + // nb : Number of files in the archive + // comment : Comment associated with the archive file + // status : not_exist, ok + // Parameters : + // None + // Return Values : + // 0 on failure, + // An array with the archive properties. + // -------------------------------------------------------------------------------- + public function properties() + { + + // ----- Reset the error handler + $this->privErrorReset(); + + // ----- Magic quotes trick + $this->privDisableMagicQuotes(); + + // ----- Check archive + if (!$this->privCheckFormat()) { + $this->privSwapBackMagicQuotes(); + + return (0); + } + + // ----- Default properties + $v_prop = array(); + $v_prop['comment'] = ''; + $v_prop['nb'] = 0; + $v_prop['status'] = 'not_exist'; + + // ----- Look if file exists + if (@is_file($this->zipname)) { + // ----- Open the zip file + if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0) { + $this->privSwapBackMagicQuotes(); // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \'' . $this->zipname . '\' in binary read mode'); + + // ----- Return + return 0; + } + + // ----- Read the central directory informations + $v_central_dir = array(); + if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { + $this->privSwapBackMagicQuotes(); + + return 0; + } + + // ----- Close the zip file + $this->privCloseFd(); + + // ----- Set the user attributes + $v_prop['comment'] = $v_central_dir['comment']; + $v_prop['nb'] = $v_central_dir['entries']; + $v_prop['status'] = 'ok'; + } + + // ----- Magic quotes trick + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_prop; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : duplicate() + // Description : + // This method creates an archive by copying the content of an other one. If + // the archive already exist, it is replaced by the new one without any warning. + // Parameters : + // $p_archive : The filename of a valid archive, or + // a valid PclZip object. + // Return Values : + // 1 on success. + // 0 or a negative value on error (error code). + // -------------------------------------------------------------------------------- + public function duplicate($p_archive) + { + $v_result = 1; + + // ----- Reset the error handler + $this->privErrorReset(); + + // ----- Look if the $p_archive is a PclZip object + if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip')) { + + // ----- Duplicate the archive + $v_result = $this->privDuplicate($p_archive->zipname); + + // ----- Look if the $p_archive is a string (so a filename) + } elseif (is_string($p_archive)) { + + // ----- Check that $p_archive is a valid zip file + // TBC : Should also check the archive format + if (!is_file($p_archive)) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '" . $p_archive . "'"); + $v_result = PCLZIP_ERR_MISSING_FILE; + } else { + // ----- Duplicate the archive + $v_result = $this->privDuplicate($p_archive); + } + + // ----- Invalid variable + } else { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add"); + $v_result = PCLZIP_ERR_INVALID_PARAMETER; + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : merge() + // Description : + // This method merge the $p_archive_to_add archive at the end of the current + // one ($this). + // If the archive ($this) does not exist, the merge becomes a duplicate. + // If the $p_archive_to_add archive does not exist, the merge is a success. + // Parameters : + // $p_archive_to_add : It can be directly the filename of a valid zip archive, + // or a PclZip object archive. + // Return Values : + // 1 on success, + // 0 or negative values on error (see below). + // -------------------------------------------------------------------------------- + public function merge($p_archive_to_add) + { + $v_result = 1; + + // ----- Reset the error handler + $this->privErrorReset(); + + // ----- Check archive + if (!$this->privCheckFormat()) { + return (0); + } + + // ----- Look if the $p_archive_to_add is a PclZip object + if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip')) { + + // ----- Merge the archive + $v_result = $this->privMerge($p_archive_to_add); + + // ----- Look if the $p_archive_to_add is a string (so a filename) + } elseif (is_string($p_archive_to_add)) { + + // ----- Create a temporary archive + $v_object_archive = new PclZip($p_archive_to_add); + + // ----- Merge the archive + $v_result = $this->privMerge($v_object_archive); + + // ----- Invalid variable + } else { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add"); + $v_result = PCLZIP_ERR_INVALID_PARAMETER; + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : errorCode() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + public function errorCode() + { + if (PCLZIP_ERROR_EXTERNAL == 1) { + return (PclErrorCode()); + } else { + return ($this->error_code); + } + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : errorName() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + public function errorName($p_with_code = false) + { + $v_name = array( + PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR', + PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL', + PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL', + PCLZIP_ERR_INVALID_PARAMETER => 'PCLZIP_ERR_INVALID_PARAMETER', + PCLZIP_ERR_MISSING_FILE => 'PCLZIP_ERR_MISSING_FILE', + PCLZIP_ERR_FILENAME_TOO_LONG => 'PCLZIP_ERR_FILENAME_TOO_LONG', + PCLZIP_ERR_INVALID_ZIP => 'PCLZIP_ERR_INVALID_ZIP', + PCLZIP_ERR_BAD_EXTRACTED_FILE => 'PCLZIP_ERR_BAD_EXTRACTED_FILE', + PCLZIP_ERR_DIR_CREATE_FAIL => 'PCLZIP_ERR_DIR_CREATE_FAIL', + PCLZIP_ERR_BAD_EXTENSION => 'PCLZIP_ERR_BAD_EXTENSION', + PCLZIP_ERR_BAD_FORMAT => 'PCLZIP_ERR_BAD_FORMAT', + PCLZIP_ERR_DELETE_FILE_FAIL => 'PCLZIP_ERR_DELETE_FILE_FAIL', + PCLZIP_ERR_RENAME_FILE_FAIL => 'PCLZIP_ERR_RENAME_FILE_FAIL', + PCLZIP_ERR_BAD_CHECKSUM => 'PCLZIP_ERR_BAD_CHECKSUM', + PCLZIP_ERR_INVALID_ARCHIVE_ZIP => 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', + PCLZIP_ERR_MISSING_OPTION_VALUE => 'PCLZIP_ERR_MISSING_OPTION_VALUE', + PCLZIP_ERR_INVALID_OPTION_VALUE => 'PCLZIP_ERR_INVALID_OPTION_VALUE', + PCLZIP_ERR_UNSUPPORTED_COMPRESSION => 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', + PCLZIP_ERR_UNSUPPORTED_ENCRYPTION => 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', + PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE => 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', + PCLZIP_ERR_DIRECTORY_RESTRICTION => 'PCLZIP_ERR_DIRECTORY_RESTRICTION' + ); + + if (isset($v_name[$this->error_code])) { + $v_value = $v_name[$this->error_code]; + } else { + $v_value = 'NoName'; + } + + if ($p_with_code) { + return ($v_value . ' (' . $this->error_code . ')'); + } else { + return ($v_value); + } + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : errorInfo() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + public function errorInfo($p_full = false) + { + if (PCLZIP_ERROR_EXTERNAL == 1) { + return (PclErrorString()); + } else { + if ($p_full) { + return ($this->errorName(true) . " : " . $this->error_string); + } else { + return ($this->error_string . " [code " . $this->error_code . "]"); + } + } + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // ***** UNDER THIS LINE ARE DEFINED PRIVATE INTERNAL FUNCTIONS ***** + // ***** ***** + // ***** THESES FUNCTIONS MUST NOT BE USED DIRECTLY ***** + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privCheckFormat() + // Description : + // This method check that the archive exists and is a valid zip archive. + // Several level of check exists. (futur) + // Parameters : + // $p_level : Level of check. Default 0. + // 0 : Check the first bytes (magic codes) (default value)) + // 1 : 0 + Check the central directory (futur) + // 2 : 1 + Check each file header (futur) + // Return Values : + // true on success, + // false on error, the error code is set. + // -------------------------------------------------------------------------------- + public function privCheckFormat($p_level = 0) + { + $v_result = true; + + // ----- Reset the file system cache + clearstatcache(); + + // ----- Reset the error handler + $this->privErrorReset(); + + // ----- Look if the file exits + if (!is_file($this->zipname)) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '" . $this->zipname . "'"); + + return (false); + } + + // ----- Check that the file is readeable + if (!is_readable($this->zipname)) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '" . $this->zipname . "'"); + + return (false); + } + + // ----- Check the magic code + // TBC + + // ----- Check the central header + // TBC + + // ----- Check each file header + // TBC + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privParseOptions() + // Description : + // This internal methods reads the variable list of arguments ($p_options_list, + // $p_size) and generate an array with the options and values ($v_result_list). + // $v_requested_options contains the options that can be present and those that + // must be present. + // $v_requested_options is an array, with the option value as key, and 'optional', + // or 'mandatory' as value. + // Parameters : + // See above. + // Return Values : + // 1 on success. + // 0 on failure. + // -------------------------------------------------------------------------------- + public function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options = false) + { + $v_result = 1; + + // ----- Read the options + $i = 0; + while ($i < $p_size) { + + // ----- Check if the option is supported + if (!isset($v_requested_options[$p_options_list[$i]])) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '" . $p_options_list[$i] . "' for this method"); // ----- Return return PclZip::errorCode(); } - // ----- Read the file header - $v_local_header = array(); - if (($v_result = $this->privReadFileHeader($v_local_header)) != 1) { - // ----- Close the zip file - $this->privCloseFd(); - $v_temp_zip->privCloseFd(); - @unlink($v_zip_temp_name); + // ----- Look for next option + switch ($p_options_list[$i]) { + // ----- Look for options that request a path value + case PCLZIP_OPT_PATH: + case PCLZIP_OPT_REMOVE_PATH: + case PCLZIP_OPT_ADD_PATH: + // ----- Check the number of parameters + if (($i + 1) >= $p_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); - // ----- Return - return $v_result; + // ----- Return + return PclZip::errorCode(); + } + + // ----- Get the value + $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i + 1], false); + $i++; + break; + + case PCLZIP_OPT_TEMP_FILE_THRESHOLD: + // ----- Check the number of parameters + if (($i + 1) >= $p_size) { + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + return PclZip::errorCode(); + } + + // ----- Check for incompatible options + if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '" . PclZipUtilOptionText($p_options_list[$i]) . "' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'"); + + return PclZip::errorCode(); + } + + // ----- Check the value + $v_value = $p_options_list[$i + 1]; + if ((!is_integer($v_value)) || ($v_value < 0)) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + return PclZip::errorCode(); + } + + // ----- Get the value (and convert it in bytes) + $v_result_list[$p_options_list[$i]] = $v_value * 1048576; + $i++; + break; + + case PCLZIP_OPT_TEMP_FILE_ON: + // ----- Check for incompatible options + if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '" . PclZipUtilOptionText($p_options_list[$i]) . "' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'"); + + return PclZip::errorCode(); + } + + $v_result_list[$p_options_list[$i]] = true; + break; + + case PCLZIP_OPT_TEMP_FILE_OFF: + // ----- Check for incompatible options + if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_ON])) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '" . PclZipUtilOptionText($p_options_list[$i]) . "' can not be used with option 'PCLZIP_OPT_TEMP_FILE_ON'"); + + return PclZip::errorCode(); + } + // ----- Check for incompatible options + if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '" . PclZipUtilOptionText($p_options_list[$i]) . "' can not be used with option 'PCLZIP_OPT_TEMP_FILE_THRESHOLD'"); + + return PclZip::errorCode(); + } + + $v_result_list[$p_options_list[$i]] = true; + break; + + case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION: + // ----- Check the number of parameters + if (($i + 1) >= $p_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Get the value + if (is_string($p_options_list[$i + 1]) && ($p_options_list[$i + 1] != '')) { + $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i + 1], false); + $i++; + } else { + } + break; + + // ----- Look for options that request an array of string for value + case PCLZIP_OPT_BY_NAME: + // ----- Check the number of parameters + if (($i + 1) >= $p_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Get the value + if (is_string($p_options_list[$i + 1])) { + $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i + 1]; + } elseif (is_array($p_options_list[$i + 1])) { + $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; + } else { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + $i++; + break; + + // ----- Look for options that request an EREG or PREG expression + case PCLZIP_OPT_BY_EREG: + $p_options_list[$i] = PCLZIP_OPT_BY_PREG; + // ereg() is deprecated starting with PHP 5.3. Move PCLZIP_OPT_BY_EREG + // to PCLZIP_OPT_BY_PREG + case PCLZIP_OPT_BY_PREG: + //case PCLZIP_OPT_CRYPT : + // ----- Check the number of parameters + if (($i + 1) >= $p_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Get the value + if (is_string($p_options_list[$i + 1])) { + $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; + } else { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + $i++; + break; + + // ----- Look for options that takes a string + case PCLZIP_OPT_COMMENT: + case PCLZIP_OPT_ADD_COMMENT: + case PCLZIP_OPT_PREPEND_COMMENT: + // ----- Check the number of parameters + if (($i + 1) >= $p_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Get the value + if (is_string($p_options_list[$i + 1])) { + $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; + } else { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + $i++; + break; + + // ----- Look for options that request an array of index + case PCLZIP_OPT_BY_INDEX: + // ----- Check the number of parameters + if (($i + 1) >= $p_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Get the value + $v_work_list = array(); + if (is_string($p_options_list[$i + 1])) { + + // ----- Remove spaces + $p_options_list[$i + 1] = strtr($p_options_list[$i + 1], ' ', ''); + + // ----- Parse items + $v_work_list = explode(",", $p_options_list[$i + 1]); + } elseif (is_integer($p_options_list[$i + 1])) { + $v_work_list[0] = $p_options_list[$i + 1] . '-' . $p_options_list[$i + 1]; + } elseif (is_array($p_options_list[$i + 1])) { + $v_work_list = $p_options_list[$i + 1]; + } else { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Reduce the index list + // each index item in the list must be a couple with a start and + // an end value : [0,3], [5-5], [8-10], ... + // ----- Check the format of each item + $v_sort_flag = false; + $v_sort_value = 0; + for ($j = 0; $j < sizeof($v_work_list); $j++) { + // ----- Explode the item + $v_item_list = explode("-", $v_work_list[$j]); + $v_size_item_list = sizeof($v_item_list); + + // ----- TBC : Here we might check that each item is a + // real integer ... + + // ----- Look for single value + if ($v_size_item_list == 1) { + // ----- Set the option value + $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0]; + $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[0]; + } elseif ($v_size_item_list == 2) { + // ----- Set the option value + $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0]; + $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[1]; + } else { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Too many values in index range for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Look for list sort + if ($v_result_list[$p_options_list[$i]][$j]['start'] < $v_sort_value) { + $v_sort_flag = true; + + // ----- TBC : An automatic sort should be writen ... + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Invalid order of index range for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + $v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start']; + } + + // ----- Sort the items + if ($v_sort_flag) { + // TBC : To Be Completed + } + + // ----- Next option + $i++; + break; + + // ----- Look for options that request no value + case PCLZIP_OPT_REMOVE_ALL_PATH: + case PCLZIP_OPT_EXTRACT_AS_STRING: + case PCLZIP_OPT_NO_COMPRESSION: + case PCLZIP_OPT_EXTRACT_IN_OUTPUT: + case PCLZIP_OPT_REPLACE_NEWER: + case PCLZIP_OPT_STOP_ON_ERROR: + $v_result_list[$p_options_list[$i]] = true; + break; + + // ----- Look for options that request an octal value + case PCLZIP_OPT_SET_CHMOD: + // ----- Check the number of parameters + if (($i + 1) >= $p_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Get the value + $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; + $i++; + break; + + // ----- Look for options that request a call-back + case PCLZIP_CB_PRE_EXTRACT: + case PCLZIP_CB_POST_EXTRACT: + case PCLZIP_CB_PRE_ADD: + case PCLZIP_CB_POST_ADD: + /* for futur use + case PCLZIP_CB_PRE_DELETE : + case PCLZIP_CB_POST_DELETE : + case PCLZIP_CB_PRE_LIST : + case PCLZIP_CB_POST_LIST : + */ + // ----- Check the number of parameters + if (($i + 1) >= $p_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Get the value + $v_function_name = $p_options_list[$i + 1]; + + // ----- Check that the value is a valid existing function + if (!function_exists($v_function_name)) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '" . $v_function_name . "()' is not an existing function for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Set the attribute + $v_result_list[$p_options_list[$i]] = $v_function_name; + $i++; + break; + + default: + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Unknown parameter '" . $p_options_list[$i] . "'"); + + // ----- Return + return PclZip::errorCode(); } - // ----- Check that local file header is same as central file header - if ($this->privCheckFileHeaders($v_local_header, - $v_header_list[$i]) != 1) { - // TBC - } - unset($v_local_header); + // ----- Next options + $i++; + } - // ----- Write the file header - if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) { - // ----- Close the zip file - $this->privCloseFd(); - $v_temp_zip->privCloseFd(); - @unlink($v_zip_temp_name); + // ----- Look for mandatory options + if ($v_requested_options !== false) { + for ($key = reset($v_requested_options); $key = key($v_requested_options); $key = next($v_requested_options)) { + // ----- Look for mandatory option + if ($v_requested_options[$key] == 'mandatory') { + // ----- Look if present + if (!isset($v_result_list[$key])) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter " . PclZipUtilOptionText($key) . "(" . $key . ")"); - // ----- Return - return $v_result; - } - - // ----- Read/write the data block - if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) { - // ----- Close the zip file - $this->privCloseFd(); - $v_temp_zip->privCloseFd(); - @unlink($v_zip_temp_name); - - // ----- Return - return $v_result; + // ----- Return + return PclZip::errorCode(); + } + } } } - // ----- Store the offset of the central dir - $v_offset = @ftell($v_temp_zip->zip_fd); + // ----- Look for default values + if (!isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) { - // ----- Re-Create the Central Dir files header - for ($i=0; $iprivWriteCentralFileHeader($v_header_list[$i])) != 1) { - $v_temp_zip->privCloseFd(); - $this->privCloseFd(); - @unlink($v_zip_temp_name); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privOptionDefaultThreshold() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privOptionDefaultThreshold(&$p_options) + { + $v_result = 1; + + if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) || isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) { + return $v_result; + } + + // ----- Get 'memory_limit' configuration value + $v_memory_limit = ini_get('memory_limit'); + $v_memory_limit = trim($v_memory_limit); + $last = strtolower(substr($v_memory_limit, -1)); + $v_memory_limit = preg_replace('/[^0-9,.]/', '', $v_memory_limit); + + if ($last == 'g') { + //$v_memory_limit = $v_memory_limit*1024*1024*1024; + $v_memory_limit = $v_memory_limit * 1073741824; + } + if ($last == 'm') { + //$v_memory_limit = $v_memory_limit*1024*1024; + $v_memory_limit = $v_memory_limit * 1048576; + } + if ($last == 'k') { + $v_memory_limit = $v_memory_limit * 1024; + } + + $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit * PCLZIP_TEMPORARY_FILE_RATIO); + + // ----- Sanity check : No threshold if value lower than 1M + if ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] < 1048576) { + unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privFileDescrParseAtt() + // Description : + // Parameters : + // Return Values : + // 1 on success. + // 0 on failure. + // -------------------------------------------------------------------------------- + public function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options = false) + { + $v_result = 1; + + // ----- For each file in the list check the attributes + foreach ($p_file_list as $v_key => $v_value) { + + // ----- Check if the option is supported + if (!isset($v_requested_options[$v_key])) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file attribute '" . $v_key . "' for this file"); // ----- Return - return $v_result; + return PclZip::errorCode(); } - // ----- Transform the header to a 'usable' info - $v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); + // ----- Look for attribute + switch ($v_key) { + case PCLZIP_ATT_FILE_NAME: + if (!is_string($v_value)) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type " . gettype($v_value) . ". String expected for attribute '" . PclZipUtilOptionText($v_key) . "'"); + + return PclZip::errorCode(); + } + + $p_filedescr['filename'] = PclZipUtilPathReduction($v_value); + + if ($p_filedescr['filename'] == '') { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '" . PclZipUtilOptionText($v_key) . "'"); + + return PclZip::errorCode(); + } + + break; + + case PCLZIP_ATT_FILE_NEW_SHORT_NAME: + if (!is_string($v_value)) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type " . gettype($v_value) . ". String expected for attribute '" . PclZipUtilOptionText($v_key) . "'"); + + return PclZip::errorCode(); + } + + $p_filedescr['new_short_name'] = PclZipUtilPathReduction($v_value); + + if ($p_filedescr['new_short_name'] == '') { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty short filename for attribute '" . PclZipUtilOptionText($v_key) . "'"); + + return PclZip::errorCode(); + } + break; + + case PCLZIP_ATT_FILE_NEW_FULL_NAME: + if (!is_string($v_value)) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type " . gettype($v_value) . ". String expected for attribute '" . PclZipUtilOptionText($v_key) . "'"); + + return PclZip::errorCode(); + } + + $p_filedescr['new_full_name'] = PclZipUtilPathReduction($v_value); + + if ($p_filedescr['new_full_name'] == '') { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty full filename for attribute '" . PclZipUtilOptionText($v_key) . "'"); + + return PclZip::errorCode(); + } + break; + + // ----- Look for options that takes a string + case PCLZIP_ATT_FILE_COMMENT: + if (!is_string($v_value)) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type " . gettype($v_value) . ". String expected for attribute '" . PclZipUtilOptionText($v_key) . "'"); + + return PclZip::errorCode(); + } + + $p_filedescr['comment'] = $v_value; + break; + + case PCLZIP_ATT_FILE_MTIME: + if (!is_integer($v_value)) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type " . gettype($v_value) . ". Integer expected for attribute '" . PclZipUtilOptionText($v_key) . "'"); + + return PclZip::errorCode(); + } + + $p_filedescr['mtime'] = $v_value; + break; + + case PCLZIP_ATT_FILE_CONTENT: + $p_filedescr['content'] = $v_value; + break; + + default: + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Unknown parameter '" . $v_key . "'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Look for mandatory options + if ($v_requested_options !== false) { + for ($key = reset($v_requested_options); $key = key($v_requested_options); $key = next($v_requested_options)) { + // ----- Look for mandatory option + if ($v_requested_options[$key] == 'mandatory') { + // ----- Look if present + if (!isset($p_file_list[$key])) { + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter " . PclZipUtilOptionText($key) . "(" . $key . ")"); + + return PclZip::errorCode(); + } + } + } + } + + // end foreach } + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- - // ----- Zip file comment - $v_comment = ''; - if (isset($p_options[PCLZIP_OPT_COMMENT])) { - $v_comment = $p_options[PCLZIP_OPT_COMMENT]; + // -------------------------------------------------------------------------------- + // Function : privFileDescrExpand() + // Description : + // This method look for each item of the list to see if its a file, a folder + // or a string to be added as file. For any other type of files (link, other) + // just ignore the item. + // Then prepare the information that will be stored for that file. + // When its a folder, expand the folder with all the files that are in that + // folder (recursively). + // Parameters : + // Return Values : + // 1 on success. + // 0 on failure. + // -------------------------------------------------------------------------------- + public function privFileDescrExpand(&$p_filedescr_list, &$p_options) + { + $v_result = 1; + + // ----- Create a result list + $v_result_list = array(); + + // ----- Look each entry + for ($i = 0; $i < sizeof($p_filedescr_list); $i++) { + + // ----- Get filedescr + $v_descr = $p_filedescr_list[$i]; + + // ----- Reduce the filename + $v_descr['filename'] = PclZipUtilTranslateWinPath($v_descr['filename'], false); + $v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']); + + // ----- Look for real file or folder + if (file_exists($v_descr['filename'])) { + if (@is_file($v_descr['filename'])) { + $v_descr['type'] = 'file'; + } elseif (@is_dir($v_descr['filename'])) { + $v_descr['type'] = 'folder'; + } elseif (@is_link($v_descr['filename'])) { + // skip + continue; + } else { + // skip + continue; + } + + // ----- Look for string added as file + } elseif (isset($v_descr['content'])) { + $v_descr['type'] = 'virtual_file'; + + // ----- Missing file + } else { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '" . $v_descr['filename'] . "' does not exist"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Calculate the stored filename + $this->privCalculateStoredFilename($v_descr, $p_options); + + // ----- Add the descriptor in result list + $v_result_list[sizeof($v_result_list)] = $v_descr; + + // ----- Look for folder + if ($v_descr['type'] == 'folder') { + // ----- List of items in folder + $v_dirlist_descr = array(); + $v_dirlist_nb = 0; + if ($v_folder_handler = @opendir($v_descr['filename'])) { + while (($v_item_handler = @readdir($v_folder_handler)) !== false) { + + // ----- Skip '.' and '..' + if (($v_item_handler == '.') || ($v_item_handler == '..')) { + continue; + } + + // ----- Compose the full filename + $v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'] . '/' . $v_item_handler; + + // ----- Look for different stored filename + // Because the name of the folder was changed, the name of the + // files/sub-folders also change + if (($v_descr['stored_filename'] != $v_descr['filename']) && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) { + if ($v_descr['stored_filename'] != '') { + $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'] . '/' . $v_item_handler; + } else { + $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_item_handler; + } + } + + $v_dirlist_nb++; + } + + @closedir($v_folder_handler); + } else { + // TBC : unable to open folder in read mode + } + + // ----- Expand each element of the list + if ($v_dirlist_nb != 0) { + // ----- Expand + if (($v_result = $this->privFileDescrExpand($v_dirlist_descr, $p_options)) != 1) { + return $v_result; + } + + // ----- Concat the resulting list + $v_result_list = array_merge($v_result_list, $v_dirlist_descr); + } else { + } + + // ----- Free local array + unset($v_dirlist_descr); + } } - // ----- Calculate the size of the central header - $v_size = @ftell($v_temp_zip->zip_fd)-$v_offset; + // ----- Get the result list + $p_filedescr_list = $v_result_list; - // ----- Create the central dir footer - if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) { - // ----- Reset the file list - unset($v_header_list); - $v_temp_zip->privCloseFd(); - $this->privCloseFd(); - @unlink($v_zip_temp_name); + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privCreate() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privCreate($p_filedescr_list, &$p_result_list, &$p_options) + { + $v_result = 1; + $v_list_detail = array(); + + // ----- Magic quotes trick + $this->privDisableMagicQuotes(); + + // ----- Open the file in write mode + if (($v_result = $this->privOpenFd('wb')) != 1) { + // ----- Return + return $v_result; + } + + // ----- Add the list of files + $v_result = $this->privAddList($p_filedescr_list, $p_result_list, $p_options); + + // ----- Close + $this->privCloseFd(); + + // ----- Magic quotes trick + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privAdd() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privAdd($p_filedescr_list, &$p_result_list, &$p_options) + { + $v_result = 1; + $v_list_detail = array(); + + // ----- Look if the archive exists or is empty + if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0)) { + + // ----- Do a create + $v_result = $this->privCreate($p_filedescr_list, $p_result_list, $p_options); + + // ----- Return + return $v_result; + } + // ----- Magic quotes trick + $this->privDisableMagicQuotes(); + + // ----- Open the zip file + if (($v_result = $this->privOpenFd('rb')) != 1) { + // ----- Magic quotes trick + $this->privSwapBackMagicQuotes(); // ----- Return return $v_result; } + // ----- Read the central directory informations + $v_central_dir = array(); + if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + return $v_result; + } + + // ----- Go to beginning of File + @rewind($this->zip_fd); + + // ----- Creates a temporay file + $v_zip_temp_name = PCLZIP_TEMPORARY_DIR . uniqid('pclzip-') . '.tmp'; + + // ----- Open the temporary file in write mode + if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0) { + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \'' . $v_zip_temp_name . '\' in binary write mode'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Copy the files from the archive to the temporary file + // TBC : Here I should better append the file and go back to erase the central dir + $v_size = $v_central_dir['offset']; + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = fread($this->zip_fd, $v_read_size); + @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Swap the file descriptor + // Here is a trick : I swap the temporary fd with the zip fd, in order to use + // the following methods on the temporary fil and not the real archive + $v_swap = $this->zip_fd; + $this->zip_fd = $v_zip_temp_fd; + $v_zip_temp_fd = $v_swap; + + // ----- Add the files + $v_header_list = array(); + if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1) { + fclose($v_zip_temp_fd); + $this->privCloseFd(); + @unlink($v_zip_temp_name); + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_result; + } + + // ----- Store the offset of the central dir + $v_offset = @ftell($this->zip_fd); + + // ----- Copy the block of file headers from the old archive + $v_size = $v_central_dir['size']; + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($v_zip_temp_fd, $v_read_size); + @fwrite($this->zip_fd, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Create the Central Dir files header + for ($i = 0, $v_count = 0; $i < sizeof($v_header_list); $i++) { + // ----- Create the file header + if ($v_header_list[$i]['status'] == 'ok') { + if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) { + fclose($v_zip_temp_fd); + $this->privCloseFd(); + @unlink($v_zip_temp_name); + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_result; + } + $v_count++; + } + + // ----- Transform the header to a 'usable' info + $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); + } + + // ----- Zip file comment + $v_comment = $v_central_dir['comment']; + if (isset($p_options[PCLZIP_OPT_COMMENT])) { + $v_comment = $p_options[PCLZIP_OPT_COMMENT]; + } + if (isset($p_options[PCLZIP_OPT_ADD_COMMENT])) { + $v_comment = $v_comment . $p_options[PCLZIP_OPT_ADD_COMMENT]; + } + if (isset($p_options[PCLZIP_OPT_PREPEND_COMMENT])) { + $v_comment = $p_options[PCLZIP_OPT_PREPEND_COMMENT] . $v_comment; + } + + // ----- Calculate the size of the central header + $v_size = @ftell($this->zip_fd) - $v_offset; + + // ----- Create the central dir footer + if (($v_result = $this->privWriteCentralHeader($v_count + $v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1) { + // ----- Reset the file list + unset($v_header_list); + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_result; + } + + // ----- Swap back the file descriptor + $v_swap = $this->zip_fd; + $this->zip_fd = $v_zip_temp_fd; + $v_zip_temp_fd = $v_swap; + // ----- Close - $v_temp_zip->privCloseFd(); $this->privCloseFd(); + // ----- Close the temporary file + @fclose($v_zip_temp_fd); + + // ----- Magic quotes trick + $this->privSwapBackMagicQuotes(); + // ----- Delete the zip file // TBC : I should test the result ... @unlink($this->zipname); @@ -4954,544 +2269,2964 @@ //@rename($v_zip_temp_name, $this->zipname); PclZipUtilRename($v_zip_temp_name, $this->zipname); - // ----- Destroy the temporary archive - unset($v_temp_zip); + // ----- Return + return $v_result; } + // -------------------------------------------------------------------------------- - // ----- Remove every files : reset the file - else if ($v_central_dir['entries'] != 0) { + // -------------------------------------------------------------------------------- + // Function : privOpenFd() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + public function privOpenFd($p_mode) + { + $v_result = 1; + + // ----- Look if already open + if ($this->zip_fd != 0) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Zip file \'' . $this->zipname . '\' already open'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Open the zip file + if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \'' . $this->zipname . '\' in ' . $p_mode . ' mode'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privCloseFd() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + public function privCloseFd() + { + $v_result = 1; + + if ($this->zip_fd != 0) { + @fclose($this->zip_fd); + } + $this->zip_fd = 0; + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privAddList() + // Description : + // $p_add_dir and $p_remove_dir will give the ability to memorize a path which is + // different from the real path of the file. This is usefull if you want to have PclTar + // running in any directory, and memorize relative path from an other directory. + // Parameters : + // $p_list : An array containing the file or directory names to add in the tar + // $p_result_list : list of added files with their properties (specially the status field) + // $p_add_dir : Path to add in the filename path archived + // $p_remove_dir : Path to remove in the filename path archived + // Return Values : + // -------------------------------------------------------------------------------- + // function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options) + public function privAddList($p_filedescr_list, &$p_result_list, &$p_options) + { + $v_result = 1; + + // ----- Add the files + $v_header_list = array(); + if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1) { + // ----- Return + return $v_result; + } + + // ----- Store the offset of the central dir + $v_offset = @ftell($this->zip_fd); + + // ----- Create the Central Dir files header + for ($i = 0, $v_count = 0; $i < sizeof($v_header_list); $i++) { + // ----- Create the file header + if ($v_header_list[$i]['status'] == 'ok') { + if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) { + // ----- Return + return $v_result; + } + $v_count++; + } + + // ----- Transform the header to a 'usable' info + $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); + } + + // ----- Zip file comment + $v_comment = ''; + if (isset($p_options[PCLZIP_OPT_COMMENT])) { + $v_comment = $p_options[PCLZIP_OPT_COMMENT]; + } + + // ----- Calculate the size of the central header + $v_size = @ftell($this->zip_fd) - $v_offset; + + // ----- Create the central dir footer + if (($v_result = $this->privWriteCentralHeader($v_count, $v_size, $v_offset, $v_comment)) != 1) { + // ----- Reset the file list + unset($v_header_list); + + // ----- Return + return $v_result; + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privAddFileList() + // Description : + // Parameters : + // $p_filedescr_list : An array containing the file description + // or directory names to add in the zip + // $p_result_list : list of added files with their properties (specially the status field) + // Return Values : + // -------------------------------------------------------------------------------- + public function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options) + { + $v_result = 1; + $v_header = array(); + + // ----- Recuperate the current number of elt in list + $v_nb = sizeof($p_result_list); + + // ----- Loop on the files + for ($j = 0; ($j < sizeof($p_filedescr_list)) && ($v_result == 1); $j++) { + // ----- Format the filename + $p_filedescr_list[$j]['filename'] = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false); + + // ----- Skip empty file names + // TBC : Can this be possible ? not checked in DescrParseAtt ? + if ($p_filedescr_list[$j]['filename'] == "") { + continue; + } + + // ----- Check the filename + if (($p_filedescr_list[$j]['type'] != 'virtual_file') && (!file_exists($p_filedescr_list[$j]['filename']))) { + PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '" . $p_filedescr_list[$j]['filename'] . "' does not exist"); + + return PclZip::errorCode(); + } + + // ----- Look if it is a file or a dir with no all path remove option + // or a dir with all its path removed + // if ( (is_file($p_filedescr_list[$j]['filename'])) + // || ( is_dir($p_filedescr_list[$j]['filename']) + if (($p_filedescr_list[$j]['type'] == 'file') || ($p_filedescr_list[$j]['type'] == 'virtual_file') || (($p_filedescr_list[$j]['type'] == 'folder') && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]) || !$p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) { + + // ----- Add the file + $v_result = $this->privAddFile($p_filedescr_list[$j], $v_header, $p_options); + if ($v_result != 1) { + return $v_result; + } + + // ----- Store the file infos + $p_result_list[$v_nb++] = $v_header; + } + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privAddFile() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privAddFile($p_filedescr, &$p_header, &$p_options) + { + $v_result = 1; + + // ----- Working variable + $p_filename = $p_filedescr['filename']; + + // TBC : Already done in the fileAtt check ... ? + if ($p_filename == "") { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file list parameter (invalid or empty list)"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Look for a stored different filename + /* TBC : Removed + if (isset($p_filedescr['stored_filename'])) { + $v_stored_filename = $p_filedescr['stored_filename']; + } else { + $v_stored_filename = $p_filedescr['stored_filename']; + } + */ + + // ----- Set the file properties + clearstatcache(); + $p_header['version'] = 20; + $p_header['version_extracted'] = 10; + $p_header['flag'] = 0; + $p_header['compression'] = 0; + $p_header['crc'] = 0; + $p_header['compressed_size'] = 0; + $p_header['filename_len'] = strlen($p_filename); + $p_header['extra_len'] = 0; + $p_header['disk'] = 0; + $p_header['internal'] = 0; + $p_header['offset'] = 0; + $p_header['filename'] = $p_filename; + // TBC : Removed $p_header['stored_filename'] = $v_stored_filename; + $p_header['stored_filename'] = $p_filedescr['stored_filename']; + $p_header['extra'] = ''; + $p_header['status'] = 'ok'; + $p_header['index'] = -1; + + // ----- Look for regular file + if ($p_filedescr['type'] == 'file') { + $p_header['external'] = 0x00000000; + $p_header['size'] = filesize($p_filename); + + // ----- Look for regular folder + } elseif ($p_filedescr['type'] == 'folder') { + $p_header['external'] = 0x00000010; + $p_header['mtime'] = filemtime($p_filename); + $p_header['size'] = filesize($p_filename); + + // ----- Look for virtual file + } elseif ($p_filedescr['type'] == 'virtual_file') { + $p_header['external'] = 0x00000000; + $p_header['size'] = strlen($p_filedescr['content']); + } + + // ----- Look for filetime + if (isset($p_filedescr['mtime'])) { + $p_header['mtime'] = $p_filedescr['mtime']; + } elseif ($p_filedescr['type'] == 'virtual_file') { + $p_header['mtime'] = time(); + } else { + $p_header['mtime'] = filemtime($p_filename); + } + + // ------ Look for file comment + if (isset($p_filedescr['comment'])) { + $p_header['comment_len'] = strlen($p_filedescr['comment']); + $p_header['comment'] = $p_filedescr['comment']; + } else { + $p_header['comment_len'] = 0; + $p_header['comment'] = ''; + } + + // ----- Look for pre-add callback + if (isset($p_options[PCLZIP_CB_PRE_ADD])) { + + // ----- Generate a local information + $v_local_header = array(); + $this->privConvertHeader2FileInfo($p_header, $v_local_header); + + // ----- Call the callback + // Here I do not use call_user_func() because I need to send a reference to the + // header. + // eval('$v_result = '.$p_options[PCLZIP_CB_PRE_ADD].'(PCLZIP_CB_PRE_ADD, $v_local_header);'); + $v_result = $p_options[PCLZIP_CB_PRE_ADD](PCLZIP_CB_PRE_ADD, $v_local_header); + if ($v_result == 0) { + // ----- Change the file status + $p_header['status'] = "skipped"; + $v_result = 1; + } + + // ----- Update the informations + // Only some fields can be modified + if ($p_header['stored_filename'] != $v_local_header['stored_filename']) { + $p_header['stored_filename'] = PclZipUtilPathReduction($v_local_header['stored_filename']); + } + } + + // ----- Look for empty stored filename + if ($p_header['stored_filename'] == "") { + $p_header['status'] = "filtered"; + } + + // ----- Check the path length + if (strlen($p_header['stored_filename']) > 0xFF) { + $p_header['status'] = 'filename_too_long'; + } + + // ----- Look if no error, or file not skipped + if ($p_header['status'] == 'ok') { + + // ----- Look for a file + if ($p_filedescr['type'] == 'file') { + // ----- Look for using temporary file to zip + if ((!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])))) { + $v_result = $this->privAddFileUsingTempFile($p_filedescr, $p_header, $p_options); + if ($v_result < PCLZIP_ERR_NO_ERROR) { + return $v_result; + } + + // ----- Use "in memory" zip algo + } else { + + // ----- Open the source file + if (($v_file = @fopen($p_filename, "rb")) == 0) { + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode"); + + return PclZip::errorCode(); + } + + // ----- Read the file content + $v_content = @fread($v_file, $p_header['size']); + + // ----- Close the file + @fclose($v_file); + + // ----- Calculate the CRC + $p_header['crc'] = @crc32($v_content); + + // ----- Look for no compression + if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) { + // ----- Set header parameters + $p_header['compressed_size'] = $p_header['size']; + $p_header['compression'] = 0; + + // ----- Look for normal compression + } else { + // ----- Compress the content + $v_content = @gzdeflate($v_content); + + // ----- Set header parameters + $p_header['compressed_size'] = strlen($v_content); + $p_header['compression'] = 8; + } + + // ----- Call the header generation + if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { + @fclose($v_file); + + return $v_result; + } + + // ----- Write the compressed (or not) content + @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']); + + } + + // ----- Look for a virtual file (a file from string) + } elseif ($p_filedescr['type'] == 'virtual_file') { + + $v_content = $p_filedescr['content']; + + // ----- Calculate the CRC + $p_header['crc'] = @crc32($v_content); + + // ----- Look for no compression + if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) { + // ----- Set header parameters + $p_header['compressed_size'] = $p_header['size']; + $p_header['compression'] = 0; + + // ----- Look for normal compression + } else { + // ----- Compress the content + $v_content = @gzdeflate($v_content); + + // ----- Set header parameters + $p_header['compressed_size'] = strlen($v_content); + $p_header['compression'] = 8; + } + + // ----- Call the header generation + if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { + @fclose($v_file); + + return $v_result; + } + + // ----- Write the compressed (or not) content + @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']); + + // ----- Look for a directory + } elseif ($p_filedescr['type'] == 'folder') { + // ----- Look for directory last '/' + if (@substr($p_header['stored_filename'], -1) != '/') { + $p_header['stored_filename'] .= '/'; + } + + // ----- Set the file properties + $p_header['size'] = 0; + //$p_header['external'] = 0x41FF0010; // Value for a folder : to be checked + $p_header['external'] = 0x00000010; // Value for a folder : to be checked + + // ----- Call the header generation + if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { + return $v_result; + } + } + } + + // ----- Look for post-add callback + if (isset($p_options[PCLZIP_CB_POST_ADD])) { + + // ----- Generate a local information + $v_local_header = array(); + $this->privConvertHeader2FileInfo($p_header, $v_local_header); + + // ----- Call the callback + // Here I do not use call_user_func() because I need to send a reference to the + // header. + // eval('$v_result = '.$p_options[PCLZIP_CB_POST_ADD].'(PCLZIP_CB_POST_ADD, $v_local_header);'); + $v_result = $p_options[PCLZIP_CB_POST_ADD](PCLZIP_CB_POST_ADD, $v_local_header); + if ($v_result == 0) { + // ----- Ignored + $v_result = 1; + } + + // ----- Update the informations + // Nothing can be modified + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privAddFileUsingTempFile() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privAddFileUsingTempFile($p_filedescr, &$p_header, &$p_options) + { + $v_result = PCLZIP_ERR_NO_ERROR; + + // ----- Working variable + $p_filename = $p_filedescr['filename']; + + // ----- Open the source file + if (($v_file = @fopen($p_filename, "rb")) == 0) { + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode"); + + return PclZip::errorCode(); + } + + // ----- Creates a compressed temporary file + $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR . uniqid('pclzip-') . '.gz'; + if (($v_file_compressed = @gzopen($v_gzip_temp_name, "wb")) == 0) { + fclose($v_file); + PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary write mode'); + + return PclZip::errorCode(); + } + + // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks + $v_size = filesize($p_filename); + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($v_file, $v_read_size); + //$v_binary_data = pack('a'.$v_read_size, $v_buffer); + @gzputs($v_file_compressed, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Close the file + @fclose($v_file); + @gzclose($v_file_compressed); + + // ----- Check the minimum file size + if (filesize($v_gzip_temp_name) < 18) { + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'gzip temporary file \'' . $v_gzip_temp_name . '\' has invalid filesize - should be minimum 18 bytes'); + + return PclZip::errorCode(); + } + + // ----- Extract the compressed attributes + if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) { + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary read mode'); + + return PclZip::errorCode(); + } + + // ----- Read the gzip file header + $v_binary_data = @fread($v_file_compressed, 10); + $v_data_header = unpack('a1id1/a1id2/a1cm/a1flag/Vmtime/a1xfl/a1os', $v_binary_data); + + // ----- Check some parameters + $v_data_header['os'] = bin2hex($v_data_header['os']); + + // ----- Read the gzip file footer + @fseek($v_file_compressed, filesize($v_gzip_temp_name) - 8); + $v_binary_data = @fread($v_file_compressed, 8); + $v_data_footer = unpack('Vcrc/Vcompressed_size', $v_binary_data); + + // ----- Set the attributes + $p_header['compression'] = ord($v_data_header['cm']); + //$p_header['mtime'] = $v_data_header['mtime']; + $p_header['crc'] = $v_data_footer['crc']; + $p_header['compressed_size'] = filesize($v_gzip_temp_name) - 18; + + // ----- Close the file + @fclose($v_file_compressed); + + // ----- Call the header generation + if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { + return $v_result; + } + + // ----- Add the compressed data + if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) { + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary read mode'); + + return PclZip::errorCode(); + } + + // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks + fseek($v_file_compressed, 10); + $v_size = $p_header['compressed_size']; + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($v_file_compressed, $v_read_size); + //$v_binary_data = pack('a'.$v_read_size, $v_buffer); + @fwrite($this->zip_fd, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Close the file + @fclose($v_file_compressed); + + // ----- Unlink the temporary file + @unlink($v_gzip_temp_name); + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privCalculateStoredFilename() + // Description : + // Based on file descriptor properties and global options, this method + // calculate the filename that will be stored in the archive. + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privCalculateStoredFilename(&$p_filedescr, &$p_options) + { + $v_result = 1; + + // ----- Working variables + $p_filename = $p_filedescr['filename']; + if (isset($p_options[PCLZIP_OPT_ADD_PATH])) { + $p_add_dir = $p_options[PCLZIP_OPT_ADD_PATH]; + } else { + $p_add_dir = ''; + } + if (isset($p_options[PCLZIP_OPT_REMOVE_PATH])) { + $p_remove_dir = $p_options[PCLZIP_OPT_REMOVE_PATH]; + } else { + $p_remove_dir = ''; + } + if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) { + $p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH]; + } else { + $p_remove_all_dir = 0; + } + + // ----- Look for full name change + if (isset($p_filedescr['new_full_name'])) { + // ----- Remove drive letter if any + $v_stored_filename = PclZipUtilTranslateWinPath($p_filedescr['new_full_name']); + + // ----- Look for path and/or short name change + } else { + + // ----- Look for short name change + // Its when we cahnge just the filename but not the path + if (isset($p_filedescr['new_short_name'])) { + $v_path_info = pathinfo($p_filename); + $v_dir = ''; + if ($v_path_info['dirname'] != '') { + $v_dir = $v_path_info['dirname'] . '/'; + } + $v_stored_filename = $v_dir . $p_filedescr['new_short_name']; + } else { + // ----- Calculate the stored filename + $v_stored_filename = $p_filename; + } + + // ----- Look for all path to remove + if ($p_remove_all_dir) { + $v_stored_filename = basename($p_filename); + + // ----- Look for partial path remove + } elseif ($p_remove_dir != "") { + if (substr($p_remove_dir, -1) != '/') { + $p_remove_dir .= "/"; + } + + if ((substr($p_filename, 0, 2) == "./") || (substr($p_remove_dir, 0, 2) == "./")) { + + if ((substr($p_filename, 0, 2) == "./") && (substr($p_remove_dir, 0, 2) != "./")) { + $p_remove_dir = "./" . $p_remove_dir; + } + if ((substr($p_filename, 0, 2) != "./") && (substr($p_remove_dir, 0, 2) == "./")) { + $p_remove_dir = substr($p_remove_dir, 2); + } + } + + $v_compare = PclZipUtilPathInclusion($p_remove_dir, $v_stored_filename); + if ($v_compare > 0) { + if ($v_compare == 2) { + $v_stored_filename = ""; + } else { + $v_stored_filename = substr($v_stored_filename, strlen($p_remove_dir)); + } + } + } + + // ----- Remove drive letter if any + $v_stored_filename = PclZipUtilTranslateWinPath($v_stored_filename); + + // ----- Look for path to add + if ($p_add_dir != "") { + if (substr($p_add_dir, -1) == "/") { + $v_stored_filename = $p_add_dir . $v_stored_filename; + } else { + $v_stored_filename = $p_add_dir . "/" . $v_stored_filename; + } + } + } + + // ----- Filename (reduce the path of stored name) + $v_stored_filename = PclZipUtilPathReduction($v_stored_filename); + $p_filedescr['stored_filename'] = $v_stored_filename; + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privWriteFileHeader() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privWriteFileHeader(&$p_header) + { + $v_result = 1; + + // ----- Store the offset position of the file + $p_header['offset'] = ftell($this->zip_fd); + + // ----- Transform UNIX mtime to DOS format mdate/mtime + $v_date = getdate($p_header['mtime']); + $v_mtime = ($v_date['hours'] << 11) + ($v_date['minutes'] << 5) + $v_date['seconds'] / 2; + $v_mdate = (($v_date['year'] - 1980) << 9) + ($v_date['mon'] << 5) + $v_date['mday']; + + // ----- Packed data + $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50, $p_header['version_extracted'], $p_header['flag'], $p_header['compression'], $v_mtime, $v_mdate, $p_header['crc'], $p_header['compressed_size'], $p_header['size'], strlen($p_header['stored_filename']), $p_header['extra_len']); + + // ----- Write the first 148 bytes of the header in the archive + fputs($this->zip_fd, $v_binary_data, 30); + + // ----- Write the variable fields + if (strlen($p_header['stored_filename']) != 0) { + fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); + } + if ($p_header['extra_len'] != 0) { + fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privWriteCentralFileHeader() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privWriteCentralFileHeader(&$p_header) + { + $v_result = 1; + + // TBC + //for (reset($p_header); $key = key($p_header); next($p_header)) { + //} + + // ----- Transform UNIX mtime to DOS format mdate/mtime + $v_date = getdate($p_header['mtime']); + $v_mtime = ($v_date['hours'] << 11) + ($v_date['minutes'] << 5) + $v_date['seconds'] / 2; + $v_mdate = (($v_date['year'] - 1980) << 9) + ($v_date['mon'] << 5) + $v_date['mday']; + + // ----- Packed data + $v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50, $p_header['version'], $p_header['version_extracted'], $p_header['flag'], $p_header['compression'], $v_mtime, $v_mdate, $p_header['crc'], $p_header['compressed_size'], $p_header['size'], strlen($p_header['stored_filename']), $p_header['extra_len'], $p_header['comment_len'], $p_header['disk'], $p_header['internal'], $p_header['external'], $p_header['offset']); + + // ----- Write the 42 bytes of the header in the zip file + fputs($this->zip_fd, $v_binary_data, 46); + + // ----- Write the variable fields + if (strlen($p_header['stored_filename']) != 0) { + fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); + } + if ($p_header['extra_len'] != 0) { + fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']); + } + if ($p_header['comment_len'] != 0) { + fputs($this->zip_fd, $p_header['comment'], $p_header['comment_len']); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privWriteCentralHeader() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment) + { + $v_result = 1; + + // ----- Packed data + $v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries, $p_nb_entries, $p_size, $p_offset, strlen($p_comment)); + + // ----- Write the 22 bytes of the header in the zip file + fputs($this->zip_fd, $v_binary_data, 22); + + // ----- Write the variable fields + if (strlen($p_comment) != 0) { + fputs($this->zip_fd, $p_comment, strlen($p_comment)); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privList() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privList(&$p_list) + { + $v_result = 1; + + // ----- Magic quotes trick + $this->privDisableMagicQuotes(); + + // ----- Open the zip file + if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0) { + // ----- Magic quotes trick + $this->privSwapBackMagicQuotes(); + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \'' . $this->zipname . '\' in binary read mode'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read the central directory informations + $v_central_dir = array(); + if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { + $this->privSwapBackMagicQuotes(); + + return $v_result; + } + + // ----- Go to beginning of Central Dir + @rewind($this->zip_fd); + if (@fseek($this->zip_fd, $v_central_dir['offset'])) { + $this->privSwapBackMagicQuotes(); + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read each entry + for ($i = 0; $i < $v_central_dir['entries']; $i++) { + // ----- Read the file header + if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1) { + $this->privSwapBackMagicQuotes(); + + return $v_result; + } + $v_header['index'] = $i; + + // ----- Get the only interesting attributes + $this->privConvertHeader2FileInfo($v_header, $p_list[$i]); + unset($v_header); + } + + // ----- Close the zip file $this->privCloseFd(); + // ----- Magic quotes trick + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privConvertHeader2FileInfo() + // Description : + // This function takes the file informations from the central directory + // entries and extract the interesting parameters that will be given back. + // The resulting file infos are set in the array $p_info + // $p_info['filename'] : Filename with full path. Given by user (add), + // extracted in the filesystem (extract). + // $p_info['stored_filename'] : Stored filename in the archive. + // $p_info['size'] = Size of the file. + // $p_info['compressed_size'] = Compressed size of the file. + // $p_info['mtime'] = Last modification date of the file. + // $p_info['comment'] = Comment associated with the file. + // $p_info['folder'] = true/false : indicates if the entry is a folder or not. + // $p_info['status'] = status of the action on the file. + // $p_info['crc'] = CRC of the file content. + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privConvertHeader2FileInfo($p_header, &$p_info) + { + $v_result = 1; + + // ----- Get the interesting attributes + $v_temp_path = PclZipUtilPathReduction($p_header['filename']); + $p_info['filename'] = $v_temp_path; + $v_temp_path = PclZipUtilPathReduction($p_header['stored_filename']); + $p_info['stored_filename'] = $v_temp_path; + $p_info['size'] = $p_header['size']; + $p_info['compressed_size'] = $p_header['compressed_size']; + $p_info['mtime'] = $p_header['mtime']; + $p_info['comment'] = $p_header['comment']; + $p_info['folder'] = (($p_header['external'] & 0x00000010) == 0x00000010); + $p_info['index'] = $p_header['index']; + $p_info['status'] = $p_header['status']; + $p_info['crc'] = $p_header['crc']; + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privExtractByRule() + // Description : + // Extract a file or directory depending of rules (by index, by name, ...) + // Parameters : + // $p_file_list : An array where will be placed the properties of each + // extracted file + // $p_path : Path to add while writing the extracted files + // $p_remove_path : Path to remove (from the file memorized path) while writing the + // extracted files. If the path does not match the file path, + // the file is extracted with its memorized path. + // $p_remove_path does not apply to 'list' mode. + // $p_path and $p_remove_path are commulative. + // Return Values : + // 1 on success,0 or less on error (see error code list) + // -------------------------------------------------------------------------------- + public function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options) + { + $v_result = 1; + + // ----- Magic quotes trick + $this->privDisableMagicQuotes(); + + // ----- Check the path + if (($p_path == "") || ((substr($p_path, 0, 1) != "/") && (substr($p_path, 0, 3) != "../") && (substr($p_path, 1, 2) != ":/"))) { + $p_path = "./" . $p_path; + } + + // ----- Reduce the path last (and duplicated) '/' + if (($p_path != "./") && ($p_path != "/")) { + // ----- Look for the path end '/' + while (substr($p_path, -1) == "/") { + $p_path = substr($p_path, 0, strlen($p_path) - 1); + } + } + + // ----- Look for path to remove format (should end by /) + if (($p_remove_path != "") && (substr($p_remove_path, -1) != '/')) { + $p_remove_path .= '/'; + } + $p_remove_path_size = strlen($p_remove_path); + + // ----- Open the zip file + if (($v_result = $this->privOpenFd('rb')) != 1) { + $this->privSwapBackMagicQuotes(); + + return $v_result; + } + + // ----- Read the central directory informations + $v_central_dir = array(); + if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { + // ----- Close the zip file + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + return $v_result; + } + + // ----- Start at beginning of Central Dir + $v_pos_entry = $v_central_dir['offset']; + + // ----- Read each entry + $j_start = 0; + for ($i = 0, $v_nb_extracted = 0; $i < $v_central_dir['entries']; $i++) { + + // ----- Read next Central dir entry + @rewind($this->zip_fd); + if (@fseek($this->zip_fd, $v_pos_entry)) { + // ----- Close the zip file + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read the file header + $v_header = array(); + if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1) { + // ----- Close the zip file + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + return $v_result; + } + + // ----- Store the index + $v_header['index'] = $i; + + // ----- Store the file position + $v_pos_entry = ftell($this->zip_fd); + + // ----- Look for the specific extract rules + $v_extract = false; + + // ----- Look for extract by name rule + if ((isset($p_options[PCLZIP_OPT_BY_NAME])) && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { + + // ----- Look if the filename is in the list + for ($j = 0; ($j < sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); $j++) { + + // ----- Look for a directory + if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") { + + // ----- Look if the directory is in the filename path + if ((strlen($v_header['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) && (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) { + $v_extract = true; + } + + // ----- Look for a filename + } elseif ($v_header['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) { + $v_extract = true; + } + } + // ----- Look for extract by ereg rule + // ereg() is deprecated with PHP 5.3 + /* + elseif ( (isset($p_options[PCLZIP_OPT_BY_EREG])) + && ($p_options[PCLZIP_OPT_BY_EREG] != "")) { + + if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header['stored_filename'])) { + $v_extract = true; + } + } + */ + + // ----- Look for extract by preg rule + } elseif ((isset($p_options[PCLZIP_OPT_BY_PREG])) && ($p_options[PCLZIP_OPT_BY_PREG] != "")) { + + if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) { + $v_extract = true; + } + + // ----- Look for extract by index rule + } elseif ((isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { + + // ----- Look if the index is in the list + for ($j = $j_start; ($j < sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) { + + if (($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i <= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { + $v_extract = true; + } + if ($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { + $j_start = $j + 1; + } + + if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start'] > $i) { + break; + } + } + + // ----- Look for no rule, which means extract all the archive + } else { + $v_extract = true; + } + + // ----- Check compression method + if (($v_extract) && (($v_header['compression'] != 8) && ($v_header['compression'] != 0))) { + $v_header['status'] = 'unsupported_compression'; + + // ----- Look for PCLZIP_OPT_STOP_ON_ERROR + if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { + + $this->privSwapBackMagicQuotes(); + + PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION, "Filename '" . $v_header['stored_filename'] . "' is " . "compressed by an unsupported compression " . "method (" . $v_header['compression'] . ") "); + + return PclZip::errorCode(); + } + } + + // ----- Check encrypted files + if (($v_extract) && (($v_header['flag'] & 1) == 1)) { + $v_header['status'] = 'unsupported_encryption'; + + // ----- Look for PCLZIP_OPT_STOP_ON_ERROR + if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { + + $this->privSwapBackMagicQuotes(); + + PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, "Unsupported encryption for " . " filename '" . $v_header['stored_filename'] . "'"); + + return PclZip::errorCode(); + } + } + + // ----- Look for real extraction + if (($v_extract) && ($v_header['status'] != 'ok')) { + $v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++]); + if ($v_result != 1) { + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + return $v_result; + } + + $v_extract = false; + } + + // ----- Look for real extraction + if ($v_extract) { + + // ----- Go to the file position + @rewind($this->zip_fd); + if (@fseek($this->zip_fd, $v_header['offset'])) { + // ----- Close the zip file + $this->privCloseFd(); + + $this->privSwapBackMagicQuotes(); + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Look for extraction as string + if ($p_options[PCLZIP_OPT_EXTRACT_AS_STRING]) { + + $v_string = ''; + + // ----- Extracting the file + $v_result1 = $this->privExtractFileAsString($v_header, $v_string, $p_options); + if ($v_result1 < 1) { + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + return $v_result1; + } + + // ----- Get the only interesting attributes + if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted])) != 1) { + // ----- Close the zip file + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + return $v_result; + } + + // ----- Set the file content + $p_file_list[$v_nb_extracted]['content'] = $v_string; + + // ----- Next extracted file + $v_nb_extracted++; + + // ----- Look for user callback abort + if ($v_result1 == 2) { + break; + } + + // ----- Look for extraction in standard output + } elseif ((isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) { + // ----- Extracting the file in standard output + $v_result1 = $this->privExtractFileInOutput($v_header, $p_options); + if ($v_result1 < 1) { + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + return $v_result1; + } + + // ----- Get the only interesting attributes + if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) { + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + return $v_result; + } + + // ----- Look for user callback abort + if ($v_result1 == 2) { + break; + } + + // ----- Look for normal extraction + } else { + // ----- Extracting the file + $v_result1 = $this->privExtractFile($v_header, $p_path, $p_remove_path, $p_remove_all_path, $p_options); + if ($v_result1 < 1) { + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + return $v_result1; + } + + // ----- Get the only interesting attributes + if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) { + // ----- Close the zip file + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + return $v_result; + } + + // ----- Look for user callback abort + if ($v_result1 == 2) { + break; + } + } + } + } + + // ----- Close the zip file + $this->privCloseFd(); + $this->privSwapBackMagicQuotes(); + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privExtractFile() + // Description : + // Parameters : + // Return Values : + // + // 1 : ... ? + // PCLZIP_ERR_USER_ABORTED(2) : User ask for extraction stop in callback + // -------------------------------------------------------------------------------- + public function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options) + { + $v_result = 1; + + // ----- Read the file header + if (($v_result = $this->privReadFileHeader($v_header)) != 1) { + // ----- Return + return $v_result; + } + + // ----- Check that the file header is coherent with $p_entry info + if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { + // TBC + } + + // ----- Look for all path to remove + if ($p_remove_all_path == true) { + // ----- Look for folder entry that not need to be extracted + if (($p_entry['external'] & 0x00000010) == 0x00000010) { + + $p_entry['status'] = "filtered"; + + return $v_result; + } + + // ----- Get the basename of the path + $p_entry['filename'] = basename($p_entry['filename']); + + // ----- Look for path to remove + } elseif ($p_remove_path != "") { + if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2) { + + // ----- Change the file status + $p_entry['status'] = "filtered"; + + // ----- Return + return $v_result; + } + + $p_remove_path_size = strlen($p_remove_path); + if (substr($p_entry['filename'], 0, $p_remove_path_size) == $p_remove_path) { + + // ----- Remove the path + $p_entry['filename'] = substr($p_entry['filename'], $p_remove_path_size); + + } + } + + // ----- Add the path + if ($p_path != '') { + $p_entry['filename'] = $p_path . "/" . $p_entry['filename']; + } + + // ----- Check a base_dir_restriction + if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) { + $v_inclusion = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION], $p_entry['filename']); + if ($v_inclusion == 0) { + + PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION, "Filename '" . $p_entry['filename'] . "' is " . "outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION"); + + return PclZip::errorCode(); + } + } + + // ----- Look for pre-extract callback + if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) { + + // ----- Generate a local information + $v_local_header = array(); + $this->privConvertHeader2FileInfo($p_entry, $v_local_header); + + // ----- Call the callback + // Here I do not use call_user_func() because I need to send a reference to the + // header. + // eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);'); + $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header); + if ($v_result == 0) { + // ----- Change the file status + $p_entry['status'] = "skipped"; + $v_result = 1; + } + + // ----- Look for abort result + if ($v_result == 2) { + // ----- This status is internal and will be changed in 'skipped' + $p_entry['status'] = "aborted"; + $v_result = PCLZIP_ERR_USER_ABORTED; + } + + // ----- Update the informations + // Only some fields can be modified + $p_entry['filename'] = $v_local_header['filename']; + } + + // ----- Look if extraction should be done + if ($p_entry['status'] == 'ok') { + + // ----- Look for specific actions while the file exist + if (file_exists($p_entry['filename'])) { + + // ----- Look if file is a directory + if (is_dir($p_entry['filename'])) { + + // ----- Change the file status + $p_entry['status'] = "already_a_directory"; + + // ----- Look for PCLZIP_OPT_STOP_ON_ERROR + // For historical reason first PclZip implementation does not stop + // when this kind of error occurs. + if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { + + PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY, "Filename '" . $p_entry['filename'] . "' is " . "already used by an existing directory"); + + return PclZip::errorCode(); + } + + // ----- Look if file is write protected + } elseif (!is_writeable($p_entry['filename'])) { + + // ----- Change the file status + $p_entry['status'] = "write_protected"; + + // ----- Look for PCLZIP_OPT_STOP_ON_ERROR + // For historical reason first PclZip implementation does not stop + // when this kind of error occurs. + if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { + + PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, "Filename '" . $p_entry['filename'] . "' exists " . "and is write protected"); + + return PclZip::errorCode(); + } + + // ----- Look if the extracted file is older + } elseif (filemtime($p_entry['filename']) > $p_entry['mtime']) { + // ----- Change the file status + if ((isset($p_options[PCLZIP_OPT_REPLACE_NEWER])) && ($p_options[PCLZIP_OPT_REPLACE_NEWER] === true)) { + } else { + $p_entry['status'] = "newer_exist"; + + // ----- Look for PCLZIP_OPT_STOP_ON_ERROR + // For historical reason first PclZip implementation does not stop + // when this kind of error occurs. + if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { + + PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, "Newer version of '" . $p_entry['filename'] . "' exists " . "and option PCLZIP_OPT_REPLACE_NEWER is not selected"); + + return PclZip::errorCode(); + } + } + } else { + } + + // ----- Check the directory availability and create it if necessary + } else { + if ((($p_entry['external'] & 0x00000010) == 0x00000010) || (substr($p_entry['filename'], -1) == '/')) { + $v_dir_to_check = $p_entry['filename']; + } elseif (!strstr($p_entry['filename'], "/")) { + $v_dir_to_check = ""; + } else { + $v_dir_to_check = dirname($p_entry['filename']); + } + + if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external'] & 0x00000010) == 0x00000010))) != 1) { + + // ----- Change the file status + $p_entry['status'] = "path_creation_fail"; + + // ----- Return + //return $v_result; + $v_result = 1; + } + } + } + + // ----- Look if extraction should be done + if ($p_entry['status'] == 'ok') { + + // ----- Do the extraction (if not a folder) + if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) { + // ----- Look for not compressed file + if ($p_entry['compression'] == 0) { + + // ----- Opening destination file + if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { + + // ----- Change the file status + $p_entry['status'] = "write_error"; + + // ----- Return + return $v_result; + } + + // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks + $v_size = $p_entry['compressed_size']; + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($this->zip_fd, $v_read_size); + /* Try to speed up the code + $v_binary_data = pack('a'.$v_read_size, $v_buffer); + @fwrite($v_dest_file, $v_binary_data, $v_read_size); + */ + @fwrite($v_dest_file, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Closing the destination file + fclose($v_dest_file); + + // ----- Change the file mtime + touch($p_entry['filename'], $p_entry['mtime']); + + } else { + // ----- TBC + // Need to be finished + if (($p_entry['flag'] & 1) == 1) { + PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, 'File \'' . $p_entry['filename'] . '\' is encrypted. Encrypted files are not supported.'); + + return PclZip::errorCode(); + } + + // ----- Look for using temporary file to unzip + if ((!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])))) { + $v_result = $this->privExtractFileUsingTempFile($p_entry, $p_options); + if ($v_result < PCLZIP_ERR_NO_ERROR) { + return $v_result; + } + + // ----- Look for extract in memory + } else { + + // ----- Read the compressed file in a buffer (one shot) + $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); + + // ----- Decompress the file + $v_file_content = @gzinflate($v_buffer); + unset($v_buffer); + if ($v_file_content === false) { + + // ----- Change the file status + // TBC + $p_entry['status'] = "error"; + + return $v_result; + } + + // ----- Opening destination file + if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { + + // ----- Change the file status + $p_entry['status'] = "write_error"; + + return $v_result; + } + + // ----- Write the uncompressed data + @fwrite($v_dest_file, $v_file_content, $p_entry['size']); + unset($v_file_content); + + // ----- Closing the destination file + @fclose($v_dest_file); + + } + + // ----- Change the file mtime + @touch($p_entry['filename'], $p_entry['mtime']); + } + + // ----- Look for chmod option + if (isset($p_options[PCLZIP_OPT_SET_CHMOD])) { + + // ----- Change the mode of the file + @chmod($p_entry['filename'], $p_options[PCLZIP_OPT_SET_CHMOD]); + } + + } + } + + // ----- Change abort status + if ($p_entry['status'] == "aborted") { + $p_entry['status'] = "skipped"; + + // ----- Look for post-extract callback + } elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { + + // ----- Generate a local information + $v_local_header = array(); + $this->privConvertHeader2FileInfo($p_entry, $v_local_header); + + // ----- Call the callback + // Here I do not use call_user_func() because I need to send a reference to the + // header. + // eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);'); + $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header); + + // ----- Look for abort result + if ($v_result == 2) { + $v_result = PCLZIP_ERR_USER_ABORTED; + } + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privExtractFileUsingTempFile() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privExtractFileUsingTempFile(&$p_entry, &$p_options) + { + $v_result = 1; + + // ----- Creates a temporary file + $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR . uniqid('pclzip-') . '.gz'; + if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) { + fclose($v_file); + PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary write mode'); + + return PclZip::errorCode(); + } + + // ----- Write gz file format header + $v_binary_data = pack('va1a1Va1a1', 0x8b1f, Chr($p_entry['compression']), Chr(0x00), time(), Chr(0x00), Chr(3)); + @fwrite($v_dest_file, $v_binary_data, 10); + + // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks + $v_size = $p_entry['compressed_size']; + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($this->zip_fd, $v_read_size); + //$v_binary_data = pack('a'.$v_read_size, $v_buffer); + @fwrite($v_dest_file, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Write gz file format footer + $v_binary_data = pack('VV', $p_entry['crc'], $p_entry['size']); + @fwrite($v_dest_file, $v_binary_data, 8); + + // ----- Close the temporary file + @fclose($v_dest_file); + + // ----- Opening destination file + if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { + $p_entry['status'] = "write_error"; + + return $v_result; + } + + // ----- Open the temporary gz file + if (($v_src_file = @gzopen($v_gzip_temp_name, 'rb')) == 0) { + @fclose($v_dest_file); + $p_entry['status'] = "read_error"; + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary read mode'); + + return PclZip::errorCode(); + } + + // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks + $v_size = $p_entry['size']; + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @gzread($v_src_file, $v_read_size); + //$v_binary_data = pack('a'.$v_read_size, $v_buffer); + @fwrite($v_dest_file, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + @fclose($v_dest_file); + @gzclose($v_src_file); + + // ----- Delete the temporary file + @unlink($v_gzip_temp_name); + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privExtractFileInOutput() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privExtractFileInOutput(&$p_entry, &$p_options) + { + $v_result = 1; + + // ----- Read the file header + if (($v_result = $this->privReadFileHeader($v_header)) != 1) { + return $v_result; + } + + // ----- Check that the file header is coherent with $p_entry info + if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { + // TBC + } + + // ----- Look for pre-extract callback + if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) { + + // ----- Generate a local information + $v_local_header = array(); + $this->privConvertHeader2FileInfo($p_entry, $v_local_header); + + // ----- Call the callback + // Here I do not use call_user_func() because I need to send a reference to the + // header. + // eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);'); + $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header); + if ($v_result == 0) { + // ----- Change the file status + $p_entry['status'] = "skipped"; + $v_result = 1; + } + + // ----- Look for abort result + if ($v_result == 2) { + // ----- This status is internal and will be changed in 'skipped' + $p_entry['status'] = "aborted"; + $v_result = PCLZIP_ERR_USER_ABORTED; + } + + // ----- Update the informations + // Only some fields can be modified + $p_entry['filename'] = $v_local_header['filename']; + } + + // ----- Trace + + // ----- Look if extraction should be done + if ($p_entry['status'] == 'ok') { + + // ----- Do the extraction (if not a folder) + if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) { + // ----- Look for not compressed file + if ($p_entry['compressed_size'] == $p_entry['size']) { + + // ----- Read the file in a buffer (one shot) + $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); + + // ----- Send the file to the output + echo $v_buffer; + unset($v_buffer); + } else { + + // ----- Read the compressed file in a buffer (one shot) + $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); + + // ----- Decompress the file + $v_file_content = gzinflate($v_buffer); + unset($v_buffer); + + // ----- Send the file to the output + echo $v_file_content; + unset($v_file_content); + } + } + } + + // ----- Change abort status + if ($p_entry['status'] == "aborted") { + $p_entry['status'] = "skipped"; + + // ----- Look for post-extract callback + } elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { + + // ----- Generate a local information + $v_local_header = array(); + $this->privConvertHeader2FileInfo($p_entry, $v_local_header); + + // ----- Call the callback + // Here I do not use call_user_func() because I need to send a reference to the + // header. + // eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);'); + $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header); + + // ----- Look for abort result + if ($v_result == 2) { + $v_result = PCLZIP_ERR_USER_ABORTED; + } + } + + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privExtractFileAsString() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privExtractFileAsString(&$p_entry, &$p_string, &$p_options) + { + $v_result = 1; + + // ----- Read the file header + $v_header = array(); + if (($v_result = $this->privReadFileHeader($v_header)) != 1) { + // ----- Return + return $v_result; + } + + // ----- Check that the file header is coherent with $p_entry info + if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { + // TBC + } + + // ----- Look for pre-extract callback + if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) { + + // ----- Generate a local information + $v_local_header = array(); + $this->privConvertHeader2FileInfo($p_entry, $v_local_header); + + // ----- Call the callback + // Here I do not use call_user_func() because I need to send a reference to the + // header. + // eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);'); + $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header); + if ($v_result == 0) { + // ----- Change the file status + $p_entry['status'] = "skipped"; + $v_result = 1; + } + + // ----- Look for abort result + if ($v_result == 2) { + // ----- This status is internal and will be changed in 'skipped' + $p_entry['status'] = "aborted"; + $v_result = PCLZIP_ERR_USER_ABORTED; + } + + // ----- Update the informations + // Only some fields can be modified + $p_entry['filename'] = $v_local_header['filename']; + } + + // ----- Look if extraction should be done + if ($p_entry['status'] == 'ok') { + + // ----- Do the extraction (if not a folder) + if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) { + // ----- Look for not compressed file + // if ($p_entry['compressed_size'] == $p_entry['size']) + if ($p_entry['compression'] == 0) { + + // ----- Reading the file + $p_string = @fread($this->zip_fd, $p_entry['compressed_size']); + } else { + + // ----- Reading the file + $v_data = @fread($this->zip_fd, $p_entry['compressed_size']); + + // ----- Decompress the file + if (($p_string = @gzinflate($v_data)) === false) { + // TBC + } + } + + // ----- Trace + } else { + // TBC : error : can not extract a folder in a string + } + + } + + // ----- Change abort status + if ($p_entry['status'] == "aborted") { + $p_entry['status'] = "skipped"; + + // ----- Look for post-extract callback + } elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { + + // ----- Generate a local information + $v_local_header = array(); + $this->privConvertHeader2FileInfo($p_entry, $v_local_header); + + // ----- Swap the content to header + $v_local_header['content'] = $p_string; + $p_string = ''; + + // ----- Call the callback + // Here I do not use call_user_func() because I need to send a reference to the + // header. + // eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);'); + $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header); + + // ----- Swap back the content to header + $p_string = $v_local_header['content']; + unset($v_local_header['content']); + + // ----- Look for abort result + if ($v_result == 2) { + $v_result = PCLZIP_ERR_USER_ABORTED; + } + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privReadFileHeader() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privReadFileHeader(&$p_header) + { + $v_result = 1; + + // ----- Read the 4 bytes signature + $v_binary_data = @fread($this->zip_fd, 4); + $v_data = unpack('Vid', $v_binary_data); + + // ----- Check signature + if ($v_data['id'] != 0x04034b50) { + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read the first 42 bytes of the header + $v_binary_data = fread($this->zip_fd, 26); + + // ----- Look for invalid block size + if (strlen($v_binary_data) != 26) { + $p_header['filename'] = ""; + $p_header['status'] = "invalid_header"; + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : " . strlen($v_binary_data)); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Extract the values + $v_data = unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $v_binary_data); + + // ----- Get filename + $p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']); + + // ----- Get extra_fields + if ($v_data['extra_len'] != 0) { + $p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']); + } else { + $p_header['extra'] = ''; + } + + // ----- Extract properties + $p_header['version_extracted'] = $v_data['version']; + $p_header['compression'] = $v_data['compression']; + $p_header['size'] = $v_data['size']; + $p_header['compressed_size'] = $v_data['compressed_size']; + $p_header['crc'] = $v_data['crc']; + $p_header['flag'] = $v_data['flag']; + $p_header['filename_len'] = $v_data['filename_len']; + + // ----- Recuperate date in UNIX format + $p_header['mdate'] = $v_data['mdate']; + $p_header['mtime'] = $v_data['mtime']; + if ($p_header['mdate'] && $p_header['mtime']) { + // ----- Extract time + $v_hour = ($p_header['mtime'] & 0xF800) >> 11; + $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; + $v_seconde = ($p_header['mtime'] & 0x001F) * 2; + + // ----- Extract date + $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; + $v_month = ($p_header['mdate'] & 0x01E0) >> 5; + $v_day = $p_header['mdate'] & 0x001F; + + // ----- Get UNIX date format + $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year); + + } else { + $p_header['mtime'] = time(); + } + + // TBC + //for (reset($v_data); $key = key($v_data); next($v_data)) { + //} + + // ----- Set the stored filename + $p_header['stored_filename'] = $p_header['filename']; + + // ----- Set the status field + $p_header['status'] = "ok"; + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privReadCentralFileHeader() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privReadCentralFileHeader(&$p_header) + { + $v_result = 1; + + // ----- Read the 4 bytes signature + $v_binary_data = @fread($this->zip_fd, 4); + $v_data = unpack('Vid', $v_binary_data); + + // ----- Check signature + if ($v_data['id'] != 0x02014b50) { + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read the first 42 bytes of the header + $v_binary_data = fread($this->zip_fd, 42); + + // ----- Look for invalid block size + if (strlen($v_binary_data) != 42) { + $p_header['filename'] = ""; + $p_header['status'] = "invalid_header"; + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : " . strlen($v_binary_data)); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Extract the values + $p_header = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v_binary_data); + + // ----- Get filename + if ($p_header['filename_len'] != 0) { + $p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']); + } else { + $p_header['filename'] = ''; + } + + // ----- Get extra + if ($p_header['extra_len'] != 0) { + $p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']); + } else { + $p_header['extra'] = ''; + } + + // ----- Get comment + if ($p_header['comment_len'] != 0) { + $p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']); + } else { + $p_header['comment'] = ''; + } + + // ----- Extract properties + + // ----- Recuperate date in UNIX format + //if ($p_header['mdate'] && $p_header['mtime']) + // TBC : bug : this was ignoring time with 0/0/0 + if (1) { + // ----- Extract time + $v_hour = ($p_header['mtime'] & 0xF800) >> 11; + $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; + $v_seconde = ($p_header['mtime'] & 0x001F) * 2; + + // ----- Extract date + $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; + $v_month = ($p_header['mdate'] & 0x01E0) >> 5; + $v_day = $p_header['mdate'] & 0x001F; + + // ----- Get UNIX date format + $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year); + + } else { + $p_header['mtime'] = time(); + } + + // ----- Set the stored filename + $p_header['stored_filename'] = $p_header['filename']; + + // ----- Set default status to ok + $p_header['status'] = 'ok'; + + // ----- Look if it is a directory + if (substr($p_header['filename'], -1) == '/') { + //$p_header['external'] = 0x41FF0010; + $p_header['external'] = 0x00000010; + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privCheckFileHeaders() + // Description : + // Parameters : + // Return Values : + // 1 on success, + // 0 on error; + // -------------------------------------------------------------------------------- + public function privCheckFileHeaders(&$p_local_header, &$p_central_header) + { + $v_result = 1; + + // ----- Check the static values + // TBC + if ($p_local_header['filename'] != $p_central_header['filename']) { + } + if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) { + } + if ($p_local_header['flag'] != $p_central_header['flag']) { + } + if ($p_local_header['compression'] != $p_central_header['compression']) { + } + if ($p_local_header['mtime'] != $p_central_header['mtime']) { + } + if ($p_local_header['filename_len'] != $p_central_header['filename_len']) { + } + + // ----- Look for flag bit 3 + if (($p_local_header['flag'] & 8) == 8) { + $p_local_header['size'] = $p_central_header['size']; + $p_local_header['compressed_size'] = $p_central_header['compressed_size']; + $p_local_header['crc'] = $p_central_header['crc']; + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privReadEndCentralDir() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privReadEndCentralDir(&$p_central_dir) + { + $v_result = 1; + + // ----- Go to the end of the zip file + $v_size = filesize($this->zipname); + @fseek($this->zip_fd, $v_size); + if (@ftell($this->zip_fd) != $v_size) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of the archive \'' . $this->zipname . '\''); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- First try : look if this is an archive with no commentaries (most of the time) + // in this case the end of central dir is at 22 bytes of the file end + $v_found = 0; + if ($v_size > 26) { + @fseek($this->zip_fd, $v_size - 22); + if (($v_pos = @ftell($this->zip_fd)) != ($v_size - 22)) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \'' . $this->zipname . '\''); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read for bytes + $v_binary_data = @fread($this->zip_fd, 4); + $v_data = @unpack('Vid', $v_binary_data); + + // ----- Check signature + if ($v_data['id'] == 0x06054b50) { + $v_found = 1; + } + + $v_pos = ftell($this->zip_fd); + } + + // ----- Go back to the maximum possible size of the Central Dir End Record + if (!$v_found) { + $v_maximum_size = 65557; // 0xFFFF + 22; + if ($v_maximum_size > $v_size) { + $v_maximum_size = $v_size; + } + @fseek($this->zip_fd, $v_size - $v_maximum_size); + if (@ftell($this->zip_fd) != ($v_size - $v_maximum_size)) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \'' . $this->zipname . '\''); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read byte per byte in order to find the signature + $v_pos = ftell($this->zip_fd); + $v_bytes = 0x00000000; + while ($v_pos < $v_size) { + // ----- Read a byte + $v_byte = @fread($this->zip_fd, 1); + + // ----- Add the byte + //$v_bytes = ($v_bytes << 8) | Ord($v_byte); + // Note we mask the old value down such that once shifted we can never end up with more than a 32bit number + // Otherwise on systems where we have 64bit integers the check below for the magic number will fail. + $v_bytes = (($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); + + // ----- Compare the bytes + if ($v_bytes == 0x504b0506) { + $v_pos++; + break; + } + + $v_pos++; + } + + // ----- Look if not found end of central dir + if ($v_pos == $v_size) { + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Unable to find End of Central Dir Record signature"); + + // ----- Return + return PclZip::errorCode(); + } + } + + // ----- Read the first 18 bytes of the header + $v_binary_data = fread($this->zip_fd, 18); + + // ----- Look for invalid block size + if (strlen($v_binary_data) != 18) { + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Central Dir Record size : " . strlen($v_binary_data)); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Extract the values + $v_data = unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', $v_binary_data); + + // ----- Check the global size + if (($v_pos + $v_data['comment_size'] + 18) != $v_size) { + + // ----- Removed in release 2.2 see readme file + // The check of the file size is a little too strict. + // Some bugs where found when a zip is encrypted/decrypted with 'crypt'. + // While decrypted, zip has training 0 bytes + if (0) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'The central dir is not at the end of the archive.' . ' Some trailing bytes exists after the archive.'); + + // ----- Return + return PclZip::errorCode(); + } + } + + // ----- Get comment + if ($v_data['comment_size'] != 0) { + $p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']); + } else { + $p_central_dir['comment'] = ''; + } + + $p_central_dir['entries'] = $v_data['entries']; + $p_central_dir['disk_entries'] = $v_data['disk_entries']; + $p_central_dir['offset'] = $v_data['offset']; + $p_central_dir['size'] = $v_data['size']; + $p_central_dir['disk'] = $v_data['disk']; + $p_central_dir['disk_start'] = $v_data['disk_start']; + + // TBC + //for (reset($p_central_dir); $key = key($p_central_dir); next($p_central_dir)) { + //} + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privDeleteByRule() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privDeleteByRule(&$p_result_list, &$p_options) + { + $v_result = 1; + $v_list_detail = array(); + + // ----- Open the zip file + if (($v_result = $this->privOpenFd('rb')) != 1) { + // ----- Return + return $v_result; + } + + // ----- Read the central directory informations + $v_central_dir = array(); + if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { + $this->privCloseFd(); + + return $v_result; + } + + // ----- Go to beginning of File + @rewind($this->zip_fd); + + // ----- Scan all the files + // ----- Start at beginning of Central Dir + $v_pos_entry = $v_central_dir['offset']; + @rewind($this->zip_fd); + if (@fseek($this->zip_fd, $v_pos_entry)) { + // ----- Close the zip file + $this->privCloseFd(); + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read each entry + $v_header_list = array(); + $j_start = 0; + for ($i = 0, $v_nb_extracted = 0; $i < $v_central_dir['entries']; $i++) { + + // ----- Read the file header + $v_header_list[$v_nb_extracted] = array(); + if (($v_result = $this->privReadCentralFileHeader($v_header_list[$v_nb_extracted])) != 1) { + // ----- Close the zip file + $this->privCloseFd(); + + return $v_result; + } + + // ----- Store the index + $v_header_list[$v_nb_extracted]['index'] = $i; + + // ----- Look for the specific extract rules + $v_found = false; + + // ----- Look for extract by name rule + if ((isset($p_options[PCLZIP_OPT_BY_NAME])) && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { + + // ----- Look if the filename is in the list + for ($j = 0; ($j < sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); $j++) { + + // ----- Look for a directory + if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") { + + // ----- Look if the directory is in the filename path + if ((strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) && (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) { + $v_found = true; + } elseif ((($v_header_list[$v_nb_extracted]['external'] & 0x00000010) == 0x00000010) /* Indicates a folder */ && ($v_header_list[$v_nb_extracted]['stored_filename'] . '/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) { + $v_found = true; + } + + // ----- Look for a filename + } elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) { + $v_found = true; + } + } + + // ----- Look for extract by ereg rule + // ereg() is deprecated with PHP 5.3 + /* + elseif ( (isset($p_options[PCLZIP_OPT_BY_EREG])) + && ($p_options[PCLZIP_OPT_BY_EREG] != "")) { + + if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header_list[$v_nb_extracted]['stored_filename'])) { + $v_found = true; + } + } + */ + + // ----- Look for extract by preg rule + } elseif ((isset($p_options[PCLZIP_OPT_BY_PREG])) && ($p_options[PCLZIP_OPT_BY_PREG] != "")) { + + if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) { + $v_found = true; + } + + // ----- Look for extract by index rule + } elseif ((isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { + + // ----- Look if the index is in the list + for ($j = $j_start; ($j < sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) { + + if (($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i <= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { + $v_found = true; + } + if ($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { + $j_start = $j + 1; + } + + if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start'] > $i) { + break; + } + } + } else { + $v_found = true; + } + + // ----- Look for deletion + if ($v_found) { + unset($v_header_list[$v_nb_extracted]); + } else { + $v_nb_extracted++; + } + } + + // ----- Look if something need to be deleted + if ($v_nb_extracted > 0) { + + // ----- Creates a temporay file + $v_zip_temp_name = PCLZIP_TEMPORARY_DIR . uniqid('pclzip-') . '.tmp'; + + // ----- Creates a temporary zip archive + $v_temp_zip = new PclZip($v_zip_temp_name); + + // ----- Open the temporary zip file in write mode + if (($v_result = $v_temp_zip->privOpenFd('wb')) != 1) { + $this->privCloseFd(); + + // ----- Return + return $v_result; + } + + // ----- Look which file need to be kept + for ($i = 0; $i < sizeof($v_header_list); $i++) { + + // ----- Calculate the position of the header + @rewind($this->zip_fd); + if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) { + // ----- Close the zip file + $this->privCloseFd(); + $v_temp_zip->privCloseFd(); + @unlink($v_zip_temp_name); + + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Read the file header + $v_local_header = array(); + if (($v_result = $this->privReadFileHeader($v_local_header)) != 1) { + // ----- Close the zip file + $this->privCloseFd(); + $v_temp_zip->privCloseFd(); + @unlink($v_zip_temp_name); + + // ----- Return + return $v_result; + } + + // ----- Check that local file header is same as central file header + if ($this->privCheckFileHeaders($v_local_header, $v_header_list[$i]) != 1) { + // TBC + } + unset($v_local_header); + + // ----- Write the file header + if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) { + // ----- Close the zip file + $this->privCloseFd(); + $v_temp_zip->privCloseFd(); + @unlink($v_zip_temp_name); + + // ----- Return + return $v_result; + } + + // ----- Read/write the data block + if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) { + // ----- Close the zip file + $this->privCloseFd(); + $v_temp_zip->privCloseFd(); + @unlink($v_zip_temp_name); + + // ----- Return + return $v_result; + } + } + + // ----- Store the offset of the central dir + $v_offset = @ftell($v_temp_zip->zip_fd); + + // ----- Re-Create the Central Dir files header + for ($i = 0; $i < sizeof($v_header_list); $i++) { + // ----- Create the file header + if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) { + $v_temp_zip->privCloseFd(); + $this->privCloseFd(); + @unlink($v_zip_temp_name); + + // ----- Return + return $v_result; + } + + // ----- Transform the header to a 'usable' info + $v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); + } + + // ----- Zip file comment + $v_comment = ''; + if (isset($p_options[PCLZIP_OPT_COMMENT])) { + $v_comment = $p_options[PCLZIP_OPT_COMMENT]; + } + + // ----- Calculate the size of the central header + $v_size = @ftell($v_temp_zip->zip_fd) - $v_offset; + + // ----- Create the central dir footer + if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) { + // ----- Reset the file list + unset($v_header_list); + $v_temp_zip->privCloseFd(); + $this->privCloseFd(); + @unlink($v_zip_temp_name); + + // ----- Return + return $v_result; + } + + // ----- Close + $v_temp_zip->privCloseFd(); + $this->privCloseFd(); + + // ----- Delete the zip file + // TBC : I should test the result ... + @unlink($this->zipname); + + // ----- Rename the temporary file + // TBC : I should test the result ... + //@rename($v_zip_temp_name, $this->zipname); + PclZipUtilRename($v_zip_temp_name, $this->zipname); + + // ----- Destroy the temporary archive + unset($v_temp_zip); + + // ----- Remove every files : reset the file + } elseif ($v_central_dir['entries'] != 0) { + $this->privCloseFd(); + + if (($v_result = $this->privOpenFd('wb')) != 1) { + return $v_result; + } + + if (($v_result = $this->privWriteCentralHeader(0, 0, 0, '')) != 1) { + return $v_result; + } + + $this->privCloseFd(); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privDirCheck() + // Description : + // Check if a directory exists, if not it creates it and all the parents directory + // which may be useful. + // Parameters : + // $p_dir : Directory path to check. + // Return Values : + // 1 : OK + // -1 : Unable to create directory + // -------------------------------------------------------------------------------- + public function privDirCheck($p_dir, $p_is_dir = false) + { + $v_result = 1; + + // ----- Remove the final '/' + if (($p_is_dir) && (substr($p_dir, -1) == '/')) { + $p_dir = substr($p_dir, 0, strlen($p_dir) - 1); + } + + // ----- Check the directory availability + if ((is_dir($p_dir)) || ($p_dir == "")) { + return 1; + } + + // ----- Extract parent directory + $p_parent_dir = dirname($p_dir); + + // ----- Just a check + if ($p_parent_dir != $p_dir) { + // ----- Look for parent directory + if ($p_parent_dir != "") { + if (($v_result = $this->privDirCheck($p_parent_dir)) != 1) { + return $v_result; + } + } + } + + // ----- Create the directory + if (!@mkdir($p_dir, 0777)) { + // ----- Error log + PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '$p_dir'"); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privMerge() + // Description : + // If $p_archive_to_add does not exist, the function exit with a success result. + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privMerge(&$p_archive_to_add) + { + $v_result = 1; + + // ----- Look if the archive_to_add exists + if (!is_file($p_archive_to_add->zipname)) { + + // ----- Nothing to merge, so merge is a success + $v_result = 1; + + // ----- Return + return $v_result; + } + + // ----- Look if the archive exists + if (!is_file($this->zipname)) { + + // ----- Do a duplicate + $v_result = $this->privDuplicate($p_archive_to_add->zipname); + + // ----- Return + return $v_result; + } + + // ----- Open the zip file + if (($v_result = $this->privOpenFd('rb')) != 1) { + // ----- Return + return $v_result; + } + + // ----- Read the central directory informations + $v_central_dir = array(); + if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { + $this->privCloseFd(); + + return $v_result; + } + + // ----- Go to beginning of File + @rewind($this->zip_fd); + + // ----- Open the archive_to_add file + if (($v_result = $p_archive_to_add->privOpenFd('rb')) != 1) { + $this->privCloseFd(); + + // ----- Return + return $v_result; + } + + // ----- Read the central directory informations + $v_central_dir_to_add = array(); + if (($v_result = $p_archive_to_add->privReadEndCentralDir($v_central_dir_to_add)) != 1) { + $this->privCloseFd(); + $p_archive_to_add->privCloseFd(); + + return $v_result; + } + + // ----- Go to beginning of File + @rewind($p_archive_to_add->zip_fd); + + // ----- Creates a temporay file + $v_zip_temp_name = PCLZIP_TEMPORARY_DIR . uniqid('pclzip-') . '.tmp'; + + // ----- Open the temporary file in write mode + if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0) { + $this->privCloseFd(); + $p_archive_to_add->privCloseFd(); + + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \'' . $v_zip_temp_name . '\' in binary write mode'); + + // ----- Return + return PclZip::errorCode(); + } + + // ----- Copy the files from the archive to the temporary file + // TBC : Here I should better append the file and go back to erase the central dir + $v_size = $v_central_dir['offset']; + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = fread($this->zip_fd, $v_read_size); + @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Copy the files from the archive_to_add into the temporary file + $v_size = $v_central_dir_to_add['offset']; + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = fread($p_archive_to_add->zip_fd, $v_read_size); + @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Store the offset of the central dir + $v_offset = @ftell($v_zip_temp_fd); + + // ----- Copy the block of file headers from the old archive + $v_size = $v_central_dir['size']; + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($this->zip_fd, $v_read_size); + @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Copy the block of file headers from the archive_to_add + $v_size = $v_central_dir_to_add['size']; + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($p_archive_to_add->zip_fd, $v_read_size); + @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Merge the file comments + $v_comment = $v_central_dir['comment'] . ' ' . $v_central_dir_to_add['comment']; + + // ----- Calculate the size of the (new) central header + $v_size = @ftell($v_zip_temp_fd) - $v_offset; + + // ----- Swap the file descriptor + // Here is a trick : I swap the temporary fd with the zip fd, in order to use + // the following methods on the temporary fil and not the real archive fd + $v_swap = $this->zip_fd; + $this->zip_fd = $v_zip_temp_fd; + $v_zip_temp_fd = $v_swap; + + // ----- Create the central dir footer + if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries'] + $v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1) { + $this->privCloseFd(); + $p_archive_to_add->privCloseFd(); + @fclose($v_zip_temp_fd); + $this->zip_fd = null; + + // ----- Reset the file list + unset($v_header_list); + + // ----- Return + return $v_result; + } + + // ----- Swap back the file descriptor + $v_swap = $this->zip_fd; + $this->zip_fd = $v_zip_temp_fd; + $v_zip_temp_fd = $v_swap; + + // ----- Close + $this->privCloseFd(); + $p_archive_to_add->privCloseFd(); + + // ----- Close the temporary file + @fclose($v_zip_temp_fd); + + // ----- Delete the zip file + // TBC : I should test the result ... + @unlink($this->zipname); + + // ----- Rename the temporary file + // TBC : I should test the result ... + //@rename($v_zip_temp_name, $this->zipname); + PclZipUtilRename($v_zip_temp_name, $this->zipname); + + // ----- Return + return $v_result; + } + // -------------------------------------------------------------------------------- + + // -------------------------------------------------------------------------------- + // Function : privDuplicate() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privDuplicate($p_archive_filename) + { + $v_result = 1; + + // ----- Look if the $p_archive_filename exists + if (!is_file($p_archive_filename)) { + + // ----- Nothing to duplicate, so duplicate is a success. + $v_result = 1; + + // ----- Return + return $v_result; + } + + // ----- Open the zip file if (($v_result = $this->privOpenFd('wb')) != 1) { - return $v_result; + // ----- Return + return $v_result; } - if (($v_result = $this->privWriteCentralHeader(0, 0, 0, '')) != 1) { - return $v_result; + // ----- Open the temporary file in write mode + if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0) { + $this->privCloseFd(); + + PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \'' . $p_archive_filename . '\' in binary write mode'); + + // ----- Return + return PclZip::errorCode(); } + // ----- Copy the files from the archive to the temporary file + // TBC : Here I should better append the file and go back to erase the central dir + $v_size = filesize($p_archive_filename); + while ($v_size != 0) { + $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = fread($v_zip_temp_fd, $v_read_size); + @fwrite($this->zip_fd, $v_buffer, $v_read_size); + $v_size -= $v_read_size; + } + + // ----- Close $this->privCloseFd(); + + // ----- Close the temporary file + @fclose($v_zip_temp_fd); + + // ----- Return + return $v_result; } + // -------------------------------------------------------------------------------- - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privDirCheck() - // Description : - // Check if a directory exists, if not it creates it and all the parents directory - // which may be useful. - // Parameters : - // $p_dir : Directory path to check. - // Return Values : - // 1 : OK - // -1 : Unable to create directory - // -------------------------------------------------------------------------------- - function privDirCheck($p_dir, $p_is_dir=false) - { - $v_result = 1; - - - // ----- Remove the final '/' - if (($p_is_dir) && (substr($p_dir, -1)=='/')) + // -------------------------------------------------------------------------------- + // Function : privErrorLog() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + public function privErrorLog($p_error_code = 0, $p_error_string = '') { - $p_dir = substr($p_dir, 0, strlen($p_dir)-1); - } - - // ----- Check the directory availability - if ((is_dir($p_dir)) || ($p_dir == "")) - { - return 1; - } - - // ----- Extract parent directory - $p_parent_dir = dirname($p_dir); - - // ----- Just a check - if ($p_parent_dir != $p_dir) - { - // ----- Look for parent directory - if ($p_parent_dir != "") - { - if (($v_result = $this->privDirCheck($p_parent_dir)) != 1) - { - return $v_result; + if (PCLZIP_ERROR_EXTERNAL == 1) { + PclError($p_error_code, $p_error_string); + } else { + $this->error_code = $p_error_code; + $this->error_string = $p_error_string; } - } } + // -------------------------------------------------------------------------------- - // ----- Create the directory - if (!@mkdir($p_dir, 0777)) + // -------------------------------------------------------------------------------- + // Function : privErrorReset() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + public function privErrorReset() { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '$p_dir'"); - - // ----- Return - return PclZip::errorCode(); + if (PCLZIP_ERROR_EXTERNAL == 1) { + PclErrorReset(); + } else { + $this->error_code = 0; + $this->error_string = ''; + } } + // -------------------------------------------------------------------------------- - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privMerge() - // Description : - // If $p_archive_to_add does not exist, the function exit with a success result. - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privMerge(&$p_archive_to_add) - { - $v_result=1; - - // ----- Look if the archive_to_add exists - if (!is_file($p_archive_to_add->zipname)) + // -------------------------------------------------------------------------------- + // Function : privDisableMagicQuotes() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privDisableMagicQuotes() { + $v_result = 1; - // ----- Nothing to merge, so merge is a success - $v_result = 1; + // ----- Look if function exists + if ((!function_exists("get_magic_quotes_runtime")) || (!function_exists("set_magic_quotes_runtime"))) { + return $v_result; + } - // ----- Return - return $v_result; + // ----- Look if already done + if ($this->magic_quotes_status != -1) { + return $v_result; + } + + // ----- Get and memorize the magic_quote value + $this->magic_quotes_status = @get_magic_quotes_runtime(); + + // ----- Disable magic_quotes + if ($this->magic_quotes_status == 1) { + @set_magic_quotes_runtime(0); + } + + // ----- Return + return $v_result; } + // -------------------------------------------------------------------------------- - // ----- Look if the archive exists - if (!is_file($this->zipname)) + // -------------------------------------------------------------------------------- + // Function : privSwapBackMagicQuotes() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + public function privSwapBackMagicQuotes() { + $v_result = 1; - // ----- Do a duplicate - $v_result = $this->privDuplicate($p_archive_to_add->zipname); + // ----- Look if function exists + if ((!function_exists("get_magic_quotes_runtime")) || (!function_exists("set_magic_quotes_runtime"))) { + return $v_result; + } - // ----- Return - return $v_result; + // ----- Look if something to do + if ($this->magic_quotes_status != -1) { + return $v_result; + } + + // ----- Swap back magic_quotes + if ($this->magic_quotes_status == 1) { + @set_magic_quotes_runtime($this->magic_quotes_status); + } + + // ----- Return + return $v_result; } + // -------------------------------------------------------------------------------- +} - // ----- Open the zip file - if (($v_result=$this->privOpenFd('rb')) != 1) - { - // ----- Return - return $v_result; - } +// End of class +// -------------------------------------------------------------------------------- - // ----- Read the central directory informations - $v_central_dir = array(); - if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) - { - $this->privCloseFd(); - return $v_result; - } - - // ----- Go to beginning of File - @rewind($this->zip_fd); - - // ----- Open the archive_to_add file - if (($v_result=$p_archive_to_add->privOpenFd('rb')) != 1) - { - $this->privCloseFd(); - - // ----- Return - return $v_result; - } - - // ----- Read the central directory informations - $v_central_dir_to_add = array(); - if (($v_result = $p_archive_to_add->privReadEndCentralDir($v_central_dir_to_add)) != 1) - { - $this->privCloseFd(); - $p_archive_to_add->privCloseFd(); - - return $v_result; - } - - // ----- Go to beginning of File - @rewind($p_archive_to_add->zip_fd); - - // ----- Creates a temporay file - $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp'; - - // ----- Open the temporary file in write mode - if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0) - { - $this->privCloseFd(); - $p_archive_to_add->privCloseFd(); - - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Copy the files from the archive to the temporary file - // TBC : Here I should better append the file and go back to erase the central dir - $v_size = $v_central_dir['offset']; - while ($v_size != 0) - { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = fread($this->zip_fd, $v_read_size); - @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Copy the files from the archive_to_add into the temporary file - $v_size = $v_central_dir_to_add['offset']; - while ($v_size != 0) - { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = fread($p_archive_to_add->zip_fd, $v_read_size); - @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Store the offset of the central dir - $v_offset = @ftell($v_zip_temp_fd); - - // ----- Copy the block of file headers from the old archive - $v_size = $v_central_dir['size']; - while ($v_size != 0) - { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($this->zip_fd, $v_read_size); - @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Copy the block of file headers from the archive_to_add - $v_size = $v_central_dir_to_add['size']; - while ($v_size != 0) - { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($p_archive_to_add->zip_fd, $v_read_size); - @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Merge the file comments - $v_comment = $v_central_dir['comment'].' '.$v_central_dir_to_add['comment']; - - // ----- Calculate the size of the (new) central header - $v_size = @ftell($v_zip_temp_fd)-$v_offset; - - // ----- Swap the file descriptor - // Here is a trick : I swap the temporary fd with the zip fd, in order to use - // the following methods on the temporary fil and not the real archive fd - $v_swap = $this->zip_fd; - $this->zip_fd = $v_zip_temp_fd; - $v_zip_temp_fd = $v_swap; - - // ----- Create the central dir footer - if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries']+$v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1) - { - $this->privCloseFd(); - $p_archive_to_add->privCloseFd(); - @fclose($v_zip_temp_fd); - $this->zip_fd = null; - - // ----- Reset the file list - unset($v_header_list); - - // ----- Return - return $v_result; - } - - // ----- Swap back the file descriptor - $v_swap = $this->zip_fd; - $this->zip_fd = $v_zip_temp_fd; - $v_zip_temp_fd = $v_swap; - - // ----- Close - $this->privCloseFd(); - $p_archive_to_add->privCloseFd(); - - // ----- Close the temporary file - @fclose($v_zip_temp_fd); - - // ----- Delete the zip file - // TBC : I should test the result ... - @unlink($this->zipname); - - // ----- Rename the temporary file - // TBC : I should test the result ... - //@rename($v_zip_temp_name, $this->zipname); - PclZipUtilRename($v_zip_temp_name, $this->zipname); - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privDuplicate() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privDuplicate($p_archive_filename) - { - $v_result=1; - - // ----- Look if the $p_archive_filename exists - if (!is_file($p_archive_filename)) - { - - // ----- Nothing to duplicate, so duplicate is a success. - $v_result = 1; - - // ----- Return - return $v_result; - } - - // ----- Open the zip file - if (($v_result=$this->privOpenFd('wb')) != 1) - { - // ----- Return - return $v_result; - } - - // ----- Open the temporary file in write mode - if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0) - { - $this->privCloseFd(); - - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \''.$p_archive_filename.'\' in binary write mode'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Copy the files from the archive to the temporary file - // TBC : Here I should better append the file and go back to erase the central dir - $v_size = filesize($p_archive_filename); - while ($v_size != 0) - { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = fread($v_zip_temp_fd, $v_read_size); - @fwrite($this->zip_fd, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Close - $this->privCloseFd(); - - // ----- Close the temporary file - @fclose($v_zip_temp_fd); - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privErrorLog() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - function privErrorLog($p_error_code=0, $p_error_string='') - { - if (PCLZIP_ERROR_EXTERNAL == 1) { - PclError($p_error_code, $p_error_string); - } - else { - $this->error_code = $p_error_code; - $this->error_string = $p_error_string; - } - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privErrorReset() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - function privErrorReset() - { - if (PCLZIP_ERROR_EXTERNAL == 1) { - PclErrorReset(); - } - else { - $this->error_code = 0; - $this->error_string = ''; - } - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privDisableMagicQuotes() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privDisableMagicQuotes() - { - $v_result=1; - - // ----- Look if function exists - if ( (!function_exists("get_magic_quotes_runtime")) - || (!function_exists("set_magic_quotes_runtime"))) { - return $v_result; - } - - // ----- Look if already done - if ($this->magic_quotes_status != -1) { - return $v_result; - } - - // ----- Get and memorize the magic_quote value - $this->magic_quotes_status = @get_magic_quotes_runtime(); - - // ----- Disable magic_quotes - if ($this->magic_quotes_status == 1) { - @set_magic_quotes_runtime(0); - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privSwapBackMagicQuotes() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privSwapBackMagicQuotes() - { - $v_result=1; - - // ----- Look if function exists - if ( (!function_exists("get_magic_quotes_runtime")) - || (!function_exists("set_magic_quotes_runtime"))) { - return $v_result; - } - - // ----- Look if something to do - if ($this->magic_quotes_status != -1) { - return $v_result; - } - - // ----- Swap back magic_quotes - if ($this->magic_quotes_status == 1) { - @set_magic_quotes_runtime($this->magic_quotes_status); - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - } - // End of class - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : PclZipUtilPathReduction() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function PclZipUtilPathReduction($p_dir) - { +// -------------------------------------------------------------------------------- +// Function : PclZipUtilPathReduction() +// Description : +// Parameters : +// Return Values : +// -------------------------------------------------------------------------------- +function PclZipUtilPathReduction($p_dir) +{ $v_result = ""; // ----- Look for not empty path if ($p_dir != "") { - // ----- Explode path by directory names - $v_list = explode("/", $p_dir); + // ----- Explode path by directory names + $v_list = explode("/", $p_dir); - // ----- Study directories from last to first - $v_skip = 0; - for ($i=sizeof($v_list)-1; $i>=0; $i--) { - // ----- Look for current path - if ($v_list[$i] == ".") { - // ----- Ignore this directory - // Should be the first $i=0, but no check is done - } - else if ($v_list[$i] == "..") { - $v_skip++; - } - else if ($v_list[$i] == "") { - // ----- First '/' i.e. root slash - if ($i == 0) { - $v_result = "/".$v_result; - if ($v_skip > 0) { - // ----- It is an invalid path, so the path is not modified - // TBC - $v_result = $p_dir; - $v_skip = 0; + // ----- Study directories from last to first + $v_skip = 0; + for ($i = sizeof($v_list) - 1; $i >= 0; $i--) { + // ----- Look for current path + if ($v_list[$i] == ".") { + // ----- Ignore this directory + // Should be the first $i=0, but no check is done + } elseif ($v_list[$i] == "..") { + $v_skip++; + } elseif ($v_list[$i] == "") { + // ----- First '/' i.e. root slash + if ($i == 0) { + $v_result = "/" . $v_result; + if ($v_skip > 0) { + // ----- It is an invalid path, so the path is not modified + // TBC + $v_result = $p_dir; + $v_skip = 0; + } + + // ----- Last '/' i.e. indicates a directory + } elseif ($i == (sizeof($v_list) - 1)) { + $v_result = $v_list[$i]; + + // ----- Double '/' inside the path + } else { + // ----- Ignore only the double '//' in path, + // but not the first and last '/' + } + } else { + // ----- Look for item to skip + if ($v_skip > 0) { + $v_skip--; + } else { + $v_result = $v_list[$i] . ($i != (sizeof($v_list) - 1) ? "/" . $v_result : ""); + } } - } - // ----- Last '/' i.e. indicates a directory - else if ($i == (sizeof($v_list)-1)) { - $v_result = $v_list[$i]; - } - // ----- Double '/' inside the path - else { - // ----- Ignore only the double '//' in path, - // but not the first and last '/' - } } - else { - // ----- Look for item to skip - if ($v_skip > 0) { - $v_skip--; - } - else { - $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:""); - } - } - } - // ----- Look for skip - if ($v_skip > 0) { - while ($v_skip > 0) { - $v_result = '../'.$v_result; - $v_skip--; + // ----- Look for skip + if ($v_skip > 0) { + while ($v_skip > 0) { + $v_result = '../' . $v_result; + $v_skip--; + } } - } } // ----- Return return $v_result; - } - // -------------------------------------------------------------------------------- +} +// -------------------------------------------------------------------------------- - // -------------------------------------------------------------------------------- - // Function : PclZipUtilPathInclusion() - // Description : - // This function indicates if the path $p_path is under the $p_dir tree. Or, - // said in an other way, if the file or sub-dir $p_path is inside the dir - // $p_dir. - // The function indicates also if the path is exactly the same as the dir. - // This function supports path with duplicated '/' like '//', but does not - // support '.' or '..' statements. - // Parameters : - // Return Values : - // 0 if $p_path is not inside directory $p_dir - // 1 if $p_path is inside directory $p_dir - // 2 if $p_path is exactly the same as $p_dir - // -------------------------------------------------------------------------------- - function PclZipUtilPathInclusion($p_dir, $p_path) - { +// -------------------------------------------------------------------------------- +// Function : PclZipUtilPathInclusion() +// Description : +// This function indicates if the path $p_path is under the $p_dir tree. Or, +// said in an other way, if the file or sub-dir $p_path is inside the dir +// $p_dir. +// The function indicates also if the path is exactly the same as the dir. +// This function supports path with duplicated '/' like '//', but does not +// support '.' or '..' statements. +// Parameters : +// Return Values : +// 0 if $p_path is not inside directory $p_dir +// 1 if $p_path is inside directory $p_dir +// 2 if $p_path is exactly the same as $p_dir +// -------------------------------------------------------------------------------- +function PclZipUtilPathInclusion($p_dir, $p_path) +{ $v_result = 1; // ----- Look for path beginning by ./ - if ( ($p_dir == '.') - || ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) { - $p_dir = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_dir, 1); + if (($p_dir == '.') || ((strlen($p_dir) >= 2) && (substr($p_dir, 0, 2) == './'))) { + $p_dir = PclZipUtilTranslateWinPath(getcwd(), false) . '/' . substr($p_dir, 1); } - if ( ($p_path == '.') - || ((strlen($p_path) >=2) && (substr($p_path, 0, 2) == './'))) { - $p_path = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_path, 1); + if (($p_path == '.') || ((strlen($p_path) >= 2) && (substr($p_path, 0, 2) == './'))) { + $p_path = PclZipUtilTranslateWinPath(getcwd(), false) . '/' . substr($p_path, 1); } // ----- Explode dir and path by directory separator - $v_list_dir = explode("/", $p_dir); - $v_list_dir_size = sizeof($v_list_dir); - $v_list_path = explode("/", $p_path); + $v_list_dir = explode("/", $p_dir); + $v_list_dir_size = sizeof($v_list_dir); + $v_list_path = explode("/", $p_path); $v_list_path_size = sizeof($v_list_path); // ----- Study directories paths @@ -5499,193 +5234,182 @@ $j = 0; while (($i < $v_list_dir_size) && ($j < $v_list_path_size) && ($v_result)) { - // ----- Look for empty dir (path reduction) - if ($v_list_dir[$i] == '') { + // ----- Look for empty dir (path reduction) + if ($v_list_dir[$i] == '') { + $i++; + continue; + } + if ($v_list_path[$j] == '') { + $j++; + continue; + } + + // ----- Compare the items + if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ($v_list_path[$j] != '')) { + $v_result = 0; + } + + // ----- Next items $i++; - continue; - } - if ($v_list_path[$j] == '') { $j++; - continue; - } - - // ----- Compare the items - if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ( $v_list_path[$j] != '')) { - $v_result = 0; - } - - // ----- Next items - $i++; - $j++; } // ----- Look if everything seems to be the same if ($v_result) { - // ----- Skip all the empty items - while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) $j++; - while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) $i++; + // ----- Skip all the empty items + while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) { + $j++; + } + while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) { + $i++; + } - if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) { - // ----- There are exactly the same - $v_result = 2; - } - else if ($i < $v_list_dir_size) { - // ----- The path is shorter than the dir - $v_result = 0; - } + if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) { + // ----- There are exactly the same + $v_result = 2; + } elseif ($i < $v_list_dir_size) { + // ----- The path is shorter than the dir + $v_result = 0; + } } // ----- Return return $v_result; - } - // -------------------------------------------------------------------------------- +} +// -------------------------------------------------------------------------------- - // -------------------------------------------------------------------------------- - // Function : PclZipUtilCopyBlock() - // Description : - // Parameters : - // $p_mode : read/write compression mode - // 0 : src & dest normal - // 1 : src gzip, dest normal - // 2 : src normal, dest gzip - // 3 : src & dest gzip - // Return Values : - // -------------------------------------------------------------------------------- - function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0) - { +// -------------------------------------------------------------------------------- +// Function : PclZipUtilCopyBlock() +// Description : +// Parameters : +// $p_mode : read/write compression mode +// 0 : src & dest normal +// 1 : src gzip, dest normal +// 2 : src normal, dest gzip +// 3 : src & dest gzip +// Return Values : +// -------------------------------------------------------------------------------- +function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode = 0) +{ $v_result = 1; - if ($p_mode==0) - { - while ($p_size != 0) - { - $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($p_src, $v_read_size); - @fwrite($p_dest, $v_buffer, $v_read_size); - $p_size -= $v_read_size; - } - } - else if ($p_mode==1) - { - while ($p_size != 0) - { - $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @gzread($p_src, $v_read_size); - @fwrite($p_dest, $v_buffer, $v_read_size); - $p_size -= $v_read_size; - } - } - else if ($p_mode==2) - { - while ($p_size != 0) - { - $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($p_src, $v_read_size); - @gzwrite($p_dest, $v_buffer, $v_read_size); - $p_size -= $v_read_size; - } - } - else if ($p_mode==3) - { - while ($p_size != 0) - { - $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @gzread($p_src, $v_read_size); - @gzwrite($p_dest, $v_buffer, $v_read_size); - $p_size -= $v_read_size; - } + if ($p_mode == 0) { + while ($p_size != 0) { + $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($p_src, $v_read_size); + @fwrite($p_dest, $v_buffer, $v_read_size); + $p_size -= $v_read_size; + } + } elseif ($p_mode == 1) { + while ($p_size != 0) { + $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @gzread($p_src, $v_read_size); + @fwrite($p_dest, $v_buffer, $v_read_size); + $p_size -= $v_read_size; + } + } elseif ($p_mode == 2) { + while ($p_size != 0) { + $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @fread($p_src, $v_read_size); + @gzwrite($p_dest, $v_buffer, $v_read_size); + $p_size -= $v_read_size; + } + } elseif ($p_mode == 3) { + while ($p_size != 0) { + $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); + $v_buffer = @gzread($p_src, $v_read_size); + @gzwrite($p_dest, $v_buffer, $v_read_size); + $p_size -= $v_read_size; + } } // ----- Return return $v_result; - } - // -------------------------------------------------------------------------------- +} +// -------------------------------------------------------------------------------- - // -------------------------------------------------------------------------------- - // Function : PclZipUtilRename() - // Description : - // This function tries to do a simple rename() function. If it fails, it - // tries to copy the $p_src file in a new $p_dest file and then unlink the - // first one. - // Parameters : - // $p_src : Old filename - // $p_dest : New filename - // Return Values : - // 1 on success, 0 on failure. - // -------------------------------------------------------------------------------- - function PclZipUtilRename($p_src, $p_dest) - { +// -------------------------------------------------------------------------------- +// Function : PclZipUtilRename() +// Description : +// This function tries to do a simple rename() function. If it fails, it +// tries to copy the $p_src file in a new $p_dest file and then unlink the +// first one. +// Parameters : +// $p_src : Old filename +// $p_dest : New filename +// Return Values : +// 1 on success, 0 on failure. +// -------------------------------------------------------------------------------- +function PclZipUtilRename($p_src, $p_dest) +{ $v_result = 1; // ----- Try to rename the files if (!@rename($p_src, $p_dest)) { - // ----- Try to copy & unlink the src - if (!@copy($p_src, $p_dest)) { - $v_result = 0; - } - else if (!@unlink($p_src)) { - $v_result = 0; - } + // ----- Try to copy & unlink the src + if (!@copy($p_src, $p_dest)) { + $v_result = 0; + } elseif (!@unlink($p_src)) { + $v_result = 0; + } } // ----- Return return $v_result; - } - // -------------------------------------------------------------------------------- +} +// -------------------------------------------------------------------------------- - // -------------------------------------------------------------------------------- - // Function : PclZipUtilOptionText() - // Description : - // Translate option value in text. Mainly for debug purpose. - // Parameters : - // $p_option : the option value. - // Return Values : - // The option text value. - // -------------------------------------------------------------------------------- - function PclZipUtilOptionText($p_option) - { +// -------------------------------------------------------------------------------- +// Function : PclZipUtilOptionText() +// Description : +// Translate option value in text. Mainly for debug purpose. +// Parameters : +// $p_option : the option value. +// Return Values : +// The option text value. +// -------------------------------------------------------------------------------- +function PclZipUtilOptionText($p_option) +{ $v_list = get_defined_constants(); for (reset($v_list); $v_key = key($v_list); next($v_list)) { $v_prefix = substr($v_key, 0, 10); - if (( ($v_prefix == 'PCLZIP_OPT') - || ($v_prefix == 'PCLZIP_CB_') - || ($v_prefix == 'PCLZIP_ATT')) - && ($v_list[$v_key] == $p_option)) { - return $v_key; + if ((($v_prefix == 'PCLZIP_OPT') || ($v_prefix == 'PCLZIP_CB_') || ($v_prefix == 'PCLZIP_ATT')) && ($v_list[$v_key] == $p_option)) { + return $v_key; } } $v_result = 'Unknown'; return $v_result; - } - // -------------------------------------------------------------------------------- +} +// -------------------------------------------------------------------------------- - // -------------------------------------------------------------------------------- - // Function : PclZipUtilTranslateWinPath() - // Description : - // Translate windows path by replacing '\' by '/' and optionally removing - // drive letter. - // Parameters : - // $p_path : path to translate. - // $p_remove_disk_letter : true | false - // Return Values : - // The path translated. - // -------------------------------------------------------------------------------- - function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter=true) - { +// -------------------------------------------------------------------------------- +// Function : PclZipUtilTranslateWinPath() +// Description : +// Translate windows path by replacing '\' by '/' and optionally removing +// drive letter. +// Parameters : +// $p_path : path to translate. +// $p_remove_disk_letter : true | false +// Return Values : +// The path translated. +// -------------------------------------------------------------------------------- +function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter = true) +{ if (stristr(php_uname(), 'windows')) { - // ----- Look for potential disk letter - if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) { - $p_path = substr($p_path, $v_position+1); - } - // ----- Change potential windows directory separator - if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) { - $p_path = strtr($p_path, '\\', '/'); - } + // ----- Look for potential disk letter + if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) { + $p_path = substr($p_path, $v_position + 1); + } + // ----- Change potential windows directory separator + if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0, 1) == '\\')) { + $p_path = strtr($p_path, '\\', '/'); + } } + return $p_path; - } - // -------------------------------------------------------------------------------- +} +// -------------------------------------------------------------------------------- diff --git a/src/PhpWord/Shared/ZipArchive.php b/src/PhpWord/Shared/ZipArchive.php index 4dc4af4e..d73f6c33 100644 --- a/src/PhpWord/Shared/ZipArchive.php +++ b/src/PhpWord/Shared/ZipArchive.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -37,7 +37,7 @@ use PhpOffice\PhpWord\Settings; class ZipArchive { /** @const int Flags for open method */ - const CREATE = 1; // Emulate \ZipArchive::CREATE + const CREATE = 1; // Emulate \ZipArchive::CREATE const OVERWRITE = 8; // Emulate \ZipArchive::OVERWRITE /** @@ -150,10 +150,10 @@ class ZipArchive /** * Close the active archive * - * @return bool - * * @throws \PhpOffice\PhpWord\Exception\Exception * + * @return bool + * * @codeCoverageIgnore Can't find any test case. Uncomment when found. */ public function close() @@ -183,9 +183,9 @@ class ZipArchive if (!$this->usePclzip) { return $this->zip->extractTo($destination, $entries); - } else { - return $this->pclzipExtractTo($destination, $entries); } + + return $this->pclzipExtractTo($destination, $entries); } /** @@ -301,6 +301,7 @@ class ZipArchive // Extract all files if (is_null($entries)) { $result = $zip->extract(PCLZIP_OPT_PATH, $destination); + return ($result > 0) ? true : false; } @@ -360,9 +361,9 @@ class ZipArchive $list = $zip->listContent(); if (isset($list[$index])) { return $list[$index]['filename']; - } else { - return false; } + + return false; } /** diff --git a/src/PhpWord/SimpleType/Jc.php b/src/PhpWord/SimpleType/Jc.php index 5c399a16..1a5d33ad 100644 --- a/src/PhpWord/SimpleType/Jc.php +++ b/src/PhpWord/SimpleType/Jc.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -28,7 +28,7 @@ use PhpOffice\PhpWord\Shared\AbstractEnum; * @since 0.13.0 * * @see \PhpOffice\PhpWord\SimpleType\JcTable For table alignment modes available since ISO/IEC-29500:2008. - * @link http://www.datypic.com/sc/ooxml/t-w_ST_Jc.html + * @see http://www.datypic.com/sc/ooxml/t-w_ST_Jc.html * * @codeCoverageIgnore */ diff --git a/src/PhpWord/SimpleType/JcTable.php b/src/PhpWord/SimpleType/JcTable.php index 865b25a8..e1af89ad 100644 --- a/src/PhpWord/SimpleType/JcTable.php +++ b/src/PhpWord/SimpleType/JcTable.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/SimpleType/NumberFormat.php b/src/PhpWord/SimpleType/NumberFormat.php index 9d24a2b3..480d8539 100644 --- a/src/PhpWord/SimpleType/NumberFormat.php +++ b/src/PhpWord/SimpleType/NumberFormat.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/SimpleType/Zoom.php b/src/PhpWord/SimpleType/Zoom.php index 3b78fdf9..111e4ea1 100644 --- a/src/PhpWord/SimpleType/Zoom.php +++ b/src/PhpWord/SimpleType/Zoom.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style.php b/src/PhpWord/Style.php index 57d9d692..1939aaba 100644 --- a/src/PhpWord/Style.php +++ b/src/PhpWord/Style.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -126,8 +126,6 @@ class Style * Reset styles. * * @since 0.10.0 - * - * @return void */ public static function resetStyles() { @@ -165,9 +163,9 @@ class Style { if (isset(self::$styles[$styleName])) { return self::$styles[$styleName]; - } else { - return null; } + + return null; } /** diff --git a/src/PhpWord/Style/AbstractStyle.php b/src/PhpWord/Style/AbstractStyle.php index e2b6dce9..76ebd591 100644 --- a/src/PhpWord/Style/AbstractStyle.php +++ b/src/PhpWord/Style/AbstractStyle.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -138,10 +138,11 @@ abstract class AbstractStyle { if ($substyleObject !== null) { $method = "get{$substyleProperty}"; + return $substyleObject->$method(); - } else { - return null; } + + return null; } /** @@ -242,12 +243,12 @@ abstract class AbstractStyle protected function setIntVal($value, $default = null) { if (is_string($value) && (preg_match('/[^\d]/', $value) == 0)) { - $value = intval($value); + $value = (int) $value; } if (!is_numeric($value)) { $value = $default; } else { - $value = intval($value); + $value = (int) $value; } return $value; @@ -263,7 +264,7 @@ abstract class AbstractStyle protected function setFloatVal($value, $default = null) { if (is_string($value) && (preg_match('/[^\d\.\,]/', $value) == 0)) { - $value = floatval($value); + $value = (float) $value; } if (!is_numeric($value)) { $value = $default; @@ -279,14 +280,13 @@ abstract class AbstractStyle * @param array $enum * @param mixed $default * - * @return mixed - * * @throws \InvalidArgumentException + * @return mixed */ protected function setEnumVal($value = null, $enum = array(), $default = null) { if ($value != null && trim($value) != '' && !empty($enum) && !in_array($value, $enum)) { - throw new \InvalidArgumentException("Invalid style value: {$value} Options:".join(',', $enum)); + throw new \InvalidArgumentException("Invalid style value: {$value} Options:" . implode(',', $enum)); } elseif ($value === null || trim($value) == '') { $value = $default; } diff --git a/src/PhpWord/Style/Border.php b/src/PhpWord/Style/Border.php index d3bc2e57..5c62afcd 100644 --- a/src/PhpWord/Style/Border.php +++ b/src/PhpWord/Style/Border.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -81,7 +81,7 @@ class Border extends AbstractStyle /** * Get border size * - * @return integer[] + * @return int[] */ public function getBorderSize() { diff --git a/src/PhpWord/Style/Cell.php b/src/PhpWord/Style/Cell.php index 7bab8b56..0c4ca2e1 100644 --- a/src/PhpWord/Style/Cell.php +++ b/src/PhpWord/Style/Cell.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -72,7 +72,7 @@ class Cell extends Border /** * colspan * - * @var integer + * @var int */ private $gridSpan; @@ -150,9 +150,9 @@ class Cell extends Border { if ($this->shading !== null) { return $this->shading->getFill(); - } else { - return null; } + + return null; } /** @@ -169,7 +169,7 @@ class Cell extends Border /** * Get grid span (colspan). * - * @return integer + * @return int */ public function getGridSpan() { diff --git a/src/PhpWord/Style/Chart.php b/src/PhpWord/Style/Chart.php index 8e1f4b61..694fcddc 100644 --- a/src/PhpWord/Style/Chart.php +++ b/src/PhpWord/Style/Chart.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -24,7 +24,6 @@ namespace PhpOffice\PhpWord\Style; */ class Chart extends AbstractStyle { - /** * Width (in EMU) * diff --git a/src/PhpWord/Style/Extrusion.php b/src/PhpWord/Style/Extrusion.php index d8c5e65f..11c03eda 100644 --- a/src/PhpWord/Style/Extrusion.php +++ b/src/PhpWord/Style/Extrusion.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -20,7 +20,7 @@ namespace PhpOffice\PhpWord\Style; /** * 3D extrusion style * - * @link http://www.schemacentral.com/sc/ooxml/t-o_CT_Extrusion.html + * @see http://www.schemacentral.com/sc/ooxml/t-o_CT_Extrusion.html * @since 0.12.0 */ class Extrusion extends AbstractStyle diff --git a/src/PhpWord/Style/Fill.php b/src/PhpWord/Style/Fill.php index cf6ffb41..9b473009 100644 --- a/src/PhpWord/Style/Fill.php +++ b/src/PhpWord/Style/Fill.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -20,9 +20,9 @@ namespace PhpOffice\PhpWord\Style; /** * Fill style * - * There are still lot of interesting things for this style that can be added, including gradient. See @link. + * There are still lot of interesting things for this style that can be added, including gradient. See @see . * - * @link http://www.schemacentral.com/sc/ooxml/t-v_CT_Fill.html + * @see http://www.schemacentral.com/sc/ooxml/t-v_CT_Fill.html * @since 0.12.0 */ class Fill extends AbstractStyle diff --git a/src/PhpWord/Style/Font.php b/src/PhpWord/Style/Font.php index 19f2758d..76b03ac6 100644 --- a/src/PhpWord/Style/Font.php +++ b/src/PhpWord/Style/Font.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -162,7 +162,7 @@ class Font extends AbstractStyle * Small caps * * @var bool - * @link http://www.schemacentral.com/sc/ooxml/e-w_smallCaps-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_smallCaps-1.html */ private $smallCaps = false; @@ -170,7 +170,7 @@ class Font extends AbstractStyle * All caps * * @var bool - * @link http://www.schemacentral.com/sc/ooxml/e-w_caps-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_caps-1.html */ private $allCaps = false; @@ -186,7 +186,7 @@ class Font extends AbstractStyle * * @var int * @since 0.12.0 - * @link http://www.schemacentral.com/sc/ooxml/e-w_w-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_w-1.html */ private $scale; @@ -195,7 +195,7 @@ class Font extends AbstractStyle * * @var int|float * @since 0.12.0 - * @link http://www.schemacentral.com/sc/ooxml/e-w_spacing-2.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_spacing-2.html */ private $spacing; @@ -204,7 +204,7 @@ class Font extends AbstractStyle * * @var int|float * @since 0.12.0 - * @link http://www.schemacentral.com/sc/ooxml/e-w_kern-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_kern-1.html */ private $kerning; @@ -224,12 +224,12 @@ class Font extends AbstractStyle /** * Right to left languages - * @var boolean + * @var bool */ private $rtl = false; /** - * Languages + * Languages * @var \PhpOffice\PhpWord\Style\Language */ private $lang; @@ -812,7 +812,7 @@ class Font extends AbstractStyle $value = new Language($value); } $this->setObjectVal($value, 'Language', $this->lang); - + return $this; } diff --git a/src/PhpWord/Style/Frame.php b/src/PhpWord/Style/Frame.php index 0a99146b..a8e1c69d 100644 --- a/src/PhpWord/Style/Frame.php +++ b/src/PhpWord/Style/Frame.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Image.php b/src/PhpWord/Style/Image.php index f2c88b5f..c3f1863c 100644 --- a/src/PhpWord/Style/Image.php +++ b/src/PhpWord/Style/Image.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** diff --git a/src/PhpWord/Style/Indentation.php b/src/PhpWord/Style/Indentation.php index 0408929b..9621714c 100644 --- a/src/PhpWord/Style/Indentation.php +++ b/src/PhpWord/Style/Indentation.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -20,7 +20,7 @@ namespace PhpOffice\PhpWord\Style; /** * Paragraph indentation style * - * @link http://www.schemacentral.com/sc/ooxml/t-w_CT_Ind.html + * @see http://www.schemacentral.com/sc/ooxml/t-w_CT_Ind.html * @since 0.10.0 */ class Indentation extends AbstractStyle diff --git a/src/PhpWord/Style/Language.php b/src/PhpWord/Style/Language.php index 4e9220fd..e09421e0 100644 --- a/src/PhpWord/Style/Language.php +++ b/src/PhpWord/Style/Language.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** @@ -25,7 +26,6 @@ namespace PhpOffice\PhpWord\Style; */ final class Language extends AbstractStyle { - const EN_US = 'en-US'; const EN_US_ID = 1033; @@ -89,7 +89,8 @@ final class Language extends AbstractStyle private $bidirectional; /** - * + * Constructor + * * @param string|null $latin * @param string|null $eastAsia * @param string|null $bidirectional @@ -118,6 +119,7 @@ final class Language extends AbstractStyle { $this->validateLocale($latin); $this->latin = $latin; + return $this; } @@ -142,6 +144,7 @@ final class Language extends AbstractStyle public function setLangId($langId) { $this->langId = $langId; + return $this; } @@ -166,6 +169,7 @@ final class Language extends AbstractStyle { $this->validateLocale($eastAsia); $this->eastAsia = $eastAsia; + return $this; } @@ -190,6 +194,7 @@ final class Language extends AbstractStyle { $this->validateLocale($bidirectional); $this->bidirectional = $bidirectional; + return $this; } @@ -205,9 +210,9 @@ final class Language extends AbstractStyle /** * Validates that the language passed is in the format xx-xx - * + * * @param string $locale - * @return boolean + * @return bool */ private function validateLocale($locale) { diff --git a/src/PhpWord/Style/Line.php b/src/PhpWord/Style/Line.php index f8cc4026..16d15950 100644 --- a/src/PhpWord/Style/Line.php +++ b/src/PhpWord/Style/Line.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Style; /** @@ -55,7 +56,7 @@ class Line extends Image /** * flip Line * - * @var boolean + * @var bool */ private $flip = false; @@ -104,7 +105,7 @@ class Line extends Image /** * Get flip * - * @return boolean + * @return bool */ public function isFlip() { @@ -114,7 +115,7 @@ class Line extends Image /** * Set flip * - * @param boolean $value + * @param bool $value * @return self */ public function setFlip($value = false) @@ -143,7 +144,7 @@ class Line extends Image public function setConnectorType($value = null) { $enum = array( - self::CONNECTOR_TYPE_STRAIGHT + self::CONNECTOR_TYPE_STRAIGHT, ); $this->connectorType = $this->setEnumVal($value, $enum, $this->connectorType); @@ -216,7 +217,7 @@ class Line extends Image { $enum = array( self::ARROW_STYLE_BLOCK, self::ARROW_STYLE_CLASSIC, self::ARROW_STYLE_DIAMOND, - self::ARROW_STYLE_OPEN, self::ARROW_STYLE_OVAL + self::ARROW_STYLE_OPEN, self::ARROW_STYLE_OVAL, ); $this->beginArrow = $this->setEnumVal($value, $enum, $this->beginArrow); @@ -243,7 +244,7 @@ class Line extends Image { $enum = array( self::ARROW_STYLE_BLOCK, self::ARROW_STYLE_CLASSIC, self::ARROW_STYLE_DIAMOND, - self::ARROW_STYLE_OPEN, self::ARROW_STYLE_OVAL + self::ARROW_STYLE_OPEN, self::ARROW_STYLE_OVAL, ); $this->endArrow = $this->setEnumVal($value, $enum, $this->endArrow); @@ -271,7 +272,7 @@ class Line extends Image $enum = array( self::DASH_STYLE_DASH, self::DASH_STYLE_DASH_DOT, self::DASH_STYLE_LONG_DASH, self::DASH_STYLE_LONG_DASH_DOT, self::DASH_STYLE_LONG_DASH_DOT_DOT, self::DASH_STYLE_ROUND_DOT, - self::DASH_STYLE_SQUARE_DOT + self::DASH_STYLE_SQUARE_DOT, ); $this->dash = $this->setEnumVal($value, $enum, $this->dash); diff --git a/src/PhpWord/Style/LineNumbering.php b/src/PhpWord/Style/LineNumbering.php index e125f477..b5f3c263 100644 --- a/src/PhpWord/Style/LineNumbering.php +++ b/src/PhpWord/Style/LineNumbering.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -20,14 +20,14 @@ namespace PhpOffice\PhpWord\Style; /** * Line numbering style * - * @link http://www.schemacentral.com/sc/ooxml/t-w_CT_LineNumber.html + * @see http://www.schemacentral.com/sc/ooxml/t-w_CT_LineNumber.html * @since 0.10.0 */ class LineNumbering extends AbstractStyle { /** @const string Line numbering restart setting http://www.schemacentral.com/sc/ooxml/a-w_restart-1.html */ - const LINE_NUMBERING_CONTINUOUS = 'continuous'; - const LINE_NUMBERING_NEW_PAGE = 'newPage'; + const LINE_NUMBERING_CONTINUOUS = 'continuous'; + const LINE_NUMBERING_NEW_PAGE = 'newPage'; const LINE_NUMBERING_NEW_SECTION = 'newSection'; /** @@ -55,7 +55,7 @@ class LineNumbering extends AbstractStyle * Line numbering restart setting continuous|newPage|newSection * * @var string - * @link http://www.schemacentral.com/sc/ooxml/a-w_restart-1.html + * @see http://www.schemacentral.com/sc/ooxml/a-w_restart-1.html */ private $restart; diff --git a/src/PhpWord/Style/ListItem.php b/src/PhpWord/Style/ListItem.php index 61a8349b..444341dc 100644 --- a/src/PhpWord/Style/ListItem.php +++ b/src/PhpWord/Style/ListItem.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -38,7 +38,7 @@ class ListItem extends AbstractStyle /** * Legacy list type * - * @var integer + * @var int */ private $listType; @@ -53,7 +53,7 @@ class ListItem extends AbstractStyle /** * Numbering definition instance ID * - * @var integer + * @var int * @since 0.10.0 */ private $numId; @@ -75,7 +75,7 @@ class ListItem extends AbstractStyle /** * Get List Type * - * @return integer + * @return int */ public function getListType() { @@ -85,7 +85,7 @@ class ListItem extends AbstractStyle /** * Set legacy list type for version < 0.10.0 * - * @param integer $value + * @param int $value * @return self */ public function setListType($value = self::TYPE_BULLET_FILLED) @@ -93,7 +93,7 @@ class ListItem extends AbstractStyle $enum = array( self::TYPE_SQUARE_FILLED, self::TYPE_BULLET_FILLED, self::TYPE_BULLET_EMPTY, self::TYPE_NUMBER, - self::TYPE_NUMBER_NESTED, self::TYPE_ALPHANUM + self::TYPE_NUMBER_NESTED, self::TYPE_ALPHANUM, ); $this->listType = $this->setEnumVal($value, $enum, $this->listType); $this->getListTypeStyle(); @@ -132,7 +132,7 @@ class ListItem extends AbstractStyle /** * Get numbering Id * - * @return integer + * @return int */ public function getNumId() { @@ -151,6 +151,7 @@ class ListItem extends AbstractStyle $numStyle = "PHPWordList{$this->listType}"; if (Style::getStyle($numStyle) !== null) { $this->setNumStyle($numStyle); + return; } @@ -160,7 +161,7 @@ class ListItem extends AbstractStyle // Legacy level information $listTypeStyles = array( self::TYPE_SQUARE_FILLED => array( - 'type' => 'hybridMultilevel', + 'type' => 'hybridMultilevel', 'levels' => array( 0 => '1, bullet, , left, 720, 720, 360, Wingdings, default', 1 => '1, bullet, o, left, 1440, 1440, 360, Courier New, default', @@ -174,7 +175,7 @@ class ListItem extends AbstractStyle ), ), self::TYPE_BULLET_FILLED => array( - 'type' => 'hybridMultilevel', + 'type' => 'hybridMultilevel', 'levels' => array( 0 => '1, bullet, , left, 720, 720, 360, Symbol, default', 1 => '1, bullet, o, left, 1440, 1440, 360, Courier New, default', @@ -188,7 +189,7 @@ class ListItem extends AbstractStyle ), ), self::TYPE_BULLET_EMPTY => array( - 'type' => 'hybridMultilevel', + 'type' => 'hybridMultilevel', 'levels' => array( 0 => '1, bullet, o, left, 720, 720, 360, Courier New, default', 1 => '1, bullet, o, left, 1440, 1440, 360, Courier New, default', @@ -202,7 +203,7 @@ class ListItem extends AbstractStyle ), ), self::TYPE_NUMBER => array( - 'type' => 'hybridMultilevel', + 'type' => 'hybridMultilevel', 'levels' => array( 0 => '1, decimal, %1., left, 720, 720, 360, , default', 1 => '1, bullet, o, left, 1440, 1440, 360, Courier New, default', @@ -216,7 +217,7 @@ class ListItem extends AbstractStyle ), ), self::TYPE_NUMBER_NESTED => array( - 'type' => 'multilevel', + 'type' => 'multilevel', 'levels' => array( 0 => '1, decimal, %1., left, 360, 360, 360, , ', 1 => '1, decimal, %1.%2., left, 792, 792, 432, , ', @@ -230,7 +231,7 @@ class ListItem extends AbstractStyle ), ), self::TYPE_ALPHANUM => array( - 'type' => 'multilevel', + 'type' => 'multilevel', 'levels' => array( 0 => '1, decimal, %1., left, 720, 720, 360, , ', 1 => '1, lowerLetter, %2., left, 1440, 1440, 360, , ', diff --git a/src/PhpWord/Style/Numbering.php b/src/PhpWord/Style/Numbering.php index 0d4fd85d..80ed5dca 100644 --- a/src/PhpWord/Style/Numbering.php +++ b/src/PhpWord/Style/Numbering.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -20,9 +20,9 @@ namespace PhpOffice\PhpWord\Style; /** * Numbering style * - * @link http://www.schemacentral.com/sc/ooxml/e-w_numbering.html - * @link http://www.schemacentral.com/sc/ooxml/e-w_abstractNum-1.html - * @link http://www.schemacentral.com/sc/ooxml/e-w_num-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_numbering.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_abstractNum-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_num-1.html * @since 0.10.0 */ class Numbering extends AbstractStyle @@ -31,7 +31,7 @@ class Numbering extends AbstractStyle * Numbering definition instance ID * * @var int - * @link http://www.schemacentral.com/sc/ooxml/e-w_num-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_num-1.html */ private $numId; @@ -39,7 +39,7 @@ class Numbering extends AbstractStyle * Multilevel type singleLevel|multilevel|hybridMultilevel * * @var string - * @link http://www.schemacentral.com/sc/ooxml/a-w_val-67.html + * @see http://www.schemacentral.com/sc/ooxml/a-w_val-67.html */ private $type; @@ -53,7 +53,7 @@ class Numbering extends AbstractStyle /** * Get Id * - * @return integer + * @return int */ public function getNumId() { @@ -63,7 +63,7 @@ class Numbering extends AbstractStyle /** * Set Id * - * @param integer $value + * @param int $value * @return self */ public function setNumId($value) diff --git a/src/PhpWord/Style/NumberingLevel.php b/src/PhpWord/Style/NumberingLevel.php index 9da1a2b1..33c151e4 100644 --- a/src/PhpWord/Style/NumberingLevel.php +++ b/src/PhpWord/Style/NumberingLevel.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -23,7 +23,7 @@ use PhpOffice\PhpWord\SimpleType\NumberFormat; /** * Numbering level definition * - * @link http://www.schemacentral.com/sc/ooxml/e-w_lvl-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_lvl-1.html * @since 0.10.0 */ class NumberingLevel extends AbstractStyle @@ -31,15 +31,15 @@ class NumberingLevel extends AbstractStyle /** * Level number, 0 to 8 (total 9 levels) * - * @var integer + * @var int */ private $level = 0; /** * Starting value w:start * - * @var integer - * @link http://www.schemacentral.com/sc/ooxml/e-w_start-1.html + * @var int + * @see http://www.schemacentral.com/sc/ooxml/e-w_start-1.html */ private $start = 1; @@ -47,15 +47,15 @@ class NumberingLevel extends AbstractStyle * Numbering format w:numFmt, one of PhpOffice\PhpWord\SimpleType\NumberFormat * * @var string - * @link http://www.schemacentral.com/sc/ooxml/t-w_ST_NumberFormat.html + * @see http://www.schemacentral.com/sc/ooxml/t-w_ST_NumberFormat.html */ private $format; /** * Restart numbering level symbol w:lvlRestart * - * @var integer - * @link http://www.schemacentral.com/sc/ooxml/e-w_lvlRestart-1.html + * @var int + * @see http://www.schemacentral.com/sc/ooxml/e-w_lvlRestart-1.html */ private $restart; @@ -63,7 +63,7 @@ class NumberingLevel extends AbstractStyle * Related paragraph style * * @var string - * @link http://www.schemacentral.com/sc/ooxml/e-w_pStyle-2.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_pStyle-2.html */ private $pStyle; @@ -71,7 +71,7 @@ class NumberingLevel extends AbstractStyle * Content between numbering symbol and paragraph text w:suff * * @var string tab|space|nothing - * @link http://www.schemacentral.com/sc/ooxml/e-w_suff-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_suff-1.html */ private $suffix = 'tab'; @@ -79,7 +79,7 @@ class NumberingLevel extends AbstractStyle * Numbering level text e.g. %1 for nonbullet or bullet character * * @var string - * @link http://www.schemacentral.com/sc/ooxml/e-w_lvlText-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_lvlText-1.html */ private $text; @@ -93,21 +93,21 @@ class NumberingLevel extends AbstractStyle /** * Left * - * @var integer + * @var int */ private $left; /** * Hanging * - * @var integer + * @var int */ private $hanging; /** * Tab position * - * @var integer + * @var int */ private $tabPos; @@ -122,14 +122,14 @@ class NumberingLevel extends AbstractStyle * Hint default|eastAsia|cs * * @var string - * @link http://www.schemacentral.com/sc/ooxml/a-w_hint-1.html + * @see http://www.schemacentral.com/sc/ooxml/a-w_hint-1.html */ private $hint; /** * Get level * - * @return integer + * @return int */ public function getLevel() { @@ -139,19 +139,20 @@ class NumberingLevel extends AbstractStyle /** * Set level * - * @param integer $value + * @param int $value * @return self */ public function setLevel($value) { $this->level = $this->setIntVal($value, $this->level); + return $this; } /** * Get start * - * @return integer + * @return int */ public function getStart() { @@ -161,12 +162,13 @@ class NumberingLevel extends AbstractStyle /** * Set start * - * @param integer $value + * @param int $value * @return self */ public function setStart($value) { $this->start = $this->setIntVal($value, $this->start); + return $this; } @@ -189,13 +191,14 @@ class NumberingLevel extends AbstractStyle public function setFormat($value) { $this->format = $this->setEnumVal($value, NumberFormat::values(), $this->format); + return $this; } /** * Get restart * - * @return integer + * @return int */ public function getRestart() { @@ -205,12 +208,13 @@ class NumberingLevel extends AbstractStyle /** * Set restart * - * @param integer $value + * @param int $value * @return self */ public function setRestart($value) { $this->restart = $this->setIntVal($value, $this->restart); + return $this; } @@ -233,6 +237,7 @@ class NumberingLevel extends AbstractStyle public function setPStyle($value) { $this->pStyle = $value; + return $this; } @@ -256,6 +261,7 @@ class NumberingLevel extends AbstractStyle { $enum = array('tab', 'space', 'nothing'); $this->suffix = $this->setEnumVal($value, $enum, $this->suffix); + return $this; } @@ -278,6 +284,7 @@ class NumberingLevel extends AbstractStyle public function setText($value) { $this->text = $value; + return $this; } @@ -336,7 +343,7 @@ class NumberingLevel extends AbstractStyle /** * Get left * - * @return integer + * @return int */ public function getLeft() { @@ -346,19 +353,20 @@ class NumberingLevel extends AbstractStyle /** * Set left * - * @param integer $value + * @param int $value * @return self */ public function setLeft($value) { $this->left = $this->setIntVal($value, $this->left); + return $this; } /** * Get hanging * - * @return integer + * @return int */ public function getHanging() { @@ -368,19 +376,20 @@ class NumberingLevel extends AbstractStyle /** * Set hanging * - * @param integer $value + * @param int $value * @return self */ public function setHanging($value) { $this->hanging = $this->setIntVal($value, $this->hanging); + return $this; } /** * Get tab * - * @return integer + * @return int */ public function getTabPos() { @@ -390,12 +399,13 @@ class NumberingLevel extends AbstractStyle /** * Set tab * - * @param integer $value + * @param int $value * @return self */ public function setTabPos($value) { $this->tabPos = $this->setIntVal($value, $this->tabPos); + return $this; } @@ -418,6 +428,7 @@ class NumberingLevel extends AbstractStyle public function setFont($value) { $this->font = $value; + return $this; } diff --git a/src/PhpWord/Style/Outline.php b/src/PhpWord/Style/Outline.php index 8628c4c5..fb7e028a 100644 --- a/src/PhpWord/Style/Outline.php +++ b/src/PhpWord/Style/Outline.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -20,8 +20,8 @@ namespace PhpOffice\PhpWord\Style; /** * Outline defines the line/border of the object * - * @link http://www.schemacentral.com/sc/ooxml/t-v_CT_Stroke.html - * @link http://www.w3.org/TR/1998/NOTE-VML-19980513#_Toc416858395 + * @see http://www.schemacentral.com/sc/ooxml/t-v_CT_Stroke.html + * @see http://www.w3.org/TR/1998/NOTE-VML-19980513#_Toc416858395 * @since 0.12.0 */ class Outline extends AbstractStyle @@ -29,7 +29,7 @@ class Outline extends AbstractStyle /** * Line style constants * - * @link http://www.schemacentral.com/sc/ooxml/t-v_ST_StrokeLineStyle.html + * @see http://www.schemacentral.com/sc/ooxml/t-v_ST_StrokeLineStyle.html * @const string */ const LINE_SINGLE = 'single'; @@ -41,7 +41,7 @@ class Outline extends AbstractStyle /** * Line style constants * - * @link http://www.schemacentral.com/sc/ooxml/t-v_ST_StrokeEndCap.html + * @see http://www.schemacentral.com/sc/ooxml/t-v_ST_StrokeEndCap.html * @const string */ const ENDCAP_FLAT = 'flat'; @@ -51,7 +51,7 @@ class Outline extends AbstractStyle /** * Arrowhead type constants * - * @link http://www.schemacentral.com/sc/ooxml/t-v_ST_StrokeArrowType.html + * @see http://www.schemacentral.com/sc/ooxml/t-v_ST_StrokeArrowType.html * @const string */ const ARROW_NONE = 'none'; @@ -100,7 +100,7 @@ class Outline extends AbstractStyle * End cap * * @var string - * @link http://www.schemacentral.com/sc/ooxml/t-v_ST_StrokeEndCap.html + * @see http://www.schemacentral.com/sc/ooxml/t-v_ST_StrokeEndCap.html */ private $endCap; @@ -226,7 +226,7 @@ class Outline extends AbstractStyle public function setLine($value = null) { $enum = array(self::LINE_SINGLE, self::LINE_THIN_THIN, self::LINE_THIN_THICK, - self::LINE_THICK_THIN, self::LINE_THICK_BETWEEN_THIN); + self::LINE_THICK_THIN, self::LINE_THICK_BETWEEN_THIN, ); $this->line = $this->setEnumVal($value, $enum, null); return $this; @@ -275,7 +275,7 @@ class Outline extends AbstractStyle public function setStartArrow($value = null) { $enum = array(self::ARROW_NONE, self::ARROW_BLOCK, self::ARROW_CLASSIC, - self::ARROW_OVAL, self::ARROW_DIAMOND, self::ARROW_OPEN); + self::ARROW_OVAL, self::ARROW_DIAMOND, self::ARROW_OPEN, ); $this->startArrow = $this->setEnumVal($value, $enum, null); return $this; @@ -300,7 +300,7 @@ class Outline extends AbstractStyle public function setEndArrow($value = null) { $enum = array(self::ARROW_NONE, self::ARROW_BLOCK, self::ARROW_CLASSIC, - self::ARROW_OVAL, self::ARROW_DIAMOND, self::ARROW_OPEN); + self::ARROW_OVAL, self::ARROW_DIAMOND, self::ARROW_OPEN, ); $this->endArrow = $this->setEnumVal($value, $enum, null); return $this; diff --git a/src/PhpWord/Style/Paper.php b/src/PhpWord/Style/Paper.php index eb0bcd77..2fbf59d2 100644 --- a/src/PhpWord/Style/Paper.php +++ b/src/PhpWord/Style/Paper.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Paragraph.php b/src/PhpWord/Style/Paragraph.php index 169f2cda..f665048b 100644 --- a/src/PhpWord/Style/Paragraph.php +++ b/src/PhpWord/Style/Paragraph.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -46,7 +46,7 @@ use PhpOffice\PhpWord\SimpleType\Jc; * - Borders * - Background * - * @link http://www.schemacentral.com/sc/ooxml/t-w_CT_PPr.html + * @see http://www.schemacentral.com/sc/ooxml/t-w_CT_PPr.html */ class Paragraph extends Border { @@ -157,7 +157,7 @@ class Paragraph extends Border * @var \PhpOffice\PhpWord\Style\Shading */ private $shading; - + /** * Ignore Spacing Above and Below When Using Identical Styles * @@ -420,7 +420,7 @@ class Paragraph extends Border /** * Get space before paragraph * - * @return integer + * @return int */ public function getSpaceBefore() { @@ -441,7 +441,7 @@ class Paragraph extends Border /** * Get space after paragraph * - * @return integer + * @return int */ public function getSpaceAfter() { @@ -495,22 +495,22 @@ class Paragraph extends Border * * @param int|float|string $lineHeight * - * @return self - * * @throws \PhpOffice\PhpWord\Exception\InvalidStyleException + * @return self */ public function setLineHeight($lineHeight) { if (is_string($lineHeight)) { - $lineHeight = floatval(preg_replace('/[^0-9\.\,]/', '', $lineHeight)); + $lineHeight = (float) (preg_replace('/[^0-9\.\,]/', '', $lineHeight)); } - if ((!is_integer($lineHeight) && !is_float($lineHeight)) || !$lineHeight) { + if ((!is_int($lineHeight) && !is_float($lineHeight)) || !$lineHeight) { throw new InvalidStyleException('Line height must be a valid number'); } $this->lineHeight = $lineHeight; $this->setSpacing($lineHeight * self::LINE_HEIGHT); + return $this; } @@ -767,7 +767,7 @@ class Paragraph extends Border public function setContextualSpacing($contextualSpacing) { $this->contextualSpacing = $contextualSpacing; - + return $this; } diff --git a/src/PhpWord/Style/Row.php b/src/PhpWord/Style/Row.php index 5be03b69..b56c6f5f 100644 --- a/src/PhpWord/Style/Row.php +++ b/src/PhpWord/Style/Row.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Section.php b/src/PhpWord/Style/Section.php index be8a3aad..476846f5 100644 --- a/src/PhpWord/Style/Section.php +++ b/src/PhpWord/Style/Section.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -48,7 +48,7 @@ class Section extends Border * Page Orientation * * @var string - * @link http://www.schemacentral.com/sc/ooxml/a-w_orient-1.html + * @see http://www.schemacentral.com/sc/ooxml/a-w_orient-1.html */ private $orientation = self::ORIENTATION_PORTRAIT; @@ -105,7 +105,7 @@ class Section extends Border * Page gutter spacing * * @var int|float - * @link http://www.schemacentral.com/sc/ooxml/e-w_pgMar-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_pgMar-1.html */ private $gutter = self::DEFAULT_GUTTER; @@ -162,7 +162,7 @@ class Section extends Border * Line numbering * * @var \PhpOffice\PhpWord\Style\LineNumbering - * @link http://www.schemacentral.com/sc/ooxml/e-w_lnNumType-1.html + * @see http://www.schemacentral.com/sc/ooxml/e-w_lnNumType-1.html */ private $lineNumbering; @@ -504,6 +504,7 @@ class Section extends Border public function setPageNumberingStart($pageNumberingStart = null) { $this->pageNumberingStart = $pageNumberingStart; + return $this; } @@ -572,6 +573,7 @@ class Section extends Border public function setBreakType($value = null) { $this->breakType = $value; + return $this; } diff --git a/src/PhpWord/Style/Shading.php b/src/PhpWord/Style/Shading.php index ab4fce82..eeb055b2 100644 --- a/src/PhpWord/Style/Shading.php +++ b/src/PhpWord/Style/Shading.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -20,7 +20,7 @@ namespace PhpOffice\PhpWord\Style; /** * Shading style * - * @link http://www.schemacentral.com/sc/ooxml/t-w_CT_Shd.html + * @see http://www.schemacentral.com/sc/ooxml/t-w_CT_Shd.html * @since 0.10.0 */ class Shading extends AbstractStyle @@ -29,7 +29,7 @@ class Shading extends AbstractStyle * Pattern constants (partly) * * @const string - * @link http://www.schemacentral.com/sc/ooxml/t-w_ST_Shd.html + * @see http://www.schemacentral.com/sc/ooxml/t-w_ST_Shd.html */ const PATTERN_CLEAR = 'clear'; // No pattern const PATTERN_SOLID = 'solid'; // 100% fill pattern @@ -43,7 +43,7 @@ class Shading extends AbstractStyle * Shading pattern * * @var string - * @link http://www.schemacentral.com/sc/ooxml/t-w_ST_Shd.html + * @see http://www.schemacentral.com/sc/ooxml/t-w_ST_Shd.html */ private $pattern = self::PATTERN_CLEAR; @@ -91,7 +91,7 @@ class Shading extends AbstractStyle { $enum = array( self::PATTERN_CLEAR, self::PATTERN_SOLID, self::PATTERN_HSTRIPE, - self::PATTERN_VSTRIPE, self::PATTERN_DSTRIPE, self::PATTERN_HCROSS, self::PATTERN_DCROSS + self::PATTERN_VSTRIPE, self::PATTERN_DSTRIPE, self::PATTERN_HCROSS, self::PATTERN_DCROSS, ); $this->pattern = $this->setEnumVal($value, $enum, $this->pattern); diff --git a/src/PhpWord/Style/Shadow.php b/src/PhpWord/Style/Shadow.php index f8f693a9..71d1e3e0 100644 --- a/src/PhpWord/Style/Shadow.php +++ b/src/PhpWord/Style/Shadow.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -20,7 +20,7 @@ namespace PhpOffice\PhpWord\Style; /** * Shadow style * - * @link http://www.schemacentral.com/sc/ooxml/t-v_CT_Shadow.html + * @see http://www.schemacentral.com/sc/ooxml/t-v_CT_Shadow.html * @since 0.12.0 */ class Shadow extends AbstractStyle diff --git a/src/PhpWord/Style/Shape.php b/src/PhpWord/Style/Shape.php index 01b61588..fc84241d 100644 --- a/src/PhpWord/Style/Shape.php +++ b/src/PhpWord/Style/Shape.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Spacing.php b/src/PhpWord/Style/Spacing.php index 8d7cfeb2..e0eee374 100644 --- a/src/PhpWord/Style/Spacing.php +++ b/src/PhpWord/Style/Spacing.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -20,7 +20,7 @@ namespace PhpOffice\PhpWord\Style; /** * Spacing between lines and above/below paragraph style * - * @link http://www.schemacentral.com/sc/ooxml/t-w_CT_Spacing.html + * @see http://www.schemacentral.com/sc/ooxml/t-w_CT_Spacing.html * @since 0.10.0 */ class Spacing extends AbstractStyle diff --git a/src/PhpWord/Style/TOC.php b/src/PhpWord/Style/TOC.php index eb4b2253..938e6de1 100644 --- a/src/PhpWord/Style/TOC.php +++ b/src/PhpWord/Style/TOC.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Tab.php b/src/PhpWord/Style/Tab.php index 33e518c8..09e49e02 100644 --- a/src/PhpWord/Style/Tab.php +++ b/src/PhpWord/Style/Tab.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -27,25 +27,25 @@ class Tab extends AbstractStyle * * @const string */ - const TAB_STOP_CLEAR = 'clear'; - const TAB_STOP_LEFT = 'left'; - const TAB_STOP_CENTER = 'center'; - const TAB_STOP_RIGHT = 'right'; + const TAB_STOP_CLEAR = 'clear'; + const TAB_STOP_LEFT = 'left'; + const TAB_STOP_CENTER = 'center'; + const TAB_STOP_RIGHT = 'right'; const TAB_STOP_DECIMAL = 'decimal'; - const TAB_STOP_BAR = 'bar'; - const TAB_STOP_NUM = 'num'; + const TAB_STOP_BAR = 'bar'; + const TAB_STOP_NUM = 'num'; /** * Tab leader types * * @const string */ - const TAB_LEADER_NONE = 'none'; - const TAB_LEADER_DOT = 'dot'; - const TAB_LEADER_HYPHEN = 'hyphen'; + const TAB_LEADER_NONE = 'none'; + const TAB_LEADER_DOT = 'dot'; + const TAB_LEADER_HYPHEN = 'hyphen'; const TAB_LEADER_UNDERSCORE = 'underscore'; - const TAB_LEADER_HEAVY = 'heavy'; - const TAB_LEADER_MIDDLEDOT = 'middleDot'; + const TAB_LEADER_HEAVY = 'heavy'; + const TAB_LEADER_MIDDLEDOT = 'middleDot'; /** * Tab stop type @@ -73,19 +73,19 @@ class Tab extends AbstractStyle * must conform to the values put forth in the schema. If they do not * they will be changed to default values. * - * @param string $type Defaults to 'clear' if value is not possible. - * @param int $position Must be numeric; otherwise defaults to 0. - * @param string $leader Defaults to null if value is not possible. + * @param string $type Defaults to 'clear' if value is not possible + * @param int $position Must be numeric; otherwise defaults to 0 + * @param string $leader Defaults to null if value is not possible */ public function __construct($type = null, $position = 0, $leader = null) { $stopTypes = array( - self::TAB_STOP_CLEAR, self::TAB_STOP_LEFT,self::TAB_STOP_CENTER, - self::TAB_STOP_RIGHT, self::TAB_STOP_DECIMAL, self::TAB_STOP_BAR, self::TAB_STOP_NUM + self::TAB_STOP_CLEAR, self::TAB_STOP_LEFT, self::TAB_STOP_CENTER, + self::TAB_STOP_RIGHT, self::TAB_STOP_DECIMAL, self::TAB_STOP_BAR, self::TAB_STOP_NUM, ); $leaderTypes = array( self::TAB_LEADER_NONE, self::TAB_LEADER_DOT, self::TAB_LEADER_HYPHEN, - self::TAB_LEADER_UNDERSCORE, self::TAB_LEADER_HEAVY, self::TAB_LEADER_MIDDLEDOT + self::TAB_LEADER_UNDERSCORE, self::TAB_LEADER_HEAVY, self::TAB_LEADER_MIDDLEDOT, ); $this->type = $this->setEnumVal($type, $stopTypes, $this->type); diff --git a/src/PhpWord/Style/Table.php b/src/PhpWord/Style/Table.php index a542af7b..a3d454f3 100644 --- a/src/PhpWord/Style/Table.php +++ b/src/PhpWord/Style/Table.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -133,15 +133,7 @@ class Table extends Border if ($firstRowStyle !== null && is_array($firstRowStyle)) { $this->firstRowStyle = clone $this; $this->firstRowStyle->isFirstRow = true; - unset($this->firstRowStyle->firstRowStyle); - unset($this->firstRowStyle->borderInsideHSize); - unset($this->firstRowStyle->borderInsideHColor); - unset($this->firstRowStyle->borderInsideVSize); - unset($this->firstRowStyle->borderInsideVColor); - unset($this->firstRowStyle->cellMarginTop); - unset($this->firstRowStyle->cellMarginLeft); - unset($this->firstRowStyle->cellMarginRight); - unset($this->firstRowStyle->cellMarginBottom); + unset($this->firstRowStyle->firstRowStyle, $this->firstRowStyle->borderInsideHSize, $this->firstRowStyle->borderInsideHColor, $this->firstRowStyle->borderInsideVSize, $this->firstRowStyle->borderInsideVColor, $this->firstRowStyle->cellMarginTop, $this->firstRowStyle->cellMarginLeft, $this->firstRowStyle->cellMarginRight, $this->firstRowStyle->cellMarginBottom); $this->firstRowStyle->setStyleByArray($firstRowStyle); } @@ -190,7 +182,7 @@ class Table extends Border /** * Get TLRBHV Border Size * - * @return integer[] + * @return int[] */ public function getBorderSize() { @@ -428,7 +420,7 @@ class Table extends Border /** * Get cell margin * - * @return integer[] + * @return int[] */ public function getCellMargin() { @@ -436,7 +428,7 @@ class Table extends Border $this->cellMarginTop, $this->cellMarginLeft, $this->cellMarginRight, - $this->cellMarginBottom + $this->cellMarginBottom, ); } diff --git a/src/PhpWord/Style/TextBox.php b/src/PhpWord/Style/TextBox.php index 6783cd18..91adc0af 100644 --- a/src/PhpWord/Style/TextBox.php +++ b/src/PhpWord/Style/TextBox.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -70,7 +70,6 @@ class TextBox extends Image * Set margin top. * * @param int $value - * @return void */ public function setInnerMarginTop($value = null) { @@ -91,7 +90,6 @@ class TextBox extends Image * Set margin left. * * @param int $value - * @return void */ public function setInnerMarginLeft($value = null) { @@ -112,7 +110,6 @@ class TextBox extends Image * Set margin right. * * @param int $value - * @return void */ public function setInnerMarginRight($value = null) { @@ -133,7 +130,6 @@ class TextBox extends Image * Set margin bottom. * * @param int $value - * @return void */ public function setInnerMarginBottom($value = null) { @@ -154,7 +150,6 @@ class TextBox extends Image * Set TLRB cell margin. * * @param int $value Margin in twips - * @return void */ public function setInnerMargin($value = null) { @@ -167,7 +162,7 @@ class TextBox extends Image /** * Get cell margin * - * @return integer[] + * @return int[] */ public function getInnerMargin() { @@ -197,7 +192,6 @@ class TextBox extends Image * Set border size. * * @param int $value Size in points - * @return void */ public function setBorderSize($value = null) { @@ -218,7 +212,6 @@ class TextBox extends Image * Set border color. * * @param string $value - * @return void */ public function setBorderColor($value = null) { diff --git a/src/PhpWord/Template.php b/src/PhpWord/Template.php index 87ccd8ed..a4769927 100644 --- a/src/PhpWord/Template.php +++ b/src/PhpWord/Template.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php index 2f6d6258..c46038ee 100644 --- a/src/PhpWord/TemplateProcessor.php +++ b/src/PhpWord/TemplateProcessor.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -37,35 +37,35 @@ class TemplateProcessor protected $zipClass; /** - * @var string Temporary document filename (with path). + * @var string Temporary document filename (with path) */ protected $tempDocumentFilename; /** - * Content of main document part (in XML format) of the temporary document. + * Content of main document part (in XML format) of the temporary document * * @var string */ protected $tempDocumentMainPart; /** - * Content of headers (in XML format) of the temporary document. + * Content of headers (in XML format) of the temporary document * * @var string[] */ protected $tempDocumentHeaders = array(); /** - * Content of footers (in XML format) of the temporary document. + * Content of footers (in XML format) of the temporary document * * @var string[] */ protected $tempDocumentFooters = array(); /** - * @since 0.12.0 Throws CreateTemporaryFileException and CopyFileException instead of Exception. + * @since 0.12.0 Throws CreateTemporaryFileException and CopyFileException instead of Exception * - * @param string $documentTemplate The fully qualified template filename. + * @param string $documentTemplate The fully qualified template filename * * @throws \PhpOffice\PhpWord\Exception\CreateTemporaryFileException * @throws \PhpOffice\PhpWord\Exception\CopyFileException @@ -107,9 +107,9 @@ class TemplateProcessor * @param string $xml * @param \XSLTProcessor $xsltProcessor * - * @return string - * * @throws \PhpOffice\PhpWord\Exception\Exception + * + * @return string */ protected function transformSingleXml($xml, $xsltProcessor) { @@ -155,8 +155,6 @@ class TemplateProcessor * @param array $xslOptions * @param string $xslOptionsUri * - * @return void - * * @throws \PhpOffice\PhpWord\Exception\Exception */ public function applyXslStyleSheet($xslDomDocument, $xslOptions = array(), $xslOptionsUri = '') @@ -204,9 +202,7 @@ class TemplateProcessor /** * @param mixed $search * @param mixed $replace - * @param integer $limit - * - * @return void + * @param int $limit */ public function setValue($search, $replace, $limit = self::MAXIMUM_REPLACEMENTS_DEFAULT) { @@ -260,9 +256,7 @@ class TemplateProcessor * Clone a table row in a template document. * * @param string $search - * @param integer $numberOfClones - * - * @return void + * @param int $numberOfClones * * @throws \PhpOffice\PhpWord\Exception\Exception */ @@ -274,7 +268,7 @@ class TemplateProcessor $tagPos = strpos($this->tempDocumentMainPart, $search); if (!$tagPos) { - throw new Exception("Can not clone row, template variable not found or variable contains markup."); + throw new Exception('Can not clone row, template variable not found or variable contains markup.'); } $rowStart = $this->findRowStart($tagPos); @@ -319,8 +313,8 @@ class TemplateProcessor * Clone a block. * * @param string $blockname - * @param integer $clones - * @param boolean $replace + * @param int $clones + * @param bool $replace * * @return string|null */ @@ -357,8 +351,6 @@ class TemplateProcessor * * @param string $blockname * @param string $replacement - * - * @return void */ public function replaceBlock($blockname, $replacement) { @@ -381,8 +373,6 @@ class TemplateProcessor * Delete a block of text. * * @param string $blockname - * - * @return void */ public function deleteBlock($blockname) { @@ -392,9 +382,9 @@ class TemplateProcessor /** * Saves the result document. * - * @return string - * * @throws \PhpOffice\PhpWord\Exception\Exception + * + * @return string */ public function save() { @@ -422,8 +412,6 @@ class TemplateProcessor * @since 0.8.0 * * @param string $fileName - * - * @return void */ public function saveAs($fileName) { @@ -447,7 +435,7 @@ class TemplateProcessor * Finds parts of broken macros and sticks them together. * Macros, while being edited, could be implicitly broken by some of the word processors. * - * @param string $documentPart The document part in XML representation. + * @param string $documentPart The document part in XML representation * * @return string */ @@ -472,7 +460,7 @@ class TemplateProcessor * @param mixed $search * @param mixed $replace * @param string $documentPartXML - * @param integer $limit + * @param int $limit * * @return string */ @@ -481,10 +469,10 @@ class TemplateProcessor // Note: we can't use the same function for both cases here, because of performance considerations. if (self::MAXIMUM_REPLACEMENTS_DEFAULT === $limit) { return str_replace($search, $replace, $documentPartXML); - } else { - $regExpEscaper = new RegExp(); - return preg_replace($regExpEscaper->escape($search), $replace, $documentPartXML, $limit); } + $regExpEscaper = new RegExp(); + + return preg_replace($regExpEscaper->escape($search), $replace, $documentPartXML, $limit); } /** @@ -504,7 +492,7 @@ class TemplateProcessor /** * Get the name of the header file for $index. * - * @param integer $index + * @param int $index * * @return string */ @@ -524,7 +512,7 @@ class TemplateProcessor /** * Get the name of the footer file for $index. * - * @param integer $index + * @param int $index * * @return string */ @@ -536,11 +524,11 @@ class TemplateProcessor /** * Find the start position of the nearest table row before $offset. * - * @param integer $offset - * - * @return integer + * @param int $offset * * @throws \PhpOffice\PhpWord\Exception\Exception + * + * @return int */ protected function findRowStart($offset) { @@ -559,9 +547,9 @@ class TemplateProcessor /** * Find the end position of the nearest table row after $offset. * - * @param integer $offset + * @param int $offset * - * @return integer + * @return int */ protected function findRowEnd($offset) { @@ -571,8 +559,8 @@ class TemplateProcessor /** * Get a slice of a string. * - * @param integer $startPosition - * @param integer $endPosition + * @param int $startPosition + * @param int $endPosition * * @return string */ diff --git a/src/PhpWord/Writer/AbstractWriter.php b/src/PhpWord/Writer/AbstractWriter.php index 78ec5acd..09a00990 100644 --- a/src/PhpWord/Writer/AbstractWriter.php +++ b/src/PhpWord/Writer/AbstractWriter.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -96,17 +96,15 @@ abstract class AbstractWriter implements WriterInterface /** * Get PhpWord object * - * @return \PhpOffice\PhpWord\PhpWord - * * @throws \PhpOffice\PhpWord\Exception\Exception + * @return \PhpOffice\PhpWord\PhpWord */ public function getPhpWord() { if (!is_null($this->phpWord)) { return $this->phpWord; - } else { - throw new Exception("No PhpWord assigned."); } + throw new Exception('No PhpWord assigned.'); } /** @@ -118,6 +116,7 @@ abstract class AbstractWriter implements WriterInterface public function setPhpWord(PhpWord $phpWord = null) { $this->phpWord = $phpWord; + return $this; } @@ -131,9 +130,9 @@ abstract class AbstractWriter implements WriterInterface { if ($partName != '' && isset($this->writerParts[strtolower($partName)])) { return $this->writerParts[strtolower($partName)]; - } else { - return null; } + + return null; } /** @@ -152,9 +151,8 @@ abstract class AbstractWriter implements WriterInterface * @param bool $value * @param string $directory * - * @return self - * * @throws \PhpOffice\PhpWord\Exception\Exception + * @return self */ public function setUseDiskCaching($value = false, $directory = null) { @@ -236,8 +234,6 @@ abstract class AbstractWriter implements WriterInterface /** * Cleanup temporary file. * - * @return void - * * @throws \PhpOffice\PhpWord\Exception\CopyFileException */ protected function cleanupTempFile() @@ -257,8 +253,6 @@ abstract class AbstractWriter implements WriterInterface /** * Clear temporary directory. - * - * @return void */ protected function clearTempDir() { @@ -272,9 +266,9 @@ abstract class AbstractWriter implements WriterInterface * * @param string $filename * - * @return \PhpOffice\PhpWord\Shared\ZipArchive - * * @throws \Exception + * + * @return \PhpOffice\PhpWord\Shared\ZipArchive */ protected function getZipArchive($filename) { @@ -305,9 +299,9 @@ abstract class AbstractWriter implements WriterInterface * * @param string $filename * - * @return resource - * * @throws \Exception + * + * @return resource */ protected function openFile($filename) { @@ -330,7 +324,6 @@ abstract class AbstractWriter implements WriterInterface * * @param resource $fileHandle * @param string $content - * @return void */ protected function writeFile($fileHandle, $content) { @@ -344,7 +337,6 @@ abstract class AbstractWriter implements WriterInterface * * @param \PhpOffice\PhpWord\Shared\ZipArchive $zip * @param mixed $elements - * @return void */ protected function addFilesToPackage(ZipArchive $zip, $elements) { @@ -380,7 +372,6 @@ abstract class AbstractWriter implements WriterInterface * @param \PhpOffice\PhpWord\Shared\ZipArchive $zipPackage * @param string $source * @param string $target - * @return void */ protected function addFileToPackage($zipPackage, $source, $target) { @@ -390,7 +381,7 @@ abstract class AbstractWriter implements WriterInterface $source = substr($source, 6); list($zipFilename, $imageFilename) = explode('#', $source); - $zip = new ZipArchive; + $zip = new ZipArchive(); if ($zip->open($zipFilename) !== false) { if ($zip->locateName($imageFilename)) { $zip->extractTo($this->getTempDir(), $imageFilename); @@ -411,17 +402,16 @@ abstract class AbstractWriter implements WriterInterface * Delete directory. * * @param string $dir - * @return void */ private function deleteDir($dir) { foreach (scandir($dir) as $file) { if ($file === '.' || $file === '..') { continue; - } elseif (is_file($dir . "/" . $file)) { - unlink($dir . "/" . $file); - } elseif (is_dir($dir . "/" . $file)) { - $this->deleteDir($dir . "/" . $file); + } elseif (is_file($dir . '/' . $file)) { + unlink($dir . '/' . $file); + } elseif (is_dir($dir . '/' . $file)) { + $this->deleteDir($dir . '/' . $file); } } diff --git a/src/PhpWord/Writer/HTML.php b/src/PhpWord/Writer/HTML.php index 5668f184..9b098dd8 100644 --- a/src/PhpWord/Writer/HTML.php +++ b/src/PhpWord/Writer/HTML.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -30,7 +30,7 @@ class HTML extends AbstractWriter implements WriterInterface /** * Is the current writer creating PDF? * - * @var boolean + * @var bool */ protected $isPdf = false; @@ -65,8 +65,6 @@ class HTML extends AbstractWriter implements WriterInterface * * @param string $filename * - * @return void - * * @throws \PhpOffice\PhpWord\Exception\Exception */ public function save($filename = null) @@ -119,7 +117,6 @@ class HTML extends AbstractWriter implements WriterInterface * * @param int $noteId * @param string $noteMark - * @return void */ public function addNote($noteId, $noteMark) { diff --git a/src/PhpWord/Writer/HTML/Element/AbstractElement.php b/src/PhpWord/Writer/HTML/Element/AbstractElement.php index 294d6de7..f6e06258 100644 --- a/src/PhpWord/Writer/HTML/Element/AbstractElement.php +++ b/src/PhpWord/Writer/HTML/Element/AbstractElement.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -78,7 +78,6 @@ abstract class AbstractElement * Set without paragraph. * * @param bool $value - * @return void */ public function setWithoutP($value) { diff --git a/src/PhpWord/Writer/HTML/Element/Container.php b/src/PhpWord/Writer/HTML/Element/Container.php index 88384a12..677b6173 100644 --- a/src/PhpWord/Writer/HTML/Element/Container.php +++ b/src/PhpWord/Writer/HTML/Element/Container.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/Endnote.php b/src/PhpWord/Writer/HTML/Element/Endnote.php index b049e437..c4a3e436 100644 --- a/src/PhpWord/Writer/HTML/Element/Endnote.php +++ b/src/PhpWord/Writer/HTML/Element/Endnote.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/Footnote.php b/src/PhpWord/Writer/HTML/Element/Footnote.php index b5aa0a0a..60b246f8 100644 --- a/src/PhpWord/Writer/HTML/Element/Footnote.php +++ b/src/PhpWord/Writer/HTML/Element/Footnote.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/Image.php b/src/PhpWord/Writer/HTML/Element/Image.php index 24e35957..3e516b53 100644 --- a/src/PhpWord/Writer/HTML/Element/Image.php +++ b/src/PhpWord/Writer/HTML/Element/Image.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/Link.php b/src/PhpWord/Writer/HTML/Element/Link.php index bff57cfc..bdea985a 100644 --- a/src/PhpWord/Writer/HTML/Element/Link.php +++ b/src/PhpWord/Writer/HTML/Element/Link.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/ListItem.php b/src/PhpWord/Writer/HTML/Element/ListItem.php index d8b1e4ed..02b25eb9 100644 --- a/src/PhpWord/Writer/HTML/Element/ListItem.php +++ b/src/PhpWord/Writer/HTML/Element/ListItem.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/PageBreak.php b/src/PhpWord/Writer/HTML/Element/PageBreak.php index 8b332dcf..5cab2724 100644 --- a/src/PhpWord/Writer/HTML/Element/PageBreak.php +++ b/src/PhpWord/Writer/HTML/Element/PageBreak.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -39,6 +39,6 @@ class PageBreak extends TextBreak return ''; } - return ""; + return ''; } } diff --git a/src/PhpWord/Writer/HTML/Element/Table.php b/src/PhpWord/Writer/HTML/Element/Table.php index 9025f01a..c7d8670b 100644 --- a/src/PhpWord/Writer/HTML/Element/Table.php +++ b/src/PhpWord/Writer/HTML/Element/Table.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/Text.php b/src/PhpWord/Writer/HTML/Element/Text.php index 87451595..ed1ba4a3 100644 --- a/src/PhpWord/Writer/HTML/Element/Text.php +++ b/src/PhpWord/Writer/HTML/Element/Text.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -89,7 +89,6 @@ class Text extends AbstractElement * Set opening text. * * @param string $value - * @return void */ public function setOpeningText($value) { @@ -100,7 +99,6 @@ class Text extends AbstractElement * Set closing text. * * @param string $value - * @return void */ public function setClosingText($value) { @@ -141,7 +139,7 @@ class Text extends AbstractElement $content .= $this->closingText; } - $content .= "

" . PHP_EOL; + $content .= '

' . PHP_EOL; } return $content; @@ -177,8 +175,6 @@ class Text extends AbstractElement /** * Get font style. - * - * @return void */ private function getFontStyle() { @@ -194,7 +190,7 @@ class Text extends AbstractElement if ($style) { $attribute = $fStyleIsObject ? 'style' : 'class'; $this->openingTags = ""; - $this->closingTags = ""; + $this->closingTags = ''; } } } diff --git a/src/PhpWord/Writer/HTML/Element/TextBreak.php b/src/PhpWord/Writer/HTML/Element/TextBreak.php index 9b23d739..93ab924a 100644 --- a/src/PhpWord/Writer/HTML/Element/TextBreak.php +++ b/src/PhpWord/Writer/HTML/Element/TextBreak.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/TextRun.php b/src/PhpWord/Writer/HTML/Element/TextRun.php index 492f7597..d7461539 100644 --- a/src/PhpWord/Writer/HTML/Element/TextRun.php +++ b/src/PhpWord/Writer/HTML/Element/TextRun.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/Title.php b/src/PhpWord/Writer/HTML/Element/Title.php index 23c29938..ee8f271b 100644 --- a/src/PhpWord/Writer/HTML/Element/Title.php +++ b/src/PhpWord/Writer/HTML/Element/Title.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Part/AbstractPart.php b/src/PhpWord/Writer/HTML/Part/AbstractPart.php index 584e4489..7b6e0c3e 100644 --- a/src/PhpWord/Writer/HTML/Part/AbstractPart.php +++ b/src/PhpWord/Writer/HTML/Part/AbstractPart.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -35,12 +35,12 @@ abstract class AbstractPart * @var \Zend\Escaper\Escaper */ protected $escaper; - + public function __construct() { $this->escaper = new Escaper(); } - + /** * @return string */ @@ -48,8 +48,6 @@ abstract class AbstractPart /** * @param \PhpOffice\PhpWord\Writer\AbstractWriter $writer - * - * @return void */ public function setParentWriter(AbstractWriter $writer = null) { @@ -57,16 +55,15 @@ abstract class AbstractPart } /** - * @return \PhpOffice\PhpWord\Writer\AbstractWriter - * * @throws \PhpOffice\PhpWord\Exception\Exception + * + * @return \PhpOffice\PhpWord\Writer\AbstractWriter */ public function getParentWriter() { if ($this->parentWriter !== null) { return $this->parentWriter; - } else { - throw new Exception('No parent WriterInterface assigned.'); } + throw new Exception('No parent WriterInterface assigned.'); } } diff --git a/src/PhpWord/Writer/HTML/Part/Body.php b/src/PhpWord/Writer/HTML/Part/Body.php index 0d852a57..eea17350 100644 --- a/src/PhpWord/Writer/HTML/Part/Body.php +++ b/src/PhpWord/Writer/HTML/Part/Body.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -66,7 +66,7 @@ class Body extends AbstractPart $content = ''; if (!empty($notes)) { - $content .= "
" . PHP_EOL; + $content .= '
' . PHP_EOL; foreach ($notes as $noteId => $noteMark) { list($noteType, $noteTypeId) = explode('-', $noteMark); $method = 'get' . ($noteType == 'endnote' ? 'Endnotes' : 'Footnotes'); diff --git a/src/PhpWord/Writer/HTML/Part/Head.php b/src/PhpWord/Writer/HTML/Part/Head.php index fa4c3833..f4d63014 100644 --- a/src/PhpWord/Writer/HTML/Part/Head.php +++ b/src/PhpWord/Writer/HTML/Part/Head.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -48,7 +48,7 @@ class Head extends AbstractPart 'keywords' => '', 'category' => '', 'company' => '', - 'manager' => '' + 'manager' => '', ); $title = $docProps->getTitle(); $title = ($title != '') ? $title : 'PHPWord'; @@ -60,11 +60,11 @@ class Head extends AbstractPart $content .= '' . $title . '' . PHP_EOL; foreach ($propertiesMapping as $key => $value) { $value = ($value == '') ? $key : $value; - $method = "get" . $key; + $method = 'get' . $key; if ($docProps->$method() != '') { $content .= '' . PHP_EOL; + . ' />' . PHP_EOL; } } $content .= $this->writeStyles(); @@ -86,22 +86,22 @@ class Head extends AbstractPart $defaultStyles = array( '*' => array( 'font-family' => Settings::getDefaultFontName(), - 'font-size' => Settings::getDefaultFontSize() . 'pt', + 'font-size' => Settings::getDefaultFontSize() . 'pt', ), 'a.NoteRef' => array( 'text-decoration' => 'none', ), 'hr' => array( - 'height' => '1px', - 'padding' => '0', - 'margin' => '1em 0', - 'border' => '0', + 'height' => '1px', + 'padding' => '0', + 'margin' => '1em 0', + 'border' => '0', 'border-top' => '1px solid #CCC', ), 'table' => array( - 'border' => '1px solid black', + 'border' => '1px solid black', 'border-spacing' => '0px', - 'width' => '100%', + 'width ' => '100%', ), 'td' => array( 'border' => '1px solid black', @@ -123,11 +123,11 @@ class Head extends AbstractPart } else { $name = '.' . $name; } - $css .= "{$name} {" . $styleWriter->write() . '}' . PHP_EOL; + $css .= "{$name} {" . $styleWriter->write() . '}' . PHP_EOL; } elseif ($style instanceof Paragraph) { $styleWriter = new ParagraphStyleWriter($style); $name = '.' . $name; - $css .= "{$name} {" . $styleWriter->write() . '}' . PHP_EOL; + $css .= "{$name} {" . $styleWriter->write() . '}' . PHP_EOL; } } } diff --git a/src/PhpWord/Writer/HTML/Style/AbstractStyle.php b/src/PhpWord/Writer/HTML/Style/AbstractStyle.php index 10a0a9ad..fa27c085 100644 --- a/src/PhpWord/Writer/HTML/Style/AbstractStyle.php +++ b/src/PhpWord/Writer/HTML/Style/AbstractStyle.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -59,7 +59,6 @@ abstract class AbstractStyle * Set parent writer. * * @param \PhpOffice\PhpWord\Writer\AbstractWriter $writer - * @return void */ public function setParentWriter($writer) { diff --git a/src/PhpWord/Writer/HTML/Style/Font.php b/src/PhpWord/Writer/HTML/Style/Font.php index c202af93..cb96cf64 100644 --- a/src/PhpWord/Writer/HTML/Style/Font.php +++ b/src/PhpWord/Writer/HTML/Style/Font.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Style/Generic.php b/src/PhpWord/Writer/HTML/Style/Generic.php index e3d2b352..73830707 100644 --- a/src/PhpWord/Writer/HTML/Style/Generic.php +++ b/src/PhpWord/Writer/HTML/Style/Generic.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Style/Image.php b/src/PhpWord/Writer/HTML/Style/Image.php index 36a9feca..178b1434 100644 --- a/src/PhpWord/Writer/HTML/Style/Image.php +++ b/src/PhpWord/Writer/HTML/Style/Image.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Style/Paragraph.php b/src/PhpWord/Writer/HTML/Style/Paragraph.php index 593c6dca..e264ead0 100644 --- a/src/PhpWord/Writer/HTML/Style/Paragraph.php +++ b/src/PhpWord/Writer/HTML/Style/Paragraph.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -49,11 +49,9 @@ class Paragraph extends AbstractStyle case Jc::LEFT: $textAlign = 'left'; break; - case Jc::CENTER: $textAlign = 'center'; break; - case Jc::END: case Jc::MEDIUM_KASHIDA: case Jc::HIGH_KASHIDA: @@ -61,14 +59,12 @@ class Paragraph extends AbstractStyle case Jc::RIGHT: $textAlign = 'right'; break; - case Jc::BOTH: case Jc::DISTRIBUTE: case Jc::THAI_DISTRIBUTE: case Jc::JUSTIFY: $textAlign = 'justify'; break; - default: $textAlign = 'left'; break; diff --git a/src/PhpWord/Writer/ODText.php b/src/PhpWord/Writer/ODText.php index 40bc6c2f..7158874c 100644 --- a/src/PhpWord/Writer/ODText.php +++ b/src/PhpWord/Writer/ODText.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -63,7 +63,6 @@ class ODText extends AbstractWriter implements WriterInterface * Save PhpWord to file. * * @param string $filename - * @return void */ public function save($filename = null) { diff --git a/src/PhpWord/Writer/ODText/Element/AbstractElement.php b/src/PhpWord/Writer/ODText/Element/AbstractElement.php index 0ca43e4f..481995ff 100644 --- a/src/PhpWord/Writer/ODText/Element/AbstractElement.php +++ b/src/PhpWord/Writer/ODText/Element/AbstractElement.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/Container.php b/src/PhpWord/Writer/ODText/Element/Container.php index 212cd184..112e71e8 100644 --- a/src/PhpWord/Writer/ODText/Element/Container.php +++ b/src/PhpWord/Writer/ODText/Element/Container.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/Image.php b/src/PhpWord/Writer/ODText/Element/Image.php index c6b16cfc..2c0b4727 100644 --- a/src/PhpWord/Writer/ODText/Element/Image.php +++ b/src/PhpWord/Writer/ODText/Element/Image.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/Link.php b/src/PhpWord/Writer/ODText/Element/Link.php index cb0226a3..c996ab59 100644 --- a/src/PhpWord/Writer/ODText/Element/Link.php +++ b/src/PhpWord/Writer/ODText/Element/Link.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/Table.php b/src/PhpWord/Writer/ODText/Element/Table.php index f6a2f845..cdc2a0e3 100644 --- a/src/PhpWord/Writer/ODText/Element/Table.php +++ b/src/PhpWord/Writer/ODText/Element/Table.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/Text.php b/src/PhpWord/Writer/ODText/Element/Text.php index cff68481..3b06217d 100644 --- a/src/PhpWord/Writer/ODText/Element/Text.php +++ b/src/PhpWord/Writer/ODText/Element/Text.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -47,42 +47,42 @@ class Text extends AbstractElement if ($fStyleIsObject) { // Don't never be the case, because I browse all sections for cleaning all styles not declared throw new Exception('PhpWord : $fStyleIsObject wouldn\'t be an object'); - } else { - if (!$this->withoutP) { - $xmlWriter->startElement('text:p'); // text:p + } + + if (!$this->withoutP) { + $xmlWriter->startElement('text:p'); // text:p + } + if (empty($fontStyle)) { + if (empty($paragraphStyle)) { + $xmlWriter->writeAttribute('text:style-name', 'P1'); + } elseif (is_string($paragraphStyle)) { + $xmlWriter->writeAttribute('text:style-name', $paragraphStyle); } - if (empty($fontStyle)) { - if (empty($paragraphStyle)) { - $xmlWriter->writeAttribute('text:style-name', 'P1'); - } elseif (is_string($paragraphStyle)) { - $xmlWriter->writeAttribute('text:style-name', $paragraphStyle); - } - if (Settings::isOutputEscapingEnabled()) { - $xmlWriter->text($element->getText()); - } else { - $xmlWriter->writeRaw($element->getText()); - } + if (Settings::isOutputEscapingEnabled()) { + $xmlWriter->text($element->getText()); } else { - if (empty($paragraphStyle)) { - $xmlWriter->writeAttribute('text:style-name', 'Standard'); - } elseif (is_string($paragraphStyle)) { - $xmlWriter->writeAttribute('text:style-name', $paragraphStyle); - } - // text:span - $xmlWriter->startElement('text:span'); - if (is_string($fontStyle)) { - $xmlWriter->writeAttribute('text:style-name', $fontStyle); - } - if (Settings::isOutputEscapingEnabled()) { - $xmlWriter->text($element->getText()); - } else { - $xmlWriter->writeRaw($element->getText()); - } - $xmlWriter->endElement(); + $xmlWriter->writeRaw($element->getText()); } - if (!$this->withoutP) { - $xmlWriter->endElement(); // text:p + } else { + if (empty($paragraphStyle)) { + $xmlWriter->writeAttribute('text:style-name', 'Standard'); + } elseif (is_string($paragraphStyle)) { + $xmlWriter->writeAttribute('text:style-name', $paragraphStyle); } + // text:span + $xmlWriter->startElement('text:span'); + if (is_string($fontStyle)) { + $xmlWriter->writeAttribute('text:style-name', $fontStyle); + } + if (Settings::isOutputEscapingEnabled()) { + $xmlWriter->text($element->getText()); + } else { + $xmlWriter->writeRaw($element->getText()); + } + $xmlWriter->endElement(); + } + if (!$this->withoutP) { + $xmlWriter->endElement(); // text:p } } } diff --git a/src/PhpWord/Writer/ODText/Element/TextBreak.php b/src/PhpWord/Writer/ODText/Element/TextBreak.php index b0f5009e..f7642e3b 100644 --- a/src/PhpWord/Writer/ODText/Element/TextBreak.php +++ b/src/PhpWord/Writer/ODText/Element/TextBreak.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/TextRun.php b/src/PhpWord/Writer/ODText/Element/TextRun.php index 03717016..f5c855fe 100644 --- a/src/PhpWord/Writer/ODText/Element/TextRun.php +++ b/src/PhpWord/Writer/ODText/Element/TextRun.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/Title.php b/src/PhpWord/Writer/ODText/Element/Title.php index b20ba944..bf9bf9d6 100644 --- a/src/PhpWord/Writer/ODText/Element/Title.php +++ b/src/PhpWord/Writer/ODText/Element/Title.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Part/AbstractPart.php b/src/PhpWord/Writer/ODText/Part/AbstractPart.php index dc377e0f..74412fd4 100644 --- a/src/PhpWord/Writer/ODText/Part/AbstractPart.php +++ b/src/PhpWord/Writer/ODText/Part/AbstractPart.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -37,7 +37,6 @@ abstract class AbstractPart extends Word2007AbstractPart * Write common root attributes. * * @param \PhpOffice\Common\XMLWriter $xmlWriter - * @return void */ protected function writeCommonRootAttributes(XMLWriter $xmlWriter) { @@ -74,7 +73,6 @@ abstract class AbstractPart extends Word2007AbstractPart * Write font faces declaration. * * @param \PhpOffice\Common\XMLWriter $xmlWriter - * @return void */ protected function writeFontFaces(XMLWriter $xmlWriter) { diff --git a/src/PhpWord/Writer/ODText/Part/Content.php b/src/PhpWord/Writer/ODText/Part/Content.php index 61f8e7e2..8ae4dca9 100644 --- a/src/PhpWord/Writer/ODText/Part/Content.php +++ b/src/PhpWord/Writer/ODText/Part/Content.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -111,7 +111,6 @@ class Content extends AbstractPart * @since 0.11.0 * * @param \PhpOffice\Common\XMLWriter $xmlWriter - * @return void */ private function writeAutoStyles(XMLWriter $xmlWriter) { @@ -121,7 +120,6 @@ class Content extends AbstractPart foreach ($this->autoStyles as $element => $styles) { $writerClass = 'PhpOffice\\PhpWord\\Writer\\ODText\\Style\\' . $element; foreach ($styles as $style) { - /** @var \PhpOffice\PhpWord\Writer\ODText\Style\AbstractStyle $styleWriter Type hint */ $styleWriter = new $writerClass($xmlWriter, $style); $styleWriter->write(); @@ -135,7 +133,6 @@ class Content extends AbstractPart * Write automatic styles. * * @param \PhpOffice\Common\XMLWriter $xmlWriter - * @return void */ private function writeTextStyles(XMLWriter $xmlWriter) { @@ -169,7 +166,6 @@ class Content extends AbstractPart * Get automatic styles. * * @param \PhpOffice\PhpWord\PhpWord $phpWord - * @return void */ private function getAutoStyles(PhpWord $phpWord) { @@ -192,7 +188,6 @@ class Content extends AbstractPart * @param \PhpOffice\PhpWord\Element\AbstractContainer $container * @param int &$paragraphStyleCount * @param int &$fontStyleCount - * @return void * @todo Simplify the logic */ private function getContainerStyle($container, &$paragraphStyleCount, &$fontStyleCount) @@ -226,7 +221,6 @@ class Content extends AbstractPart * @param \PhpOffice\PhpWord\Element\Text &$element * @param int &$paragraphStyleCount * @param int &$fontStyleCount - * @return void */ private function getElementStyle(&$element, &$paragraphStyleCount, &$fontStyleCount) { @@ -234,15 +228,14 @@ class Content extends AbstractPart $paragraphStyle = $element->getParagraphStyle(); $phpWord = $this->getParentWriter()->getPhpWord(); - // Font if ($fontStyle instanceof Font) { + // Font $fontStyleCount++; $style = $phpWord->addFontStyle("T{$fontStyleCount}", $fontStyle); $style->setAuto(); $element->setFontStyle("T{$fontStyleCount}"); - - // Paragraph } elseif ($paragraphStyle instanceof Paragraph) { + // Paragraph $paragraphStyleCount++; $style = $phpWord->addParagraphStyle("P{$paragraphStyleCount}", array()); $style->setAuto(); diff --git a/src/PhpWord/Writer/ODText/Part/Manifest.php b/src/PhpWord/Writer/ODText/Part/Manifest.php index 237c1a11..d916ccdf 100644 --- a/src/PhpWord/Writer/ODText/Part/Manifest.php +++ b/src/PhpWord/Writer/ODText/Part/Manifest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Part/Meta.php b/src/PhpWord/Writer/ODText/Part/Meta.php index f16db161..72d03ae6 100644 --- a/src/PhpWord/Writer/ODText/Part/Meta.php +++ b/src/PhpWord/Writer/ODText/Part/Meta.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -90,7 +90,6 @@ class Meta extends AbstractPart * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param string $property * @param string $value - * @return void * * @todo Handle other `$type`: double|date|dateTime|duration|boolean (4th arguments) */ diff --git a/src/PhpWord/Writer/ODText/Part/Mimetype.php b/src/PhpWord/Writer/ODText/Part/Mimetype.php index 7cf78b4b..6e45b848 100644 --- a/src/PhpWord/Writer/ODText/Part/Mimetype.php +++ b/src/PhpWord/Writer/ODText/Part/Mimetype.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Part/Styles.php b/src/PhpWord/Writer/ODText/Part/Styles.php index ee22aaab..e12928d3 100644 --- a/src/PhpWord/Writer/ODText/Part/Styles.php +++ b/src/PhpWord/Writer/ODText/Part/Styles.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -64,7 +64,6 @@ class Styles extends AbstractPart * Write default styles. * * @param \PhpOffice\Common\XMLWriter $xmlWriter - * @return void */ private function writeDefault(XMLWriter $xmlWriter) { @@ -114,7 +113,6 @@ class Styles extends AbstractPart * Write named styles. * * @param \PhpOffice\Common\XMLWriter $xmlWriter - * @return void */ private function writeNamed(XMLWriter $xmlWriter) { @@ -132,11 +130,11 @@ class Styles extends AbstractPart } } } + /** * Write page layout styles. * * @param \PhpOffice\Common\XMLWriter $xmlWriter - * @return void */ private function writePageLayout(XMLWriter $xmlWriter) { @@ -144,7 +142,7 @@ class Styles extends AbstractPart $xmlWriter->writeAttribute('style:name', 'Mpm1'); $xmlWriter->startElement('style:page-layout-properties'); - $xmlWriter->writeAttribute('fo:page-width', "21.001cm"); + $xmlWriter->writeAttribute('fo:page-width', '21.001cm'); $xmlWriter->writeAttribute('fo:page-height', '29.7cm'); $xmlWriter->writeAttribute('style:num-format', '1'); $xmlWriter->writeAttribute('style:print-orientation', 'portrait'); @@ -175,7 +173,6 @@ class Styles extends AbstractPart $xmlWriter->endElement(); // style:page-layout-properties - $xmlWriter->startElement('style:header-style'); $xmlWriter->endElement(); // style:header-style @@ -189,7 +186,6 @@ class Styles extends AbstractPart * Write master style. * * @param \PhpOffice\Common\XMLWriter $xmlWriter - * @return void */ private function writeMaster(XMLWriter $xmlWriter) { diff --git a/src/PhpWord/Writer/ODText/Style/AbstractStyle.php b/src/PhpWord/Writer/ODText/Style/AbstractStyle.php index 7bc49cb3..26b9905b 100644 --- a/src/PhpWord/Writer/ODText/Style/AbstractStyle.php +++ b/src/PhpWord/Writer/ODText/Style/AbstractStyle.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Style/Font.php b/src/PhpWord/Writer/ODText/Style/Font.php index 5d8e5753..50de32ad 100644 --- a/src/PhpWord/Writer/ODText/Style/Font.php +++ b/src/PhpWord/Writer/ODText/Style/Font.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,8 +26,6 @@ class Font extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/ODText/Style/Image.php b/src/PhpWord/Writer/ODText/Style/Image.php index 447f449c..b85d4d70 100644 --- a/src/PhpWord/Writer/ODText/Style/Image.php +++ b/src/PhpWord/Writer/ODText/Style/Image.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,8 +26,6 @@ class Image extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/ODText/Style/Paragraph.php b/src/PhpWord/Writer/ODText/Style/Paragraph.php index 1d821810..a047ad32 100644 --- a/src/PhpWord/Writer/ODText/Style/Paragraph.php +++ b/src/PhpWord/Writer/ODText/Style/Paragraph.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,8 +26,6 @@ class Paragraph extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/ODText/Style/Section.php b/src/PhpWord/Writer/ODText/Style/Section.php index 79d57adb..bef023e9 100644 --- a/src/PhpWord/Writer/ODText/Style/Section.php +++ b/src/PhpWord/Writer/ODText/Style/Section.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,8 +26,6 @@ class Section extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { @@ -40,7 +38,7 @@ class Section extends AbstractStyle $xmlWriter->startElement('style:style'); $xmlWriter->writeAttribute('style:name', $style->getStyleName()); - $xmlWriter->writeAttribute('style:family', "section"); + $xmlWriter->writeAttribute('style:family', 'section'); $xmlWriter->startElement('style:section-properties'); $xmlWriter->startElement('style:columns'); diff --git a/src/PhpWord/Writer/ODText/Style/Table.php b/src/PhpWord/Writer/ODText/Style/Table.php index ff3cc423..7d66899a 100644 --- a/src/PhpWord/Writer/ODText/Style/Table.php +++ b/src/PhpWord/Writer/ODText/Style/Table.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,8 +26,6 @@ class Table extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/PDF.php b/src/PhpWord/Writer/PDF.php index 5e5d9d71..45fe8f35 100644 --- a/src/PhpWord/Writer/PDF.php +++ b/src/PhpWord/Writer/PDF.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PhpWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PhpWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -47,7 +47,7 @@ class PDF $pdfLibraryName = Settings::getPdfRendererName(); $pdfLibraryPath = Settings::getPdfRendererPath(); if (is_null($pdfLibraryName) || is_null($pdfLibraryPath)) { - throw new Exception("PDF rendering library or library path has not been defined."); + throw new Exception('PDF rendering library or library path has not been defined.'); } $includePath = str_replace('\\', '/', get_include_path()); diff --git a/src/PhpWord/Writer/PDF/AbstractRenderer.php b/src/PhpWord/Writer/PDF/AbstractRenderer.php index 2778aa52..7b668e0b 100644 --- a/src/PhpWord/Writer/PDF/AbstractRenderer.php +++ b/src/PhpWord/Writer/PDF/AbstractRenderer.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PhpWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PhpWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -83,15 +83,17 @@ abstract class AbstractRenderer extends HTML public function __construct(PhpWord $phpWord) { parent::__construct($phpWord); - $includeFile = Settings::getPdfRendererPath() . '/' . $this->includeFile; - if (file_exists($includeFile)) { - /** @noinspection PhpIncludeInspection Dynamic includes */ - require_once $includeFile; - } else { - // @codeCoverageIgnoreStart - // Can't find any test case. Uncomment when found. - throw new Exception('Unable to load PDF Rendering library'); - // @codeCoverageIgnoreEnd + if ($this->includeFile != null) { + $includeFile = Settings::getPdfRendererPath() . '/' . $this->includeFile; + if (file_exists($includeFile)) { + /** @noinspection PhpIncludeInspection Dynamic includes */ + require_once $includeFile; + } else { + // @codeCoverageIgnoreStart + // Can't find any test case. Uncomment when found. + throw new Exception('Unable to load PDF Rendering library'); + // @codeCoverageIgnoreEnd + } } } @@ -141,6 +143,7 @@ abstract class AbstractRenderer extends HTML public function setPaperSize($value = 9) { $this->paperSize = $value; + return $this; } @@ -163,6 +166,7 @@ abstract class AbstractRenderer extends HTML public function setOrientation($value = 'default') { $this->orientation = $value; + return $this; } @@ -171,9 +175,8 @@ abstract class AbstractRenderer extends HTML * * @param string $filename Name of the file to save as * - * @return resource - * * @throws \PhpOffice\PhpWord\Exception\Exception + * @return resource */ protected function prepareForSave($filename = null) { @@ -194,8 +197,6 @@ abstract class AbstractRenderer extends HTML * * @param resource $fileHandle * - * @return void - * * @throws Exception */ protected function restoreStateAfterSave($fileHandle) diff --git a/src/PhpWord/Writer/PDF/DomPDF.php b/src/PhpWord/Writer/PDF/DomPDF.php index e31f3aae..be282d20 100644 --- a/src/PhpWord/Writer/PDF/DomPDF.php +++ b/src/PhpWord/Writer/PDF/DomPDF.php @@ -10,19 +10,20 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PhpWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PhpWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ namespace PhpOffice\PhpWord\Writer\PDF; +use Dompdf\Dompdf as DompdfLib; use PhpOffice\PhpWord\Writer\WriterInterface; /** * DomPDF writer * - * @link https://github.com/dompdf/dompdf + * @see https://github.com/dompdf/dompdf * @since 0.10.0 */ class DomPDF extends AbstractRenderer implements WriterInterface @@ -32,13 +33,12 @@ class DomPDF extends AbstractRenderer implements WriterInterface * * @var string */ - protected $includeFile = 'dompdf_config.inc.php'; + protected $includeFile = null; /** * Save PhpWord to file. * * @param string $filename Name of the file to save as - * @return void */ public function save($filename = null) { @@ -49,9 +49,9 @@ class DomPDF extends AbstractRenderer implements WriterInterface $orientation = 'portrait'; // Create PDF - $pdf = new \DOMPDF(); - $pdf->set_paper(strtolower($paperSize), $orientation); - $pdf->load_html($this->getContent()); + $pdf = new DompdfLib(); + $pdf->setPaper(strtolower($paperSize), $orientation); + $pdf->loadHtml(str_replace(PHP_EOL, '', $this->getContent())); $pdf->render(); // Write to file diff --git a/src/PhpWord/Writer/PDF/MPDF.php b/src/PhpWord/Writer/PDF/MPDF.php index 028ffac7..80c2eccf 100644 --- a/src/PhpWord/Writer/PDF/MPDF.php +++ b/src/PhpWord/Writer/PDF/MPDF.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PhpWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PhpWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -22,7 +22,7 @@ use PhpOffice\PhpWord\Writer\WriterInterface; /** * MPDF writer * - * @link http://www.mpdf1.com/ + * @see http://www.mpdf1.com/ * @since 0.11.0 */ class MPDF extends AbstractRenderer implements WriterInterface @@ -38,7 +38,6 @@ class MPDF extends AbstractRenderer implements WriterInterface * Save PhpWord to file. * * @param string $filename Name of the file to save as - * @return void */ public function save($filename = null) { diff --git a/src/PhpWord/Writer/PDF/TCPDF.php b/src/PhpWord/Writer/PDF/TCPDF.php index e1e19006..3b82511a 100644 --- a/src/PhpWord/Writer/PDF/TCPDF.php +++ b/src/PhpWord/Writer/PDF/TCPDF.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PhpWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PhpWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -24,7 +24,7 @@ use PhpOffice\PhpWord\Writer\WriterInterface; * * @deprecated 0.13.0 Use `DomPDF` or `MPDF` instead. * - * @link http://www.tcpdf.org/ + * @see http://www.tcpdf.org/ * @since 0.11.0 */ class TCPDF extends AbstractRenderer implements WriterInterface diff --git a/src/PhpWord/Writer/RTF.php b/src/PhpWord/Writer/RTF.php index 887b1c67..7756253a 100644 --- a/src/PhpWord/Writer/RTF.php +++ b/src/PhpWord/Writer/RTF.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -58,9 +58,6 @@ class RTF extends AbstractWriter implements WriterInterface * Save content to file. * * @param string $filename - * - * @return void - * * @throws \PhpOffice\PhpWord\Exception\Exception */ public function save($filename = null) @@ -121,7 +118,6 @@ class RTF extends AbstractWriter implements WriterInterface * Set last paragraph style. * * @param mixed $value - * @return void */ public function setLastParagraphStyle($value = '') { diff --git a/src/PhpWord/Writer/RTF/Element/AbstractElement.php b/src/PhpWord/Writer/RTF/Element/AbstractElement.php index 289733dc..1013ee36 100644 --- a/src/PhpWord/Writer/RTF/Element/AbstractElement.php +++ b/src/PhpWord/Writer/RTF/Element/AbstractElement.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -59,8 +59,6 @@ abstract class AbstractElement extends HTMLAbstractElement /** * Get font and paragraph styles. - * - * @return void */ protected function getStyles() { @@ -112,6 +110,7 @@ abstract class AbstractElement extends HTMLAbstractElement $styleWriter = new ParagraphStyleWriter($this->paragraphStyle); $styleWriter->setNestedLevel($this->element->getNestedLevel()); + return $styleWriter->write(); } @@ -125,9 +124,9 @@ abstract class AbstractElement extends HTMLAbstractElement { if (Settings::isOutputEscapingEnabled()) { return $this->escaper->escape($text); - } else { - return CommonText::toUnicode($text); // todo: replace with `return $text;` later. } + + return CommonText::toUnicode($text); // todo: replace with `return $text;` later. } /** diff --git a/src/PhpWord/Writer/RTF/Element/Container.php b/src/PhpWord/Writer/RTF/Element/Container.php index 7a1b0b07..4850c8bf 100644 --- a/src/PhpWord/Writer/RTF/Element/Container.php +++ b/src/PhpWord/Writer/RTF/Element/Container.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/Image.php b/src/PhpWord/Writer/RTF/Element/Image.php index e950d30b..fb96baff 100644 --- a/src/PhpWord/Writer/RTF/Element/Image.php +++ b/src/PhpWord/Writer/RTF/Element/Image.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/Link.php b/src/PhpWord/Writer/RTF/Element/Link.php index f106d57d..91a75720 100644 --- a/src/PhpWord/Writer/RTF/Element/Link.php +++ b/src/PhpWord/Writer/RTF/Element/Link.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/ListItem.php b/src/PhpWord/Writer/RTF/Element/ListItem.php index b2ba612d..e628bffd 100644 --- a/src/PhpWord/Writer/RTF/Element/ListItem.php +++ b/src/PhpWord/Writer/RTF/Element/ListItem.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/PageBreak.php b/src/PhpWord/Writer/RTF/Element/PageBreak.php index ac2bb8ec..0adbe06e 100644 --- a/src/PhpWord/Writer/RTF/Element/PageBreak.php +++ b/src/PhpWord/Writer/RTF/Element/PageBreak.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/Table.php b/src/PhpWord/Writer/RTF/Element/Table.php index c65d7248..d0bc0845 100644 --- a/src/PhpWord/Writer/RTF/Element/Table.php +++ b/src/PhpWord/Writer/RTF/Element/Table.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/Text.php b/src/PhpWord/Writer/RTF/Element/Text.php index b5a28adf..2fac0520 100644 --- a/src/PhpWord/Writer/RTF/Element/Text.php +++ b/src/PhpWord/Writer/RTF/Element/Text.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/TextBreak.php b/src/PhpWord/Writer/RTF/Element/TextBreak.php index 0f76aea2..2009fcff 100644 --- a/src/PhpWord/Writer/RTF/Element/TextBreak.php +++ b/src/PhpWord/Writer/RTF/Element/TextBreak.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/TextRun.php b/src/PhpWord/Writer/RTF/Element/TextRun.php index f63f338d..d4e56765 100644 --- a/src/PhpWord/Writer/RTF/Element/TextRun.php +++ b/src/PhpWord/Writer/RTF/Element/TextRun.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/Title.php b/src/PhpWord/Writer/RTF/Element/Title.php index 894f52cc..18bad9fd 100644 --- a/src/PhpWord/Writer/RTF/Element/Title.php +++ b/src/PhpWord/Writer/RTF/Element/Title.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Part/AbstractPart.php b/src/PhpWord/Writer/RTF/Part/AbstractPart.php index 04fb4cfd..7569a105 100644 --- a/src/PhpWord/Writer/RTF/Part/AbstractPart.php +++ b/src/PhpWord/Writer/RTF/Part/AbstractPart.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -48,8 +48,6 @@ abstract class AbstractPart /** * @param \PhpOffice\PhpWord\Writer\AbstractWriter $writer - * - * @return void */ public function setParentWriter(AbstractWriter $writer = null) { @@ -57,16 +55,14 @@ abstract class AbstractPart } /** - * @return \PhpOffice\PhpWord\Writer\AbstractWriter - * * @throws \PhpOffice\PhpWord\Exception\Exception + * @return \PhpOffice\PhpWord\Writer\AbstractWriter */ public function getParentWriter() { if ($this->parentWriter !== null) { return $this->parentWriter; - } else { - throw new Exception('No parent WriterInterface assigned.'); } + throw new Exception('No parent WriterInterface assigned.'); } } diff --git a/src/PhpWord/Writer/RTF/Part/Document.php b/src/PhpWord/Writer/RTF/Part/Document.php index 97b2f1b6..465872ea 100644 --- a/src/PhpWord/Writer/RTF/Part/Document.php +++ b/src/PhpWord/Writer/RTF/Part/Document.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\Writer\RTF\Style\Section as SectionStyleWriter; * RTF document part writer * * @since 0.11.0 - * @link http://www.biblioscape.com/rtf15_spec.htm#Heading24 + * @see http://www.biblioscape.com/rtf15_spec.htm#Heading24 */ class Document extends AbstractPart { @@ -54,9 +54,13 @@ class Document extends AbstractPart { $docProps = $this->getParentWriter()->getPhpWord()->getDocInfo(); $properties = array('title', 'subject', 'category', 'keywords', 'comment', - 'author', 'operator', 'creatim', 'revtim', 'company', 'manager'); - $mapping = array('comment' => 'description', 'author' => 'creator', 'operator' => 'lastModifiedBy', - 'creatim' => 'created', 'revtim' => 'modified'); + 'author', 'operator', 'creatim', 'revtim', 'company', 'manager', ); + $mapping = array( + 'comment' => 'description', + 'author' => 'creator', + 'operator' => 'lastModifiedBy', + 'creatim' => 'created', + 'revtim' => 'modified', ); $dateFields = array('creatim', 'revtim'); $content = ''; diff --git a/src/PhpWord/Writer/RTF/Part/Header.php b/src/PhpWord/Writer/RTF/Part/Header.php index 56a50349..73f1351f 100644 --- a/src/PhpWord/Writer/RTF/Part/Header.php +++ b/src/PhpWord/Writer/RTF/Part/Header.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -33,7 +33,7 @@ use PhpOffice\PhpWord\Style\Font; * - List table (not supported yet) * * @since 0.11.0 - * @link http://www.biblioscape.com/rtf15_spec.htm#Heading6 + * @see http://www.biblioscape.com/rtf15_spec.htm#Heading6 */ class Header extends AbstractPart { @@ -181,8 +181,6 @@ class Header extends AbstractPart /** * Register all fonts and colors in both named and inline styles to appropriate header table. - * - * @return void */ private function registerFont() { @@ -213,7 +211,6 @@ class Header extends AbstractPart * Register border colors. * * @param \PhpOffice\PhpWord\Style\Border $style - * @return void */ private function registerBorderColor($style) { @@ -229,7 +226,6 @@ class Header extends AbstractPart * Register fonts and colors. * * @param \PhpOffice\PhpWord\Style\AbstractStyle $style - * @return void */ private function registerFontItems($style) { @@ -249,7 +245,6 @@ class Header extends AbstractPart * @param array &$table * @param string $value * @param string $default - * @return void */ private function registerTableItem(&$table, $value, $default = null) { diff --git a/src/PhpWord/Writer/RTF/Style/AbstractStyle.php b/src/PhpWord/Writer/RTF/Style/AbstractStyle.php index 417be9cf..80523610 100644 --- a/src/PhpWord/Writer/RTF/Style/AbstractStyle.php +++ b/src/PhpWord/Writer/RTF/Style/AbstractStyle.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Style/Border.php b/src/PhpWord/Writer/RTF/Style/Border.php index 9f7ee2c0..e63d767f 100644 --- a/src/PhpWord/Writer/RTF/Style/Border.php +++ b/src/PhpWord/Writer/RTF/Style/Border.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -103,8 +103,7 @@ class Border extends AbstractStyle /** * Set sizes. * - * @param integer[] $value - * @return void + * @param int[] $value */ public function setSizes($value) { @@ -115,7 +114,6 @@ class Border extends AbstractStyle * Set colors. * * @param string[] $value - * @return void */ public function setColors($value) { diff --git a/src/PhpWord/Writer/RTF/Style/Font.php b/src/PhpWord/Writer/RTF/Style/Font.php index 6567ec33..3338368a 100644 --- a/src/PhpWord/Writer/RTF/Style/Font.php +++ b/src/PhpWord/Writer/RTF/Style/Font.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -62,7 +62,7 @@ class Font extends AbstractStyle $content .= $this->getValueIf($style->isSuperScript(), '\super'); $content .= $this->getValueIf($style->isSubScript(), '\sub'); - return $content . ' '; + return $content . ' '; } /** @@ -70,7 +70,6 @@ class Font extends AbstractStyle * * * @param int $value - * @return void */ public function setNameIndex($value = 0) { @@ -81,7 +80,6 @@ class Font extends AbstractStyle * Set font color index. * * @param int $value - * @return void */ public function setColorIndex($value = 0) { diff --git a/src/PhpWord/Writer/RTF/Style/Paragraph.php b/src/PhpWord/Writer/RTF/Style/Paragraph.php index 046adc8c..61b61fd7 100644 --- a/src/PhpWord/Writer/RTF/Style/Paragraph.php +++ b/src/PhpWord/Writer/RTF/Style/Paragraph.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -74,7 +74,6 @@ class Paragraph extends AbstractStyle * Set nested level. * * @param int $value - * @return void */ public function setNestedLevel($value) { diff --git a/src/PhpWord/Writer/RTF/Style/Section.php b/src/PhpWord/Writer/RTF/Style/Section.php index dcdc0aaf..8f073716 100644 --- a/src/PhpWord/Writer/RTF/Style/Section.php +++ b/src/PhpWord/Writer/RTF/Style/Section.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007.php b/src/PhpWord/Writer/Word2007.php index bb7b521f..fcef982f 100644 --- a/src/PhpWord/Writer/Word2007.php +++ b/src/PhpWord/Writer/Word2007.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -92,7 +92,6 @@ class Word2007 extends AbstractWriter implements WriterInterface * Save document by name. * * @param string $filename - * @return void */ public function save($filename = null) { @@ -170,7 +169,6 @@ class Word2007 extends AbstractWriter implements WriterInterface * * @param \PhpOffice\PhpWord\Shared\ZipArchive $zip * @param string $docPart - * @return void */ private function addHeaderFooterMedia(ZipArchive $zip, $docPart) { @@ -197,16 +195,15 @@ class Word2007 extends AbstractWriter implements WriterInterface * @param \PhpOffice\PhpWord\Element\Section &$section * @param \PhpOffice\PhpWord\Shared\ZipArchive $zip * @param string $elmType header|footer - * @param integer &$rId - * @return void + * @param int &$rId */ private function addHeaderFooterContent(Section &$section, ZipArchive $zip, $elmType, &$rId) { $getFunction = $elmType == 'header' ? 'getHeaders' : 'getFooters'; $elmCount = ($section->getSectionId() - 1) * 3; $elements = $section->$getFunction(); + /** @var \PhpOffice\PhpWord\Element\AbstractElement $element Type hint */ foreach ($elements as &$element) { - /** @var \PhpOffice\PhpWord\Element\AbstractElement $element Type hint */ $elmCount++; $element->setRelationId(++$rId); $elmFile = "{$elmType}{$elmCount}.xml"; // e.g. footer1.xml @@ -223,9 +220,8 @@ class Word2007 extends AbstractWriter implements WriterInterface * Add footnotes/endnotes * * @param \PhpOffice\PhpWord\Shared\ZipArchive $zip - * @param integer &$rId + * @param int &$rId * @param string $noteType - * @return void */ private function addNotes(ZipArchive $zip, &$rId, $noteType = 'footnote') { @@ -261,14 +257,13 @@ class Word2007 extends AbstractWriter implements WriterInterface * Add comments * * @param \PhpOffice\PhpWord\Shared\ZipArchive $zip - * @param integer &$rId - * @return void + * @param int &$rId */ private function addComments(ZipArchive $zip, &$rId) { $phpWord = $this->getPhpWord(); $collection = $phpWord->getComments(); - $partName = "comments"; + $partName = 'comments'; // Add comment relations and contents /** @var \PhpOffice\PhpWord\Collection\AbstractCollection $collection Type hint */ @@ -285,8 +280,7 @@ class Word2007 extends AbstractWriter implements WriterInterface * Add chart. * * @param \PhpOffice\PhpWord\Shared\ZipArchive $zip - * @param integer &$rId - * @return void + * @param int &$rId */ private function addChart(ZipArchive $zip, &$rId) { @@ -295,6 +289,7 @@ class Word2007 extends AbstractWriter implements WriterInterface $collection = $phpWord->getCharts(); $index = 0; if ($collection->countItems() > 0) { + /** @var \PhpOffice\PhpWord\Element\Chart $chart */ foreach ($collection->getItems() as $chart) { $index++; $rId++; @@ -307,7 +302,6 @@ class Word2007 extends AbstractWriter implements WriterInterface $this->relationships[] = array('target' => $filename, 'type' => 'chart', 'rID' => $rId); // word/charts/chartN.xml - /** @var \PhpOffice\PhpWord\Element\Chart $chart */ $chart->setRelationId($rId); $writerPart = $this->getWriterPart('Chart'); $writerPart->setElement($chart); @@ -320,7 +314,6 @@ class Word2007 extends AbstractWriter implements WriterInterface * Register content types for each media. * * @param array $media - * @return void */ private function registerContentTypes($media) { diff --git a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php index 305a768e..07ffc286 100644 --- a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php +++ b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -92,7 +92,6 @@ abstract class AbstractElement * Start w:p DOM element. * * @uses \PhpOffice\PhpWord\Writer\Word2007\Element\PageBreak::write() - * @return void */ protected function startElementP() { @@ -108,8 +107,6 @@ abstract class AbstractElement /** * End w:p DOM element. - * - * @return void */ protected function endElementP() { @@ -121,8 +118,6 @@ abstract class AbstractElement /** * Writes the w:commentRangeStart DOM element - * - * @return void */ protected function writeCommentRangeStart() { @@ -139,8 +134,6 @@ abstract class AbstractElement /** * Writes the w:commentRangeEnd DOM element - * - * @return void */ protected function writeCommentRangeEnd() { @@ -171,8 +164,6 @@ abstract class AbstractElement /** * Write ending. - * - * @return void */ protected function writeParagraphStyle() { @@ -181,20 +172,16 @@ abstract class AbstractElement /** * Write ending. - * - * @return void */ protected function writeFontStyle() { $this->writeTextStyle('Font'); } - /** * Write text style. * * @param string $styleType Font|Paragraph - * @return void */ private function writeTextStyle($styleType) { @@ -202,12 +189,12 @@ abstract class AbstractElement $class = "PhpOffice\\PhpWord\\Writer\\Word2007\\Style\\{$styleType}"; $styleObject = $this->element->$method(); + /** @var \PhpOffice\PhpWord\Writer\Word2007\Style\AbstractStyle $styleWriter Type Hint */ $styleWriter = new $class($this->xmlWriter, $styleObject); if (method_exists($styleWriter, 'setIsInline')) { $styleWriter->setIsInline(true); } - /** @var \PhpOffice\PhpWord\Writer\Word2007\Style\AbstractStyle $styleWriter */ $styleWriter->write(); } diff --git a/src/PhpWord/Writer/Word2007/Element/Bookmark.php b/src/PhpWord/Writer/Word2007/Element/Bookmark.php index 424fb0ab..4b0b78a7 100644 --- a/src/PhpWord/Writer/Word2007/Element/Bookmark.php +++ b/src/PhpWord/Writer/Word2007/Element/Bookmark.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -41,7 +41,7 @@ class Bookmark extends AbstractElement $xmlWriter->writeAttribute('w:id', $rId); $xmlWriter->writeAttribute('w:name', $element->getName()); $xmlWriter->endElement(); - + $xmlWriter->startElement('w:bookmarkEnd'); $xmlWriter->writeAttribute('w:id', $rId); $xmlWriter->endElement(); diff --git a/src/PhpWord/Writer/Word2007/Element/Chart.php b/src/PhpWord/Writer/Word2007/Element/Chart.php index ecdde362..591799ab 100644 --- a/src/PhpWord/Writer/Word2007/Element/Chart.php +++ b/src/PhpWord/Writer/Word2007/Element/Chart.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -28,8 +28,6 @@ class Chart extends AbstractElement { /** * Write element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/CheckBox.php b/src/PhpWord/Writer/Word2007/Element/CheckBox.php index 7424985c..31dcb867 100644 --- a/src/PhpWord/Writer/Word2007/Element/CheckBox.php +++ b/src/PhpWord/Writer/Word2007/Element/CheckBox.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -28,8 +28,6 @@ class CheckBox extends Text { /** * Write element. - * - * @return void */ public function write() { @@ -66,17 +64,17 @@ class CheckBox extends Text $xmlWriter->startElement('w:instrText'); $xmlWriter->writeAttribute('xml:space', 'preserve'); $xmlWriter->text(' FORMCHECKBOX '); - $xmlWriter->endElement();// w:instrText + $xmlWriter->endElement(); // w:instrText $xmlWriter->endElement(); // w:r $xmlWriter->startElement('w:r'); $xmlWriter->startElement('w:fldChar'); $xmlWriter->writeAttribute('w:fldCharType', 'separate'); - $xmlWriter->endElement();// w:fldChar + $xmlWriter->endElement(); // w:fldChar $xmlWriter->endElement(); // w:r $xmlWriter->startElement('w:r'); $xmlWriter->startElement('w:fldChar'); $xmlWriter->writeAttribute('w:fldCharType', 'end'); - $xmlWriter->endElement();// w:fldChar + $xmlWriter->endElement(); // w:fldChar $xmlWriter->endElement(); // w:r $xmlWriter->startElement('w:r'); diff --git a/src/PhpWord/Writer/Word2007/Element/Container.php b/src/PhpWord/Writer/Word2007/Element/Container.php index 0efd0ebc..47dae29b 100644 --- a/src/PhpWord/Writer/Word2007/Element/Container.php +++ b/src/PhpWord/Writer/Word2007/Element/Container.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -38,8 +38,6 @@ class Container extends AbstractElement /** * Write element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/Endnote.php b/src/PhpWord/Writer/Word2007/Element/Endnote.php index 9363489e..ebfe35c1 100644 --- a/src/PhpWord/Writer/Word2007/Element/Endnote.php +++ b/src/PhpWord/Writer/Word2007/Element/Endnote.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Field.php b/src/PhpWord/Writer/Word2007/Element/Field.php index 9fc45b21..75d4983f 100644 --- a/src/PhpWord/Writer/Word2007/Element/Field.php +++ b/src/PhpWord/Writer/Word2007/Element/Field.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,13 +26,11 @@ class Field extends Text { /** * Write field element. - * - * @return void */ public function write() { $xmlWriter = $this->getXmlWriter(); - $element = $this->getElement(); + $element = $this->getElement(); if (!$element instanceof \PhpOffice\PhpWord\Element\Field) { return; } @@ -65,7 +63,6 @@ class Field extends Text if ($element->getText() != null) { if ($element->getText() instanceof \PhpOffice\PhpWord\Element\TextRun) { - $containerWriter = new Container($xmlWriter, $element->getText(), true); $containerWriter->write(); @@ -110,17 +107,17 @@ class Field extends Text private function buildPropertiesAndOptions(\PhpOffice\PhpWord\Element\Field $element) { $propertiesAndOptions = ''; - $properties = $element->getProperties(); + $properties = $element->getProperties(); foreach ($properties as $propkey => $propval) { switch ($propkey) { case 'format': - $propertiesAndOptions.= '\* ' . $propval . ' '; + $propertiesAndOptions .= '\* ' . $propval . ' '; break; case 'numformat': - $propertiesAndOptions.= '\# ' . $propval . ' '; + $propertiesAndOptions .= '\# ' . $propval . ' '; break; case 'dateformat': - $propertiesAndOptions.= '\@ "' . $propval . '" '; + $propertiesAndOptions .= '\@ "' . $propval . '" '; break; } } @@ -129,27 +126,28 @@ class Field extends Text foreach ($options as $option) { switch ($option) { case 'PreserveFormat': - $propertiesAndOptions.= '\* MERGEFORMAT '; + $propertiesAndOptions .= '\* MERGEFORMAT '; break; case 'LunarCalendar': - $propertiesAndOptions.= '\h '; + $propertiesAndOptions .= '\h '; break; case 'SakaEraCalendar': - $propertiesAndOptions.= '\s '; + $propertiesAndOptions .= '\s '; break; case 'LastUsedFormat': - $propertiesAndOptions.= '\l '; + $propertiesAndOptions .= '\l '; break; case 'Bold': - $propertiesAndOptions.= '\b '; + $propertiesAndOptions .= '\b '; break; case 'Italic': - $propertiesAndOptions.= '\i '; + $propertiesAndOptions .= '\i '; break; default: - $propertiesAndOptions.= $option .' '; + $propertiesAndOptions .= $option . ' '; } } + return $propertiesAndOptions; } } diff --git a/src/PhpWord/Writer/Word2007/Element/Footnote.php b/src/PhpWord/Writer/Word2007/Element/Footnote.php index 53fcd6a0..65ef40c7 100644 --- a/src/PhpWord/Writer/Word2007/Element/Footnote.php +++ b/src/PhpWord/Writer/Word2007/Element/Footnote.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -33,8 +33,6 @@ class Footnote extends Text /** * Write element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/FormField.php b/src/PhpWord/Writer/Word2007/Element/FormField.php index 27df756f..91fb28ab 100644 --- a/src/PhpWord/Writer/Word2007/Element/FormField.php +++ b/src/PhpWord/Writer/Word2007/Element/FormField.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -27,7 +27,7 @@ use PhpOffice\PhpWord\Settings; * Note: DropDown is active when document protection is set to `forms` * * @since 0.12.0 - * @link http://www.datypic.com/sc/ooxml/t-w_CT_FFData.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_FFData.html * @SuppressWarnings(PHPMD.UnusedPrivateMethod) */ class FormField extends Text @@ -37,8 +37,6 @@ class FormField extends Text /** * Write element. - * - * @return void */ public function write() { @@ -80,7 +78,7 @@ class FormField extends Text $xmlWriter->startElement('w:instrText'); $xmlWriter->writeAttribute('xml:space', 'preserve'); $xmlWriter->text("{$instruction}"); - $xmlWriter->endElement();// w:instrText + $xmlWriter->endElement(); // w:instrText $xmlWriter->endElement(); // w:r $xmlWriter->startElement('w:r'); @@ -111,10 +109,9 @@ class FormField extends Text /** * Write textinput. * - * @link http://www.datypic.com/sc/ooxml/t-w_CT_FFTextInput.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_FFTextInput.html * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\FormField $element - * @return void */ private function writeTextInput(XMLWriter $xmlWriter, FormFieldElement $element) { @@ -128,10 +125,9 @@ class FormField extends Text /** * Write checkbox. * - * @link http://www.datypic.com/sc/ooxml/t-w_CT_FFCheckBox.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_FFCheckBox.html * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\FormField $element - * @return void */ private function writeCheckBox(XMLWriter $xmlWriter, FormFieldElement $element) { @@ -152,10 +148,9 @@ class FormField extends Text /** * Write dropdown. * - * @link http://www.datypic.com/sc/ooxml/t-w_CT_FFDDList.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_FFDDList.html * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\FormField $element - * @return void */ private function writeDropDown(XMLWriter $xmlWriter, FormFieldElement $element) { diff --git a/src/PhpWord/Writer/Word2007/Element/Image.php b/src/PhpWord/Writer/Word2007/Element/Image.php index edf32739..7e33f75e 100644 --- a/src/PhpWord/Writer/Word2007/Element/Image.php +++ b/src/PhpWord/Writer/Word2007/Element/Image.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -30,8 +30,6 @@ class Image extends AbstractElement { /** * Write element. - * - * @return void */ public function write() { @@ -50,8 +48,6 @@ class Image extends AbstractElement /** * Write image element. - * - * @return void */ private function writeImage(XMLWriter $xmlWriter, ImageElement $element) { @@ -86,8 +82,6 @@ class Image extends AbstractElement /** * Write watermark element. - * - * @return void */ private function writeWatermark(XMLWriter $xmlWriter, ImageElement $element) { diff --git a/src/PhpWord/Writer/Word2007/Element/Line.php b/src/PhpWord/Writer/Word2007/Element/Line.php index ebc5d395..9b1a160d 100644 --- a/src/PhpWord/Writer/Word2007/Element/Line.php +++ b/src/PhpWord/Writer/Word2007/Element/Line.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -22,19 +22,16 @@ use PhpOffice\PhpWord\Writer\Word2007\Style\Line as LineStyleWriter; /** * Line element writer - * */ class Line extends AbstractElement { /** * Write element. - * - * @return void */ public function write() { $xmlWriter = $this->getXmlWriter(); - $element = $this->getElement(); + $element = $this->getElement(); if (!$element instanceof LineElement) { return; } diff --git a/src/PhpWord/Writer/Word2007/Element/Link.php b/src/PhpWord/Writer/Word2007/Element/Link.php index 5f7ad278..8ea3f53c 100644 --- a/src/PhpWord/Writer/Word2007/Element/Link.php +++ b/src/PhpWord/Writer/Word2007/Element/Link.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -28,8 +28,6 @@ class Link extends Text { /** * Write link element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/ListItem.php b/src/PhpWord/Writer/Word2007/Element/ListItem.php index 53644ffa..c1aa0ce3 100644 --- a/src/PhpWord/Writer/Word2007/Element/ListItem.php +++ b/src/PhpWord/Writer/Word2007/Element/ListItem.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -28,8 +28,6 @@ class ListItem extends AbstractElement { /** * Write list item element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/ListItemRun.php b/src/PhpWord/Writer/Word2007/Element/ListItemRun.php index 1ac17a98..e6ed2b46 100644 --- a/src/PhpWord/Writer/Word2007/Element/ListItemRun.php +++ b/src/PhpWord/Writer/Word2007/Element/ListItemRun.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -28,8 +28,6 @@ class ListItemRun extends AbstractElement { /** * Write list item element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/Object.php b/src/PhpWord/Writer/Word2007/Element/Object.php index fc0532cd..8231ec0c 100644 --- a/src/PhpWord/Writer/Word2007/Element/Object.php +++ b/src/PhpWord/Writer/Word2007/Element/Object.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -28,8 +28,6 @@ class Object extends AbstractElement { /** * Write object element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/PageBreak.php b/src/PhpWord/Writer/Word2007/Element/PageBreak.php index 363a8c2c..04ff29d4 100644 --- a/src/PhpWord/Writer/Word2007/Element/PageBreak.php +++ b/src/PhpWord/Writer/Word2007/Element/PageBreak.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -28,7 +28,6 @@ class PageBreak extends AbstractElement * Write element. * * @usedby \PhpOffice\PhpWord\Writer\Word2007\Element\AbstractElement::startElementP() - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/ParagraphAlignment.php b/src/PhpWord/Writer/Word2007/Element/ParagraphAlignment.php index 2c775d14..0dafa4a0 100644 --- a/src/PhpWord/Writer/Word2007/Element/ParagraphAlignment.php +++ b/src/PhpWord/Writer/Word2007/Element/ParagraphAlignment.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -29,7 +29,7 @@ class ParagraphAlignment /** * @since 0.13.0 * - * @param string $value Any value provided by Jc simple type. + * @param string $value Any value provided by Jc simple type * * @see \PhpOffice\PhpWord\SimpleType\Jc For the allowed values of $value parameter. */ diff --git a/src/PhpWord/Writer/Word2007/Element/PreserveText.php b/src/PhpWord/Writer/Word2007/Element/PreserveText.php index 82c6f87b..92b9ea40 100644 --- a/src/PhpWord/Writer/Word2007/Element/PreserveText.php +++ b/src/PhpWord/Writer/Word2007/Element/PreserveText.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -28,8 +28,6 @@ class PreserveText extends Text { /** * Write preserve text element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/SDT.php b/src/PhpWord/Writer/Word2007/Element/SDT.php index 313bf7e0..e77f87e9 100644 --- a/src/PhpWord/Writer/Word2007/Element/SDT.php +++ b/src/PhpWord/Writer/Word2007/Element/SDT.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -24,15 +24,13 @@ use PhpOffice\PhpWord\Element\SDT as SDTElement; * Structured document tag element writer * * @since 0.12.0 - * @link http://www.datypic.com/sc/ooxml/t-w_CT_SdtBlock.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_SdtBlock.html * @SuppressWarnings(PHPMD.UnusedPrivateMethod) */ class SDT extends Text { /** * Write element. - * - * @return void */ public function write() { @@ -70,10 +68,9 @@ class SDT extends Text /** * Write combo box. * - * @link http://www.datypic.com/sc/ooxml/t-w_CT_SdtComboBox.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_SdtComboBox.html * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\SDT $element - * @return void */ private function writeComboBox(XMLWriter $xmlWriter, SDTElement $element) { @@ -90,10 +87,9 @@ class SDT extends Text /** * Write drop down list. * - * @link http://www.datypic.com/sc/ooxml/t-w_CT_SdtDropDownList.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_SdtDropDownList.html * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\SDT $element - * @return void */ private function writeDropDownList(XMLWriter $xmlWriter, SDTElement $element) { @@ -103,10 +99,9 @@ class SDT extends Text /** * Write date. * - * @link http://www.datypic.com/sc/ooxml/t-w_CT_SdtDate.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_SdtDate.html * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\SDT $element - * @return void */ private function writeDate(XMLWriter $xmlWriter, SDTElement $element) { diff --git a/src/PhpWord/Writer/Word2007/Element/Shape.php b/src/PhpWord/Writer/Word2007/Element/Shape.php index a589af6c..e384db06 100644 --- a/src/PhpWord/Writer/Word2007/Element/Shape.php +++ b/src/PhpWord/Writer/Word2007/Element/Shape.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -32,8 +32,6 @@ class Shape extends AbstractElement { /** * Write element. - * - * @return void */ public function write() { @@ -81,7 +79,6 @@ class Shape extends AbstractElement * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Shape $style - * @return void */ private function writeArc(XMLWriter $xmlWriter, ShapeStyle $style) { @@ -96,7 +93,6 @@ class Shape extends AbstractElement * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Shape $style - * @return void */ private function writeCurve(XMLWriter $xmlWriter, ShapeStyle $style) { @@ -112,7 +108,6 @@ class Shape extends AbstractElement * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Shape $style - * @return void */ private function writeLine(XMLWriter $xmlWriter, ShapeStyle $style) { @@ -127,7 +122,6 @@ class Shape extends AbstractElement * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Shape $style - * @return void */ private function writePolyline(XMLWriter $xmlWriter, ShapeStyle $style) { @@ -139,7 +133,6 @@ class Shape extends AbstractElement * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Shape $style - * @return void */ private function writeRoundRect(XMLWriter $xmlWriter, ShapeStyle $style) { diff --git a/src/PhpWord/Writer/Word2007/Element/TOC.php b/src/PhpWord/Writer/Word2007/Element/TOC.php index 996edb64..a679188f 100644 --- a/src/PhpWord/Writer/Word2007/Element/TOC.php +++ b/src/PhpWord/Writer/Word2007/Element/TOC.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -34,8 +34,6 @@ class TOC extends AbstractElement { /** * Write element. - * - * @return void */ public function write() { @@ -71,7 +69,6 @@ class TOC extends AbstractElement * @param \PhpOffice\PhpWord\Element\TOC $element * @param \PhpOffice\PhpWord\Element\Title $title * @param bool $writeFieldMark - * @return void */ private function writeTitle(XMLWriter $xmlWriter, TOCElement $element, $title, $writeFieldMark) { @@ -143,7 +140,6 @@ class TOC extends AbstractElement * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\TOC $element * @param int $indent - * @return void */ private function writeStyle(XMLWriter $xmlWriter, TOCElement $element, $indent) { @@ -189,7 +185,6 @@ class TOC extends AbstractElement * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\TOC $element - * @return void */ private function writeFieldMark(XMLWriter $xmlWriter, TOCElement $element) { diff --git a/src/PhpWord/Writer/Word2007/Element/Table.php b/src/PhpWord/Writer/Word2007/Element/Table.php index 093666ee..c0590772 100644 --- a/src/PhpWord/Writer/Word2007/Element/Table.php +++ b/src/PhpWord/Writer/Word2007/Element/Table.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -36,8 +36,6 @@ class Table extends AbstractElement { /** * Write element. - * - * @return void */ public function write() { @@ -75,7 +73,6 @@ class Table extends AbstractElement * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\Table $element - * @return void */ private function writeColumns(XMLWriter $xmlWriter, TableElement $element) { @@ -112,7 +109,6 @@ class Table extends AbstractElement * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\Row $row - * @return void */ private function writeRow(XMLWriter $xmlWriter, RowElement $row) { @@ -139,11 +135,9 @@ class Table extends AbstractElement * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\Cell $cell - * @return void */ private function writeCell(XMLWriter $xmlWriter, CellElement $cell) { - $xmlWriter->startElement('w:tc'); // Write style diff --git a/src/PhpWord/Writer/Word2007/Element/TableAlignment.php b/src/PhpWord/Writer/Word2007/Element/TableAlignment.php index 45459a38..44450fd6 100644 --- a/src/PhpWord/Writer/Word2007/Element/TableAlignment.php +++ b/src/PhpWord/Writer/Word2007/Element/TableAlignment.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -29,7 +29,7 @@ class TableAlignment /** * @since 0.13.0 * - * @param string $value Any value provided by JcTable simple type. + * @param string $value Any value provided by JcTable simple type * * @see \PhpOffice\PhpWord\SimpleType\JcTable For the allowed values of $value parameter. */ diff --git a/src/PhpWord/Writer/Word2007/Element/Text.php b/src/PhpWord/Writer/Word2007/Element/Text.php index 2df4892b..694a834a 100644 --- a/src/PhpWord/Writer/Word2007/Element/Text.php +++ b/src/PhpWord/Writer/Word2007/Element/Text.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -28,8 +28,6 @@ class Text extends AbstractElement { /** * Write text element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/TextBox.php b/src/PhpWord/Writer/Word2007/Element/TextBox.php index e83fe0c9..3780c698 100644 --- a/src/PhpWord/Writer/Word2007/Element/TextBox.php +++ b/src/PhpWord/Writer/Word2007/Element/TextBox.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -28,8 +28,6 @@ class TextBox extends Image { /** * Write element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/TextBreak.php b/src/PhpWord/Writer/Word2007/Element/TextBreak.php index a9e6f613..161a528e 100644 --- a/src/PhpWord/Writer/Word2007/Element/TextBreak.php +++ b/src/PhpWord/Writer/Word2007/Element/TextBreak.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,8 +26,6 @@ class TextBreak extends Text { /** * Write text break element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/TextRun.php b/src/PhpWord/Writer/Word2007/Element/TextRun.php index 1e95ab5c..9fd70b13 100644 --- a/src/PhpWord/Writer/Word2007/Element/TextRun.php +++ b/src/PhpWord/Writer/Word2007/Element/TextRun.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,8 +26,6 @@ class TextRun extends Text { /** * Write textrun element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Element/Title.php b/src/PhpWord/Writer/Word2007/Element/Title.php index 925d4c43..63ed94de 100644 --- a/src/PhpWord/Writer/Word2007/Element/Title.php +++ b/src/PhpWord/Writer/Word2007/Element/Title.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -28,8 +28,6 @@ class Title extends AbstractElement { /** * Write title element. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Part/AbstractPart.php b/src/PhpWord/Writer/Word2007/Part/AbstractPart.php index 26734aa0..0b9d8b88 100644 --- a/src/PhpWord/Writer/Word2007/Part/AbstractPart.php +++ b/src/PhpWord/Writer/Word2007/Part/AbstractPart.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -50,7 +50,6 @@ abstract class AbstractPart * Set parent writer. * * @param \PhpOffice\PhpWord\Writer\AbstractWriter $writer - * @return void */ public function setParentWriter(AbstractWriter $writer = null) { @@ -60,17 +59,15 @@ abstract class AbstractPart /** * Get parent writer * - * @return \PhpOffice\PhpWord\Writer\AbstractWriter - * * @throws \PhpOffice\PhpWord\Exception\Exception + * @return \PhpOffice\PhpWord\Writer\AbstractWriter */ public function getParentWriter() { if (!is_null($this->parentWriter)) { return $this->parentWriter; - } else { - throw new Exception('No parent WriterInterface assigned.'); } + throw new Exception('No parent WriterInterface assigned.'); } /** @@ -88,8 +85,8 @@ abstract class AbstractPart } if ($useDiskCaching) { return new XMLWriter(XMLWriter::STORAGE_DISK, $this->parentWriter->getDiskCachingDirectory(), Settings::hasCompatibility()); - } else { - return new XMLWriter(XMLWriter::STORAGE_MEMORY, './', Settings::hasCompatibility()); } + + return new XMLWriter(XMLWriter::STORAGE_MEMORY, './', Settings::hasCompatibility()); } } diff --git a/src/PhpWord/Writer/Word2007/Part/Chart.php b/src/PhpWord/Writer/Word2007/Part/Chart.php index 86045b9a..2f162108 100644 --- a/src/PhpWord/Writer/Word2007/Part/Chart.php +++ b/src/PhpWord/Writer/Word2007/Part/Chart.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -24,14 +24,14 @@ use PhpOffice\PhpWord\Element\Chart as ChartElement; * Word2007 chart part writer: word/charts/chartx.xml * * @since 0.12.0 - * @link http://www.datypic.com/sc/ooxml/e-draw-chart_chartSpace.html + * @see http://www.datypic.com/sc/ooxml/e-draw-chart_chartSpace.html */ class Chart extends AbstractPart { /** * Chart element * - * @var \PhpOffice\PhpWord\Element\Chart $element + * @var \PhpOffice\PhpWord\Element\Chart */ private $element; @@ -62,7 +62,6 @@ class Chart extends AbstractPart * Set chart element. * * @param \PhpOffice\PhpWord\Element\Chart $element - * @return void */ public function setElement(ChartElement $element) { @@ -95,9 +94,8 @@ class Chart extends AbstractPart /** * Write chart * - * @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_Chart.html + * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_Chart.html * @param \PhpOffice\Common\XMLWriter $xmlWriter - * @return void */ private function writeChart(XMLWriter $xmlWriter) { @@ -113,16 +111,15 @@ class Chart extends AbstractPart /** * Write plot area. * - * @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_PlotArea.html - * @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_PieChart.html - * @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_DoughnutChart.html - * @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_BarChart.html - * @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_LineChart.html - * @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_AreaChart.html - * @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_RadarChart.html - * @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_ScatterChart.html + * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_PlotArea.html + * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_PieChart.html + * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_DoughnutChart.html + * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_BarChart.html + * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_LineChart.html + * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_AreaChart.html + * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_RadarChart.html + * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_ScatterChart.html * @param \PhpOffice\Common\XMLWriter $xmlWriter - * @return void */ private function writePlotArea(XMLWriter $xmlWriter) { @@ -135,7 +132,7 @@ class Chart extends AbstractPart // Chart $chartType = $this->options['type']; - $chartType .= $style->is3d() && !isset($this->options['no3d'])? '3D' : ''; + $chartType .= $style->is3d() && !isset($this->options['no3d']) ? '3D' : ''; $chartType .= 'Chart'; $xmlWriter->startElement("c:{$chartType}"); @@ -182,7 +179,6 @@ class Chart extends AbstractPart * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param bool $scatter - * @return void */ private function writeSeries(XMLWriter $xmlWriter, $scatter = false) { @@ -221,13 +217,12 @@ class Chart extends AbstractPart * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param string $type * @param array $values - * @return void */ private function writeSeriesItem(XMLWriter $xmlWriter, $type, $values) { $types = array( - 'cat' => array('c:cat', 'c:strLit'), - 'val' => array('c:val', 'c:numLit'), + 'cat' => array('c:cat', 'c:strLit'), + 'val' => array('c:val', 'c:numLit'), 'xVal' => array('c:xVal', 'c:strLit'), 'yVal' => array('c:yVal', 'c:numLit'), ); @@ -258,10 +253,9 @@ class Chart extends AbstractPart /** * Write axis * - * @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_CatAx.html + * @see http://www.datypic.com/sc/ooxml/t-draw-chart_CT_CatAx.html * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param string $type - * @return void */ private function writeAxis(XMLWriter $xmlWriter, $type) { @@ -301,10 +295,9 @@ class Chart extends AbstractPart /** * Write shape * - * @link http://www.datypic.com/sc/ooxml/t-a_CT_ShapeProperties.html + * @see http://www.datypic.com/sc/ooxml/t-a_CT_ShapeProperties.html * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param bool $line - * @return void */ private function writeShape(XMLWriter $xmlWriter, $line = false) { diff --git a/src/PhpWord/Writer/Word2007/Part/Comments.php b/src/PhpWord/Writer/Word2007/Part/Comments.php index 73314785..b2b49864 100644 --- a/src/PhpWord/Writer/Word2007/Part/Comments.php +++ b/src/PhpWord/Writer/Word2007/Part/Comments.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -72,7 +72,6 @@ class Comments extends AbstractPart * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\Comment $comment - * @return void */ protected function writeComment(XMLWriter $xmlWriter, Comment $comment) { diff --git a/src/PhpWord/Writer/Word2007/Part/ContentTypes.php b/src/PhpWord/Writer/Word2007/Part/ContentTypes.php index 7a03243e..9be988d3 100644 --- a/src/PhpWord/Writer/Word2007/Part/ContentTypes.php +++ b/src/PhpWord/Writer/Word2007/Part/ContentTypes.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -36,20 +36,20 @@ class ContentTypes extends AbstractPart $contentTypes = $parentWriter->getContentTypes(); $openXMLPrefix = 'application/vnd.openxmlformats-'; - $wordMLPrefix = $openXMLPrefix . 'officedocument.wordprocessingml.'; - $drawingMLPrefix = $openXMLPrefix . 'officedocument.drawingml.'; + $wordMLPrefix = $openXMLPrefix . 'officedocument.wordprocessingml.'; + $drawingMLPrefix = $openXMLPrefix . 'officedocument.drawingml.'; $overrides = array( '/docProps/core.xml' => $openXMLPrefix . 'package.core-properties+xml', '/docProps/app.xml' => $openXMLPrefix . 'officedocument.extended-properties+xml', '/docProps/custom.xml' => $openXMLPrefix . 'officedocument.custom-properties+xml', - '/word/document.xml' => $wordMLPrefix . 'document.main+xml', - '/word/styles.xml' => $wordMLPrefix . 'styles+xml', - '/word/numbering.xml' => $wordMLPrefix . 'numbering+xml', - '/word/settings.xml' => $wordMLPrefix . 'settings+xml', + '/word/document.xml' => $wordMLPrefix . 'document.main+xml', + '/word/styles.xml' => $wordMLPrefix . 'styles+xml', + '/word/numbering.xml' => $wordMLPrefix . 'numbering+xml', + '/word/settings.xml' => $wordMLPrefix . 'settings+xml', '/word/theme/theme1.xml' => $openXMLPrefix . 'officedocument.theme+xml', - '/word/webSettings.xml' => $wordMLPrefix . 'webSettings+xml', - '/word/fontTable.xml' => $wordMLPrefix . 'fontTable+xml', - '/word/comments.xml' => $wordMLPrefix . 'comments+xml', + '/word/webSettings.xml' => $wordMLPrefix . 'webSettings+xml', + '/word/fontTable.xml' => $wordMLPrefix . 'fontTable+xml', + '/word/comments.xml' => $wordMLPrefix . 'comments+xml', ); $defaults = $contentTypes['default']; @@ -82,8 +82,7 @@ class ContentTypes extends AbstractPart * * @param \PhpOffice\Common\XMLWriter $xmlWriter XML Writer * @param array $parts - * @param boolean $isDefault - * @return void + * @param bool $isDefault */ private function writeContentType(XMLWriter $xmlWriter, $parts, $isDefault) { diff --git a/src/PhpWord/Writer/Word2007/Part/DocPropsApp.php b/src/PhpWord/Writer/Word2007/Part/DocPropsApp.php index adfe752f..dbd55187 100644 --- a/src/PhpWord/Writer/Word2007/Part/DocPropsApp.php +++ b/src/PhpWord/Writer/Word2007/Part/DocPropsApp.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/DocPropsCore.php b/src/PhpWord/Writer/Word2007/Part/DocPropsCore.php index afb6f286..fdabee36 100644 --- a/src/PhpWord/Writer/Word2007/Part/DocPropsCore.php +++ b/src/PhpWord/Writer/Word2007/Part/DocPropsCore.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php b/src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php index 63ed8ede..212e9d27 100644 --- a/src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php +++ b/src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Document.php b/src/PhpWord/Writer/Word2007/Part/Document.php index 11e3f510..72e4fcd8 100644 --- a/src/PhpWord/Writer/Word2007/Part/Document.php +++ b/src/PhpWord/Writer/Word2007/Part/Document.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -56,7 +56,6 @@ class Document extends AbstractPart $xmlWriter->startElement('w:body'); - if ($sectionCount > 0) { foreach ($sections as $section) { $currentSection++; @@ -83,7 +82,6 @@ class Document extends AbstractPart * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\Section $section - * @return void */ private function writeSection(XMLWriter $xmlWriter, Section $section) { @@ -99,7 +97,6 @@ class Document extends AbstractPart * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\Section $section - * @return void */ private function writeSectionSettings(XMLWriter $xmlWriter, Section $section) { diff --git a/src/PhpWord/Writer/Word2007/Part/Endnotes.php b/src/PhpWord/Writer/Word2007/Part/Endnotes.php index bc15cf1e..289119db 100644 --- a/src/PhpWord/Writer/Word2007/Part/Endnotes.php +++ b/src/PhpWord/Writer/Word2007/Part/Endnotes.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/FontTable.php b/src/PhpWord/Writer/Word2007/Part/FontTable.php index 08f0ad0e..065a318e 100644 --- a/src/PhpWord/Writer/Word2007/Part/FontTable.php +++ b/src/PhpWord/Writer/Word2007/Part/FontTable.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Footer.php b/src/PhpWord/Writer/Word2007/Part/Footer.php index 3e4e4fee..cfc9dd40 100644 --- a/src/PhpWord/Writer/Word2007/Part/Footer.php +++ b/src/PhpWord/Writer/Word2007/Part/Footer.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Footnotes.php b/src/PhpWord/Writer/Word2007/Part/Footnotes.php index fd692149..c9e3bcac 100644 --- a/src/PhpWord/Writer/Word2007/Part/Footnotes.php +++ b/src/PhpWord/Writer/Word2007/Part/Footnotes.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -137,7 +137,6 @@ class Footnotes extends AbstractPart * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\Footnote|\PhpOffice\PhpWord\Element\Endnote $element - * @return void */ protected function writeNote(XMLWriter $xmlWriter, $element) { diff --git a/src/PhpWord/Writer/Word2007/Part/Header.php b/src/PhpWord/Writer/Word2007/Part/Header.php index 438e503e..5853d92f 100644 --- a/src/PhpWord/Writer/Word2007/Part/Header.php +++ b/src/PhpWord/Writer/Word2007/Part/Header.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Numbering.php b/src/PhpWord/Writer/Word2007/Part/Numbering.php index c5c9b4c7..6233a6b7 100644 --- a/src/PhpWord/Writer/Word2007/Part/Numbering.php +++ b/src/PhpWord/Writer/Word2007/Part/Numbering.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -99,7 +99,6 @@ class Numbering extends AbstractPart * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\NumberingLevel $level - * @return void */ private function writeLevel(XMLWriter $xmlWriter, NumberingLevel $level) { @@ -140,7 +139,6 @@ class Numbering extends AbstractPart * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\NumberingLevel $level - * @return void * @todo Use paragraph style writer */ private function writeParagraph(XMLWriter $xmlWriter, NumberingLevel $level) @@ -173,7 +171,6 @@ class Numbering extends AbstractPart * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\NumberingLevel $level - * @return void * @todo Use font style writer */ private function writeFont(XMLWriter $xmlWriter, NumberingLevel $level) diff --git a/src/PhpWord/Writer/Word2007/Part/Rels.php b/src/PhpWord/Writer/Word2007/Part/Rels.php index 4a3b5b67..154c7e89 100644 --- a/src/PhpWord/Writer/Word2007/Part/Rels.php +++ b/src/PhpWord/Writer/Word2007/Part/Rels.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -53,7 +53,6 @@ class Rels extends AbstractPart * @param array $xmlRels * @param array $mediaRels * @param int $relId - * @return void */ protected function writeRels(XMLWriter $xmlWriter, $xmlRels = array(), $mediaRels = array(), $relId = 1) { @@ -80,7 +79,6 @@ class Rels extends AbstractPart * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param int $relId * @param array $mediaRel - * @return void */ private function writeMediaRel(XMLWriter $xmlWriter, $relId, $mediaRel) { @@ -109,8 +107,6 @@ class Rels extends AbstractPart * @param string $target Relationship target * @param string $targetMode Relationship target mode * - * @return void - * * @throws \PhpOffice\PhpWord\Exception\Exception */ private function writeRel(XMLWriter $xmlWriter, $relId, $type, $target, $targetMode = '') @@ -128,7 +124,7 @@ class Rels extends AbstractPart } $xmlWriter->endElement(); } else { - throw new Exception("Invalid parameters passed."); + throw new Exception('Invalid parameters passed.'); } } } diff --git a/src/PhpWord/Writer/Word2007/Part/RelsDocument.php b/src/PhpWord/Writer/Word2007/Part/RelsDocument.php index c60dba28..505aa223 100644 --- a/src/PhpWord/Writer/Word2007/Part/RelsDocument.php +++ b/src/PhpWord/Writer/Word2007/Part/RelsDocument.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/RelsPart.php b/src/PhpWord/Writer/Word2007/Part/RelsPart.php index e8939c7f..e639c041 100644 --- a/src/PhpWord/Writer/Word2007/Part/RelsPart.php +++ b/src/PhpWord/Writer/Word2007/Part/RelsPart.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index eca70d29..b205619d 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -24,7 +24,7 @@ use PhpOffice\PhpWord\Style\Language; /** * Word2007 settings part writer: word/settings.xml * - * @link http://www.schemacentral.com/sc/ooxml/t-w_CT_Settings.html + * @see http://www.schemacentral.com/sc/ooxml/t-w_CT_Settings.html */ class Settings extends AbstractPart { @@ -71,7 +71,6 @@ class Settings extends AbstractPart * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param string $settingKey * @param array|string $settingValue - * @return void */ protected function writeSetting($xmlWriter, $settingKey, $settingValue) { @@ -96,49 +95,46 @@ class Settings extends AbstractPart /** * Get settings. - * - * @return void */ private function getSettings() { - /** @var \PhpOffice\PhpWord\Metadata\Settings $documentSettings */ $documentSettings = $this->getParentWriter()->getPhpWord()->getSettings(); // Default settings $this->settings = array( - 'w:defaultTabStop' => array('@attributes' => array('w:val' => '708')), - 'w:hyphenationZone' => array('@attributes' => array('w:val' => '425')), + 'w:defaultTabStop' => array('@attributes' => array('w:val' => '708')), + 'w:hyphenationZone' => array('@attributes' => array('w:val' => '425')), 'w:characterSpacingControl' => array('@attributes' => array('w:val' => 'doNotCompress')), - 'w:decimalSymbol' => array('@attributes' => array('w:val' => $documentSettings->getDecimalSymbol())), - 'w:listSeparator' => array('@attributes' => array('w:val' => ';')), - 'w:compat' => array(), - 'm:mathPr' => array( - 'm:mathFont' => array('@attributes' => array('m:val' => 'Cambria Math')), - 'm:brkBin' => array('@attributes' => array('m:val' => 'before')), - 'm:brkBinSub' => array('@attributes' => array('m:val' => '--')), - 'm:smallFrac' => array('@attributes' => array('m:val' => 'off')), - 'm:dispDef' => '', - 'm:lMargin' => array('@attributes' => array('m:val' => '0')), - 'm:rMargin' => array('@attributes' => array('m:val' => '0')), - 'm:defJc' => array('@attributes' => array('m:val' => 'centerGroup')), + 'w:decimalSymbol' => array('@attributes' => array('w:val' => $documentSettings->getDecimalSymbol())), + 'w:listSeparator' => array('@attributes' => array('w:val' => ';')), + 'w:compat' => array(), + 'm:mathPr' => array( + 'm:mathFont' => array('@attributes' => array('m:val' => 'Cambria Math')), + 'm:brkBin' => array('@attributes' => array('m:val' => 'before')), + 'm:brkBinSub' => array('@attributes' => array('m:val' => '--')), + 'm:smallFrac' => array('@attributes' => array('m:val' => 'off')), + 'm:dispDef' => '', + 'm:lMargin' => array('@attributes' => array('m:val' => '0')), + 'm:rMargin' => array('@attributes' => array('m:val' => '0')), + 'm:defJc' => array('@attributes' => array('m:val' => 'centerGroup')), 'm:wrapIndent' => array('@attributes' => array('m:val' => '1440')), - 'm:intLim' => array('@attributes' => array('m:val' => 'subSup')), - 'm:naryLim' => array('@attributes' => array('m:val' => 'undOvr')), + 'm:intLim' => array('@attributes' => array('m:val' => 'subSup')), + 'm:naryLim' => array('@attributes' => array('m:val' => 'undOvr')), ), 'w:clrSchemeMapping' => array( '@attributes' => array( - 'w:bg1' => 'light1', - 'w:t1' => 'dark1', - 'w:bg2' => 'light2', - 'w:t2' => 'dark2', - 'w:accent1' => 'accent1', - 'w:accent2' => 'accent2', - 'w:accent3' => 'accent3', - 'w:accent4' => 'accent4', - 'w:accent5' => 'accent5', - 'w:accent6' => 'accent6', - 'w:hyperlink' => 'hyperlink', + 'w:bg1' => 'light1', + 'w:t1' => 'dark1', + 'w:bg2' => 'light2', + 'w:t2' => 'dark2', + 'w:accent1' => 'accent1', + 'w:accent2' => 'accent2', + 'w:accent3' => 'accent3', + 'w:accent4' => 'accent4', + 'w:accent5' => 'accent5', + 'w:accent6' => 'accent6', + 'w:hyperlink' => 'hyperlink', 'w:followedHyperlink' => 'followedHyperlink', ), ), @@ -163,7 +159,7 @@ class Settings extends AbstractPart * Adds a boolean attribute to the settings array * * @param string $settingName - * @param boolean $booleanValue + * @param bool $booleanValue */ private function setOnOffValue($settingName, $booleanValue) { @@ -180,7 +176,6 @@ class Settings extends AbstractPart * Get protection settings. * * @param \PhpOffice\PhpWord\Metadata\Protection $documentProtection - * @return void */ private function setDocumentProtection($documentProtection) { @@ -188,8 +183,8 @@ class Settings extends AbstractPart $this->settings['w:documentProtection'] = array( '@attributes' => array( 'w:enforcement' => 1, - 'w:edit' => $documentProtection->getEditing(), - ) + 'w:edit' => $documentProtection->getEditing(), + ), ); } } @@ -205,8 +200,8 @@ class Settings extends AbstractPart $this->settings['w:proofState'] = array( '@attributes' => array( 'w:spelling' => $proofState->getSpelling(), - 'w:grammar' => $proofState->getGrammar() - ) + 'w:grammar' => $proofState->getGrammar(), + ), ); } } @@ -219,11 +214,11 @@ class Settings extends AbstractPart private function setRevisionView(TrackChangesView $trackChangesView = null) { if ($trackChangesView != null) { - $revisionView['w:markup'] = $trackChangesView->hasMarkup() ? 'true': 'false'; - $revisionView['w:comments'] = $trackChangesView->hasComments() ? 'true': 'false'; - $revisionView['w:insDel'] = $trackChangesView->hasInsDel() ? 'true': 'false'; - $revisionView['w:formatting'] = $trackChangesView->hasFormatting() ? 'true': 'false'; - $revisionView['w:inkAnnotations'] = $trackChangesView->hasInkAnnotations() ? 'true': 'false'; + $revisionView['w:markup'] = $trackChangesView->hasMarkup() ? 'true' : 'false'; + $revisionView['w:comments'] = $trackChangesView->hasComments() ? 'true' : 'false'; + $revisionView['w:insDel'] = $trackChangesView->hasInsDel() ? 'true' : 'false'; + $revisionView['w:formatting'] = $trackChangesView->hasFormatting() ? 'true' : 'false'; + $revisionView['w:inkAnnotations'] = $trackChangesView->hasInkAnnotations() ? 'true' : 'false'; $this->settings['w:revisionView'] = array('@attributes' => $revisionView); } @@ -231,7 +226,7 @@ class Settings extends AbstractPart /** * Sets the language - * + * * @param Language $language */ private function setThemeFontLang(Language $language = null) @@ -261,8 +256,6 @@ class Settings extends AbstractPart /** * Get compatibility setting. - * - * @return void */ private function getCompatibility() { diff --git a/src/PhpWord/Writer/Word2007/Part/Styles.php b/src/PhpWord/Writer/Word2007/Part/Styles.php index 7795d56b..126cda4f 100644 --- a/src/PhpWord/Writer/Word2007/Part/Styles.php +++ b/src/PhpWord/Writer/Word2007/Part/Styles.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -79,7 +79,6 @@ class Styles extends AbstractPart * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\AbstractStyle[] $styles - * @return void */ private function writeDefaultStyles(XMLWriter $xmlWriter, $styles) { @@ -154,7 +153,6 @@ class Styles extends AbstractPart * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param string $styleName * @param \PhpOffice\PhpWord\Style\Font $style - * @return void */ private function writeFontStyle(XMLWriter $xmlWriter, $styleName, FontStyle $style) { @@ -179,7 +177,7 @@ class Styles extends AbstractPart $xmlWriter->startElement('w:link'); $xmlWriter->writeAttribute('w:val', $styleLink); $xmlWriter->endElement(); - } else if (!is_null($paragraphStyle)) { + } elseif (!is_null($paragraphStyle)) { // if type is 'paragraph' it should have a styleId $xmlWriter->writeAttribute('w:styleId', $styleName); } @@ -217,7 +215,6 @@ class Styles extends AbstractPart * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param string $styleName * @param \PhpOffice\PhpWord\Style\Paragraph $style - * @return void */ private function writeParagraphStyle(XMLWriter $xmlWriter, $styleName, ParagraphStyle $style) { @@ -250,7 +247,6 @@ class Styles extends AbstractPart * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param string $styleName * @param \PhpOffice\PhpWord\Style\Table $style - * @return void */ private function writeTableStyle(XMLWriter $xmlWriter, $styleName, TableStyle $style) { diff --git a/src/PhpWord/Writer/Word2007/Part/Theme.php b/src/PhpWord/Writer/Word2007/Part/Theme.php index e9b16bfc..c264140e 100644 --- a/src/PhpWord/Writer/Word2007/Part/Theme.php +++ b/src/PhpWord/Writer/Word2007/Part/Theme.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -48,7 +48,6 @@ class Theme extends AbstractPart return $str; } - /** * Write color scheme * diff --git a/src/PhpWord/Writer/Word2007/Part/WebSettings.php b/src/PhpWord/Writer/Word2007/Part/WebSettings.php index ce42063d..9f18e356 100644 --- a/src/PhpWord/Writer/Word2007/Part/WebSettings.php +++ b/src/PhpWord/Writer/Word2007/Part/WebSettings.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/AbstractStyle.php b/src/PhpWord/Writer/Word2007/Style/AbstractStyle.php index 0b8b0a52..d7756933 100644 --- a/src/PhpWord/Writer/Word2007/Style/AbstractStyle.php +++ b/src/PhpWord/Writer/Word2007/Style/AbstractStyle.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -88,11 +88,11 @@ abstract class AbstractStyle protected function convertTwip($value, $default = 0) { $factors = array( - Settings::UNIT_CM => 567, - Settings::UNIT_MM => 56.7, - Settings::UNIT_INCH => 1440, + Settings::UNIT_CM => 567, + Settings::UNIT_MM => 56.7, + Settings::UNIT_INCH => 1440, Settings::UNIT_POINT => 20, - Settings::UNIT_PICA => 240, + Settings::UNIT_PICA => 240, ); $unit = Settings::getMeasurementUnit(); $factor = 1; @@ -109,12 +109,11 @@ abstract class AbstractStyle * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param string $name * @param mixed $value - * @return void */ protected function writeChildStyle(XMLWriter $xmlWriter, $name, $value) { if ($value !== null) { - $class = "PhpOffice\\PhpWord\\Writer\\Word2007\\Style\\" . $name; + $class = 'PhpOffice\\PhpWord\\Writer\\Word2007\\Style\\' . $name; /** @var \PhpOffice\PhpWord\Writer\Word2007\Style\AbstractStyle $writer */ $writer = new $class($xmlWriter, $value); diff --git a/src/PhpWord/Writer/Word2007/Style/Cell.php b/src/PhpWord/Writer/Word2007/Style/Cell.php index c9156de1..c2cf1c7c 100644 --- a/src/PhpWord/Writer/Word2007/Style/Cell.php +++ b/src/PhpWord/Writer/Word2007/Style/Cell.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -33,8 +33,6 @@ class Cell extends AbstractStyle /** * Write style. - * - * @return void */ public function write() { @@ -93,7 +91,6 @@ class Cell extends AbstractStyle * Set width. * * @param int $value - * @return void */ public function setWidth($value = null) { diff --git a/src/PhpWord/Writer/Word2007/Style/Extrusion.php b/src/PhpWord/Writer/Word2007/Style/Extrusion.php index 3ecd76e4..e3a86a58 100644 --- a/src/PhpWord/Writer/Word2007/Style/Extrusion.php +++ b/src/PhpWord/Writer/Word2007/Style/Extrusion.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,8 +26,6 @@ class Extrusion extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { @@ -37,7 +35,7 @@ class Extrusion extends AbstractStyle } $xmlWriter = $this->getXmlWriter(); - $xmlWriter->startElement("o:extrusion"); + $xmlWriter->startElement('o:extrusion'); $xmlWriter->writeAttribute('on', 't'); $xmlWriter->writeAttributeIf($style->getType() !== null, 'type', $style->getType()); $xmlWriter->writeAttributeIf($style->getColor() !== null, 'color', $style->getColor()); diff --git a/src/PhpWord/Writer/Word2007/Style/Fill.php b/src/PhpWord/Writer/Word2007/Style/Fill.php index 7ce68106..de64313b 100644 --- a/src/PhpWord/Writer/Word2007/Style/Fill.php +++ b/src/PhpWord/Writer/Word2007/Style/Fill.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,8 +26,6 @@ class Fill extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Style/Font.php b/src/PhpWord/Writer/Word2007/Style/Font.php index 2248a448..0cb3209f 100644 --- a/src/PhpWord/Writer/Word2007/Style/Font.php +++ b/src/PhpWord/Writer/Word2007/Style/Font.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -33,8 +33,6 @@ class Font extends AbstractStyle /** * Write style. - * - * @return void */ public function write() { @@ -54,8 +52,6 @@ class Font extends AbstractStyle /** * Write full style. - * - * @return void */ private function writeStyle() { @@ -139,7 +135,7 @@ class Font extends AbstractStyle $styleWriter = new Shading($xmlWriter, $shading); $styleWriter->write(); } - + // RTL if ($this->isInline === true) { $styleName = $style->getStyleName(); @@ -153,7 +149,6 @@ class Font extends AbstractStyle * Set is inline. * * @param bool $value - * @return void */ public function setIsInline($value) { diff --git a/src/PhpWord/Writer/Word2007/Style/Frame.php b/src/PhpWord/Writer/Word2007/Style/Frame.php index 9c6ddaef..da5aee1e 100644 --- a/src/PhpWord/Writer/Word2007/Style/Frame.php +++ b/src/PhpWord/Writer/Word2007/Style/Frame.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -30,8 +30,6 @@ class Frame extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { @@ -62,7 +60,7 @@ class Frame extends AbstractStyle $styles = array_merge($sizeStyles, $posStyles); - // zIndex for infront & behind wrap + // zIndex for infront & behind wrap $wrap = $style->getWrap(); if ($wrap !== null && isset($zIndices[$wrap])) { $styles['z-index'] = $zIndices[$wrap]; @@ -77,8 +75,6 @@ class Frame extends AbstractStyle /** * Write alignment. - * - * @return void */ public function writeAlignment() { @@ -108,7 +104,6 @@ class Frame extends AbstractStyle * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Frame $style * @param string $wrap - * @return void */ private function writeWrap(XMLWriter $xmlWriter, FrameStyle $style, $wrap) { @@ -129,8 +124,8 @@ class Frame extends AbstractStyle $vPos = $style->getVPosRelTo(); if ($pos == FrameStyle::POS_ABSOLUTE) { - $xmlWriter->writeAttribute('anchorx', "page"); - $xmlWriter->writeAttribute('anchory', "page"); + $xmlWriter->writeAttribute('anchorx', 'page'); + $xmlWriter->writeAttribute('anchory', 'page'); } elseif ($pos == FrameStyle::POS_RELATIVE) { if (isset($relativePositions[$hPos])) { $xmlWriter->writeAttribute('anchorx', $relativePositions[$hPos]); diff --git a/src/PhpWord/Writer/Word2007/Style/Image.php b/src/PhpWord/Writer/Word2007/Style/Image.php index 3bbe751e..271b99df 100644 --- a/src/PhpWord/Writer/Word2007/Style/Image.php +++ b/src/PhpWord/Writer/Word2007/Style/Image.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Indentation.php b/src/PhpWord/Writer/Word2007/Style/Indentation.php index a7edaee1..c5a598ff 100644 --- a/src/PhpWord/Writer/Word2007/Style/Indentation.php +++ b/src/PhpWord/Writer/Word2007/Style/Indentation.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,8 +26,6 @@ class Indentation extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Style/Line.php b/src/PhpWord/Writer/Word2007/Style/Line.php index 3407c252..f065e521 100644 --- a/src/PhpWord/Writer/Word2007/Style/Line.php +++ b/src/PhpWord/Writer/Word2007/Style/Line.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -21,14 +21,11 @@ use PhpOffice\PhpWord\Style\Line as LineStyle; /** * Line style writer - * */ class Line extends Frame { /** * Write Line stroke. - * - * @return void * @todo Merge with `Stroke` style */ public function writeStroke() diff --git a/src/PhpWord/Writer/Word2007/Style/LineNumbering.php b/src/PhpWord/Writer/Word2007/Style/LineNumbering.php index 592fb7bb..3ed577c6 100644 --- a/src/PhpWord/Writer/Word2007/Style/LineNumbering.php +++ b/src/PhpWord/Writer/Word2007/Style/LineNumbering.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,9 +26,6 @@ class LineNumbering extends AbstractStyle { /** * Write style. - * - * @return void - * * The w:start seems to be zero based so we have to decrement by one */ public function write() diff --git a/src/PhpWord/Writer/Word2007/Style/MarginBorder.php b/src/PhpWord/Writer/Word2007/Style/MarginBorder.php index 68ba70d2..3d877384 100644 --- a/src/PhpWord/Writer/Word2007/Style/MarginBorder.php +++ b/src/PhpWord/Writer/Word2007/Style/MarginBorder.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -29,7 +29,7 @@ class MarginBorder extends AbstractStyle /** * Sizes * - * @var integer[] + * @var int[] */ private $sizes = array(); @@ -49,8 +49,6 @@ class MarginBorder extends AbstractStyle /** * Write style. - * - * @return void */ public function write() { @@ -76,7 +74,6 @@ class MarginBorder extends AbstractStyle * @param string $side * @param int $width * @param string $color - * @return void */ private function writeSide(XMLWriter $xmlWriter, $side, $width, $color = null) { @@ -105,8 +102,7 @@ class MarginBorder extends AbstractStyle /** * Set sizes. * - * @param integer[] $value - * @return void + * @param int[] $value */ public function setSizes($value) { @@ -117,7 +113,6 @@ class MarginBorder extends AbstractStyle * Set colors. * * @param string[] $value - * @return void */ public function setColors($value) { @@ -128,7 +123,6 @@ class MarginBorder extends AbstractStyle * Set attributes. * * @param array $value - * @return void */ public function setAttributes($value) { diff --git a/src/PhpWord/Writer/Word2007/Style/Outline.php b/src/PhpWord/Writer/Word2007/Style/Outline.php index 620720b3..9ae61f39 100644 --- a/src/PhpWord/Writer/Word2007/Style/Outline.php +++ b/src/PhpWord/Writer/Word2007/Style/Outline.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,8 +26,6 @@ class Outline extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { @@ -37,7 +35,7 @@ class Outline extends AbstractStyle } $xmlWriter = $this->getXmlWriter(); - $xmlWriter->startElement("v:stroke"); + $xmlWriter->startElement('v:stroke'); $xmlWriter->writeAttribute('on', 't'); $xmlWriter->writeAttributeIf($style->getColor() !== null, 'color', $style->getColor()); $xmlWriter->writeAttributeIf($style->getWeight() !== null, 'weight', $style->getWeight() . $style->getUnit()); diff --git a/src/PhpWord/Writer/Word2007/Style/Paragraph.php b/src/PhpWord/Writer/Word2007/Style/Paragraph.php index 32f8abba..707bf031 100644 --- a/src/PhpWord/Writer/Word2007/Style/Paragraph.php +++ b/src/PhpWord/Writer/Word2007/Style/Paragraph.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -45,8 +45,6 @@ class Paragraph extends AbstractStyle /** * Write style. - * - * @return void */ public function write() { @@ -70,8 +68,6 @@ class Paragraph extends AbstractStyle /** * Write full style. - * - * @return void */ private function writeStyle() { @@ -146,12 +142,11 @@ class Paragraph extends AbstractStyle * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Tab[] $tabs - * @return void */ private function writeTabs(XMLWriter $xmlWriter, $tabs) { if (!empty($tabs)) { - $xmlWriter->startElement("w:tabs"); + $xmlWriter->startElement('w:tabs'); foreach ($tabs as $tab) { $styleWriter = new Tab($xmlWriter, $tab); $styleWriter->write(); @@ -165,7 +160,6 @@ class Paragraph extends AbstractStyle * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param array $numbering - * @return void */ private function writeNumbering(XMLWriter $xmlWriter, $numbering) { @@ -194,7 +188,6 @@ class Paragraph extends AbstractStyle * Set without w:pPr. * * @param bool $value - * @return void */ public function setWithoutPPR($value) { @@ -205,7 +198,6 @@ class Paragraph extends AbstractStyle * Set is inline. * * @param bool $value - * @return void */ public function setIsInline($value) { diff --git a/src/PhpWord/Writer/Word2007/Style/Row.php b/src/PhpWord/Writer/Word2007/Style/Row.php index e8b7e1a5..f57094db 100644 --- a/src/PhpWord/Writer/Word2007/Style/Row.php +++ b/src/PhpWord/Writer/Word2007/Style/Row.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -31,8 +31,6 @@ class Row extends AbstractStyle /** * Write style. - * - * @return void */ public function write() { @@ -60,7 +58,6 @@ class Row extends AbstractStyle * Set height. * * @param int $value - * @return void */ public function setHeight($value = null) { diff --git a/src/PhpWord/Writer/Word2007/Style/Section.php b/src/PhpWord/Writer/Word2007/Style/Section.php index 60b5d869..ef50c111 100644 --- a/src/PhpWord/Writer/Word2007/Style/Section.php +++ b/src/PhpWord/Writer/Word2007/Style/Section.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -28,8 +28,6 @@ class Section extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Style/Shading.php b/src/PhpWord/Writer/Word2007/Style/Shading.php index c3594b24..a8e6592a 100644 --- a/src/PhpWord/Writer/Word2007/Style/Shading.php +++ b/src/PhpWord/Writer/Word2007/Style/Shading.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,8 +26,6 @@ class Shading extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Style/Shadow.php b/src/PhpWord/Writer/Word2007/Style/Shadow.php index 239c161d..5efc38c4 100644 --- a/src/PhpWord/Writer/Word2007/Style/Shadow.php +++ b/src/PhpWord/Writer/Word2007/Style/Shadow.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,8 +26,6 @@ class Shadow extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { @@ -37,7 +35,7 @@ class Shadow extends AbstractStyle } $xmlWriter = $this->getXmlWriter(); - $xmlWriter->startElement("v:shadow"); + $xmlWriter->startElement('v:shadow'); $xmlWriter->writeAttribute('on', 't'); $xmlWriter->writeAttributeIf($style->getColor() !== null, 'color', $style->getColor()); $xmlWriter->writeAttributeIf($style->getOffset() !== null, 'offset', $style->getOffset()); diff --git a/src/PhpWord/Writer/Word2007/Style/Shape.php b/src/PhpWord/Writer/Word2007/Style/Shape.php index 4ed1469d..aad42ae7 100644 --- a/src/PhpWord/Writer/Word2007/Style/Shape.php +++ b/src/PhpWord/Writer/Word2007/Style/Shape.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,8 +26,6 @@ class Shape extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Style/Spacing.php b/src/PhpWord/Writer/Word2007/Style/Spacing.php index bd2d06aa..8db78161 100644 --- a/src/PhpWord/Writer/Word2007/Style/Spacing.php +++ b/src/PhpWord/Writer/Word2007/Style/Spacing.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,8 +26,6 @@ class Spacing extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Style/Tab.php b/src/PhpWord/Writer/Word2007/Style/Tab.php index 9867023f..7b0a0ab5 100644 --- a/src/PhpWord/Writer/Word2007/Style/Tab.php +++ b/src/PhpWord/Writer/Word2007/Style/Tab.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,8 +26,6 @@ class Tab extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { @@ -37,9 +35,9 @@ class Tab extends AbstractStyle } $xmlWriter = $this->getXmlWriter(); - $xmlWriter->startElement("w:tab"); - $xmlWriter->writeAttribute("w:val", $style->getType()); - $xmlWriter->writeAttribute("w:leader", $style->getLeader()); + $xmlWriter->startElement('w:tab'); + $xmlWriter->writeAttribute('w:val', $style->getType()); + $xmlWriter->writeAttribute('w:leader', $style->getLeader()); $xmlWriter->writeAttribute('w:pos', $this->convertTwip($style->getPosition())); $xmlWriter->endElement(); } diff --git a/src/PhpWord/Writer/Word2007/Style/Table.php b/src/PhpWord/Writer/Word2007/Style/Table.php index 570e85bb..620e4fbf 100644 --- a/src/PhpWord/Writer/Word2007/Style/Table.php +++ b/src/PhpWord/Writer/Word2007/Style/Table.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -35,8 +35,6 @@ class Table extends AbstractStyle /** * Write style. - * - * @return void */ public function write() { @@ -62,7 +60,6 @@ class Table extends AbstractStyle * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Table $style - * @return void */ private function writeStyle(XMLWriter $xmlWriter, TableStyle $style) { @@ -100,7 +97,6 @@ class Table extends AbstractStyle * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param int $width * @param string $unit - * @return void */ private function writeWidth(XMLWriter $xmlWriter, $width, $unit) { @@ -115,7 +111,6 @@ class Table extends AbstractStyle * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Table $style - * @return void */ private function writeMargin(XMLWriter $xmlWriter, TableStyle $style) { @@ -135,7 +130,6 @@ class Table extends AbstractStyle * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Table $style - * @return void */ private function writeBorder(XMLWriter $xmlWriter, TableStyle $style) { @@ -156,7 +150,6 @@ class Table extends AbstractStyle * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Table $style - * @return void */ private function writeFirstRow(XMLWriter $xmlWriter, TableStyle $style) { @@ -176,7 +169,6 @@ class Table extends AbstractStyle * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Table $style - * @return void */ private function writeShading(XMLWriter $xmlWriter, TableStyle $style) { @@ -194,7 +186,6 @@ class Table extends AbstractStyle * Set width. * * @param int $value - * @return void */ public function setWidth($value = null) { diff --git a/src/PhpWord/Writer/Word2007/Style/TextBox.php b/src/PhpWord/Writer/Word2007/Style/TextBox.php index f8f94da3..cd92f845 100644 --- a/src/PhpWord/Writer/Word2007/Style/TextBox.php +++ b/src/PhpWord/Writer/Word2007/Style/TextBox.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -28,8 +28,6 @@ class TextBox extends Frame { /** * Writer inner margin. - * - * @return void */ public function writeInnerMargin() { @@ -46,8 +44,6 @@ class TextBox extends Frame /** * Writer border. - * - * @return void */ public function writeBorder() { diff --git a/src/PhpWord/Writer/WriterInterface.php b/src/PhpWord/Writer/WriterInterface.php index 1ccdf321..b5f08199 100644 --- a/src/PhpWord/Writer/WriterInterface.php +++ b/src/PhpWord/Writer/WriterInterface.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Collection/CollectionTest.php b/tests/PhpWord/Collection/CollectionTest.php index 4b2fa0ca..22f89b72 100644 --- a/tests/PhpWord/Collection/CollectionTest.php +++ b/tests/PhpWord/Collection/CollectionTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/ComplexType/FootnotePropertiesTest.php b/tests/PhpWord/ComplexType/FootnotePropertiesTest.php index aa46d89b..55e22e6f 100644 --- a/tests/PhpWord/ComplexType/FootnotePropertiesTest.php +++ b/tests/PhpWord/ComplexType/FootnotePropertiesTest.php @@ -10,14 +10,13 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ namespace PhpOffice\PhpWord\ComplexType; -use PhpOffice\PhpWord\ComplexType\FootnoteProperties; use PhpOffice\PhpWord\SimpleType\NumberFormat; /** @@ -52,7 +51,7 @@ class FootnotePropertiesTest extends \PHPUnit_Framework_TestCase */ public function testWrongPos() { - $footnoteProp= new FootnoteProperties(); + $footnoteProp = new FootnoteProperties(); $footnoteProp->setPos(NumberFormat::LOWER_ROMAN); } @@ -63,7 +62,7 @@ class FootnotePropertiesTest extends \PHPUnit_Framework_TestCase */ public function testWrongNumFmt() { - $footnoteProp= new FootnoteProperties(); + $footnoteProp = new FootnoteProperties(); $footnoteProp->setNumFmt(FootnoteProperties::POSITION_DOC_END); } @@ -74,7 +73,7 @@ class FootnotePropertiesTest extends \PHPUnit_Framework_TestCase */ public function testWrongNumRestart() { - $footnoteProp= new FootnoteProperties(); + $footnoteProp = new FootnoteProperties(); $footnoteProp->setNumRestart(NumberFormat::LOWER_ROMAN); } } diff --git a/tests/PhpWord/ComplexType/ProofStateTest.php b/tests/PhpWord/ComplexType/ProofStateTest.php index 0b7e74ca..e807ca2f 100644 --- a/tests/PhpWord/ComplexType/ProofStateTest.php +++ b/tests/PhpWord/ComplexType/ProofStateTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\ComplexType; /** @@ -23,13 +24,12 @@ namespace PhpOffice\PhpWord\ComplexType; */ class ProofStateTest extends \PHPUnit_Framework_TestCase { - /** * Tests the getters and setters */ public function testGetSet() { - $pState= new ProofState(); + $pState = new ProofState(); $pState->setGrammar(ProofState::CLEAN); $pState->setSpelling(ProofState::DIRTY); @@ -55,7 +55,7 @@ class ProofStateTest extends \PHPUnit_Framework_TestCase */ public function testWrongSpelling() { - $pState= new ProofState(); + $pState = new ProofState(); $pState->setSpelling('Wrong'); } } diff --git a/tests/PhpWord/Element/AbstractElementTest.php b/tests/PhpWord/Element/AbstractElementTest.php index 83f209e4..458b94c8 100644 --- a/tests/PhpWord/Element/AbstractElementTest.php +++ b/tests/PhpWord/Element/AbstractElementTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/BookmarkTest.php b/tests/PhpWord/Element/BookmarkTest.php new file mode 100644 index 00000000..da86a62e --- /dev/null +++ b/tests/PhpWord/Element/BookmarkTest.php @@ -0,0 +1,38 @@ +assertInstanceOf('PhpOffice\\PhpWord\\Element\\Bookmark', $oBookmark); + $this->assertEquals($bookmarkName, $oBookmark->getName()); + } +} diff --git a/tests/PhpWord/Element/CellTest.php b/tests/PhpWord/Element/CellTest.php index f1d6a280..aff208c4 100644 --- a/tests/PhpWord/Element/CellTest.php +++ b/tests/PhpWord/Element/CellTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/CheckBoxTest.php b/tests/PhpWord/Element/CheckBoxTest.php index 183d22db..fb71b8c2 100644 --- a/tests/PhpWord/Element/CheckBoxTest.php +++ b/tests/PhpWord/Element/CheckBoxTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/CommentTest.php b/tests/PhpWord/Element/CommentTest.php index db9ec902..fd2c814d 100644 --- a/tests/PhpWord/Element/CommentTest.php +++ b/tests/PhpWord/Element/CommentTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -80,4 +80,24 @@ class CommentTest extends \PHPUnit_Framework_TestCase $oComment->setRelationId($iVal); $this->assertEquals($iVal, $oComment->getRelationId()); } + + /** + * @expectedException \InvalidArgumentException + */ + public function testExceptionOnCommentStartOnComment() + { + $dummyComment = new Comment('Test User', new \DateTime(), 'my_initials'); + $oComment = new Comment('Test User', new \DateTime(), 'my_initials'); + $oComment->setCommentRangeStart($dummyComment); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testExceptionOnCommentEndOnComment() + { + $dummyComment = new Comment('Test User', new \DateTime(), 'my_initials'); + $oComment = new Comment('Test User', new \DateTime(), 'my_initials'); + $oComment->setCommentRangeEnd($dummyComment); + } } diff --git a/tests/PhpWord/Element/FieldTest.php b/tests/PhpWord/Element/FieldTest.php index 6f5ebbbf..1bd0c216 100644 --- a/tests/PhpWord/Element/FieldTest.php +++ b/tests/PhpWord/Element/FieldTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/FooterTest.php b/tests/PhpWord/Element/FooterTest.php index 33a211d3..2938ae5e 100644 --- a/tests/PhpWord/Element/FooterTest.php +++ b/tests/PhpWord/Element/FooterTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/FootnoteTest.php b/tests/PhpWord/Element/FootnoteTest.php index a3f3b4d8..b02ab5c6 100644 --- a/tests/PhpWord/Element/FootnoteTest.php +++ b/tests/PhpWord/Element/FootnoteTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/HeaderTest.php b/tests/PhpWord/Element/HeaderTest.php index f75910aa..13ace285 100644 --- a/tests/PhpWord/Element/HeaderTest.php +++ b/tests/PhpWord/Element/HeaderTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -228,7 +228,7 @@ class HeaderTest extends \PHPUnit_Framework_TestCase /** * Add footnote exception * - * @expectedException BadMethodCallException + * @expectedException \BadMethodCallException */ public function testAddFootnoteException() { diff --git a/tests/PhpWord/Element/ImageTest.php b/tests/PhpWord/Element/ImageTest.php index 974e868c..80e0bcfc 100644 --- a/tests/PhpWord/Element/ImageTest.php +++ b/tests/PhpWord/Element/ImageTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -133,9 +133,9 @@ class ImageTest extends \PHPUnit_Framework_TestCase { //disable ssl verification, never do this in real application, you should pass the certiciate instead!!! $arrContextOptions = array( - "ssl" => array( - "verify_peer" => false, - "verify_peer_name" => false, + 'ssl' => array( + 'verify_peer' => false, + 'verify_peer_name' => false, ), ); stream_context_set_default($arrContextOptions); diff --git a/tests/PhpWord/Element/LineTest.php b/tests/PhpWord/Element/LineTest.php index a7b15b08..a6e3f79b 100644 --- a/tests/PhpWord/Element/LineTest.php +++ b/tests/PhpWord/Element/LineTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/LinkTest.php b/tests/PhpWord/Element/LinkTest.php index 40f07a1f..48b576c3 100644 --- a/tests/PhpWord/Element/LinkTest.php +++ b/tests/PhpWord/Element/LinkTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -49,7 +49,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase $oLink = new Link( 'https://github.com/PHPOffice/PHPWord', 'PHPWord on GitHub', - array('color' => '0000FF', 'underline' => Font::UNDERLINE_SINGLE), + array('color' => '0000FF', 'underline' => Font::UNDERLINE_SINGLE), array('marginLeft' => 600, 'marginRight' => 600, 'marginTop' => 600, 'marginBottom' => 600) ); diff --git a/tests/PhpWord/Element/ListItemRunTest.php b/tests/PhpWord/Element/ListItemRunTest.php index 91609357..0c4c1ac9 100644 --- a/tests/PhpWord/Element/ListItemRunTest.php +++ b/tests/PhpWord/Element/ListItemRunTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/ListItemTest.php b/tests/PhpWord/Element/ListItemTest.php index 2dc4f65c..775a97d4 100644 --- a/tests/PhpWord/Element/ListItemTest.php +++ b/tests/PhpWord/Element/ListItemTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/ObjectTest.php b/tests/PhpWord/Element/ObjectTest.php index 44516b61..51ed19b5 100644 --- a/tests/PhpWord/Element/ObjectTest.php +++ b/tests/PhpWord/Element/ObjectTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,9 +26,22 @@ namespace PhpOffice\PhpWord\Element; class ObjectTest extends \PHPUnit_Framework_TestCase { /** - * Create new instance with supported files + * Create new instance with supported files, 4 character extention */ public function testConstructWithSupportedFiles() + { + $src = __DIR__ . '/../_files/documents/reader.docx'; + $oObject = new Object($src); + + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Object', $oObject); + $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Image', $oObject->getStyle()); + $this->assertEquals($src, $oObject->getSource()); + } + + /** + * Create new instance with supported files + */ + public function testConstructWithSupportedFilesLong() { $src = __DIR__ . '/../_files/documents/sheet.xls'; $oObject = new Object($src); diff --git a/tests/PhpWord/Element/PageBreakTest.php b/tests/PhpWord/Element/PageBreakTest.php index 3d8b1db6..69a71204 100644 --- a/tests/PhpWord/Element/PageBreakTest.php +++ b/tests/PhpWord/Element/PageBreakTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/PreserveTextTest.php b/tests/PhpWord/Element/PreserveTextTest.php index 33e2272a..a47cc77c 100644 --- a/tests/PhpWord/Element/PreserveTextTest.php +++ b/tests/PhpWord/Element/PreserveTextTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/RowTest.php b/tests/PhpWord/Element/RowTest.php index 58a166f4..cb365dad 100644 --- a/tests/PhpWord/Element/RowTest.php +++ b/tests/PhpWord/Element/RowTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/SDTTest.php b/tests/PhpWord/Element/SDTTest.php index 52705bc1..fc3682b6 100644 --- a/tests/PhpWord/Element/SDTTest.php +++ b/tests/PhpWord/Element/SDTTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/SectionTest.php b/tests/PhpWord/Element/SectionTest.php index 78010bc9..aebfc9b7 100644 --- a/tests/PhpWord/Element/SectionTest.php +++ b/tests/PhpWord/Element/SectionTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -129,6 +129,17 @@ class SectionTest extends \PHPUnit_Framework_TestCase $this->assertFalse($object->hasDifferentFirstPage()); } + /** + * @covers ::addHeader + * @covers ::hasDifferentFirstPage + */ + public function testHasDifferentFirstPageFooter() + { + $object = new Section(1); + $object->addFooter(Header::FIRST); + $this->assertTrue($object->hasDifferentFirstPage()); + } + /** * @covers ::addHeader * @covers ::hasDifferentFirstPage diff --git a/tests/PhpWord/Element/TOCTest.php b/tests/PhpWord/Element/TOCTest.php index 6b5867bc..655d567c 100644 --- a/tests/PhpWord/Element/TOCTest.php +++ b/tests/PhpWord/Element/TOCTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/TableTest.php b/tests/PhpWord/Element/TableTest.php index 785ec40a..3085aee2 100644 --- a/tests/PhpWord/Element/TableTest.php +++ b/tests/PhpWord/Element/TableTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/TextBoxTest.php b/tests/PhpWord/Element/TextBoxTest.php index cb3fdb99..cc61e20d 100644 --- a/tests/PhpWord/Element/TextBoxTest.php +++ b/tests/PhpWord/Element/TextBoxTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/TextBreakTest.php b/tests/PhpWord/Element/TextBreakTest.php index 40ed6965..62186244 100644 --- a/tests/PhpWord/Element/TextBreakTest.php +++ b/tests/PhpWord/Element/TextBreakTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/TextRunTest.php b/tests/PhpWord/Element/TextRunTest.php index efd8d6f3..59db597c 100644 --- a/tests/PhpWord/Element/TextRunTest.php +++ b/tests/PhpWord/Element/TextRunTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/TextTest.php b/tests/PhpWord/Element/TextTest.php index d2fe0472..9723a2e1 100644 --- a/tests/PhpWord/Element/TextTest.php +++ b/tests/PhpWord/Element/TextTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/TitleTest.php b/tests/PhpWord/Element/TitleTest.php index 2b886e5e..500de133 100644 --- a/tests/PhpWord/Element/TitleTest.php +++ b/tests/PhpWord/Element/TitleTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Exception/CopyFileExceptionTest.php b/tests/PhpWord/Exception/CopyFileExceptionTest.php index 0bc2e322..9d921740 100644 --- a/tests/PhpWord/Exception/CopyFileExceptionTest.php +++ b/tests/PhpWord/Exception/CopyFileExceptionTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php b/tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php index d68bf573..91c7012f 100644 --- a/tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php +++ b/tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Exception/ExceptionTest.php b/tests/PhpWord/Exception/ExceptionTest.php index 4c14abb9..28b15702 100644 --- a/tests/PhpWord/Exception/ExceptionTest.php +++ b/tests/PhpWord/Exception/ExceptionTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -33,6 +33,6 @@ class ExceptionTest extends \PHPUnit_Framework_TestCase */ public function testThrowException() { - throw new Exception; + throw new Exception(); } } diff --git a/tests/PhpWord/Exception/InvalidImageExceptionTest.php b/tests/PhpWord/Exception/InvalidImageExceptionTest.php index d83aa878..dfaadbd7 100644 --- a/tests/PhpWord/Exception/InvalidImageExceptionTest.php +++ b/tests/PhpWord/Exception/InvalidImageExceptionTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -33,6 +33,6 @@ class InvalidImageExceptionTest extends \PHPUnit_Framework_TestCase */ public function testThrowException() { - throw new InvalidImageException; + throw new InvalidImageException(); } } diff --git a/tests/PhpWord/Exception/InvalidStyleExceptionTest.php b/tests/PhpWord/Exception/InvalidStyleExceptionTest.php index 5038ed2f..77ee8571 100644 --- a/tests/PhpWord/Exception/InvalidStyleExceptionTest.php +++ b/tests/PhpWord/Exception/InvalidStyleExceptionTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -33,6 +33,6 @@ class InvalidStyleExceptionTest extends \PHPUnit_Framework_TestCase */ public function testThrowException() { - throw new InvalidStyleException; + throw new InvalidStyleException(); } } diff --git a/tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php b/tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php index 251ed957..50b4806d 100644 --- a/tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php +++ b/tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -33,6 +33,6 @@ class UnsupportedImageTypeExceptionTest extends \PHPUnit_Framework_TestCase */ public function testThrowException() { - throw new UnsupportedImageTypeException; + throw new UnsupportedImageTypeException(); } } diff --git a/tests/PhpWord/IOFactoryTest.php b/tests/PhpWord/IOFactoryTest.php index 9c2d1e67..6dbb006e 100644 --- a/tests/PhpWord/IOFactoryTest.php +++ b/tests/PhpWord/IOFactoryTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/MediaTest.php b/tests/PhpWord/MediaTest.php index 25480313..d045abcd 100644 --- a/tests/PhpWord/MediaTest.php +++ b/tests/PhpWord/MediaTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -106,7 +106,7 @@ class MediaTest extends \PHPUnit_Framework_TestCase /** * Add image element exception * - * @expectedException Exception + * @expectedException \Exception * @expectedExceptionMessage Image object not assigned. */ public function testAddElementImageException() diff --git a/tests/PhpWord/Metadata/DocInfoTest.php b/tests/PhpWord/Metadata/DocInfoTest.php index 23572710..5443f0b2 100644 --- a/tests/PhpWord/Metadata/DocInfoTest.php +++ b/tests/PhpWord/Metadata/DocInfoTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Metadata/SettingsTest.php b/tests/PhpWord/Metadata/SettingsTest.php index fff51652..6f493d04 100644 --- a/tests/PhpWord/Metadata/SettingsTest.php +++ b/tests/PhpWord/Metadata/SettingsTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -34,7 +34,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase { $oSettings = new Settings(); $oSettings->setEvenAndOddHeaders(true); - $this->assertEquals(true, $oSettings->hasEvenAndOddHeaders()); + $this->assertTrue($oSettings->hasEvenAndOddHeaders()); } /** @@ -44,7 +44,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase { $oSettings = new Settings(); $oSettings->setHideGrammaticalErrors(true); - $this->assertEquals(true, $oSettings->hasHideGrammaticalErrors()); + $this->assertTrue($oSettings->hasHideGrammaticalErrors()); } /** @@ -54,7 +54,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase { $oSettings = new Settings(); $oSettings->setHideSpellingErrors(true); - $this->assertEquals(true, $oSettings->hasHideSpellingErrors()); + $this->assertTrue($oSettings->hasHideSpellingErrors()); } /** @@ -77,7 +77,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase { $oSettings = new Settings(); $oSettings->setTrackRevisions(true); - $this->assertEquals(true, $oSettings->hasTrackRevisions()); + $this->assertTrue($oSettings->hasTrackRevisions()); } /** @@ -87,7 +87,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase { $oSettings = new Settings(); $oSettings->setDoNotTrackFormatting(true); - $this->assertEquals(true, $oSettings->hasDoNotTrackFormatting()); + $this->assertTrue($oSettings->hasDoNotTrackFormatting()); } /** @@ -97,7 +97,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase { $oSettings = new Settings(); $oSettings->setDoNotTrackMoves(true); - $this->assertEquals(true, $oSettings->hasDoNotTrackMoves()); + $this->assertTrue($oSettings->hasDoNotTrackMoves()); } /** @@ -116,6 +116,24 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertEquals(ProofState::DIRTY, $oSettings->getProofState()->getSpelling()); } + /** + * @expectedException \InvalidArgumentException + */ + public function testWrongProofStateGrammar() + { + $proofState = new ProofState(); + $proofState->setGrammar('wrong'); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testWrongProofStateSpelling() + { + $proofState = new ProofState(); + $proofState->setSpelling('wrong'); + } + /** * Zoom as percentage */ diff --git a/tests/PhpWord/PhpWordTest.php b/tests/PhpWord/PhpWordTest.php index b49666f5..01d7342e 100644 --- a/tests/PhpWord/PhpWordTest.php +++ b/tests/PhpWord/PhpWordTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -138,7 +138,7 @@ class PhpWordTest extends \PHPUnit_Framework_TestCase */ public function testLoadTemplateException() { - $templateFqfn = join( + $templateFqfn = implode( DIRECTORY_SEPARATOR, array(PHPWORD_TESTS_BASE_DIR, 'PhpWord', 'Tests', '_files', 'templates', 'blanks.docx') ); @@ -151,6 +151,8 @@ class PhpWordTest extends \PHPUnit_Framework_TestCase */ public function testSave() { + $this->setOutputCallback(function () { + }); $phpWord = new PhpWord(); $section = $phpWord->addSection(); $section->addText('Hello world!'); diff --git a/tests/PhpWord/Reader/HTMLTest.php b/tests/PhpWord/Reader/HTMLTest.php index 6e3039cf..24751cac 100644 --- a/tests/PhpWord/Reader/HTMLTest.php +++ b/tests/PhpWord/Reader/HTMLTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Reader/MsDocTest.php b/tests/PhpWord/Reader/MsDocTest.php index b4173d17..ed16e64b 100644 --- a/tests/PhpWord/Reader/MsDocTest.php +++ b/tests/PhpWord/Reader/MsDocTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Reader/ODTextTest.php b/tests/PhpWord/Reader/ODTextTest.php index 1bdce2e6..d00657de 100644 --- a/tests/PhpWord/Reader/ODTextTest.php +++ b/tests/PhpWord/Reader/ODTextTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Reader/RTFTest.php b/tests/PhpWord/Reader/RTFTest.php index 79cf13a7..58154ee3 100644 --- a/tests/PhpWord/Reader/RTFTest.php +++ b/tests/PhpWord/Reader/RTFTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Reader/Word2007Test.php b/tests/PhpWord/Reader/Word2007Test.php index 9be78a5b..627bc66e 100644 --- a/tests/PhpWord/Reader/Word2007Test.php +++ b/tests/PhpWord/Reader/Word2007Test.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/SettingsTest.php b/tests/PhpWord/SettingsTest.php index f5ac3ed6..6fd2f52b 100644 --- a/tests/PhpWord/SettingsTest.php +++ b/tests/PhpWord/SettingsTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -78,7 +78,6 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertEquals(sys_get_temp_dir(), Settings::getTempDir()); } - /** * @covers ::setTempDir * @covers ::getTempDir diff --git a/tests/PhpWord/Shared/ConverterTest.php b/tests/PhpWord/Shared/ConverterTest.php index e307f09b..a2031787 100644 --- a/tests/PhpWord/Shared/ConverterTest.php +++ b/tests/PhpWord/Shared/ConverterTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -89,7 +89,7 @@ class ConverterTest extends \PHPUnit_Framework_TestCase $this->assertEquals(round($value / 9525), $result); $result = Converter::degreeToAngle($value); - $this->assertEquals((int)round($value * 60000), $result); + $this->assertEquals((int) round($value * 60000), $result); $result = Converter::angleToDegree($value); $this->assertEquals(round($value / 60000), $result); diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index c651fd4a..602b644d 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Shared/ZipArchiveTest.php b/tests/PhpWord/Shared/ZipArchiveTest.php index 1adcfbfc..689f122b 100644 --- a/tests/PhpWord/Shared/ZipArchiveTest.php +++ b/tests/PhpWord/Shared/ZipArchiveTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -27,7 +27,6 @@ use PhpOffice\PhpWord\Settings; */ class ZipArchiveTest extends \PHPUnit_Framework_TestCase { - /** * Test close method exception: Working in local, not working in Travis * diff --git a/tests/PhpWord/Style/AbstractStyleTest.php b/tests/PhpWord/Style/AbstractStyleTest.php index f7c6f6c5..ab3ea14e 100644 --- a/tests/PhpWord/Style/AbstractStyleTest.php +++ b/tests/PhpWord/Style/AbstractStyleTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -87,6 +87,7 @@ class AbstractStyleTest extends \PHPUnit_Framework_TestCase $class = new \ReflectionClass(get_class($object)); $method = $class->getMethod($method); $method->setAccessible(true); + return $method->invokeArgs($object, $args); } } diff --git a/tests/PhpWord/Style/CellTest.php b/tests/PhpWord/Style/CellTest.php index 51f4e895..71b32a65 100644 --- a/tests/PhpWord/Style/CellTest.php +++ b/tests/PhpWord/Style/CellTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/FontTest.php b/tests/PhpWord/Style/FontTest.php index c8fd4dab..707784f6 100644 --- a/tests/PhpWord/Style/FontTest.php +++ b/tests/PhpWord/Style/FontTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -45,7 +45,7 @@ class FontTest extends \PHPUnit_Framework_TestCase $this->assertEquals('text', $object->getStyleType()); $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Paragraph', $object->getParagraphStyle()); - $this->assertTrue(is_array($object->getStyleValues())); + $this->assertInternalType('array', $object->getStyleValues()); } /** diff --git a/tests/PhpWord/Style/ImageTest.php b/tests/PhpWord/Style/ImageTest.php index c5bb5c7d..decc13b1 100644 --- a/tests/PhpWord/Style/ImageTest.php +++ b/tests/PhpWord/Style/ImageTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/IndentationTest.php b/tests/PhpWord/Style/IndentationTest.php index 477e1314..db079704 100644 --- a/tests/PhpWord/Style/IndentationTest.php +++ b/tests/PhpWord/Style/IndentationTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/LanguageTest.php b/tests/PhpWord/Style/LanguageTest.php index bd466956..35a01e07 100644 --- a/tests/PhpWord/Style/LanguageTest.php +++ b/tests/PhpWord/Style/LanguageTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/LineNumberingTest.php b/tests/PhpWord/Style/LineNumberingTest.php index e8ef1367..56440529 100644 --- a/tests/PhpWord/Style/LineNumberingTest.php +++ b/tests/PhpWord/Style/LineNumberingTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/LineTest.php b/tests/PhpWord/Style/LineTest.php index 98e20b3d..21489caf 100644 --- a/tests/PhpWord/Style/LineTest.php +++ b/tests/PhpWord/Style/LineTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/ListItemTest.php b/tests/PhpWord/Style/ListItemTest.php index 2e8692e9..a2e4eb74 100644 --- a/tests/PhpWord/Style/ListItemTest.php +++ b/tests/PhpWord/Style/ListItemTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/NumberingLevelTest.php b/tests/PhpWord/Style/NumberingLevelTest.php index c6cee11c..402d936b 100644 --- a/tests/PhpWord/Style/NumberingLevelTest.php +++ b/tests/PhpWord/Style/NumberingLevelTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/NumberingTest.php b/tests/PhpWord/Style/NumberingTest.php index ee9c032c..ad57ebff 100644 --- a/tests/PhpWord/Style/NumberingTest.php +++ b/tests/PhpWord/Style/NumberingTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/PaperTest.php b/tests/PhpWord/Style/PaperTest.php index 8e1dd960..7d12410c 100644 --- a/tests/PhpWord/Style/PaperTest.php +++ b/tests/PhpWord/Style/PaperTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/ParagraphTest.php b/tests/PhpWord/Style/ParagraphTest.php index b78c557a..a702d3f2 100644 --- a/tests/PhpWord/Style/ParagraphTest.php +++ b/tests/PhpWord/Style/ParagraphTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -99,10 +99,11 @@ class ParagraphTest extends \PHPUnit_Framework_TestCase if (is_bool($value)) { if (method_exists($object, "is{$key}")) { return "is{$key}"; - } else if (method_exists($object, "has{$key}")) { + } elseif (method_exists($object, "has{$key}")) { return "has{$key}"; } } + return "get{$key}"; } diff --git a/tests/PhpWord/Style/RowTest.php b/tests/PhpWord/Style/RowTest.php index a89f73d2..db98d0a9 100644 --- a/tests/PhpWord/Style/RowTest.php +++ b/tests/PhpWord/Style/RowTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/SectionTest.php b/tests/PhpWord/Style/SectionTest.php index d15dc490..89c4640a 100644 --- a/tests/PhpWord/Style/SectionTest.php +++ b/tests/PhpWord/Style/SectionTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -23,7 +23,7 @@ namespace PhpOffice\PhpWord\Style; * @coversDefaultClass \PhpOffice\PhpWord\Element\Section * @runTestsInSeparateProcesses */ -class SettingsTest extends \PHPUnit_Framework_TestCase +class SectionTest extends \PHPUnit_Framework_TestCase { /** * Executed before each method of the class diff --git a/tests/PhpWord/Style/ShadingTest.php b/tests/PhpWord/Style/ShadingTest.php index d6378f8d..fd0aaf5e 100644 --- a/tests/PhpWord/Style/ShadingTest.php +++ b/tests/PhpWord/Style/ShadingTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/SpacingTest.php b/tests/PhpWord/Style/SpacingTest.php index 79c9e458..f147ae61 100644 --- a/tests/PhpWord/Style/SpacingTest.php +++ b/tests/PhpWord/Style/SpacingTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/TOCTest.php b/tests/PhpWord/Style/TOCTest.php index 03620c17..ec01acd9 100644 --- a/tests/PhpWord/Style/TOCTest.php +++ b/tests/PhpWord/Style/TOCTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/TabTest.php b/tests/PhpWord/Style/TabTest.php index 7724aa41..8102369d 100644 --- a/tests/PhpWord/Style/TabTest.php +++ b/tests/PhpWord/Style/TabTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/TableTest.php b/tests/PhpWord/Style/TableTest.php index 5e878692..ee020dd9 100644 --- a/tests/PhpWord/Style/TableTest.php +++ b/tests/PhpWord/Style/TableTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/TextBoxTest.php b/tests/PhpWord/Style/TextBoxTest.php index ea7bc71f..a91b5b28 100644 --- a/tests/PhpWord/Style/TextBoxTest.php +++ b/tests/PhpWord/Style/TextBoxTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -238,7 +238,6 @@ class TextBoxTest extends \PHPUnit_Framework_TestCase $this->assertEquals($expected, $object->getPosVerticalRel()); } - /** * Test set/get innerMarginRight */ diff --git a/tests/PhpWord/StyleTest.php b/tests/PhpWord/StyleTest.php index 57ec98f4..aa46c6b1 100644 --- a/tests/PhpWord/StyleTest.php +++ b/tests/PhpWord/StyleTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/TemplateProcessorTest.php b/tests/PhpWord/TemplateProcessorTest.php index 11b43cf4..4bf69f5a 100644 --- a/tests/PhpWord/TemplateProcessorTest.php +++ b/tests/PhpWord/TemplateProcessorTest.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -36,7 +36,7 @@ final class TemplateProcessorTest extends \PHPUnit_Framework_TestCase $templateProcessor = new TemplateProcessor($templateFqfn); $xslDomDocument = new \DOMDocument(); - $xslDomDocument->load(__DIR__ . "/_files/xsl/remove_tables_by_needle.xsl"); + $xslDomDocument->load(__DIR__ . '/_files/xsl/remove_tables_by_needle.xsl'); foreach (array('${employee.', '${scoreboard.', '${reference.') as $needle) { $templateProcessor->applyXslStyleSheet($xslDomDocument, array('needle' => $needle)); } diff --git a/tests/PhpWord/Writer/HTML/ElementTest.php b/tests/PhpWord/Writer/HTML/ElementTest.php index 2a1e03dc..0778650e 100644 --- a/tests/PhpWord/Writer/HTML/ElementTest.php +++ b/tests/PhpWord/Writer/HTML/ElementTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML; use PhpOffice\PhpWord\Element\Text as TextElement; diff --git a/tests/PhpWord/Writer/HTML/PartTest.php b/tests/PhpWord/Writer/HTML/PartTest.php index 137a092e..a4a6264e 100644 --- a/tests/PhpWord/Writer/HTML/PartTest.php +++ b/tests/PhpWord/Writer/HTML/PartTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML; use PhpOffice\PhpWord\Writer\HTML\Part\Body; diff --git a/tests/PhpWord/Writer/HTML/StyleTest.php b/tests/PhpWord/Writer/HTML/StyleTest.php index 629efd7a..7548ff02 100644 --- a/tests/PhpWord/Writer/HTML/StyleTest.php +++ b/tests/PhpWord/Writer/HTML/StyleTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\HTML; /** diff --git a/tests/PhpWord/Writer/HTMLTest.php b/tests/PhpWord/Writer/HTMLTest.php index b2b10165..69cd5a97 100644 --- a/tests/PhpWord/Writer/HTMLTest.php +++ b/tests/PhpWord/Writer/HTMLTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer; use PhpOffice\PhpWord\PhpWord; @@ -31,7 +32,7 @@ class HTMLTest extends \PHPUnit_Framework_TestCase */ public function testConstruct() { - $object = new HTML(new PhpWord); + $object = new HTML(new PhpWord()); $this->assertInstanceOf('PhpOffice\\PhpWord\\PhpWord', $object->getPhpWord()); } @@ -121,7 +122,7 @@ class HTMLTest extends \PHPUnit_Framework_TestCase $writer = new HTML($phpWord); $writer->save($file); - $this->assertTrue(file_exists($file)); + $this->assertFileExists($file); unlink($file); } diff --git a/tests/PhpWord/Writer/ODText/ElementTest.php b/tests/PhpWord/Writer/ODText/ElementTest.php index fb14aae5..ef4e68b0 100644 --- a/tests/PhpWord/Writer/ODText/ElementTest.php +++ b/tests/PhpWord/Writer/ODText/ElementTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText; use PhpOffice\Common\XMLWriter; diff --git a/tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php b/tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php index 90874b47..5ca980f2 100644 --- a/tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php +++ b/tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Part; use PhpOffice\PhpWord\Writer\ODText; @@ -40,7 +41,7 @@ class AbstractPartTest extends \PHPUnit_Framework_TestCase /** * covers ::getParentWriter * - * @expectedException Exception + * @expectedException \Exception * @expectedExceptionMessage No parent WriterInterface assigned. */ public function testSetGetParentWriterNull() diff --git a/tests/PhpWord/Writer/ODText/Part/ContentTest.php b/tests/PhpWord/Writer/ODText/Part/ContentTest.php index 5814fa60..048c5242 100644 --- a/tests/PhpWord/Writer/ODText/Part/ContentTest.php +++ b/tests/PhpWord/Writer/ODText/Part/ContentTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText\Part; use PhpOffice\PhpWord\PhpWord; diff --git a/tests/PhpWord/Writer/ODText/StyleTest.php b/tests/PhpWord/Writer/ODText/StyleTest.php index 6b979385..1a0c3ccd 100644 --- a/tests/PhpWord/Writer/ODText/StyleTest.php +++ b/tests/PhpWord/Writer/ODText/StyleTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\ODText; use PhpOffice\Common\XMLWriter; diff --git a/tests/PhpWord/Writer/ODTextTest.php b/tests/PhpWord/Writer/ODTextTest.php index d79a9d42..d35a4ec7 100644 --- a/tests/PhpWord/Writer/ODTextTest.php +++ b/tests/PhpWord/Writer/ODTextTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer; use PhpOffice\PhpWord\PhpWord; @@ -90,7 +91,7 @@ class ODTextTest extends \PHPUnit_Framework_TestCase $writer = new ODText($phpWord); $writer->save($file); - $this->assertTrue(file_exists($file)); + $this->assertFileExists($file); unlink($file); } @@ -102,6 +103,8 @@ class ODTextTest extends \PHPUnit_Framework_TestCase */ public function testSavePhpOutput() { + $this->setOutputCallback(function () { + }); $phpWord = new PhpWord(); $section = $phpWord->addSection(); $section->addText('Test'); @@ -136,7 +139,7 @@ class ODTextTest extends \PHPUnit_Framework_TestCase */ public function testSetUseDiskCachingException() { - $dir = join(DIRECTORY_SEPARATOR, array(PHPWORD_TESTS_BASE_DIR, 'foo')); + $dir = implode(DIRECTORY_SEPARATOR, array(PHPWORD_TESTS_BASE_DIR, 'foo')); $object = new ODText(); $object->setUseDiskCaching(true, $dir); diff --git a/tests/PhpWord/Writer/PDF/DomPDFTest.php b/tests/PhpWord/Writer/PDF/DomPDFTest.php index 67026a84..7831f472 100644 --- a/tests/PhpWord/Writer/PDF/DomPDFTest.php +++ b/tests/PhpWord/Writer/PDF/DomPDFTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\PDF; use PhpOffice\PhpWord\PhpWord; @@ -45,7 +46,7 @@ class DomPDFTest extends \PHPUnit_Framework_TestCase $writer = new PDF($phpWord); $writer->save($file); - $this->assertTrue(file_exists($file)); + $this->assertFileExists($file); unlink($file); } diff --git a/tests/PhpWord/Writer/PDF/MPDFTest.php b/tests/PhpWord/Writer/PDF/MPDFTest.php index b6c85a40..62411b97 100644 --- a/tests/PhpWord/Writer/PDF/MPDFTest.php +++ b/tests/PhpWord/Writer/PDF/MPDFTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\PDF; use PhpOffice\PhpWord\PhpWord; @@ -44,7 +45,7 @@ class MPDFTest extends \PHPUnit_Framework_TestCase $writer = new PDF($phpWord); $writer->save($file); - $this->assertTrue(file_exists($file)); + $this->assertFileExists($file); unlink($file); } diff --git a/tests/PhpWord/Writer/PDF/TCPDFTest.php b/tests/PhpWord/Writer/PDF/TCPDFTest.php index aaec55eb..d5bd534b 100644 --- a/tests/PhpWord/Writer/PDF/TCPDFTest.php +++ b/tests/PhpWord/Writer/PDF/TCPDFTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\PDF; use PhpOffice\PhpWord\PhpWord; @@ -44,7 +45,7 @@ class TCPDFTest extends \PHPUnit_Framework_TestCase $writer = new PDF($phpWord); $writer->save($file); - $this->assertTrue(file_exists($file)); + $this->assertFileExists($file); unlink($file); } diff --git a/tests/PhpWord/Writer/PDFTest.php b/tests/PhpWord/Writer/PDFTest.php index 75db6c03..f1a908a9 100644 --- a/tests/PhpWord/Writer/PDFTest.php +++ b/tests/PhpWord/Writer/PDFTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer; use PhpOffice\PhpWord\PhpWord; @@ -40,7 +41,7 @@ class PDFTest extends \PHPUnit_Framework_TestCase $writer = new PDF(new PhpWord()); $writer->save($file); - $this->assertTrue(file_exists($file)); + $this->assertFileExists($file); unlink($file); } diff --git a/tests/PhpWord/Writer/RTF/ElementTest.php b/tests/PhpWord/Writer/RTF/ElementTest.php index 47d01d00..17a9c22f 100644 --- a/tests/PhpWord/Writer/RTF/ElementTest.php +++ b/tests/PhpWord/Writer/RTF/ElementTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\RTF; use PhpOffice\PhpWord\Writer\RTF; diff --git a/tests/PhpWord/Writer/RTF/StyleTest.php b/tests/PhpWord/Writer/RTF/StyleTest.php index 095d30d5..4e3a0eed 100644 --- a/tests/PhpWord/Writer/RTF/StyleTest.php +++ b/tests/PhpWord/Writer/RTF/StyleTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\RTF; /** diff --git a/tests/PhpWord/Writer/RTFTest.php b/tests/PhpWord/Writer/RTFTest.php index 0b4f6b0f..ec83f7b1 100644 --- a/tests/PhpWord/Writer/RTFTest.php +++ b/tests/PhpWord/Writer/RTFTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer; use PhpOffice\PhpWord\PhpWord; @@ -31,7 +32,7 @@ class RTFTest extends \PHPUnit_Framework_TestCase */ public function testConstruct() { - $object = new RTF(new PhpWord); + $object = new RTF(new PhpWord()); $this->assertInstanceOf('PhpOffice\\PhpWord\\PhpWord', $object->getPhpWord()); } @@ -91,7 +92,7 @@ class RTFTest extends \PHPUnit_Framework_TestCase $writer = new RTF($phpWord); $writer->save($file); - $this->assertTrue(file_exists($file)); + $this->assertFileExists($file); @unlink($file); } @@ -103,6 +104,8 @@ class RTFTest extends \PHPUnit_Framework_TestCase */ public function testSavePhpOutput() { + $this->setOutputCallback(function () { + }); $phpWord = new PhpWord(); $section = $phpWord->addSection(); $section->addText(htmlspecialchars('Test', ENT_COMPAT, 'UTF-8')); diff --git a/tests/PhpWord/Writer/Word2007/ElementTest.php b/tests/PhpWord/Writer/Word2007/ElementTest.php index b3c7b197..6186695b 100644 --- a/tests/PhpWord/Writer/Word2007/ElementTest.php +++ b/tests/PhpWord/Writer/Word2007/ElementTest.php @@ -10,16 +10,17 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007; use PhpOffice\Common\XMLWriter; +use PhpOffice\PhpWord\Element\TextRun; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\TestHelperDOCX; -use PhpOffice\PhpWord\Element\TextRun; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Element subnamespace @@ -186,7 +187,7 @@ class ElementTest extends \PHPUnit_Framework_TestCase $index = 0; foreach ($chartTypes as $chartType) { - $index++; + ++$index; $file = "word/charts/chart{$index}.xml"; $path = "/c:chartSpace/c:chart/c:plotArea/c:{$chartType}Chart"; $this->assertTrue($doc->elementExists($path, $file)); diff --git a/tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php b/tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php index 8f72cdfe..47f65861 100644 --- a/tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\Writer\Word2007; @@ -24,7 +25,7 @@ use PhpOffice\PhpWord\Writer\Word2007; * @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007\Part\AbstractWriterPart * @runTestsInSeparateProcesses */ -class AbstractWriterPartTest extends \PHPUnit_Framework_TestCase +class AbstractPartTest extends \PHPUnit_Framework_TestCase { /** * covers ::setParentWriter @@ -40,7 +41,7 @@ class AbstractWriterPartTest extends \PHPUnit_Framework_TestCase /** * covers ::getParentWriter * - * @expectedException Exception + * @expectedException \Exception * @expectedExceptionMessage No parent WriterInterface assigned. */ public function testSetGetParentWriterNull() diff --git a/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php b/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php index aac4b15b..4a4fd308 100644 --- a/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php @@ -10,15 +10,15 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\TestHelperDOCX; -use PhpOffice\PhpWord\Writer\Word2007; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Comment @@ -40,7 +40,6 @@ class CommentsTest extends \PHPUnit_Framework_TestCase */ public function testWriteComments() { - $comment = new \PhpOffice\PhpWord\Element\Comment('Authors name', new \DateTime(), 'my_initials'); $comment->addText('Test'); @@ -55,7 +54,7 @@ class CommentsTest extends \PHPUnit_Framework_TestCase $element = $doc->getElement($path, $file); $this->assertNotNull($element->getAttribute('w:id')); - $this->assertEquals("Authors name", $element->getAttribute('w:author')); - $this->assertEquals("my_initials", $element->getAttribute('w:initials')); + $this->assertEquals('Authors name', $element->getAttribute('w:author')); + $this->assertEquals('my_initials', $element->getAttribute('w:initials')); } } diff --git a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php index d45cde6b..d194814c 100644 --- a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php @@ -10,18 +10,19 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\ComplexType\FootnoteProperties; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\SimpleType\Jc; +use PhpOffice\PhpWord\SimpleType\NumberFormat; use PhpOffice\PhpWord\Style\Font; use PhpOffice\PhpWord\TestHelperDOCX; -use PhpOffice\PhpWord\SimpleType\NumberFormat; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Document @@ -458,7 +459,7 @@ class DocumentTest extends \PHPUnit_Framework_TestCase // Test the attributes $attributeCount = 0; foreach ($attributes as $key => $value) { - $attributeCount++; + ++$attributeCount; $nodeName = ($key == 'alignment') ? 'jc' : $key; $path = "/w:document/w:body/w:p[{$attributeCount}]/w:pPr/w:{$nodeName}"; if ('alignment' != $key) { diff --git a/tests/PhpWord/Writer/Word2007/Part/FooterTest.php b/tests/PhpWord/Writer/Word2007/Part/FooterTest.php index 9a7d809a..98fb003e 100644 --- a/tests/PhpWord/Writer/Word2007/Part/FooterTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/FooterTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\Writer\Word2007; diff --git a/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php b/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php index 2d48fe36..e557d9c2 100644 --- a/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\PhpWord; diff --git a/tests/PhpWord/Writer/Word2007/Part/HeaderTest.php b/tests/PhpWord/Writer/Word2007/Part/HeaderTest.php index 6c285af6..7830469c 100644 --- a/tests/PhpWord/Writer/Word2007/Part/HeaderTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/HeaderTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\Writer\Word2007; diff --git a/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php b/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php index bca4b562..0f1ae523 100644 --- a/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php @@ -10,16 +10,17 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\SimpleType\Jc; -use PhpOffice\PhpWord\TestHelperDOCX; use PhpOffice\PhpWord\SimpleType\NumberFormat; +use PhpOffice\PhpWord\TestHelperDOCX; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Numbering @@ -64,7 +65,7 @@ class NumberingTest extends \PHPUnit_Framework_TestCase 'font' => 'Arial', 'hint' => 'default', ), - ) + ), ) ); diff --git a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php index 99c66680..7d85995c 100644 --- a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\ComplexType\TrackChangesView; @@ -77,15 +78,15 @@ class SettingsTest extends \PHPUnit_Framework_TestCase public function testDefaultLanguage() { $phpWord = new PhpWord(); - + $doc = TestHelperDOCX::getDocument($phpWord); - + $file = 'word/settings.xml'; - + $path = '/w:settings/w:themeFontLang'; $this->assertTrue($doc->elementExists($path, $file)); $element = $doc->getElement($path, $file); - + $this->assertEquals('en-US', $element->getAttribute('w:val')); } @@ -97,13 +98,13 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $phpWord = new PhpWord(); $phpWord->getSettings()->setThemeFontLang(new Language(Language::DE_DE, Language::KO_KR, Language::HE_IL)); $doc = TestHelperDOCX::getDocument($phpWord); - + $file = 'word/settings.xml'; - + $path = '/w:settings/w:themeFontLang'; $this->assertTrue($doc->elementExists($path, $file)); $element = $doc->getElement($path, $file); - + $this->assertEquals(Language::DE_DE, $element->getAttribute('w:val')); $this->assertEquals(Language::KO_KR, $element->getAttribute('w:eastAsia')); $this->assertEquals(Language::HE_IL, $element->getAttribute('w:bidi')); @@ -116,15 +117,15 @@ class SettingsTest extends \PHPUnit_Framework_TestCase { $phpWord = new PhpWord(); $phpWord->getSettings()->setHideSpellingErrors(true); - + $doc = TestHelperDOCX::getDocument($phpWord); - + $file = 'word/settings.xml'; - + $path = '/w:settings/w:hideSpellingErrors'; $this->assertTrue($doc->elementExists($path, $file)); $element = $doc->getElement($path, $file); - + $this->assertNotEquals('false', $element->getAttribute('w:val')); } @@ -135,14 +136,14 @@ class SettingsTest extends \PHPUnit_Framework_TestCase { $phpWord = new PhpWord(); $phpWord->getSettings()->setEvenAndOddHeaders(true); - + $doc = TestHelperDOCX::getDocument($phpWord); - + $file = 'word/settings.xml'; - + $path = '/w:settings/w:evenAndOddHeaders'; $this->assertTrue($doc->elementExists($path, $file)); - + $element = $doc->getElement($path, $file); $this->assertNotEquals('false', $element->getAttribute('w:val')); } @@ -161,7 +162,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $path = '/w:settings/w:zoom'; $this->assertTrue($doc->elementExists($path, $file)); - + $element = $doc->getElement($path, $file); $this->assertEquals('75', $element->getAttribute('w:percent')); } @@ -180,7 +181,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $path = '/w:settings/w:zoom'; $this->assertTrue($doc->elementExists($path, $file)); - + $element = $doc->getElement($path, $file); $this->assertEquals('fullPage', $element->getAttribute('w:val')); } diff --git a/tests/PhpWord/Writer/Word2007/Part/StylesTest.php b/tests/PhpWord/Writer/Word2007/Part/StylesTest.php index 0c0f7aef..cba0bfb3 100644 --- a/tests/PhpWord/Writer/Word2007/Part/StylesTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/StylesTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\PhpWord; @@ -21,7 +22,6 @@ use PhpOffice\PhpWord\SimpleType\Jc; use PhpOffice\PhpWord\Style\Font; use PhpOffice\PhpWord\Style\Paragraph; use PhpOffice\PhpWord\TestHelperDOCX; -use PhpOffice\PhpWord\Writer\Word2007; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Styles @@ -85,12 +85,12 @@ class StylesTest extends \PHPUnit_Framework_TestCase $baseParagraphStyle = new Paragraph(); $baseParagraphStyle->setAlignment(Jc::CENTER); $baseParagraphStyle = $phpWord->addParagraphStyle('BaseStyle', $baseParagraphStyle); - + $childFont = new Font(); $childFont->setParagraph($baseParagraphStyle); $childFont->setSize(16); $childFont = $phpWord->addFontStyle('ChildFontStyle', $childFont); - + $otherFont = new Font(); $otherFont->setSize(20); $otherFont = $phpWord->addFontStyle('OtherFontStyle', $otherFont); @@ -134,7 +134,7 @@ class StylesTest extends \PHPUnit_Framework_TestCase $styleGenerationEteinte->setParagraph($styleGenerationEteinteP); $styleGenerationEteinte->setSize(8.5); $phpWord->addFontStyle('GeneratEteinte', $styleGenerationEteinte); - + $doc = TestHelperDOCX::getDocument($phpWord); $file = 'word/styles.xml'; diff --git a/tests/PhpWord/Writer/Word2007/PartTest.php b/tests/PhpWord/Writer/Word2007/PartTest.php index 7af8ce3a..3261db4f 100644 --- a/tests/PhpWord/Writer/Word2007/PartTest.php +++ b/tests/PhpWord/Writer/Word2007/PartTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007; use PhpOffice\PhpWord\Writer\Word2007\Part\RelsPart; diff --git a/tests/PhpWord/Writer/Word2007/Style/FontTest.php b/tests/PhpWord/Writer/Word2007/Style/FontTest.php index 50a7ecf7..f406bc05 100644 --- a/tests/PhpWord/Writer/Word2007/Style/FontTest.php +++ b/tests/PhpWord/Writer/Word2007/Style/FontTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007\Style; use PhpOffice\PhpWord\TestHelperDOCX; diff --git a/tests/PhpWord/Writer/Word2007/StyleTest.php b/tests/PhpWord/Writer/Word2007/StyleTest.php index dfabec03..05785b0c 100644 --- a/tests/PhpWord/Writer/Word2007/StyleTest.php +++ b/tests/PhpWord/Writer/Word2007/StyleTest.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer\Word2007; use PhpOffice\Common\XMLWriter; diff --git a/tests/PhpWord/Writer/Word2007Test.php b/tests/PhpWord/Writer/Word2007Test.php index 76ba2114..88a522a9 100644 --- a/tests/PhpWord/Writer/Word2007Test.php +++ b/tests/PhpWord/Writer/Word2007Test.php @@ -10,10 +10,11 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ + namespace PhpOffice\PhpWord\Writer; use PhpOffice\PhpWord\PhpWord; @@ -96,7 +97,7 @@ class Word2007Test extends \PHPUnit_Framework_TestCase $file = __DIR__ . '/../_files/temp.docx'; $writer->save($file); - $this->assertTrue(file_exists($file)); + $this->assertFileExists($file); unlink($file); } @@ -117,7 +118,7 @@ class Word2007Test extends \PHPUnit_Framework_TestCase $file = __DIR__ . '/../_files/temp.docx'; $writer->save($file); - $this->assertTrue(file_exists($file)); + $this->assertFileExists($file); unlink($file); } @@ -166,6 +167,8 @@ class Word2007Test extends \PHPUnit_Framework_TestCase */ public function testSetGetUseDiskCaching() { + $this->setOutputCallback(function () { + }); $phpWord = new PhpWord(); $phpWord->addSection(); $object = new Word2007($phpWord); @@ -183,7 +186,7 @@ class Word2007Test extends \PHPUnit_Framework_TestCase */ public function testSetUseDiskCachingException() { - $dir = join(DIRECTORY_SEPARATOR, array(PHPWORD_TESTS_BASE_DIR, 'foo')); + $dir = implode(DIRECTORY_SEPARATOR, array(PHPWORD_TESTS_BASE_DIR, 'foo')); $object = new Word2007(); $object->setUseDiskCaching(true, $dir); diff --git a/tests/PhpWord/_includes/TestHelperDOCX.php b/tests/PhpWord/_includes/TestHelperDOCX.php index 03079974..bef060ee 100644 --- a/tests/PhpWord/_includes/TestHelperDOCX.php +++ b/tests/PhpWord/_includes/TestHelperDOCX.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -29,7 +29,7 @@ class TestHelperDOCX * * @var string */ - static protected $file; + protected static $file; /** * Get document content @@ -39,9 +39,8 @@ class TestHelperDOCX * @param \PhpOffice\PhpWord\PhpWord $phpWord * @param string $writerName * - * @return \PhpOffice\PhpWord\XmlDocument - * * @throws \PhpOffice\PhpWord\Exception\CreateTemporaryFileException + * @return \PhpOffice\PhpWord\XmlDocument */ public static function getDocument(PhpWord $phpWord, $writerName = 'Word2007') { @@ -57,7 +56,7 @@ class TestHelperDOCX $xmlWriter = IOFactory::createWriter($phpWord, $writerName); $xmlWriter->save(self::$file); - $zip = new \ZipArchive; + $zip = new \ZipArchive(); $res = $zip->open(self::$file); if (true === $res) { $zip->extractTo(Settings::getTempDir() . '/PhpWord_Unit_Test/'); diff --git a/tests/PhpWord/_includes/XmlDocument.php b/tests/PhpWord/_includes/XmlDocument.php index c3bab0f6..ef56ed15 100644 --- a/tests/PhpWord/_includes/XmlDocument.php +++ b/tests/PhpWord/_includes/XmlDocument.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -25,7 +25,7 @@ class XmlDocument /** * Path * - * @var string $path + * @var string */ private $path; @@ -78,6 +78,7 @@ class XmlDocument $file = $this->path . '/' . $file; $this->dom = new \DOMDocument(); $this->dom->load($file); + return $this->dom; } @@ -158,6 +159,7 @@ class XmlDocument public function elementExists($path, $file = 'word/document.xml') { $nodeList = $this->getNodeList($path, $file); + return !($nodeList->length == 0); } } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 60ca5ae7..7126c204 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -10,11 +10,10 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. test bootstrap * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ - require_once __DIR__ . '/../bootstrap.php'; date_default_timezone_set('UTC'); @@ -29,7 +28,7 @@ spl_autoload_register(function ($class) { $prefix = 'PhpOffice\\PhpWord'; if (strpos($class, $prefix) === 0) { $class = str_replace('\\', DIRECTORY_SEPARATOR, $class); - $class = join(DIRECTORY_SEPARATOR, array('PhpWord', '_includes')) . + $class = implode(DIRECTORY_SEPARATOR, array('PhpWord', '_includes')) . substr($class, strlen($prefix)); $file = __DIR__ . DIRECTORY_SEPARATOR . $class . '.php'; if (file_exists($file)) { From 601a2b6ec697d62e605722a2b71a42e78fb87d03 Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 4 Nov 2017 23:26:04 +0100 Subject: [PATCH 109/370] make Comment constructor attributes optional --- samples/Sample_37_Comments.php | 4 ++-- src/PhpWord/Element/Comment.php | 2 +- src/PhpWord/Element/TrackChange.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/Sample_37_Comments.php b/samples/Sample_37_Comments.php index 5c0e8abc..268739bc 100644 --- a/samples/Sample_37_Comments.php +++ b/samples/Sample_37_Comments.php @@ -21,7 +21,7 @@ $textrun->addText(' a test'); $section->addTextBreak(2); // Let's create a comment that we will link to a start element and an end element -$commentWithStartAndEnd = new \PhpOffice\PhpWord\Element\Comment('Foo Bar', new \DateTime(), ''); +$commentWithStartAndEnd = new \PhpOffice\PhpWord\Element\Comment('Foo Bar', new \DateTime()); $commentWithStartAndEnd->addText('A comment with a start and an end'); $phpWord->addComment($commentWithStartAndEnd); @@ -36,7 +36,7 @@ $textToEndOn->setCommentRangeEnd($commentWithStartAndEnd); $section->addTextBreak(2); // Let's add a comment on an image -$commentOnImage = new \PhpOffice\PhpWord\Element\Comment('Mr Smart', new \DateTime(), ''); +$commentOnImage = new \PhpOffice\PhpWord\Element\Comment('Mr Smart', new \DateTime()); $imageComment = $commentOnImage->addTextRun(); $imageComment->addText('Hey, Mars does look '); $imageComment->addText('red', array('color' => 'FF0000')); diff --git a/src/PhpWord/Element/Comment.php b/src/PhpWord/Element/Comment.php index a8f39748..908b8785 100644 --- a/src/PhpWord/Element/Comment.php +++ b/src/PhpWord/Element/Comment.php @@ -57,7 +57,7 @@ class Comment extends TrackChange * @param \DateTime $date * @param string $initials */ - public function __construct($author, $date, $initials) + public function __construct($author, $date = null, $initials = null) { parent::__construct($author, $date); $this->initials = $initials; diff --git a/src/PhpWord/Element/TrackChange.php b/src/PhpWord/Element/TrackChange.php index 11cc763a..d900b053 100644 --- a/src/PhpWord/Element/TrackChange.php +++ b/src/PhpWord/Element/TrackChange.php @@ -47,7 +47,7 @@ class TrackChange extends AbstractContainer * @param string $author * @param \DateTime $date */ - public function __construct($author, \DateTime $date) + public function __construct($author, \DateTime $date = null) { $this->author = $author; $this->date = $date; From 03d4a36b9bb98ed37740cd0cc810791aa71083cb Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 5 Nov 2017 00:03:06 +0100 Subject: [PATCH 110/370] fixed HTML superscript, and added allcaps, smallcaps, and letter-spacing --- src/PhpWord/Writer/HTML/Element/Text.php | 4 ++++ src/PhpWord/Writer/HTML/Style/Font.php | 11 ++++++++--- src/PhpWord/Writer/HTML/Style/Paragraph.php | 3 +++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/PhpWord/Writer/HTML/Element/Text.php b/src/PhpWord/Writer/HTML/Element/Text.php index ed1ba4a3..71cb7566 100644 --- a/src/PhpWord/Writer/HTML/Element/Text.php +++ b/src/PhpWord/Writer/HTML/Element/Text.php @@ -164,6 +164,8 @@ class Text extends AbstractElement if ($pStyleIsObject) { $styleWriter = new ParagraphStyleWriter($paragraphStyle); $style = $styleWriter->write(); + } elseif (is_string($paragraphStyle)) { + $style = $paragraphStyle; } if ($style) { $attribute = $pStyleIsObject ? 'style' : 'class'; @@ -186,6 +188,8 @@ class Text extends AbstractElement if ($fStyleIsObject) { $styleWriter = new FontStyleWriter($fontStyle); $style = $styleWriter->write(); + } elseif (is_string($fontStyle)) { + $style = $fontStyle; } if ($style) { $attribute = $fStyleIsObject ? 'style' : 'class'; diff --git a/src/PhpWord/Writer/HTML/Style/Font.php b/src/PhpWord/Writer/HTML/Style/Font.php index cb96cf64..8daa8823 100644 --- a/src/PhpWord/Writer/HTML/Style/Font.php +++ b/src/PhpWord/Writer/HTML/Style/Font.php @@ -52,12 +52,17 @@ class Font extends AbstractStyle $css['background'] = $this->getValueIf($fgColor != '', $fgColor); $css['font-weight'] = $this->getValueIf($style->isBold(), 'bold'); $css['font-style'] = $this->getValueIf($style->isItalic(), 'italic'); - $css['vertical-align'] = $this->getValueIf($style->isSuperScript(), 'italic'); - $css['vertical-align'] = $this->getValueIf($style->isSuperScript(), 'super'); - $css['vertical-align'] = $this->getValueIf($style->isSubScript(), 'sub'); + $css['vertical-align'] = ''; + $css['vertical-align'] .= $this->getValueIf($style->isSuperScript(), 'super'); + $css['vertical-align'] .= $this->getValueIf($style->isSubScript(), 'sub'); $css['text-decoration'] = ''; $css['text-decoration'] .= $this->getValueIf($underline, 'underline '); $css['text-decoration'] .= $this->getValueIf($lineThrough, 'line-through '); + $css['text-transform'] = $this->getValueIf($style->isAllCaps(), 'uppercase'); + $css['font-variant'] = $this->getValueIf($style->isSmallCaps(), 'small-caps'); + + $spacing = $style->getSpacing(); + $css['letter-spacing'] = $this->getValueIf(!is_null($spacing), ($spacing / 20) . 'pt'); return $this->assembleCss($css); } diff --git a/src/PhpWord/Writer/HTML/Style/Paragraph.php b/src/PhpWord/Writer/HTML/Style/Paragraph.php index e264ead0..af551dc5 100644 --- a/src/PhpWord/Writer/HTML/Style/Paragraph.php +++ b/src/PhpWord/Writer/HTML/Style/Paragraph.php @@ -80,6 +80,9 @@ class Paragraph extends AbstractStyle $after = $spacing->getAfter(); $css['margin-top'] = $this->getValueIf(!is_null($before), ($before / 20) . 'pt'); $css['margin-bottom'] = $this->getValueIf(!is_null($after), ($after / 20) . 'pt'); + } else { + $css['margin-top'] = '0'; + $css['margin-bottom'] = '0'; } return $this->assembleCss($css); From b926eec3bcc36e8d776970414142d4d1b381eeb9 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 5 Nov 2017 00:08:15 +0100 Subject: [PATCH 111/370] update changelog --- .gitignore | 1 + CHANGELOG.md | 1 + 2 files changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 42f03ebe..2ac6e2b5 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,5 @@ vendor phpword.ini /.buildpath /.project +/nbproject /.php_cs.cache diff --git a/CHANGELOG.md b/CHANGELOG.md index f963a3cd..ad046951 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ This is the last version to support PHP 5.3 - Impossible to add element PreserveText in Section - @rvanlaak #452 - Added missing options for numbering format - @troosan #1041 - Fixed impossibility to set a different footer for first page - @ctrlaltca #1116 +- Fixed styles not being applied by HTML writer, better pdf output - @sarke #1047 #500 #1139 v0.13.0 (31 July 2016) ------------------- From 64957d9ec8dce1feb2fb3ca9ad637106866e0ace Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 5 Nov 2017 01:58:17 +0100 Subject: [PATCH 112/370] Support for Mirrored page setup for docx --- docs/general.rst | 9 +++++ src/PhpWord/Metadata/Settings.php | 24 +++++++++++ src/PhpWord/Writer/Word2007/Part/Settings.php | 1 + .../Writer/Word2007/Part/SettingsTest.php | 40 +++++++++++++++++++ 4 files changed, 74 insertions(+) diff --git a/docs/general.rst b/docs/general.rst index 5b5c5d9e..b11734b1 100644 --- a/docs/general.rst +++ b/docs/general.rst @@ -159,6 +159,15 @@ Or to predefined values ``fullPage``, ``bestFit``, ``textFit`` $phpWord->getSettings()->setZoom(Zoom::BEST_FIT); +Mirroring the Page Margins +~~~~~~~~~~~~~~~~~~~~~~~~~~ +Use mirror margins to set up facing pages for double-sided documents, such as books or magazines. + +.. code-block:: php + + $phpWord->getSettings()->setMirrorMargins(true); + + Spelling and grammatical checks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/PhpWord/Metadata/Settings.php b/src/PhpWord/Metadata/Settings.php index 85c0659d..dc9270e7 100644 --- a/src/PhpWord/Metadata/Settings.php +++ b/src/PhpWord/Metadata/Settings.php @@ -38,6 +38,14 @@ class Settings */ private $zoom = 100; + /** + * Mirror Page Margins + * + * @see http://www.datypic.com/sc/ooxml/e-w_mirrorMargins-1.html + * @var bool + */ + private $mirrorMargins; + /** * Hide spelling errors * @@ -301,6 +309,22 @@ class Settings } } + /** + * @return bool + */ + public function hasMirrorMargins() + { + return $this->mirrorMargins; + } + + /** + * @param bool $mirrorMargins + */ + public function setMirrorMargins($mirrorMargins) + { + $this->mirrorMargins = $mirrorMargins; + } + /** * Returns the Language * diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index b205619d..c8772e71 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -140,6 +140,7 @@ class Settings extends AbstractPart ), ); + $this->setOnOffValue('w:mirrorMargins', $documentSettings->hasMirrorMargins()); $this->setOnOffValue('w:hideSpellingErrors', $documentSettings->hasHideSpellingErrors()); $this->setOnOffValue('w:hideGrammaticalErrors', $documentSettings->hasHideGrammaticalErrors()); $this->setOnOffValue('w:trackRevisions', $documentSettings->hasTrackRevisions()); diff --git a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php index 7d85995c..4715d2da 100644 --- a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php @@ -23,6 +23,7 @@ use PhpOffice\PhpWord\Settings; use PhpOffice\PhpWord\SimpleType\Zoom; use PhpOffice\PhpWord\Style\Language; use PhpOffice\PhpWord\TestHelperDOCX; +use PhpOffice\PhpWord\ComplexType\ProofState; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Settings @@ -110,6 +111,29 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertEquals(Language::HE_IL, $element->getAttribute('w:bidi')); } + /** + * Test proofState + */ + public function testProofState() + { + $proofState = new ProofState(); + $proofState->setSpelling(ProofState::DIRTY); + $proofState->setGrammar(ProofState::DIRTY); + $phpWord = new PhpWord(); + $phpWord->getSettings()->setProofState($proofState); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:proofState'; + $this->assertTrue($doc->elementExists($path, $file)); + $element = $doc->getElement($path, $file); + + $this->assertEquals('dirty', $element->getAttribute('w:spelling')); + $this->assertEquals('dirty', $element->getAttribute('w:grammar')); + } + /** * Test spelling */ @@ -186,6 +210,22 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertEquals('fullPage', $element->getAttribute('w:val')); } + public function testMirrorMargins() + { + $phpWord = new PhpWord(); + $phpWord->getSettings()->setMirrorMargins(true); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:mirrorMargins'; + $this->assertTrue($doc->elementExists($path, $file)); + + $element = $doc->getElement($path, $file); + $this->assertNotEquals('false', $element->getAttribute('w:val')); + } + /** * Test Revision View */ From 8c7ed19d6210c92319d212b845c1acdb3a11a098 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 5 Nov 2017 02:07:53 +0100 Subject: [PATCH 113/370] Support for Mirrored page setup for docx (#1183) --- docs/general.rst | 9 +++++ src/PhpWord/Metadata/Settings.php | 24 +++++++++++ src/PhpWord/Writer/Word2007/Part/Settings.php | 1 + .../Writer/Word2007/Part/SettingsTest.php | 40 +++++++++++++++++++ 4 files changed, 74 insertions(+) diff --git a/docs/general.rst b/docs/general.rst index 5b5c5d9e..b11734b1 100644 --- a/docs/general.rst +++ b/docs/general.rst @@ -159,6 +159,15 @@ Or to predefined values ``fullPage``, ``bestFit``, ``textFit`` $phpWord->getSettings()->setZoom(Zoom::BEST_FIT); +Mirroring the Page Margins +~~~~~~~~~~~~~~~~~~~~~~~~~~ +Use mirror margins to set up facing pages for double-sided documents, such as books or magazines. + +.. code-block:: php + + $phpWord->getSettings()->setMirrorMargins(true); + + Spelling and grammatical checks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/PhpWord/Metadata/Settings.php b/src/PhpWord/Metadata/Settings.php index 85c0659d..dc9270e7 100644 --- a/src/PhpWord/Metadata/Settings.php +++ b/src/PhpWord/Metadata/Settings.php @@ -38,6 +38,14 @@ class Settings */ private $zoom = 100; + /** + * Mirror Page Margins + * + * @see http://www.datypic.com/sc/ooxml/e-w_mirrorMargins-1.html + * @var bool + */ + private $mirrorMargins; + /** * Hide spelling errors * @@ -301,6 +309,22 @@ class Settings } } + /** + * @return bool + */ + public function hasMirrorMargins() + { + return $this->mirrorMargins; + } + + /** + * @param bool $mirrorMargins + */ + public function setMirrorMargins($mirrorMargins) + { + $this->mirrorMargins = $mirrorMargins; + } + /** * Returns the Language * diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index b205619d..c8772e71 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -140,6 +140,7 @@ class Settings extends AbstractPart ), ); + $this->setOnOffValue('w:mirrorMargins', $documentSettings->hasMirrorMargins()); $this->setOnOffValue('w:hideSpellingErrors', $documentSettings->hasHideSpellingErrors()); $this->setOnOffValue('w:hideGrammaticalErrors', $documentSettings->hasHideGrammaticalErrors()); $this->setOnOffValue('w:trackRevisions', $documentSettings->hasTrackRevisions()); diff --git a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php index 7d85995c..4715d2da 100644 --- a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php @@ -23,6 +23,7 @@ use PhpOffice\PhpWord\Settings; use PhpOffice\PhpWord\SimpleType\Zoom; use PhpOffice\PhpWord\Style\Language; use PhpOffice\PhpWord\TestHelperDOCX; +use PhpOffice\PhpWord\ComplexType\ProofState; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Settings @@ -110,6 +111,29 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertEquals(Language::HE_IL, $element->getAttribute('w:bidi')); } + /** + * Test proofState + */ + public function testProofState() + { + $proofState = new ProofState(); + $proofState->setSpelling(ProofState::DIRTY); + $proofState->setGrammar(ProofState::DIRTY); + $phpWord = new PhpWord(); + $phpWord->getSettings()->setProofState($proofState); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:proofState'; + $this->assertTrue($doc->elementExists($path, $file)); + $element = $doc->getElement($path, $file); + + $this->assertEquals('dirty', $element->getAttribute('w:spelling')); + $this->assertEquals('dirty', $element->getAttribute('w:grammar')); + } + /** * Test spelling */ @@ -186,6 +210,22 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertEquals('fullPage', $element->getAttribute('w:val')); } + public function testMirrorMargins() + { + $phpWord = new PhpWord(); + $phpWord->getSettings()->setMirrorMargins(true); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:mirrorMargins'; + $this->assertTrue($doc->elementExists($path, $file)); + + $element = $doc->getElement($path, $file); + $this->assertNotEquals('false', $element->getAttribute('w:val')); + } + /** * Test Revision View */ From ce377b9b586693bf43b8dee47d9a7e3e63e966dc Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 5 Nov 2017 02:16:04 +0100 Subject: [PATCH 114/370] fix php-cs error --- src/PhpWord/Shared/AbstractEnum.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/PhpWord/Shared/AbstractEnum.php b/src/PhpWord/Shared/AbstractEnum.php index d7839c4f..58601a14 100644 --- a/src/PhpWord/Shared/AbstractEnum.php +++ b/src/PhpWord/Shared/AbstractEnum.php @@ -1,4 +1,20 @@ Date: Sun, 5 Nov 2017 08:54:52 +0100 Subject: [PATCH 115/370] fix end of line space --- src/PhpWord/Metadata/Settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Metadata/Settings.php b/src/PhpWord/Metadata/Settings.php index dc9270e7..412f5c52 100644 --- a/src/PhpWord/Metadata/Settings.php +++ b/src/PhpWord/Metadata/Settings.php @@ -40,7 +40,7 @@ class Settings /** * Mirror Page Margins - * + * * @see http://www.datypic.com/sc/ooxml/e-w_mirrorMargins-1.html * @var bool */ From 200d846f6195a0801e1ac2c41f6513cf68832094 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 5 Nov 2017 21:39:10 +0100 Subject: [PATCH 116/370] implement paragraph textAlignment --- src/PhpWord/SimpleType/TextAlignment.php | 45 +++++++++++++++++++ src/PhpWord/Style/Paragraph.php | 33 ++++++++++++++ .../Writer/Word2007/Style/Paragraph.php | 3 ++ tests/PhpWord/Element/ImageTest.php | 1 + tests/PhpWord/Style/FontTest.php | 14 ++++++ tests/PhpWord/Style/ParagraphTest.php | 3 +- .../Writer/Word2007/Part/SettingsTest.php | 2 +- 7 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 src/PhpWord/SimpleType/TextAlignment.php diff --git a/src/PhpWord/SimpleType/TextAlignment.php b/src/PhpWord/SimpleType/TextAlignment.php new file mode 100644 index 00000000..de36b108 --- /dev/null +++ b/src/PhpWord/SimpleType/TextAlignment.php @@ -0,0 +1,45 @@ + $this->getShading(), 'contextualSpacing' => $this->hasContextualSpacing(), 'bidi' => $this->isBidi(), + 'textAlignment' => $this->getTextAlignment(), ); return $styles; @@ -794,4 +803,28 @@ class Paragraph extends Border return $this; } + + /** + * Get textAlignment + * + * @return string + */ + public function getTextAlignment() + { + return $this->textAlignment; + } + + /** + * Set textAlignment + * + * @param string $textAlignment + * @return self + */ + public function setTextAlignment($textAlignment) + { + TextAlignment::validate($textAlignment); + $this->textAlignment = $textAlignment; + + return $this; + } } diff --git a/src/PhpWord/Writer/Word2007/Style/Paragraph.php b/src/PhpWord/Writer/Word2007/Style/Paragraph.php index 707bf031..424b87f8 100644 --- a/src/PhpWord/Writer/Word2007/Style/Paragraph.php +++ b/src/PhpWord/Writer/Word2007/Style/Paragraph.php @@ -109,6 +109,9 @@ class Paragraph extends AbstractStyle //Paragraph contextualSpacing $xmlWriter->writeElementIf($styles['contextualSpacing'] === true, 'w:contextualSpacing'); + //Paragraph contextualSpacing + $xmlWriter->writeElementIf($styles['textAlignment'] !== null, 'w:textAlignment', 'w:val', $styles['textAlignment']); + // Child style: alignment, indentation, spacing, and shading $this->writeChildStyle($xmlWriter, 'Indentation', $styles['indentation']); $this->writeChildStyle($xmlWriter, 'Spacing', $styles['spacing']); diff --git a/tests/PhpWord/Element/ImageTest.php b/tests/PhpWord/Element/ImageTest.php index 80e0bcfc..b681b81f 100644 --- a/tests/PhpWord/Element/ImageTest.php +++ b/tests/PhpWord/Element/ImageTest.php @@ -87,6 +87,7 @@ class ImageTest extends \PHPUnit_Framework_TestCase $this->assertEquals($createFunction, $image->getImageCreateFunction()); $this->assertEquals($imageFunction, $image->getImageFunction()); $this->assertFalse($image->isMemImage()); + $this->assertNotNull($image->getImageStringData()); } } diff --git a/tests/PhpWord/Style/FontTest.php b/tests/PhpWord/Style/FontTest.php index 707784f6..a227d7f9 100644 --- a/tests/PhpWord/Style/FontTest.php +++ b/tests/PhpWord/Style/FontTest.php @@ -69,6 +69,7 @@ class FontTest extends \PHPUnit_Framework_TestCase 'doubleStrikethrough' => false, 'smallCaps' => false, 'allCaps' => false, + 'rtl' => false, 'fgColor' => null, 'bgColor' => null, 'scale' => null, @@ -113,6 +114,8 @@ class FontTest extends \PHPUnit_Framework_TestCase 'scale' => 150, 'spacing' => 240, 'kerning' => 10, + 'rtl' => true, + 'lang' => new Language(Language::EN_US), ); $object->setStyleByArray($attributes); foreach ($attributes as $key => $value) { @@ -173,4 +176,15 @@ class FontTest extends \PHPUnit_Framework_TestCase $object = new Font(); $object->setLineHeight('a'); } + + /** + * Test setting the language as a string + */ + public function testSetLangAsString() + { + $object = new Font(); + $object->setLang(Language::FR_BE); + $this->assertInstanceOf('PhpOffice\PhpWord\Style\Language', $object->getLang()); + $this->assertEquals(Language::FR_BE, $object->getLang()->getLatin()); + } } diff --git a/tests/PhpWord/Style/ParagraphTest.php b/tests/PhpWord/Style/ParagraphTest.php index a702d3f2..e28f54c7 100644 --- a/tests/PhpWord/Style/ParagraphTest.php +++ b/tests/PhpWord/Style/ParagraphTest.php @@ -80,6 +80,7 @@ class ParagraphTest extends \PHPUnit_Framework_TestCase 'keepLines' => true, 'pageBreakBefore' => true, 'contextualSpacing' => true, + 'textAlignment' => 'auto', 'bidi' => true, ); foreach ($attributes as $key => $value) { @@ -114,7 +115,7 @@ class ParagraphTest extends \PHPUnit_Framework_TestCase { $object = new Paragraph(); - $attributes = array('spacing', 'indent', 'hanging', 'spaceBefore', 'spaceAfter'); + $attributes = array('spacing', 'indent', 'hanging', 'spaceBefore', 'spaceAfter', 'textAlignment'); foreach ($attributes as $key) { $get = $this->findGetter($key, null, $object); $this->assertNull($object->$get()); diff --git a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php index 4715d2da..5b812a0f 100644 --- a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php @@ -17,13 +17,13 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Part; +use PhpOffice\PhpWord\ComplexType\ProofState; use PhpOffice\PhpWord\ComplexType\TrackChangesView; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\Settings; use PhpOffice\PhpWord\SimpleType\Zoom; use PhpOffice\PhpWord\Style\Language; use PhpOffice\PhpWord\TestHelperDOCX; -use PhpOffice\PhpWord\ComplexType\ProofState; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Settings From a7a35c688dac969d08ea38b5fdc28ab932f8272d Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 5 Nov 2017 22:48:04 +0100 Subject: [PATCH 117/370] Allow reading of TargetMode for external images --- CHANGELOG.md | 2 ++ docs/styles.rst | 4 ++++ src/PhpWord/Reader/Word2007.php | 5 ++-- src/PhpWord/Reader/Word2007/AbstractPart.php | 24 +++++++++++++++++++- 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad046951..f21cb9d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ This is the last version to support PHP 5.3 - Possiblity to hide spelling and/or grammatical errors - @troosan #542 - Possiblity to set default document language as well as changing the language for each text element - @troosan #1108 - Support for Comments - @troosan #1067 +- Support for paragraph textAlignment - @troosan #1165 ### Fixed - Loosen dependency to Zend @@ -30,6 +31,7 @@ This is the last version to support PHP 5.3 - Added missing options for numbering format - @troosan #1041 - Fixed impossibility to set a different footer for first page - @ctrlaltca #1116 - Fixed styles not being applied by HTML writer, better pdf output - @sarke #1047 #500 #1139 +- Fixed read docx error when document contains image from remote url - @FBnil #1173 #1176 v0.13.0 (31 July 2016) ------------------- diff --git a/docs/styles.rst b/docs/styles.rst index e8d2aec8..4f4926a8 100644 --- a/docs/styles.rst +++ b/docs/styles.rst @@ -80,6 +80,10 @@ Available Paragraph style options: - ``tabs``. Set of custom tab stops. - ``widowControl``. Allow first/last line to display on a separate page, *true* or *false*. - ``contextualSpacing``. Ignore Spacing Above and Below When Using Identical Styles, *true* or *false*. +- ``bidi``. Right to Left Paragraph Layout, *true* or *false*. +- ``shading``. Paragraph Shading. +- ``textAlignment``. Vertical Character Alignment on Line. + See ``\PhpOffice\PhpWord\SimpleType\TextAlignment`` class for possible values. .. _table-style: diff --git a/src/PhpWord/Reader/Word2007.php b/src/PhpWord/Reader/Word2007.php index 9f9fce08..6c2178ad 100644 --- a/src/PhpWord/Reader/Word2007.php +++ b/src/PhpWord/Reader/Word2007.php @@ -147,6 +147,7 @@ class Word2007 extends AbstractReader implements ReaderInterface $rId = $xmlReader->getAttribute('Id', $node); $type = $xmlReader->getAttribute('Type', $node); $target = $xmlReader->getAttribute('Target', $node); + $mode = $xmlReader->getAttribute('TargetMode', $node); // Remove URL prefixes from $type to make it easier to read $type = str_replace($metaPrefix, '', $type); @@ -154,12 +155,12 @@ class Word2007 extends AbstractReader implements ReaderInterface $docPart = str_replace('.xml', '', $target); // Do not add prefix to link source - if (!in_array($type, array('hyperlink'))) { + if ($type != 'hyperlink' && $mode != 'External') { $target = $targetPrefix . $target; } // Push to return array - $rels[$rId] = array('type' => $type, 'target' => $target, 'docPart' => $docPart); + $rels[$rId] = array('type' => $type, 'target' => $target, 'docPart' => $docPart, 'targetMode' => $mode); } ksort($rels); diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index 21e12902..521c8a7f 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -210,7 +210,11 @@ abstract class AbstractPart $rId = $xmlReader->getAttribute('r:id', $domNode, 'w:pict/v:shape/v:imagedata'); $target = $this->getMediaTarget($docPart, $rId); if (!is_null($target)) { - $imageSource = "zip://{$this->docFile}#{$target}"; + if ('External' == $this->getTargetMode($docPart, $rId)) { + $imageSource = $target; + } else { + $imageSource = "zip://{$this->docFile}#{$target}"; + } $parent->addImage($imageSource); } } elseif ($xmlReader->elementExists('w:object', $domNode)) { @@ -500,4 +504,22 @@ abstract class AbstractPart return $target; } + + /** + * Returns the target mode + * + * @param string $docPart + * @param string $rId + * @return string|null + */ + private function getTargetMode($docPart, $rId) + { + $mode = null; + + if (isset($this->rels[$docPart]) && isset($this->rels[$docPart][$rId])) { + $mode = $this->rels[$docPart][$rId]['targetMode']; + } + + return $mode; + } } From 9ac9016f5071f70c05e59222c18168b1147d099a Mon Sep 17 00:00:00 2001 From: sergeizelenyi Date: Mon, 23 Jan 2017 16:15:33 +0300 Subject: [PATCH 118/370] added functionality specified alias and tag --- src/PhpWord/Element/SDT.php | 46 +++++++++++++++++++++ src/PhpWord/Writer/Word2007/Element/SDT.php | 4 ++ 2 files changed, 50 insertions(+) diff --git a/src/PhpWord/Element/SDT.php b/src/PhpWord/Element/SDT.php index 88ee7238..3e29410f 100644 --- a/src/PhpWord/Element/SDT.php +++ b/src/PhpWord/Element/SDT.php @@ -45,6 +45,20 @@ class SDT extends Text */ private $listItems = array(); + /** + * Alias + * + * @var string + */ + private $alias; + + /** + * Tag + * + * @var string + */ + private $tag; + /** * Create new instance * @@ -126,4 +140,36 @@ class SDT extends Text return $this; } + + /** + * @return string + */ + public function getTag() + { + return $this->tag; + } + + /** + * @param string $tag + */ + public function setTag($tag) + { + $this->tag = $tag; + } + + /** + * @return mixed + */ + public function getAlias() + { + return $this->alias; + } + + /** + * @param mixed $alias + */ + public function setAlias($alias) + { + $this->alias = $alias; + } } diff --git a/src/PhpWord/Writer/Word2007/Element/SDT.php b/src/PhpWord/Writer/Word2007/Element/SDT.php index e77f87e9..c6ea9f01 100644 --- a/src/PhpWord/Writer/Word2007/Element/SDT.php +++ b/src/PhpWord/Writer/Word2007/Element/SDT.php @@ -41,6 +41,8 @@ class SDT extends Text } $type = $element->getType(); $writeFormField = "write{$type}"; + $alias = $element->getAlias(); + $tag = $element->getTag(); $this->startElementP(); @@ -48,6 +50,8 @@ class SDT extends Text // Properties $xmlWriter->startElement('w:sdtPr'); + $xmlWriter->writeElementBlock('w:alias', 'w:val', $alias); + $xmlWriter->writeElementBlock('w:tag', 'w:val', $tag); $xmlWriter->writeElementBlock('w:id', 'w:val', rand(100000000, 999999999)); $xmlWriter->writeElementBlock('w:lock', 'w:val', 'sdtLocked'); $this->$writeFormField($xmlWriter, $element); From 9c1c544954833115d195d36688b9e86c7960a2ea Mon Sep 17 00:00:00 2001 From: sergeizelenyi Date: Mon, 23 Jan 2017 16:43:56 +0300 Subject: [PATCH 119/370] stylization code --- src/PhpWord/Element/SDT.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/Element/SDT.php b/src/PhpWord/Element/SDT.php index 3e29410f..6d7f103f 100644 --- a/src/PhpWord/Element/SDT.php +++ b/src/PhpWord/Element/SDT.php @@ -142,6 +142,8 @@ class SDT extends Text } /** + * Get tag + * * @return string */ public function getTag() @@ -150,15 +152,22 @@ class SDT extends Text } /** + * Set tag + * * @param string $tag + * @return self */ public function setTag($tag) { $this->tag = $tag; + + return $this; } /** - * @return mixed + * Get alias + * + * @return string */ public function getAlias() { @@ -166,10 +175,15 @@ class SDT extends Text } /** - * @param mixed $alias + * Set alias + * + * @param string $alias + * @return self */ public function setAlias($alias) { $this->alias = $alias; + + return $this; } } From 1e9203adc9daa0fffe1693f19a8a57832fd227aa Mon Sep 17 00:00:00 2001 From: troosan Date: Mon, 6 Nov 2017 21:47:02 +0100 Subject: [PATCH 120/370] add unit tests --- src/PhpWord/Element/SDT.php | 2 +- src/PhpWord/Writer/Word2007/Element/SDT.php | 6 +++--- tests/PhpWord/Element/SDTTest.php | 6 ++++++ tests/PhpWord/Writer/Word2007/ElementTest.php | 14 +++++++++----- tests/PhpWord/_includes/XmlDocument.php | 18 ++++++++++++++++++ 5 files changed, 37 insertions(+), 9 deletions(-) diff --git a/src/PhpWord/Element/SDT.php b/src/PhpWord/Element/SDT.php index 6d7f103f..6d4207b7 100644 --- a/src/PhpWord/Element/SDT.php +++ b/src/PhpWord/Element/SDT.php @@ -143,7 +143,7 @@ class SDT extends Text /** * Get tag - * + * * @return string */ public function getTag() diff --git a/src/PhpWord/Writer/Word2007/Element/SDT.php b/src/PhpWord/Writer/Word2007/Element/SDT.php index c6ea9f01..908f9f49 100644 --- a/src/PhpWord/Writer/Word2007/Element/SDT.php +++ b/src/PhpWord/Writer/Word2007/Element/SDT.php @@ -50,10 +50,10 @@ class SDT extends Text // Properties $xmlWriter->startElement('w:sdtPr'); - $xmlWriter->writeElementBlock('w:alias', 'w:val', $alias); - $xmlWriter->writeElementBlock('w:tag', 'w:val', $tag); - $xmlWriter->writeElementBlock('w:id', 'w:val', rand(100000000, 999999999)); + $xmlWriter->writeElementIf($alias != null, 'w:alias', 'w:val', $alias); $xmlWriter->writeElementBlock('w:lock', 'w:val', 'sdtLocked'); + $xmlWriter->writeElementBlock('w:id', 'w:val', rand(100000000, 999999999)); + $xmlWriter->writeElementIf($tag != null, 'w:tag', 'w:val', $tag); $this->$writeFormField($xmlWriter, $element); $xmlWriter->endElement(); // w:sdtPr diff --git a/tests/PhpWord/Element/SDTTest.php b/tests/PhpWord/Element/SDTTest.php index fc3682b6..537841a6 100644 --- a/tests/PhpWord/Element/SDTTest.php +++ b/tests/PhpWord/Element/SDTTest.php @@ -32,14 +32,20 @@ class SDTTest extends \PHPUnit_Framework_TestCase $types = array('comboBox', 'dropDownList', 'date'); $type = $types[rand(0, 2)]; $value = rand(0, 100); + $alias = 'alias'; + $tag = 'my_tag'; $object = new SDT($type); $object->setValue($value); $object->setListItems($types); + $object->setAlias($alias); + $object->setTag($tag); $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\SDT', $object); $this->assertEquals($type, $object->getType()); $this->assertEquals($types, $object->getListItems()); $this->assertEquals($value, $object->getValue()); + $this->assertEquals($alias, $object->getAlias()); + $this->assertEquals($tag, $object->getTag()); } /** diff --git a/tests/PhpWord/Writer/Word2007/ElementTest.php b/tests/PhpWord/Writer/Word2007/ElementTest.php index 6186695b..0ebc7c57 100644 --- a/tests/PhpWord/Writer/Word2007/ElementTest.php +++ b/tests/PhpWord/Writer/Word2007/ElementTest.php @@ -269,13 +269,17 @@ class ElementTest extends \PHPUnit_Framework_TestCase $section->addSDT('comboBox'); $section->addSDT('dropDownList'); - $section->addSDT('date'); + $section->addSDT('date')->setAlias('date_alias')->setTag('my_tag'); $doc = TestHelperDOCX::getDocument($phpWord); - $path = '/w:document/w:body/w:p/w:sdt/w:sdtPr'; - $this->assertTrue($doc->elementExists($path . '/w:comboBox')); - $this->assertTrue($doc->elementExists($path . '/w:dropDownList')); - $this->assertTrue($doc->elementExists($path . '/w:date')); + $path = '/w:document/w:body/w:p'; + + $this->assertTrue($doc->elementExists($path . '[1]/w:sdt/w:sdtPr/w:comboBox')); + $this->assertTrue($doc->elementExists($path . '[2]/w:sdt/w:sdtPr/w:dropDownList')); + $this->assertFalse($doc->elementExists($path . '[2]/w:sdt/w:sdtPr/w:alias')); + $this->assertTrue($doc->elementExists($path . '[3]/w:sdt/w:sdtPr/w:date')); + $this->assertTrue($doc->elementExists($path . '[3]/w:sdt/w:sdtPr/w:alias')); + $this->assertTrue($doc->elementExists($path . '[3]/w:sdt/w:sdtPr/w:tag')); } } diff --git a/tests/PhpWord/_includes/XmlDocument.php b/tests/PhpWord/_includes/XmlDocument.php index ef56ed15..eb335278 100644 --- a/tests/PhpWord/_includes/XmlDocument.php +++ b/tests/PhpWord/_includes/XmlDocument.php @@ -162,4 +162,22 @@ class XmlDocument return !($nodeList->length == 0); } + + /** + * Returns the xml, or part of it as a formatted string + * + * @param string $path + * @param string $file + * @return string + */ + public function printXml($path = '/w:document', $file = 'word/document.xml') + { + $newdoc = new \DOMDocument(); + $newdoc->formatOutput = true; + $newdoc->preserveWhiteSpace = false; + $node = $newdoc->importNode($this->getElement($path, $file), true); + $newdoc->appendChild($node); + + return $newdoc->saveXML($node); + } } From 56a3a53e7bb7fbf38deae759cafdc776e10a68a9 Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 7 Nov 2017 22:11:31 +0100 Subject: [PATCH 121/370] add unit test --- tests/PhpWord/Writer/Word2007/ElementTest.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/PhpWord/Writer/Word2007/ElementTest.php b/tests/PhpWord/Writer/Word2007/ElementTest.php index 0ebc7c57..dc3d30bd 100644 --- a/tests/PhpWord/Writer/Word2007/ElementTest.php +++ b/tests/PhpWord/Writer/Word2007/ElementTest.php @@ -267,7 +267,7 @@ class ElementTest extends \PHPUnit_Framework_TestCase $phpWord = new PhpWord(); $section = $phpWord->addSection(); - $section->addSDT('comboBox'); + $section->addSDT('comboBox')->setListItems(array('1' => 'Choice 1', '2' => 'Choice 2'))->setValue('select value'); $section->addSDT('dropDownList'); $section->addSDT('date')->setAlias('date_alias')->setTag('my_tag'); @@ -275,9 +275,16 @@ class ElementTest extends \PHPUnit_Framework_TestCase $path = '/w:document/w:body/w:p'; + $this->assertTrue($doc->elementExists($path . '[1]/w:sdt/w:sdtContent/w:r/w:t')); + $this->assertEquals('select value', $doc->getElement($path . '[1]/w:sdt/w:sdtContent/w:r/w:t')->nodeValue); $this->assertTrue($doc->elementExists($path . '[1]/w:sdt/w:sdtPr/w:comboBox')); + $this->assertTrue($doc->elementExists($path . '[1]/w:sdt/w:sdtPr/w:comboBox/w:listItem')); + $this->assertEquals('1', $doc->getElementAttribute($path . '[1]/w:sdt/w:sdtPr/w:comboBox/w:listItem[1]', 'w:value')); + $this->assertEquals('Choice 1', $doc->getElementAttribute($path . '[1]/w:sdt/w:sdtPr/w:comboBox/w:listItem[1]', 'w:displayText')); + $this->assertTrue($doc->elementExists($path . '[2]/w:sdt/w:sdtPr/w:dropDownList')); $this->assertFalse($doc->elementExists($path . '[2]/w:sdt/w:sdtPr/w:alias')); + $this->assertTrue($doc->elementExists($path . '[3]/w:sdt/w:sdtPr/w:date')); $this->assertTrue($doc->elementExists($path . '[3]/w:sdt/w:sdtPr/w:alias')); $this->assertTrue($doc->elementExists($path . '[3]/w:sdt/w:sdtPr/w:tag')); From 1b9c1d921b22cb87e17e0848ab00b785f370328a Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 7 Nov 2017 22:38:30 +0100 Subject: [PATCH 122/370] format --- src/PhpWord/Writer/ODText/Style/Paragraph.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/Writer/ODText/Style/Paragraph.php b/src/PhpWord/Writer/ODText/Style/Paragraph.php index 68613855..14a811a5 100644 --- a/src/PhpWord/Writer/ODText/Style/Paragraph.php +++ b/src/PhpWord/Writer/ODText/Style/Paragraph.php @@ -35,8 +35,8 @@ class Paragraph extends AbstractStyle } $xmlWriter = $this->getXmlWriter(); - $marginTop = ($style->getSpaceBefore() ==0 ) ? '0' : round(17.6 / $style->getSpaceBefore(), 2); - $marginBottom = ($style->getSpaceAfter() == 0) ? '0' : round(17.6 / $style->getSpaceAfter(), 2); + $marginTop = (is_null($style->getSpaceBefore()) || $style->getSpaceBefore() == 0) ? '0' : round(17.6 / $style->getSpaceBefore(), 2); + $marginBottom = (is_null($style->getSpaceAfter()) || $style->getSpaceAfter() == 0) ? '0' : round(17.6 / $style->getSpaceAfter(), 2); $xmlWriter->startElement('style:style'); $xmlWriter->writeAttribute('style:name', $style->getStyleName()); From 9634352b0f4d5fed0a916ac2f5c82e3a88247adc Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 7 Nov 2017 23:12:06 +0100 Subject: [PATCH 123/370] update changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f21cb9d6..0a5a91d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,9 +29,10 @@ This is the last version to support PHP 5.3 - Fixed Word2007 reader where margins were not being read correctly - @slowprog #885 #1008 - Impossible to add element PreserveText in Section - @rvanlaak #452 - Added missing options for numbering format - @troosan #1041 -- Fixed impossibility to set a different footer for first page - @ctrlaltca #1116 +- Fixed impossibility to set a different footer for first page - @ctrlaltca #1116, @aoloe #875 - Fixed styles not being applied by HTML writer, better pdf output - @sarke #1047 #500 #1139 - Fixed read docx error when document contains image from remote url - @FBnil #1173 #1176 +- Padded the $args array to remove error - @kaigoh #1150, @reformed #870 v0.13.0 (31 July 2016) ------------------- From 610d91e041fc53ef141faee97ab993909fff6f60 Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 8 Nov 2017 00:27:58 +0100 Subject: [PATCH 124/370] call parent constructor in SDT and FormField --- docs/styles.rst | 4 +++- src/PhpWord/Element/FormField.php | 1 + src/PhpWord/Element/SDT.php | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/styles.rst b/docs/styles.rst index 4f4926a8..f223574f 100644 --- a/docs/styles.rst +++ b/docs/styles.rst @@ -45,6 +45,7 @@ Available Font style options: - ``color``. Font color, e.g. *FF0000*. - ``doubleStrikethrough``. Double strikethrough, *true* or *false*. - ``fgColor``. Font highlight color, e.g. *yellow*, *green*, *blue*. + See ``\PhpOffice\PhpWord\Style\Font::FGCOLOR_...`` constants for more values - ``hint``. Font content type, *default*, *eastAsia*, or *cs*. - ``italic``. Italic, *true* or *false*. - ``name``. Font name, e.g. *Arial*. @@ -54,7 +55,8 @@ Available Font style options: - ``strikethrough``. Strikethrough, *true* or *false*. - ``subScript``. Subscript, *true* or *false*. - ``superScript``. Superscript, *true* or *false*. -- ``underline``. Underline, *dash*, *dotted*, etc. +- ``underline``. Underline, *single*, *dash*, *dotted*, etc. + See ``\PhpOffice\PhpWord\Style\Font::UNDERLINE_...`` constants for more values - ``lang``. Language, either a language code like *en-US*, *fr-BE*, etc. or an object (or as an array) if you need to set eastAsian or bidirectional languages See ``\PhpOffice\PhpWord\Style\Language`` class for some language codes. diff --git a/src/PhpWord/Element/FormField.php b/src/PhpWord/Element/FormField.php index 1e3e182c..598d61dc 100644 --- a/src/PhpWord/Element/FormField.php +++ b/src/PhpWord/Element/FormField.php @@ -73,6 +73,7 @@ class FormField extends Text */ public function __construct($type, $fontStyle = null, $paragraphStyle = null) { + parent::__construct(null, $fontStyle, $paragraphStyle); $this->setType($type); } diff --git a/src/PhpWord/Element/SDT.php b/src/PhpWord/Element/SDT.php index 6d4207b7..86f445cc 100644 --- a/src/PhpWord/Element/SDT.php +++ b/src/PhpWord/Element/SDT.php @@ -68,6 +68,7 @@ class SDT extends Text */ public function __construct($type, $fontStyle = null, $paragraphStyle = null) { + parent::__construct(null, $fontStyle, $paragraphStyle); $this->setType($type); } From 5412df29fae2a4c74cfda0885b1ec9fb87ea83fd Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 8 Nov 2017 00:34:22 +0100 Subject: [PATCH 125/370] update doc --- src/PhpWord/Style/Font.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/Style/Font.php b/src/PhpWord/Style/Font.php index 017ee521..8bfb3ac5 100644 --- a/src/PhpWord/Style/Font.php +++ b/src/PhpWord/Style/Font.php @@ -33,10 +33,16 @@ class Font extends AbstractStyle const UNDERLINE_DASHLONG = 'dashLong'; const UNDERLINE_DASHLONGHEAVY = 'dashLongHeavy'; const UNDERLINE_DOUBLE = 'dbl'; + /** + * @deprecated use UNDERLINE_DOTHASH instead, TODO remove in version 1.0 + */ const UNDERLINE_DOTHASH = 'dotDash'; // Incorrect spelling, for backwards compatibility + /** + * @deprecated use UNDERLINE_DOTDASHHEAVY instead, TODO remove in version 1.0 + */ const UNDERLINE_DOTHASHHEAVY = 'dotDashHeavy'; // Incorrect spelling, for backwards compatibility - const UNDERLINE_DOTDASH = 'dotDash'; // Correct spelling - const UNDERLINE_DOTDASHHEAVY = 'dotDashHeavy'; // Correct spelling + const UNDERLINE_DOTDASH = 'dotDash'; + const UNDERLINE_DOTDASHHEAVY = 'dotDashHeavy'; const UNDERLINE_DOTDOTDASH = 'dotDotDash'; const UNDERLINE_DOTDOTDASHHEAVY = 'dotDotDashHeavy'; const UNDERLINE_DOTTED = 'dotted'; From ebd4741774b3c211ccdc4129d70e93ae987dab8d Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 8 Nov 2017 00:45:14 +0100 Subject: [PATCH 126/370] update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c66ae424..6579d2ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,7 +33,7 @@ This is the last version to support PHP 5.3 - Fixed styles not being applied by HTML writer, better pdf output - @sarke #1047 #500 #1139 - Fixed read docx error when document contains image from remote url - @FBnil #1173 #1176 - Padded the $args array to remove error - @kaigoh #1150, @reformed #870 - +- Fix incorrect image size between windows and mac - @bskrtich #874 v0.13.0 (31 July 2016) ------------------- This release brings several improvements in `TemplateProcessor`, automatic output escaping feature for OOXML, ODF, HTML, and RTF (turned off, by default). From 778a77ecff34779841531354990ddfa55f97e0e9 Mon Sep 17 00:00:00 2001 From: ejuhjav Date: Wed, 20 May 2015 13:17:11 +0200 Subject: [PATCH 127/370] Update elements.rst Fixed a typo in the $lineStyle example (defined previously as $linestyle but used as $lineStyle) --- docs/elements.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/elements.rst b/docs/elements.rst index 124f4431..e27b45d9 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -414,7 +414,7 @@ Line elements can be added to sections by using ``addLine``. .. code-block:: php - $linestyle = array('weight' => 1, 'width' => 100, 'height' => 0, 'color' => 635552); + $lineStyle = array('weight' => 1, 'width' => 100, 'height' => 0, 'color' => 635552); $section->addLine($lineStyle) Available line style attributes: From fcdafeedd47ddf9473f802df680d1e1619d63df5 Mon Sep 17 00:00:00 2001 From: Nilton Date: Sat, 21 Oct 2017 00:07:52 +0200 Subject: [PATCH 128/370] Bring back b, i, and --- src/PhpWord/Shared/Html.php | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 670ba6e5..369b57fe 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -117,9 +117,12 @@ class Html 'h6' => array('Heading', null, $element, $styles, null, 'Heading6', null), '#text' => array('Text', $node, $element, $styles, null, null, null), 'strong' => array('Property', null, null, $styles, null, 'bold', true), + 'b' => array('Property', null, null, $styles, null, 'bold', true), 'em' => array('Property', null, null, $styles, null, 'italic', true), + 'i' => array('Property', null, null, $styles, null, 'italic', true), 'sup' => array('Property', null, null, $styles, null, 'superScript', true), 'sub' => array('Property', null, null, $styles, null, 'subScript', true), + 'span' => array('Property', null, null, $styles, null, 'span', $node), 'table' => array('Table', $node, $element, $styles, null, 'addTable', true), 'tr' => array('Table', $node, $element, $styles, null, 'addRow', true), 'td' => array('Table', $node, $element, $styles, null, 'addCell', true), @@ -246,7 +249,16 @@ class Html */ private static function parseProperty(&$styles, $argument1, $argument2) { - $styles['font'][$argument1] = $argument2; + if ($argument1 !== 'span') { + $styles['font'][$argument1] = $argument2; + } else { + if (!is_null($argument2->attributes)) { + $nodeAttr = $argument2->attributes->getNamedItem('style'); + if (!is_null($nodeAttr) && property_exists($nodeAttr, 'value')) { + $styles['font'] = self::parseStyle($nodeAttr, $styles['font']); + } + } + } return null; } @@ -362,6 +374,20 @@ class Html case 'background-color': $styles['bgColor'] = trim($cValue, '#'); break; + case 'font-weight': + $tValue = false; + if (preg_match('#bold#', $cValue)) { + $tValue = true; // also match bolder + } + $styles['bold'] = $tValue; + break; + case 'font-style': + $tValue = false; + if (preg_match('#(?:italic|oblique)#', $cValue)) { + $tValue = true; + } + $styles['italic'] = $tValue; + break; } } From 9e7e07d0bc5399d11a061a6baef314b8706d4242 Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 9 Nov 2017 00:41:56 +0100 Subject: [PATCH 129/370] Add unit tests for Html parser --- src/PhpWord/Shared/Html.php | 41 ++++----- tests/PhpWord/Reader/MsDocTest.php | 20 +++++ tests/PhpWord/Shared/HtmlTest.php | 110 +++++++++++++++++++++++- tests/PhpWord/_includes/XmlDocument.php | 12 ++- 4 files changed, 156 insertions(+), 27 deletions(-) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index f2282499..620839b4 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -18,6 +18,7 @@ namespace PhpOffice\PhpWord\Shared; use PhpOffice\PhpWord\Element\AbstractContainer; +use PhpOffice\PhpWord\SimpleType\Jc; /** * Common Html functions @@ -120,9 +121,10 @@ class Html 'b' => array('Property', null, null, $styles, null, 'bold', true), 'em' => array('Property', null, null, $styles, null, 'italic', true), 'i' => array('Property', null, null, $styles, null, 'italic', true), + 'u' => array('Property', null, null, $styles, null, 'underline', 'single'), 'sup' => array('Property', null, null, $styles, null, 'superScript', true), 'sub' => array('Property', null, null, $styles, null, 'subScript', true), - 'span' => array('Property', null, null, $styles, null, 'span', $node), + 'span' => array('Property', null, null, $styles, null, 'span', $node), 'table' => array('Table', $node, $element, $styles, null, 'addTable', true), 'tr' => array('Table', $node, $element, $styles, null, 'addRow', true), 'td' => array('Table', $node, $element, $styles, null, 'addCell', true), @@ -236,8 +238,6 @@ class Html // if (method_exists($element, 'addText')) { $element->addText($node->nodeValue, $styles['font'], $styles['paragraph']); // } - - return null; } /** @@ -259,8 +259,6 @@ class Html } } } - - return null; } /** @@ -310,8 +308,6 @@ class Html $data['listdepth'] = 0; } $styles['list']['listType'] = $argument1; - - return null; } /** @@ -337,8 +333,6 @@ class Html } $element->addListItem($text, $data['listdepth'], $styles['font'], $styles['list'], $styles['paragraph']); } - - return null; } /** @@ -366,7 +360,20 @@ class Html } break; case 'text-align': - $styles['alignment'] = $cValue; // todo: any mapping? + switch ($cValue) { + case 'left': + $styles['alignment'] = Jc::START; + break; + case 'right': + $styles['alignment'] = Jc::END; + break; + case 'center': + $styles['alignment'] = Jc::CENTER; + break; + case 'justify': + $styles['alignment'] = Jc::BOTH; + break; + } break; case 'color': $styles['color'] = trim($cValue, '#'); @@ -388,20 +395,6 @@ class Html } $styles['italic'] = $tValue; break; - case 'font-weight': - $tValue = false; - if (preg_match('#bold#', $cValue)) { - $tValue = true; // also match bolder - } - $styles['bold'] = $tValue; - break; - case 'font-style': - $tValue = false; - if (preg_match('#(?:italic|oblique)#', $cValue)) { - $tValue = true; - } - $styles['italic'] = $tValue; - break; } } diff --git a/tests/PhpWord/Reader/MsDocTest.php b/tests/PhpWord/Reader/MsDocTest.php index ed16e64b..b57f7e44 100644 --- a/tests/PhpWord/Reader/MsDocTest.php +++ b/tests/PhpWord/Reader/MsDocTest.php @@ -56,4 +56,24 @@ class MsDocTest extends \PHPUnit_Framework_TestCase $phpWord = IOFactory::load($filename, 'MsDoc'); $this->assertInstanceOf('PhpOffice\\PhpWord\\PhpWord', $phpWord); } + + /** + * Test exception on not existing file + * @expectedException \Exception + */ + public function testFailIfFileNotReadable() + { + $filename = __DIR__ . '/../_files/documents/not_existing_reader.doc'; + IOFactory::load($filename, 'MsDoc'); + } + + /** + * Test exception on non OLE document + * @expectedException \Exception + */ + public function testFailIfFileNotOle() + { + $filename = __DIR__ . '/../_files/documents/reader.odt'; + IOFactory::load($filename, 'MsDoc'); + } } diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index 602b644d..b1a9e31c 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -18,9 +18,12 @@ namespace PhpOffice\PhpWord\Shared; use PhpOffice\PhpWord\Element\Section; +use PhpOffice\PhpWord\SimpleType\Jc; +use PhpOffice\PhpWord\TestHelperDOCX; /** * Test class for PhpOffice\PhpWord\Shared\Html + * @coversDefaultClass \PhpOffice\PhpWord\Shared\Html */ class HtmlTest extends \PHPUnit_Framework_TestCase { @@ -43,7 +46,7 @@ class HtmlTest extends \PHPUnit_Framework_TestCase // Styles $content .= '

'; + . 'text-align: center; color: #999; background-color: #000; font-weight: bold; font-style: italic;">'; foreach ($styles as $style) { $content .= "<{$style}>{$style}"; } @@ -67,4 +70,109 @@ class HtmlTest extends \PHPUnit_Framework_TestCase $content .= '–   ²³¼½¾'; Html::addHtml($section, $content); } + + /** + * Test that html already in body element can be read + * @ignore + */ + public function testParseFullHtml() + { + $section = new Section(1); + Html::addHtml($section, '

test paragraph1

test paragraph2

', true); + + $this->assertCount(2, $section->getElements()); + } + + /** + * Test underline + */ + public function testParseUnderline() + { + $html = 'test'; + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + Html::addHtml($section, $html); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:rPr/w:u')); + $this->assertEquals('single', $doc->getElementAttribute('/w:document/w:body/w:p/w:r/w:rPr/w:u', 'w:val')); + } + + /** + * Test text-decoration style + */ + public function testParseTextDecoration() + { + $html = 'test'; + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + Html::addHtml($section, $html); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:rPr/w:u')); + $this->assertEquals('single', $doc->getElementAttribute('/w:document/w:body/w:p/w:r/w:rPr/w:u', 'w:val')); + } + + /** + * Test text-align style + */ + public function testParseTextAlign() + { + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + Html::addHtml($section, '

test

'); + Html::addHtml($section, '

test

'); + Html::addHtml($section, '

test

'); + Html::addHtml($section, '

test

'); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:pPr/w:jc')); + $this->assertEquals('start', $doc->getElementAttribute('/w:document/w:body/w:p[1]/w:pPr/w:jc', 'w:val')); + $this->assertEquals('end', $doc->getElementAttribute('/w:document/w:body/w:p[2]/w:pPr/w:jc', 'w:val')); + $this->assertEquals('center', $doc->getElementAttribute('/w:document/w:body/w:p[3]/w:pPr/w:jc', 'w:val')); + $this->assertEquals('both', $doc->getElementAttribute('/w:document/w:body/w:p[4]/w:pPr/w:jc', 'w:val')); + } + + /** + * Test parsing paragraph and span styles + */ + public function testParseParagraphAndSpanStyle() + { + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + Html::addHtml($section, '

test

'); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:pPr/w:jc')); + $this->assertEquals('center', $doc->getElementAttribute('/w:document/w:body/w:p[1]/w:pPr/w:jc', 'w:val')); + $this->assertEquals('single', $doc->getElementAttribute('/w:document/w:body/w:p[1]/w:r/w:rPr/w:u', 'w:val')); + } + + /** + * Test parsing table + */ + public function testParseTable() + { + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $html = ' + + + + + + + + + + + + +
abc
12
456
'; + Html::addHtml($section, $html); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); +// echo $doc->printXml(); +// $this->assertTrue($doc->elementExists('/w:document/w:body/w:tbl/w:tr/w:tc')); + } } diff --git a/tests/PhpWord/_includes/XmlDocument.php b/tests/PhpWord/_includes/XmlDocument.php index eb335278..c82c5a8e 100644 --- a/tests/PhpWord/_includes/XmlDocument.php +++ b/tests/PhpWord/_includes/XmlDocument.php @@ -170,12 +170,20 @@ class XmlDocument * @param string $file * @return string */ - public function printXml($path = '/w:document', $file = 'word/document.xml') + public function printXml($path = '/', $file = 'word/document.xml') { + $element = $this->getElement($path, $file); + if ($element instanceof \DOMDocument) { + $element->formatOutput = true; + $element->preserveWhiteSpace = false; + + return $element->saveXML(); + } + $newdoc = new \DOMDocument(); $newdoc->formatOutput = true; $newdoc->preserveWhiteSpace = false; - $node = $newdoc->importNode($this->getElement($path, $file), true); + $node = $newdoc->importNode($element, true); $newdoc->appendChild($node); return $newdoc->saveXML($node); From ba6c03e06d54da20091e589b0bad29ab8f5f0eda Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Thu, 9 Nov 2017 06:36:47 -0200 Subject: [PATCH 130/370] Use PHPUnit\Framework\TestCase instead of PHPUnit_Framework_TestCase --- composer.json | 2 +- tests/PhpWord/Collection/CollectionTest.php | 2 +- tests/PhpWord/ComplexType/FootnotePropertiesTest.php | 2 +- tests/PhpWord/ComplexType/ProofStateTest.php | 2 +- tests/PhpWord/Element/AbstractElementTest.php | 2 +- tests/PhpWord/Element/BookmarkTest.php | 2 +- tests/PhpWord/Element/CellTest.php | 2 +- tests/PhpWord/Element/CheckBoxTest.php | 2 +- tests/PhpWord/Element/CommentTest.php | 2 +- tests/PhpWord/Element/FieldTest.php | 2 +- tests/PhpWord/Element/FooterTest.php | 2 +- tests/PhpWord/Element/FootnoteTest.php | 2 +- tests/PhpWord/Element/HeaderTest.php | 2 +- tests/PhpWord/Element/ImageTest.php | 2 +- tests/PhpWord/Element/LineTest.php | 2 +- tests/PhpWord/Element/LinkTest.php | 2 +- tests/PhpWord/Element/ListItemRunTest.php | 2 +- tests/PhpWord/Element/ListItemTest.php | 2 +- tests/PhpWord/Element/ObjectTest.php | 2 +- tests/PhpWord/Element/PageBreakTest.php | 2 +- tests/PhpWord/Element/PreserveTextTest.php | 2 +- tests/PhpWord/Element/RowTest.php | 2 +- tests/PhpWord/Element/SDTTest.php | 2 +- tests/PhpWord/Element/SectionTest.php | 2 +- tests/PhpWord/Element/TOCTest.php | 2 +- tests/PhpWord/Element/TableTest.php | 2 +- tests/PhpWord/Element/TextBoxTest.php | 2 +- tests/PhpWord/Element/TextBreakTest.php | 2 +- tests/PhpWord/Element/TextRunTest.php | 2 +- tests/PhpWord/Element/TextTest.php | 2 +- tests/PhpWord/Element/TitleTest.php | 2 +- tests/PhpWord/Exception/CopyFileExceptionTest.php | 2 +- tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php | 2 +- tests/PhpWord/Exception/ExceptionTest.php | 2 +- tests/PhpWord/Exception/InvalidImageExceptionTest.php | 2 +- tests/PhpWord/Exception/InvalidStyleExceptionTest.php | 2 +- tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php | 2 +- tests/PhpWord/IOFactoryTest.php | 2 +- tests/PhpWord/MediaTest.php | 2 +- tests/PhpWord/Metadata/DocInfoTest.php | 2 +- tests/PhpWord/Metadata/SettingsTest.php | 2 +- tests/PhpWord/PhpWordTest.php | 2 +- tests/PhpWord/Reader/HTMLTest.php | 2 +- tests/PhpWord/Reader/MsDocTest.php | 2 +- tests/PhpWord/Reader/ODTextTest.php | 2 +- tests/PhpWord/Reader/RTFTest.php | 2 +- tests/PhpWord/Reader/Word2007Test.php | 2 +- tests/PhpWord/SettingsTest.php | 2 +- tests/PhpWord/Shared/ConverterTest.php | 2 +- tests/PhpWord/Shared/HtmlTest.php | 2 +- tests/PhpWord/Shared/ZipArchiveTest.php | 2 +- tests/PhpWord/Style/AbstractStyleTest.php | 2 +- tests/PhpWord/Style/CellTest.php | 2 +- tests/PhpWord/Style/FontTest.php | 2 +- tests/PhpWord/Style/ImageTest.php | 2 +- tests/PhpWord/Style/IndentationTest.php | 2 +- tests/PhpWord/Style/LanguageTest.php | 2 +- tests/PhpWord/Style/LineNumberingTest.php | 2 +- tests/PhpWord/Style/LineTest.php | 2 +- tests/PhpWord/Style/ListItemTest.php | 2 +- tests/PhpWord/Style/NumberingLevelTest.php | 2 +- tests/PhpWord/Style/NumberingTest.php | 2 +- tests/PhpWord/Style/PaperTest.php | 2 +- tests/PhpWord/Style/ParagraphTest.php | 2 +- tests/PhpWord/Style/RowTest.php | 2 +- tests/PhpWord/Style/SectionTest.php | 2 +- tests/PhpWord/Style/ShadingTest.php | 2 +- tests/PhpWord/Style/SpacingTest.php | 2 +- tests/PhpWord/Style/TOCTest.php | 2 +- tests/PhpWord/Style/TabTest.php | 2 +- tests/PhpWord/Style/TableTest.php | 2 +- tests/PhpWord/Style/TextBoxTest.php | 2 +- tests/PhpWord/StyleTest.php | 2 +- tests/PhpWord/TemplateProcessorTest.php | 2 +- tests/PhpWord/Writer/HTML/ElementTest.php | 2 +- tests/PhpWord/Writer/HTML/PartTest.php | 2 +- tests/PhpWord/Writer/HTML/StyleTest.php | 2 +- tests/PhpWord/Writer/HTMLTest.php | 2 +- tests/PhpWord/Writer/ODText/ElementTest.php | 2 +- tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php | 2 +- tests/PhpWord/Writer/ODText/Part/ContentTest.php | 2 +- tests/PhpWord/Writer/ODText/StyleTest.php | 2 +- tests/PhpWord/Writer/ODTextTest.php | 2 +- tests/PhpWord/Writer/PDF/DomPDFTest.php | 2 +- tests/PhpWord/Writer/PDF/MPDFTest.php | 2 +- tests/PhpWord/Writer/PDF/TCPDFTest.php | 2 +- tests/PhpWord/Writer/PDFTest.php | 2 +- tests/PhpWord/Writer/RTF/ElementTest.php | 2 +- tests/PhpWord/Writer/RTF/StyleTest.php | 2 +- tests/PhpWord/Writer/RTFTest.php | 2 +- tests/PhpWord/Writer/Word2007/ElementTest.php | 2 +- tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php | 2 +- tests/PhpWord/Writer/Word2007/Part/CommentsTest.php | 2 +- tests/PhpWord/Writer/Word2007/Part/DocumentTest.php | 2 +- tests/PhpWord/Writer/Word2007/Part/FooterTest.php | 2 +- tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php | 2 +- tests/PhpWord/Writer/Word2007/Part/HeaderTest.php | 2 +- tests/PhpWord/Writer/Word2007/Part/NumberingTest.php | 2 +- tests/PhpWord/Writer/Word2007/Part/SettingsTest.php | 2 +- tests/PhpWord/Writer/Word2007/Part/StylesTest.php | 2 +- tests/PhpWord/Writer/Word2007/PartTest.php | 2 +- tests/PhpWord/Writer/Word2007/Style/FontTest.php | 2 +- tests/PhpWord/Writer/Word2007/StyleTest.php | 2 +- tests/PhpWord/Writer/Word2007Test.php | 2 +- 104 files changed, 104 insertions(+), 104 deletions(-) diff --git a/composer.json b/composer.json index 5b5a91d2..ee4f9bd5 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,7 @@ "phpoffice/common": "^0.2" }, "require-dev": { - "phpunit/phpunit": "4.8.*", + "phpunit/phpunit": "^4.8.36", "phpdocumentor/phpdocumentor":"2.*", "twig/twig":"1.27", "squizlabs/php_codesniffer": "^2.7", diff --git a/tests/PhpWord/Collection/CollectionTest.php b/tests/PhpWord/Collection/CollectionTest.php index 22f89b72..a8757171 100644 --- a/tests/PhpWord/Collection/CollectionTest.php +++ b/tests/PhpWord/Collection/CollectionTest.php @@ -24,7 +24,7 @@ use PhpOffice\PhpWord\Element\Footnote; * * Using concrete class Footnotes instead of AbstractCollection */ -class CollectionTest extends \PHPUnit_Framework_TestCase +class CollectionTest extends \PHPUnit\Framework\TestCase { /** * Test collection diff --git a/tests/PhpWord/ComplexType/FootnotePropertiesTest.php b/tests/PhpWord/ComplexType/FootnotePropertiesTest.php index 55e22e6f..b8df9bbe 100644 --- a/tests/PhpWord/ComplexType/FootnotePropertiesTest.php +++ b/tests/PhpWord/ComplexType/FootnotePropertiesTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\SimpleType\NumberFormat; * @coversDefaultClass \PhpOffice\PhpWord\ComplexType\FootnoteProperties * @runTestsInSeparateProcesses */ -class FootnotePropertiesTest extends \PHPUnit_Framework_TestCase +class FootnotePropertiesTest extends \PHPUnit\Framework\TestCase { /** * Test setting style with normal value diff --git a/tests/PhpWord/ComplexType/ProofStateTest.php b/tests/PhpWord/ComplexType/ProofStateTest.php index e807ca2f..baf2009e 100644 --- a/tests/PhpWord/ComplexType/ProofStateTest.php +++ b/tests/PhpWord/ComplexType/ProofStateTest.php @@ -22,7 +22,7 @@ namespace PhpOffice\PhpWord\ComplexType; * * @coversDefaultClass \PhpOffice\PhpWord\ComplexType\ProofState */ -class ProofStateTest extends \PHPUnit_Framework_TestCase +class ProofStateTest extends \PHPUnit\Framework\TestCase { /** * Tests the getters and setters diff --git a/tests/PhpWord/Element/AbstractElementTest.php b/tests/PhpWord/Element/AbstractElementTest.php index 458b94c8..87bb5e18 100644 --- a/tests/PhpWord/Element/AbstractElementTest.php +++ b/tests/PhpWord/Element/AbstractElementTest.php @@ -20,7 +20,7 @@ namespace PhpOffice\PhpWord\Element; /** * Test class for PhpOffice\PhpWord\Element\AbstractElement */ -class AbstractElementTest extends \PHPUnit_Framework_TestCase +class AbstractElementTest extends \PHPUnit\Framework\TestCase { /** * Test set/get element index diff --git a/tests/PhpWord/Element/BookmarkTest.php b/tests/PhpWord/Element/BookmarkTest.php index da86a62e..bd5d27ae 100644 --- a/tests/PhpWord/Element/BookmarkTest.php +++ b/tests/PhpWord/Element/BookmarkTest.php @@ -22,7 +22,7 @@ namespace PhpOffice\PhpWord\Element; * * @runTestsInSeparateProcesses */ -class BookmarkTest extends \PHPUnit_Framework_TestCase +class BookmarkTest extends \PHPUnit\Framework\TestCase { /** * New instance diff --git a/tests/PhpWord/Element/CellTest.php b/tests/PhpWord/Element/CellTest.php index aff208c4..4e8daa0e 100644 --- a/tests/PhpWord/Element/CellTest.php +++ b/tests/PhpWord/Element/CellTest.php @@ -22,7 +22,7 @@ namespace PhpOffice\PhpWord\Element; * * @runTestsInSeparateProcesses */ -class CellTest extends \PHPUnit_Framework_TestCase +class CellTest extends \PHPUnit\Framework\TestCase { /** * New instance diff --git a/tests/PhpWord/Element/CheckBoxTest.php b/tests/PhpWord/Element/CheckBoxTest.php index fb71b8c2..d5bda9bd 100644 --- a/tests/PhpWord/Element/CheckBoxTest.php +++ b/tests/PhpWord/Element/CheckBoxTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\Style\Font; * * @runTestsInSeparateProcesses */ -class CheckBoxTest extends \PHPUnit_Framework_TestCase +class CheckBoxTest extends \PHPUnit\Framework\TestCase { /** * Construct diff --git a/tests/PhpWord/Element/CommentTest.php b/tests/PhpWord/Element/CommentTest.php index fd2c814d..d33a54f6 100644 --- a/tests/PhpWord/Element/CommentTest.php +++ b/tests/PhpWord/Element/CommentTest.php @@ -22,7 +22,7 @@ namespace PhpOffice\PhpWord\Element; * * @runTestsInSeparateProcesses */ -class CommentTest extends \PHPUnit_Framework_TestCase +class CommentTest extends \PHPUnit\Framework\TestCase { /** * New instance diff --git a/tests/PhpWord/Element/FieldTest.php b/tests/PhpWord/Element/FieldTest.php index 1bd0c216..8baa68e4 100644 --- a/tests/PhpWord/Element/FieldTest.php +++ b/tests/PhpWord/Element/FieldTest.php @@ -22,7 +22,7 @@ namespace PhpOffice\PhpWord\Element; * * @runTestsInSeparateProcesses */ -class FieldTest extends \PHPUnit_Framework_TestCase +class FieldTest extends \PHPUnit\Framework\TestCase { /** * New instance diff --git a/tests/PhpWord/Element/FooterTest.php b/tests/PhpWord/Element/FooterTest.php index 2938ae5e..b68e80cd 100644 --- a/tests/PhpWord/Element/FooterTest.php +++ b/tests/PhpWord/Element/FooterTest.php @@ -22,7 +22,7 @@ namespace PhpOffice\PhpWord\Element; * * @runTestsInSeparateProcesses */ -class FooterTest extends \PHPUnit_Framework_TestCase +class FooterTest extends \PHPUnit\Framework\TestCase { /** * New instance diff --git a/tests/PhpWord/Element/FootnoteTest.php b/tests/PhpWord/Element/FootnoteTest.php index b02ab5c6..fd4c8d03 100644 --- a/tests/PhpWord/Element/FootnoteTest.php +++ b/tests/PhpWord/Element/FootnoteTest.php @@ -22,7 +22,7 @@ namespace PhpOffice\PhpWord\Element; * * @runTestsInSeparateProcesses */ -class FootnoteTest extends \PHPUnit_Framework_TestCase +class FootnoteTest extends \PHPUnit\Framework\TestCase { /** * New instance without parameter diff --git a/tests/PhpWord/Element/HeaderTest.php b/tests/PhpWord/Element/HeaderTest.php index 13ace285..29b2fef5 100644 --- a/tests/PhpWord/Element/HeaderTest.php +++ b/tests/PhpWord/Element/HeaderTest.php @@ -22,7 +22,7 @@ namespace PhpOffice\PhpWord\Element; * * @runTestsInSeparateProcesses */ -class HeaderTest extends \PHPUnit_Framework_TestCase +class HeaderTest extends \PHPUnit\Framework\TestCase { /** * New instance diff --git a/tests/PhpWord/Element/ImageTest.php b/tests/PhpWord/Element/ImageTest.php index b681b81f..00449e1f 100644 --- a/tests/PhpWord/Element/ImageTest.php +++ b/tests/PhpWord/Element/ImageTest.php @@ -24,7 +24,7 @@ use PhpOffice\PhpWord\SimpleType\Jc; * * @runTestsInSeparateProcesses */ -class ImageTest extends \PHPUnit_Framework_TestCase +class ImageTest extends \PHPUnit\Framework\TestCase { /** * New instance diff --git a/tests/PhpWord/Element/LineTest.php b/tests/PhpWord/Element/LineTest.php index a6e3f79b..4d414944 100644 --- a/tests/PhpWord/Element/LineTest.php +++ b/tests/PhpWord/Element/LineTest.php @@ -23,7 +23,7 @@ namespace PhpOffice\PhpWord\Element; * @coversDefaultClass \PhpOffice\PhpWord\Element\Line * @runTestsInSeparateProcesses */ -class LineTest extends \PHPUnit_Framework_TestCase +class LineTest extends \PHPUnit\Framework\TestCase { /** * Create new instance diff --git a/tests/PhpWord/Element/LinkTest.php b/tests/PhpWord/Element/LinkTest.php index 48b576c3..63e8f1de 100644 --- a/tests/PhpWord/Element/LinkTest.php +++ b/tests/PhpWord/Element/LinkTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\Style\Font; * @coversDefaultClass \PhpOffice\PhpWord\Element\Link * @runTestsInSeparateProcesses */ -class LinkTest extends \PHPUnit_Framework_TestCase +class LinkTest extends \PHPUnit\Framework\TestCase { /** * Create new instance diff --git a/tests/PhpWord/Element/ListItemRunTest.php b/tests/PhpWord/Element/ListItemRunTest.php index 0c4c1ac9..999756ba 100644 --- a/tests/PhpWord/Element/ListItemRunTest.php +++ b/tests/PhpWord/Element/ListItemRunTest.php @@ -22,7 +22,7 @@ namespace PhpOffice\PhpWord\Element; * * @runTestsInSeparateProcesses */ -class ListItemRunTest extends \PHPUnit_Framework_TestCase +class ListItemRunTest extends \PHPUnit\Framework\TestCase { /** * New instance diff --git a/tests/PhpWord/Element/ListItemTest.php b/tests/PhpWord/Element/ListItemTest.php index 775a97d4..5fae34d4 100644 --- a/tests/PhpWord/Element/ListItemTest.php +++ b/tests/PhpWord/Element/ListItemTest.php @@ -23,7 +23,7 @@ namespace PhpOffice\PhpWord\Element; * @coversDefaultClass \PhpOffice\PhpWord\Element\ListItem * @runTestsInSeparateProcesses */ -class ListItemTest extends \PHPUnit_Framework_TestCase +class ListItemTest extends \PHPUnit\Framework\TestCase { /** * Get text object diff --git a/tests/PhpWord/Element/ObjectTest.php b/tests/PhpWord/Element/ObjectTest.php index 51ed19b5..71f12974 100644 --- a/tests/PhpWord/Element/ObjectTest.php +++ b/tests/PhpWord/Element/ObjectTest.php @@ -23,7 +23,7 @@ namespace PhpOffice\PhpWord\Element; * @coversDefaultClass \PhpOffice\PhpWord\Element\Object * @runTestsInSeparateProcesses */ -class ObjectTest extends \PHPUnit_Framework_TestCase +class ObjectTest extends \PHPUnit\Framework\TestCase { /** * Create new instance with supported files, 4 character extention diff --git a/tests/PhpWord/Element/PageBreakTest.php b/tests/PhpWord/Element/PageBreakTest.php index 69a71204..3b081848 100644 --- a/tests/PhpWord/Element/PageBreakTest.php +++ b/tests/PhpWord/Element/PageBreakTest.php @@ -23,7 +23,7 @@ namespace PhpOffice\PhpWord\Element; * @coversDefaultClass \PhpOffice\PhpWord\Element\PageBreak * @runTestsInSeparateProcesses */ -class PageBreakTest extends \PHPUnit_Framework_TestCase +class PageBreakTest extends \PHPUnit\Framework\TestCase { /** * Executed before each method of the class diff --git a/tests/PhpWord/Element/PreserveTextTest.php b/tests/PhpWord/Element/PreserveTextTest.php index a47cc77c..c2767a4f 100644 --- a/tests/PhpWord/Element/PreserveTextTest.php +++ b/tests/PhpWord/Element/PreserveTextTest.php @@ -24,7 +24,7 @@ use PhpOffice\PhpWord\SimpleType\Jc; * * @runTestsInSeparateProcesses */ -class PreserveTextTest extends \PHPUnit_Framework_TestCase +class PreserveTextTest extends \PHPUnit\Framework\TestCase { /** * Create new instance diff --git a/tests/PhpWord/Element/RowTest.php b/tests/PhpWord/Element/RowTest.php index cb365dad..9abf3776 100644 --- a/tests/PhpWord/Element/RowTest.php +++ b/tests/PhpWord/Element/RowTest.php @@ -23,7 +23,7 @@ namespace PhpOffice\PhpWord\Element; * @coversDefaultClass \PhpOffice\PhpWord\Element\Row * @runTestsInSeparateProcesses */ -class RowTest extends \PHPUnit_Framework_TestCase +class RowTest extends \PHPUnit\Framework\TestCase { /** * Create new instance diff --git a/tests/PhpWord/Element/SDTTest.php b/tests/PhpWord/Element/SDTTest.php index 537841a6..41eae213 100644 --- a/tests/PhpWord/Element/SDTTest.php +++ b/tests/PhpWord/Element/SDTTest.php @@ -22,7 +22,7 @@ namespace PhpOffice\PhpWord\Element; * * @coversDefaultClass \PhpOffice\PhpWord\Element\SDT */ -class SDTTest extends \PHPUnit_Framework_TestCase +class SDTTest extends \PHPUnit\Framework\TestCase { /** * Create new instance diff --git a/tests/PhpWord/Element/SectionTest.php b/tests/PhpWord/Element/SectionTest.php index aebfc9b7..8b6c9a43 100644 --- a/tests/PhpWord/Element/SectionTest.php +++ b/tests/PhpWord/Element/SectionTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\Style; * @coversDefaultClass \PhpOffice\PhpWord\Element\Section * @runTestsInSeparateProcesses */ -class SectionTest extends \PHPUnit_Framework_TestCase +class SectionTest extends \PHPUnit\Framework\TestCase { /** * @covers ::setStyle diff --git a/tests/PhpWord/Element/TOCTest.php b/tests/PhpWord/Element/TOCTest.php index 655d567c..d826a1a1 100644 --- a/tests/PhpWord/Element/TOCTest.php +++ b/tests/PhpWord/Element/TOCTest.php @@ -24,7 +24,7 @@ use PhpOffice\PhpWord\PhpWord; * * @runTestsInSeparateProcesses */ -class TOCTest extends \PHPUnit_Framework_TestCase +class TOCTest extends \PHPUnit\Framework\TestCase { /** * Construct with font and TOC style in array format diff --git a/tests/PhpWord/Element/TableTest.php b/tests/PhpWord/Element/TableTest.php index 3085aee2..0bbefb24 100644 --- a/tests/PhpWord/Element/TableTest.php +++ b/tests/PhpWord/Element/TableTest.php @@ -23,7 +23,7 @@ namespace PhpOffice\PhpWord\Element; * @coversDefaultClass \PhpOffice\PhpWord\Element\Table * @runTestsInSeparateProcesses */ -class TableTest extends \PHPUnit_Framework_TestCase +class TableTest extends \PHPUnit\Framework\TestCase { /** * Create new instance diff --git a/tests/PhpWord/Element/TextBoxTest.php b/tests/PhpWord/Element/TextBoxTest.php index cc61e20d..63b093c9 100644 --- a/tests/PhpWord/Element/TextBoxTest.php +++ b/tests/PhpWord/Element/TextBoxTest.php @@ -23,7 +23,7 @@ namespace PhpOffice\PhpWord\Element; * @coversDefaultClass \PhpOffice\PhpWord\Element\TextBox * @runTestsInSeparateProcesses */ -class TextBoxTest extends \PHPUnit_Framework_TestCase +class TextBoxTest extends \PHPUnit\Framework\TestCase { /** * Create new instance diff --git a/tests/PhpWord/Element/TextBreakTest.php b/tests/PhpWord/Element/TextBreakTest.php index 62186244..9b25bac3 100644 --- a/tests/PhpWord/Element/TextBreakTest.php +++ b/tests/PhpWord/Element/TextBreakTest.php @@ -26,7 +26,7 @@ use PhpOffice\PhpWord\Style\Paragraph; * @coversDefaultClass \PhpOffice\PhpWord\Element\TextBreak * @runTestsInSeparateProcesses */ -class TextBreakTest extends \PHPUnit_Framework_TestCase +class TextBreakTest extends \PHPUnit\Framework\TestCase { /** * Construct with empty value diff --git a/tests/PhpWord/Element/TextRunTest.php b/tests/PhpWord/Element/TextRunTest.php index 59db597c..27f5af6b 100644 --- a/tests/PhpWord/Element/TextRunTest.php +++ b/tests/PhpWord/Element/TextRunTest.php @@ -24,7 +24,7 @@ use PhpOffice\PhpWord\PhpWord; * * @runTestsInSeparateProcesses */ -class TextRunTest extends \PHPUnit_Framework_TestCase +class TextRunTest extends \PHPUnit\Framework\TestCase { /** * New instance diff --git a/tests/PhpWord/Element/TextTest.php b/tests/PhpWord/Element/TextTest.php index 9723a2e1..09027ad6 100644 --- a/tests/PhpWord/Element/TextTest.php +++ b/tests/PhpWord/Element/TextTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\Style\Font; * * @runTestsInSeparateProcesses */ -class TextTest extends \PHPUnit_Framework_TestCase +class TextTest extends \PHPUnit\Framework\TestCase { /** * New instance diff --git a/tests/PhpWord/Element/TitleTest.php b/tests/PhpWord/Element/TitleTest.php index 500de133..3ea6242f 100644 --- a/tests/PhpWord/Element/TitleTest.php +++ b/tests/PhpWord/Element/TitleTest.php @@ -23,7 +23,7 @@ namespace PhpOffice\PhpWord\Element; * @coversDefaultClass \PhpOffice\PhpWord\Element\Title * @runTestsInSeparateProcesses */ -class TitleTest extends \PHPUnit_Framework_TestCase +class TitleTest extends \PHPUnit\Framework\TestCase { /** * Create new instance diff --git a/tests/PhpWord/Exception/CopyFileExceptionTest.php b/tests/PhpWord/Exception/CopyFileExceptionTest.php index 9d921740..fa9949ed 100644 --- a/tests/PhpWord/Exception/CopyFileExceptionTest.php +++ b/tests/PhpWord/Exception/CopyFileExceptionTest.php @@ -21,7 +21,7 @@ namespace PhpOffice\PhpWord\Exception; * @covers \PhpOffice\PhpWord\Exception\CopyFileException * @coversDefaultClass \PhpOffice\PhpWord\Exception\CopyFileException */ -class CopyFileExceptionTest extends \PHPUnit_Framework_TestCase +class CopyFileExceptionTest extends \PHPUnit\Framework\TestCase { /** * CopyFileException can be thrown. diff --git a/tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php b/tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php index 91c7012f..6b4d14bf 100644 --- a/tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php +++ b/tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php @@ -21,7 +21,7 @@ namespace PhpOffice\PhpWord\Exception; * @covers \PhpOffice\PhpWord\Exception\CreateTemporaryFileException * @coversDefaultClass \PhpOffice\PhpWord\Exception\CreateTemporaryFileException */ -class CreateTemporaryFileExceptionTest extends \PHPUnit_Framework_TestCase +class CreateTemporaryFileExceptionTest extends \PHPUnit\Framework\TestCase { /** * CreateTemporaryFileException can be thrown. diff --git a/tests/PhpWord/Exception/ExceptionTest.php b/tests/PhpWord/Exception/ExceptionTest.php index 28b15702..255477f9 100644 --- a/tests/PhpWord/Exception/ExceptionTest.php +++ b/tests/PhpWord/Exception/ExceptionTest.php @@ -23,7 +23,7 @@ namespace PhpOffice\PhpWord\Exception; * @coversDefaultClass \PhpOffice\PhpWord\Exception\Exception * @runTestsInSeparateProcesses */ -class ExceptionTest extends \PHPUnit_Framework_TestCase +class ExceptionTest extends \PHPUnit\Framework\TestCase { /** * Throw new exception diff --git a/tests/PhpWord/Exception/InvalidImageExceptionTest.php b/tests/PhpWord/Exception/InvalidImageExceptionTest.php index dfaadbd7..c0285dc1 100644 --- a/tests/PhpWord/Exception/InvalidImageExceptionTest.php +++ b/tests/PhpWord/Exception/InvalidImageExceptionTest.php @@ -23,7 +23,7 @@ namespace PhpOffice\PhpWord\Exception; * @coversDefaultClass \PhpOffice\PhpWord\Exception\InvalidImageException * @runTestsInSeparateProcesses */ -class InvalidImageExceptionTest extends \PHPUnit_Framework_TestCase +class InvalidImageExceptionTest extends \PHPUnit\Framework\TestCase { /** * Throw new exception diff --git a/tests/PhpWord/Exception/InvalidStyleExceptionTest.php b/tests/PhpWord/Exception/InvalidStyleExceptionTest.php index 77ee8571..d516019f 100644 --- a/tests/PhpWord/Exception/InvalidStyleExceptionTest.php +++ b/tests/PhpWord/Exception/InvalidStyleExceptionTest.php @@ -23,7 +23,7 @@ namespace PhpOffice\PhpWord\Exception; * @coversDefaultClass \PhpOffice\PhpWord\Exception\InvalidStyleException * @runTestsInSeparateProcesses */ -class InvalidStyleExceptionTest extends \PHPUnit_Framework_TestCase +class InvalidStyleExceptionTest extends \PHPUnit\Framework\TestCase { /** * Throw new exception diff --git a/tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php b/tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php index 50b4806d..559d6341 100644 --- a/tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php +++ b/tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php @@ -23,7 +23,7 @@ namespace PhpOffice\PhpWord\Exception; * @coversDefaultClass \PhpOffice\PhpWord\Exception\UnsupportedImageTypeExceptionTest * @runTestsInSeparateProcesses */ -class UnsupportedImageTypeExceptionTest extends \PHPUnit_Framework_TestCase +class UnsupportedImageTypeExceptionTest extends \PHPUnit\Framework\TestCase { /** * Throw new exception diff --git a/tests/PhpWord/IOFactoryTest.php b/tests/PhpWord/IOFactoryTest.php index 6dbb006e..581b7d49 100644 --- a/tests/PhpWord/IOFactoryTest.php +++ b/tests/PhpWord/IOFactoryTest.php @@ -22,7 +22,7 @@ namespace PhpOffice\PhpWord; * * @runTestsInSeparateProcesses */ -class IOFactoryTest extends \PHPUnit_Framework_TestCase +class IOFactoryTest extends \PHPUnit\Framework\TestCase { /** * Create existing writer diff --git a/tests/PhpWord/MediaTest.php b/tests/PhpWord/MediaTest.php index d045abcd..ed56376b 100644 --- a/tests/PhpWord/MediaTest.php +++ b/tests/PhpWord/MediaTest.php @@ -24,7 +24,7 @@ use PhpOffice\PhpWord\Element\Image; * * @runTestsInSeparateProcesses */ -class MediaTest extends \PHPUnit_Framework_TestCase +class MediaTest extends \PHPUnit\Framework\TestCase { /** * Get section media elements diff --git a/tests/PhpWord/Metadata/DocInfoTest.php b/tests/PhpWord/Metadata/DocInfoTest.php index 5443f0b2..01659773 100644 --- a/tests/PhpWord/Metadata/DocInfoTest.php +++ b/tests/PhpWord/Metadata/DocInfoTest.php @@ -22,7 +22,7 @@ namespace PhpOffice\PhpWord\Metadata; * * @runTestsInSeparateProcesses */ -class DocInfoTest extends \PHPUnit_Framework_TestCase +class DocInfoTest extends \PHPUnit\Framework\TestCase { /** * Creator diff --git a/tests/PhpWord/Metadata/SettingsTest.php b/tests/PhpWord/Metadata/SettingsTest.php index 6f493d04..bee8d0ca 100644 --- a/tests/PhpWord/Metadata/SettingsTest.php +++ b/tests/PhpWord/Metadata/SettingsTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\SimpleType\Zoom; * * @runTestsInSeparateProcesses */ -class SettingsTest extends \PHPUnit_Framework_TestCase +class SettingsTest extends \PHPUnit\Framework\TestCase { /** * EvenAndOddHeaders diff --git a/tests/PhpWord/PhpWordTest.php b/tests/PhpWord/PhpWordTest.php index 01d7342e..f8a22459 100644 --- a/tests/PhpWord/PhpWordTest.php +++ b/tests/PhpWord/PhpWordTest.php @@ -24,7 +24,7 @@ use PhpOffice\PhpWord\Metadata\DocInfo; * * @runTestsInSeparateProcesses */ -class PhpWordTest extends \PHPUnit_Framework_TestCase +class PhpWordTest extends \PHPUnit\Framework\TestCase { /** * Test object creation diff --git a/tests/PhpWord/Reader/HTMLTest.php b/tests/PhpWord/Reader/HTMLTest.php index 24751cac..c56fc1fc 100644 --- a/tests/PhpWord/Reader/HTMLTest.php +++ b/tests/PhpWord/Reader/HTMLTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\IOFactory; * @coversDefaultClass \PhpOffice\PhpWord\Reader\HTML * @runTestsInSeparateProcesses */ -class HTMLTest extends \PHPUnit_Framework_TestCase +class HTMLTest extends \PHPUnit\Framework\TestCase { /** * Test load diff --git a/tests/PhpWord/Reader/MsDocTest.php b/tests/PhpWord/Reader/MsDocTest.php index ed16e64b..12d50247 100644 --- a/tests/PhpWord/Reader/MsDocTest.php +++ b/tests/PhpWord/Reader/MsDocTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\IOFactory; * @coversDefaultClass \PhpOffice\PhpWord\Reader\MsDoc * @runTestsInSeparateProcesses */ -class MsDocTest extends \PHPUnit_Framework_TestCase +class MsDocTest extends \PHPUnit\Framework\TestCase { /** * Test canRead() method diff --git a/tests/PhpWord/Reader/ODTextTest.php b/tests/PhpWord/Reader/ODTextTest.php index d00657de..7041e13e 100644 --- a/tests/PhpWord/Reader/ODTextTest.php +++ b/tests/PhpWord/Reader/ODTextTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\IOFactory; * @coversDefaultClass \PhpOffice\PhpWord\Reader\ODText * @runTestsInSeparateProcesses */ -class ODTextTest extends \PHPUnit_Framework_TestCase +class ODTextTest extends \PHPUnit\Framework\TestCase { /** * Load diff --git a/tests/PhpWord/Reader/RTFTest.php b/tests/PhpWord/Reader/RTFTest.php index 58154ee3..ca1f6ed4 100644 --- a/tests/PhpWord/Reader/RTFTest.php +++ b/tests/PhpWord/Reader/RTFTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\IOFactory; * @coversDefaultClass \PhpOffice\PhpWord\Reader\RTF * @runTestsInSeparateProcesses */ -class RTFTest extends \PHPUnit_Framework_TestCase +class RTFTest extends \PHPUnit\Framework\TestCase { /** * Test load diff --git a/tests/PhpWord/Reader/Word2007Test.php b/tests/PhpWord/Reader/Word2007Test.php index 627bc66e..8b787247 100644 --- a/tests/PhpWord/Reader/Word2007Test.php +++ b/tests/PhpWord/Reader/Word2007Test.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\IOFactory; * @coversDefaultClass \PhpOffice\PhpWord\Reader\Word2007 * @runTestsInSeparateProcesses */ -class Word2007Test extends \PHPUnit_Framework_TestCase +class Word2007Test extends \PHPUnit\Framework\TestCase { /** * Test canRead() method diff --git a/tests/PhpWord/SettingsTest.php b/tests/PhpWord/SettingsTest.php index 6fd2f52b..d8752b2b 100644 --- a/tests/PhpWord/SettingsTest.php +++ b/tests/PhpWord/SettingsTest.php @@ -23,7 +23,7 @@ namespace PhpOffice\PhpWord; * @coversDefaultClass \PhpOffice\PhpWord\Settings * @runTestsInSeparateProcesses */ -class SettingsTest extends \PHPUnit_Framework_TestCase +class SettingsTest extends \PHPUnit\Framework\TestCase { /** * Test set/get compatibity option diff --git a/tests/PhpWord/Shared/ConverterTest.php b/tests/PhpWord/Shared/ConverterTest.php index a2031787..a71046aa 100644 --- a/tests/PhpWord/Shared/ConverterTest.php +++ b/tests/PhpWord/Shared/ConverterTest.php @@ -22,7 +22,7 @@ namespace PhpOffice\PhpWord\Shared; * * @coversDefaultClass \PhpOffice\PhpWord\Shared\Converter */ -class ConverterTest extends \PHPUnit_Framework_TestCase +class ConverterTest extends \PHPUnit\Framework\TestCase { /** * Test unit conversion functions with various numbers diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index 602b644d..0ba7717f 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -22,7 +22,7 @@ use PhpOffice\PhpWord\Element\Section; /** * Test class for PhpOffice\PhpWord\Shared\Html */ -class HtmlTest extends \PHPUnit_Framework_TestCase +class HtmlTest extends \PHPUnit\Framework\TestCase { /** * Test unit conversion functions with various numbers diff --git a/tests/PhpWord/Shared/ZipArchiveTest.php b/tests/PhpWord/Shared/ZipArchiveTest.php index 689f122b..91f0f030 100644 --- a/tests/PhpWord/Shared/ZipArchiveTest.php +++ b/tests/PhpWord/Shared/ZipArchiveTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\Settings; * @coversDefaultClass \PhpOffice\PhpWord\Shared\ZipArchive * @runTestsInSeparateProcesses */ -class ZipArchiveTest extends \PHPUnit_Framework_TestCase +class ZipArchiveTest extends \PHPUnit\Framework\TestCase { /** * Test close method exception: Working in local, not working in Travis diff --git a/tests/PhpWord/Style/AbstractStyleTest.php b/tests/PhpWord/Style/AbstractStyleTest.php index ab3ea14e..d4291c2a 100644 --- a/tests/PhpWord/Style/AbstractStyleTest.php +++ b/tests/PhpWord/Style/AbstractStyleTest.php @@ -22,7 +22,7 @@ namespace PhpOffice\PhpWord\Style; * * @runTestsInSeparateProcesses */ -class AbstractStyleTest extends \PHPUnit_Framework_TestCase +class AbstractStyleTest extends \PHPUnit\Framework\TestCase { /** * Test set style by array diff --git a/tests/PhpWord/Style/CellTest.php b/tests/PhpWord/Style/CellTest.php index 71b32a65..79b22ee1 100644 --- a/tests/PhpWord/Style/CellTest.php +++ b/tests/PhpWord/Style/CellTest.php @@ -23,7 +23,7 @@ namespace PhpOffice\PhpWord\Style; * @coversDefaultClass \PhpOffice\PhpWord\Style\Cell * @runTestsInSeparateProcesses */ -class CellTest extends \PHPUnit_Framework_TestCase +class CellTest extends \PHPUnit\Framework\TestCase { /** * Test setting style with normal value diff --git a/tests/PhpWord/Style/FontTest.php b/tests/PhpWord/Style/FontTest.php index a227d7f9..91bba97f 100644 --- a/tests/PhpWord/Style/FontTest.php +++ b/tests/PhpWord/Style/FontTest.php @@ -26,7 +26,7 @@ use PhpOffice\PhpWord\TestHelperDOCX; * * @runTestsInSeparateProcesses */ -class FontTest extends \PHPUnit_Framework_TestCase +class FontTest extends \PHPUnit\Framework\TestCase { /** * Tear down after each test diff --git a/tests/PhpWord/Style/ImageTest.php b/tests/PhpWord/Style/ImageTest.php index decc13b1..5d9e5568 100644 --- a/tests/PhpWord/Style/ImageTest.php +++ b/tests/PhpWord/Style/ImageTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\SimpleType\Jc; * @coversDefaultClass \PhpOffice\PhpWord\Style\Image * @runTestsInSeparateProcesses */ -class ImageTest extends \PHPUnit_Framework_TestCase +class ImageTest extends \PHPUnit\Framework\TestCase { /** * Test setting style with normal value diff --git a/tests/PhpWord/Style/IndentationTest.php b/tests/PhpWord/Style/IndentationTest.php index db079704..63a96628 100644 --- a/tests/PhpWord/Style/IndentationTest.php +++ b/tests/PhpWord/Style/IndentationTest.php @@ -22,7 +22,7 @@ namespace PhpOffice\PhpWord\Style; * * @coversDefaultClass \PhpOffice\PhpWord\Style\Indentation */ -class IndentationTest extends \PHPUnit_Framework_TestCase +class IndentationTest extends \PHPUnit\Framework\TestCase { /** * Test get/set diff --git a/tests/PhpWord/Style/LanguageTest.php b/tests/PhpWord/Style/LanguageTest.php index 35a01e07..74b2067a 100644 --- a/tests/PhpWord/Style/LanguageTest.php +++ b/tests/PhpWord/Style/LanguageTest.php @@ -22,7 +22,7 @@ namespace PhpOffice\PhpWord\Style; * * @coversDefaultClass \PhpOffice\PhpWord\Style\Language */ -class LanguageTest extends \PHPUnit_Framework_TestCase +class LanguageTest extends \PHPUnit\Framework\TestCase { /** * Test get/set diff --git a/tests/PhpWord/Style/LineNumberingTest.php b/tests/PhpWord/Style/LineNumberingTest.php index 56440529..9ec1e3b7 100644 --- a/tests/PhpWord/Style/LineNumberingTest.php +++ b/tests/PhpWord/Style/LineNumberingTest.php @@ -22,7 +22,7 @@ namespace PhpOffice\PhpWord\Style; * * @coversDefaultClass \PhpOffice\PhpWord\Style\LineNumbering */ -class LineNumberingTest extends \PHPUnit_Framework_TestCase +class LineNumberingTest extends \PHPUnit\Framework\TestCase { /** * Test get/set diff --git a/tests/PhpWord/Style/LineTest.php b/tests/PhpWord/Style/LineTest.php index 21489caf..ab77b328 100644 --- a/tests/PhpWord/Style/LineTest.php +++ b/tests/PhpWord/Style/LineTest.php @@ -23,7 +23,7 @@ namespace PhpOffice\PhpWord\Style; * @coversDefaultClass \PhpOffice\PhpWord\Style\Image * @runTestsInSeparateProcesses */ -class LineTest extends \PHPUnit_Framework_TestCase +class LineTest extends \PHPUnit\Framework\TestCase { /** * Test setting style with normal value diff --git a/tests/PhpWord/Style/ListItemTest.php b/tests/PhpWord/Style/ListItemTest.php index a2e4eb74..a8155fa3 100644 --- a/tests/PhpWord/Style/ListItemTest.php +++ b/tests/PhpWord/Style/ListItemTest.php @@ -23,7 +23,7 @@ namespace PhpOffice\PhpWord\Style; * @coversDefaultClass \PhpOffice\PhpWord\Style\ListItem * @runTestsInSeparateProcesses */ -class ListItemTest extends \PHPUnit_Framework_TestCase +class ListItemTest extends \PHPUnit\Framework\TestCase { /** * Test construct diff --git a/tests/PhpWord/Style/NumberingLevelTest.php b/tests/PhpWord/Style/NumberingLevelTest.php index 402d936b..9b512eb0 100644 --- a/tests/PhpWord/Style/NumberingLevelTest.php +++ b/tests/PhpWord/Style/NumberingLevelTest.php @@ -24,7 +24,7 @@ use PhpOffice\PhpWord\SimpleType\Jc; * * @runTestsInSeparateProcesses */ -class NumberingLevelTest extends \PHPUnit_Framework_TestCase +class NumberingLevelTest extends \PHPUnit\Framework\TestCase { /** * Test setting style with normal value diff --git a/tests/PhpWord/Style/NumberingTest.php b/tests/PhpWord/Style/NumberingTest.php index ad57ebff..0103c503 100644 --- a/tests/PhpWord/Style/NumberingTest.php +++ b/tests/PhpWord/Style/NumberingTest.php @@ -22,7 +22,7 @@ namespace PhpOffice\PhpWord\Style; * * @coversDefaultClass \PhpOffice\PhpWord\Style\Numbering */ -class NumberingTest extends \PHPUnit_Framework_TestCase +class NumberingTest extends \PHPUnit\Framework\TestCase { /** * Test get/set diff --git a/tests/PhpWord/Style/PaperTest.php b/tests/PhpWord/Style/PaperTest.php index 7d12410c..687e23c6 100644 --- a/tests/PhpWord/Style/PaperTest.php +++ b/tests/PhpWord/Style/PaperTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\TestHelperDOCX; * * @runTestsInSeparateProcesses */ -class PaperTest extends \PHPUnit_Framework_TestCase +class PaperTest extends \PHPUnit\Framework\TestCase { /** * Tear down after each test diff --git a/tests/PhpWord/Style/ParagraphTest.php b/tests/PhpWord/Style/ParagraphTest.php index e28f54c7..48acc600 100644 --- a/tests/PhpWord/Style/ParagraphTest.php +++ b/tests/PhpWord/Style/ParagraphTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\TestHelperDOCX; * * @runTestsInSeparateProcesses */ -class ParagraphTest extends \PHPUnit_Framework_TestCase +class ParagraphTest extends \PHPUnit\Framework\TestCase { /** * Tear down after each test diff --git a/tests/PhpWord/Style/RowTest.php b/tests/PhpWord/Style/RowTest.php index db98d0a9..2daad7ea 100644 --- a/tests/PhpWord/Style/RowTest.php +++ b/tests/PhpWord/Style/RowTest.php @@ -23,7 +23,7 @@ namespace PhpOffice\PhpWord\Style; * @coversDefaultClass \PhpOffice\PhpWord\Style\Row * @runTestsInSeparateProcesses */ -class RowTest extends \PHPUnit_Framework_TestCase +class RowTest extends \PHPUnit\Framework\TestCase { /** * Test properties with boolean value diff --git a/tests/PhpWord/Style/SectionTest.php b/tests/PhpWord/Style/SectionTest.php index 89c4640a..c9b7003f 100644 --- a/tests/PhpWord/Style/SectionTest.php +++ b/tests/PhpWord/Style/SectionTest.php @@ -23,7 +23,7 @@ namespace PhpOffice\PhpWord\Style; * @coversDefaultClass \PhpOffice\PhpWord\Element\Section * @runTestsInSeparateProcesses */ -class SectionTest extends \PHPUnit_Framework_TestCase +class SectionTest extends \PHPUnit\Framework\TestCase { /** * Executed before each method of the class diff --git a/tests/PhpWord/Style/ShadingTest.php b/tests/PhpWord/Style/ShadingTest.php index fd0aaf5e..ab991a57 100644 --- a/tests/PhpWord/Style/ShadingTest.php +++ b/tests/PhpWord/Style/ShadingTest.php @@ -22,7 +22,7 @@ namespace PhpOffice\PhpWord\Style; * * @coversDefaultClass \PhpOffice\PhpWord\Style\Shading */ -class ShadingTest extends \PHPUnit_Framework_TestCase +class ShadingTest extends \PHPUnit\Framework\TestCase { /** * Test get/set diff --git a/tests/PhpWord/Style/SpacingTest.php b/tests/PhpWord/Style/SpacingTest.php index f147ae61..2c26f68b 100644 --- a/tests/PhpWord/Style/SpacingTest.php +++ b/tests/PhpWord/Style/SpacingTest.php @@ -22,7 +22,7 @@ namespace PhpOffice\PhpWord\Style; * * @coversDefaultClass \PhpOffice\PhpWord\Style\Spacing */ -class SpacingTest extends \PHPUnit_Framework_TestCase +class SpacingTest extends \PHPUnit\Framework\TestCase { /** * Test get/set diff --git a/tests/PhpWord/Style/TOCTest.php b/tests/PhpWord/Style/TOCTest.php index ec01acd9..5981b00c 100644 --- a/tests/PhpWord/Style/TOCTest.php +++ b/tests/PhpWord/Style/TOCTest.php @@ -22,7 +22,7 @@ namespace PhpOffice\PhpWord\Style; * * @coversDefaultClass \PhpOffice\PhpWord\Style\TOC */ -class TOCTest extends \PHPUnit_Framework_TestCase +class TOCTest extends \PHPUnit\Framework\TestCase { /** * Test get/set diff --git a/tests/PhpWord/Style/TabTest.php b/tests/PhpWord/Style/TabTest.php index 8102369d..c11f0558 100644 --- a/tests/PhpWord/Style/TabTest.php +++ b/tests/PhpWord/Style/TabTest.php @@ -22,7 +22,7 @@ namespace PhpOffice\PhpWord\Style; * * @coversDefaultClass \PhpOffice\PhpWord\Style\Tab */ -class TabTest extends \PHPUnit_Framework_TestCase +class TabTest extends \PHPUnit\Framework\TestCase { /** * Test get/set diff --git a/tests/PhpWord/Style/TableTest.php b/tests/PhpWord/Style/TableTest.php index ee020dd9..ff813927 100644 --- a/tests/PhpWord/Style/TableTest.php +++ b/tests/PhpWord/Style/TableTest.php @@ -24,7 +24,7 @@ use PhpOffice\PhpWord\SimpleType\JcTable; * * @runTestsInSeparateProcesses */ -class TableTest extends \PHPUnit_Framework_TestCase +class TableTest extends \PHPUnit\Framework\TestCase { /** * Test class construction diff --git a/tests/PhpWord/Style/TextBoxTest.php b/tests/PhpWord/Style/TextBoxTest.php index a91b5b28..5a6bc76f 100644 --- a/tests/PhpWord/Style/TextBoxTest.php +++ b/tests/PhpWord/Style/TextBoxTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\SimpleType\Jc; * @coversDefaultClass \PhpOffice\PhpWord\Style\Image * @runTestsInSeparateProcesses */ -class TextBoxTest extends \PHPUnit_Framework_TestCase +class TextBoxTest extends \PHPUnit\Framework\TestCase { /** * Test setting style with normal value diff --git a/tests/PhpWord/StyleTest.php b/tests/PhpWord/StyleTest.php index aa46c6b1..6f2f0980 100644 --- a/tests/PhpWord/StyleTest.php +++ b/tests/PhpWord/StyleTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\SimpleType\Jc; * @coversDefaultClass \PhpOffice\PhpWord\Style * @runTestsInSeparateProcesses */ -class StyleTest extends \PHPUnit_Framework_TestCase +class StyleTest extends \PHPUnit\Framework\TestCase { /** * Add and get paragraph, font, link, title, and table styles diff --git a/tests/PhpWord/TemplateProcessorTest.php b/tests/PhpWord/TemplateProcessorTest.php index 4bf69f5a..7b064ef7 100644 --- a/tests/PhpWord/TemplateProcessorTest.php +++ b/tests/PhpWord/TemplateProcessorTest.php @@ -22,7 +22,7 @@ namespace PhpOffice\PhpWord; * @coversDefaultClass \PhpOffice\PhpWord\TemplateProcessor * @runTestsInSeparateProcesses */ -final class TemplateProcessorTest extends \PHPUnit_Framework_TestCase +final class TemplateProcessorTest extends \PHPUnit\Framework\TestCase { /** * Template can be saved in temporary location. diff --git a/tests/PhpWord/Writer/HTML/ElementTest.php b/tests/PhpWord/Writer/HTML/ElementTest.php index 0778650e..86856d5c 100644 --- a/tests/PhpWord/Writer/HTML/ElementTest.php +++ b/tests/PhpWord/Writer/HTML/ElementTest.php @@ -24,7 +24,7 @@ use PhpOffice\PhpWord\Writer\HTML\Element\Text; /** * Test class for PhpOffice\PhpWord\Writer\HTML\Element subnamespace */ -class ElementTest extends \PHPUnit_Framework_TestCase +class ElementTest extends \PHPUnit\Framework\TestCase { /** * Test unmatched elements diff --git a/tests/PhpWord/Writer/HTML/PartTest.php b/tests/PhpWord/Writer/HTML/PartTest.php index a4a6264e..3d56f983 100644 --- a/tests/PhpWord/Writer/HTML/PartTest.php +++ b/tests/PhpWord/Writer/HTML/PartTest.php @@ -22,7 +22,7 @@ use PhpOffice\PhpWord\Writer\HTML\Part\Body; /** * Test class for PhpOffice\PhpWord\Writer\HTML\Part subnamespace */ -class PartTest extends \PHPUnit_Framework_TestCase +class PartTest extends \PHPUnit\Framework\TestCase { /** * Test get parent writer exception diff --git a/tests/PhpWord/Writer/HTML/StyleTest.php b/tests/PhpWord/Writer/HTML/StyleTest.php index 7548ff02..e9117de9 100644 --- a/tests/PhpWord/Writer/HTML/StyleTest.php +++ b/tests/PhpWord/Writer/HTML/StyleTest.php @@ -20,7 +20,7 @@ namespace PhpOffice\PhpWord\Writer\HTML; /** * Test class for PhpOffice\PhpWord\Writer\HTML\Style subnamespace */ -class StyleTest extends \PHPUnit_Framework_TestCase +class StyleTest extends \PHPUnit\Framework\TestCase { /** * Test empty styles diff --git a/tests/PhpWord/Writer/HTMLTest.php b/tests/PhpWord/Writer/HTMLTest.php index 69cd5a97..4d75ea5a 100644 --- a/tests/PhpWord/Writer/HTMLTest.php +++ b/tests/PhpWord/Writer/HTMLTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\SimpleType\Jc; * * @runTestsInSeparateProcesses */ -class HTMLTest extends \PHPUnit_Framework_TestCase +class HTMLTest extends \PHPUnit\Framework\TestCase { /** * Construct diff --git a/tests/PhpWord/Writer/ODText/ElementTest.php b/tests/PhpWord/Writer/ODText/ElementTest.php index ef4e68b0..253c8e11 100644 --- a/tests/PhpWord/Writer/ODText/ElementTest.php +++ b/tests/PhpWord/Writer/ODText/ElementTest.php @@ -22,7 +22,7 @@ use PhpOffice\Common\XMLWriter; /** * Test class for PhpOffice\PhpWord\Writer\ODText\Element subnamespace */ -class ElementTest extends \PHPUnit_Framework_TestCase +class ElementTest extends \PHPUnit\Framework\TestCase { /** * Test unmatched elements diff --git a/tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php b/tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php index 5ca980f2..f91e6dd2 100644 --- a/tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php +++ b/tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\Writer\ODText; * @coversDefaultClass \PhpOffice\PhpWord\Writer\ODText\Part\AbstractPart * @runTestsInSeparateProcesses */ -class AbstractPartTest extends \PHPUnit_Framework_TestCase +class AbstractPartTest extends \PHPUnit\Framework\TestCase { /** * covers ::setParentWriter diff --git a/tests/PhpWord/Writer/ODText/Part/ContentTest.php b/tests/PhpWord/Writer/ODText/Part/ContentTest.php index 048c5242..28542379 100644 --- a/tests/PhpWord/Writer/ODText/Part/ContentTest.php +++ b/tests/PhpWord/Writer/ODText/Part/ContentTest.php @@ -27,7 +27,7 @@ use PhpOffice\PhpWord\TestHelperDOCX; * @coversDefaultClass \PhpOffice\PhpWord\Writer\ODText\Part\Content * @runTestsInSeparateProcesses */ -class ContentTest extends \PHPUnit_Framework_TestCase +class ContentTest extends \PHPUnit\Framework\TestCase { /** * Executed before each method of the class diff --git a/tests/PhpWord/Writer/ODText/StyleTest.php b/tests/PhpWord/Writer/ODText/StyleTest.php index 1a0c3ccd..5bd862f9 100644 --- a/tests/PhpWord/Writer/ODText/StyleTest.php +++ b/tests/PhpWord/Writer/ODText/StyleTest.php @@ -22,7 +22,7 @@ use PhpOffice\Common\XMLWriter; /** * Test class for PhpOffice\PhpWord\Writer\ODText\Style subnamespace */ -class StyleTest extends \PHPUnit_Framework_TestCase +class StyleTest extends \PHPUnit\Framework\TestCase { /** * Test empty styles diff --git a/tests/PhpWord/Writer/ODTextTest.php b/tests/PhpWord/Writer/ODTextTest.php index d35a4ec7..bb1b9538 100644 --- a/tests/PhpWord/Writer/ODTextTest.php +++ b/tests/PhpWord/Writer/ODTextTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\SimpleType\Jc; * * @runTestsInSeparateProcesses */ -class ODTextTest extends \PHPUnit_Framework_TestCase +class ODTextTest extends \PHPUnit\Framework\TestCase { /** * Construct diff --git a/tests/PhpWord/Writer/PDF/DomPDFTest.php b/tests/PhpWord/Writer/PDF/DomPDFTest.php index 7831f472..61c3d296 100644 --- a/tests/PhpWord/Writer/PDF/DomPDFTest.php +++ b/tests/PhpWord/Writer/PDF/DomPDFTest.php @@ -26,7 +26,7 @@ use PhpOffice\PhpWord\Writer\PDF; * * @runTestsInSeparateProcesses */ -class DomPDFTest extends \PHPUnit_Framework_TestCase +class DomPDFTest extends \PHPUnit\Framework\TestCase { /** * Test construct diff --git a/tests/PhpWord/Writer/PDF/MPDFTest.php b/tests/PhpWord/Writer/PDF/MPDFTest.php index 62411b97..0e6cf308 100644 --- a/tests/PhpWord/Writer/PDF/MPDFTest.php +++ b/tests/PhpWord/Writer/PDF/MPDFTest.php @@ -26,7 +26,7 @@ use PhpOffice\PhpWord\Writer\PDF; * * @runTestsInSeparateProcesses */ -class MPDFTest extends \PHPUnit_Framework_TestCase +class MPDFTest extends \PHPUnit\Framework\TestCase { /** * Test construct diff --git a/tests/PhpWord/Writer/PDF/TCPDFTest.php b/tests/PhpWord/Writer/PDF/TCPDFTest.php index d5bd534b..e697eee1 100644 --- a/tests/PhpWord/Writer/PDF/TCPDFTest.php +++ b/tests/PhpWord/Writer/PDF/TCPDFTest.php @@ -26,7 +26,7 @@ use PhpOffice\PhpWord\Writer\PDF; * * @runTestsInSeparateProcesses */ -class TCPDFTest extends \PHPUnit_Framework_TestCase +class TCPDFTest extends \PHPUnit\Framework\TestCase { /** * Test construct diff --git a/tests/PhpWord/Writer/PDFTest.php b/tests/PhpWord/Writer/PDFTest.php index f1a908a9..a7ca9f68 100644 --- a/tests/PhpWord/Writer/PDFTest.php +++ b/tests/PhpWord/Writer/PDFTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\Settings; * * @runTestsInSeparateProcesses */ -class PDFTest extends \PHPUnit_Framework_TestCase +class PDFTest extends \PHPUnit\Framework\TestCase { /** * Test normal construct diff --git a/tests/PhpWord/Writer/RTF/ElementTest.php b/tests/PhpWord/Writer/RTF/ElementTest.php index 17a9c22f..e85d2091 100644 --- a/tests/PhpWord/Writer/RTF/ElementTest.php +++ b/tests/PhpWord/Writer/RTF/ElementTest.php @@ -22,7 +22,7 @@ use PhpOffice\PhpWord\Writer\RTF; /** * Test class for PhpOffice\PhpWord\Writer\RTF\Element subnamespace */ -class ElementTest extends \PHPUnit_Framework_TestCase +class ElementTest extends \PHPUnit\Framework\TestCase { /** * Test unmatched elements diff --git a/tests/PhpWord/Writer/RTF/StyleTest.php b/tests/PhpWord/Writer/RTF/StyleTest.php index 4e3a0eed..b9dc7b45 100644 --- a/tests/PhpWord/Writer/RTF/StyleTest.php +++ b/tests/PhpWord/Writer/RTF/StyleTest.php @@ -20,7 +20,7 @@ namespace PhpOffice\PhpWord\Writer\RTF; /** * Test class for PhpOffice\PhpWord\Writer\RTF\Style subnamespace */ -class StyleTest extends \PHPUnit_Framework_TestCase +class StyleTest extends \PHPUnit\Framework\TestCase { /** * Test empty styles diff --git a/tests/PhpWord/Writer/RTFTest.php b/tests/PhpWord/Writer/RTFTest.php index ec83f7b1..f4442043 100644 --- a/tests/PhpWord/Writer/RTFTest.php +++ b/tests/PhpWord/Writer/RTFTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\SimpleType\Jc; * * @runTestsInSeparateProcesses */ -class RTFTest extends \PHPUnit_Framework_TestCase +class RTFTest extends \PHPUnit\Framework\TestCase { /** * Construct diff --git a/tests/PhpWord/Writer/Word2007/ElementTest.php b/tests/PhpWord/Writer/Word2007/ElementTest.php index dc3d30bd..85a9bb38 100644 --- a/tests/PhpWord/Writer/Word2007/ElementTest.php +++ b/tests/PhpWord/Writer/Word2007/ElementTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\TestHelperDOCX; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Element subnamespace */ -class ElementTest extends \PHPUnit_Framework_TestCase +class ElementTest extends \PHPUnit\Framework\TestCase { /** * Executed before each method of the class diff --git a/tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php b/tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php index 47f65861..7796c02c 100644 --- a/tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\Writer\Word2007; * @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007\Part\AbstractWriterPart * @runTestsInSeparateProcesses */ -class AbstractPartTest extends \PHPUnit_Framework_TestCase +class AbstractPartTest extends \PHPUnit\Framework\TestCase { /** * covers ::setParentWriter diff --git a/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php b/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php index 4a4fd308..83af284f 100644 --- a/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\TestHelperDOCX; * * @runTestsInSeparateProcesses */ -class CommentsTest extends \PHPUnit_Framework_TestCase +class CommentsTest extends \PHPUnit\Framework\TestCase { /** * Executed before each method of the class diff --git a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php index d194814c..9bad19fe 100644 --- a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php @@ -29,7 +29,7 @@ use PhpOffice\PhpWord\TestHelperDOCX; * * @runTestsInSeparateProcesses */ -class DocumentTest extends \PHPUnit_Framework_TestCase +class DocumentTest extends \PHPUnit\Framework\TestCase { /** * Executed before each method of the class diff --git a/tests/PhpWord/Writer/Word2007/Part/FooterTest.php b/tests/PhpWord/Writer/Word2007/Part/FooterTest.php index 98fb003e..82bb7b7d 100644 --- a/tests/PhpWord/Writer/Word2007/Part/FooterTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/FooterTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\Writer\Word2007; * @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007\Part\Footer * @runTestsInSeparateProcesses */ -class FooterTest extends \PHPUnit_Framework_TestCase +class FooterTest extends \PHPUnit\Framework\TestCase { /** * Write footer diff --git a/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php b/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php index e557d9c2..3d11174a 100644 --- a/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\TestHelperDOCX; * @coversNothing * @runTestsInSeparateProcesses */ -class FootnotesTest extends \PHPUnit_Framework_TestCase +class FootnotesTest extends \PHPUnit\Framework\TestCase { public function tearDown() { diff --git a/tests/PhpWord/Writer/Word2007/Part/HeaderTest.php b/tests/PhpWord/Writer/Word2007/Part/HeaderTest.php index 7830469c..afa81cf9 100644 --- a/tests/PhpWord/Writer/Word2007/Part/HeaderTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/HeaderTest.php @@ -24,7 +24,7 @@ use PhpOffice\PhpWord\Writer\Word2007; * * @runTestsInSeparateProcesses */ -class HeaderTest extends \PHPUnit_Framework_TestCase +class HeaderTest extends \PHPUnit\Framework\TestCase { /** * Write header diff --git a/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php b/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php index 0f1ae523..62127e29 100644 --- a/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php @@ -29,7 +29,7 @@ use PhpOffice\PhpWord\TestHelperDOCX; * @runTestsInSeparateProcesses * @since 0.10.0 */ -class NumberingTest extends \PHPUnit_Framework_TestCase +class NumberingTest extends \PHPUnit\Framework\TestCase { /** * Executed before each method of the class diff --git a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php index 5b812a0f..6af86696 100644 --- a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php @@ -30,7 +30,7 @@ use PhpOffice\PhpWord\TestHelperDOCX; * * @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007\Part\Settings */ -class SettingsTest extends \PHPUnit_Framework_TestCase +class SettingsTest extends \PHPUnit\Framework\TestCase { /** * Executed before each method of the class diff --git a/tests/PhpWord/Writer/Word2007/Part/StylesTest.php b/tests/PhpWord/Writer/Word2007/Part/StylesTest.php index cba0bfb3..0cdb444e 100644 --- a/tests/PhpWord/Writer/Word2007/Part/StylesTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/StylesTest.php @@ -29,7 +29,7 @@ use PhpOffice\PhpWord\TestHelperDOCX; * @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007\Part\Styles * @runTestsInSeparateProcesses */ -class StylesTest extends \PHPUnit_Framework_TestCase +class StylesTest extends \PHPUnit\Framework\TestCase { /** * Executed before each method of the class diff --git a/tests/PhpWord/Writer/Word2007/PartTest.php b/tests/PhpWord/Writer/Word2007/PartTest.php index 3261db4f..160bf553 100644 --- a/tests/PhpWord/Writer/Word2007/PartTest.php +++ b/tests/PhpWord/Writer/Word2007/PartTest.php @@ -24,7 +24,7 @@ use PhpOffice\PhpWord\Writer\Word2007\Part\RelsPart; * * Covers miscellaneous tests */ -class PartTest extends \PHPUnit_Framework_TestCase +class PartTest extends \PHPUnit\Framework\TestCase { /** * Test exception when no type or target assigned to a relation diff --git a/tests/PhpWord/Writer/Word2007/Style/FontTest.php b/tests/PhpWord/Writer/Word2007/Style/FontTest.php index f406bc05..78b2c320 100644 --- a/tests/PhpWord/Writer/Word2007/Style/FontTest.php +++ b/tests/PhpWord/Writer/Word2007/Style/FontTest.php @@ -25,7 +25,7 @@ use PhpOffice\PhpWord\TestHelperDOCX; * @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007\Style\Font * @runTestsInSeparateProcesses */ -class FontTest extends \PHPUnit_Framework_TestCase +class FontTest extends \PHPUnit\Framework\TestCase { /** * Executed before each method of the class diff --git a/tests/PhpWord/Writer/Word2007/StyleTest.php b/tests/PhpWord/Writer/Word2007/StyleTest.php index 05785b0c..f48597d2 100644 --- a/tests/PhpWord/Writer/Word2007/StyleTest.php +++ b/tests/PhpWord/Writer/Word2007/StyleTest.php @@ -22,7 +22,7 @@ use PhpOffice\Common\XMLWriter; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Style subnamespace */ -class StyleTest extends \PHPUnit_Framework_TestCase +class StyleTest extends \PHPUnit\Framework\TestCase { /** * Test empty styles diff --git a/tests/PhpWord/Writer/Word2007Test.php b/tests/PhpWord/Writer/Word2007Test.php index 88a522a9..3e1edb39 100644 --- a/tests/PhpWord/Writer/Word2007Test.php +++ b/tests/PhpWord/Writer/Word2007Test.php @@ -26,7 +26,7 @@ use PhpOffice\PhpWord\TestHelperDOCX; * * @runTestsInSeparateProcesses */ -class Word2007Test extends \PHPUnit_Framework_TestCase +class Word2007Test extends \PHPUnit\Framework\TestCase { /** * Tear down after each test From 6328b833881c3d4908bb3fdfd2b95c740b25e2dc Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 9 Nov 2017 23:07:17 +0100 Subject: [PATCH 131/370] fix warning --- tests/PhpWord/Shared/HtmlTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index b1a9e31c..c35cc6d5 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -173,6 +173,7 @@ class HtmlTest extends \PHPUnit_Framework_TestCase $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); // echo $doc->printXml(); -// $this->assertTrue($doc->elementExists('/w:document/w:body/w:tbl/w:tr/w:tc')); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p')); +// $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:tbl/w:tr/w:tc')); } } From e4fe0c66731a0bff17e95d6278db6ddf90e53fff Mon Sep 17 00:00:00 2001 From: ejuhjav Date: Wed, 20 May 2015 13:17:11 +0200 Subject: [PATCH 132/370] Update elements.rst Fixed a typo in the $lineStyle example (defined previously as $linestyle but used as $lineStyle) --- docs/elements.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/elements.rst b/docs/elements.rst index 124f4431..e27b45d9 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -414,7 +414,7 @@ Line elements can be added to sections by using ``addLine``. .. code-block:: php - $linestyle = array('weight' => 1, 'width' => 100, 'height' => 0, 'color' => 635552); + $lineStyle = array('weight' => 1, 'width' => 100, 'height' => 0, 'color' => 635552); $section->addLine($lineStyle) Available line style attributes: From 379df3cebd4ace1400a5bfa9a89474da67083a91 Mon Sep 17 00:00:00 2001 From: Nilton Date: Sat, 21 Oct 2017 00:07:52 +0200 Subject: [PATCH 133/370] Bring back b, i, and --- src/PhpWord/Shared/Html.php | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 670ba6e5..369b57fe 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -117,9 +117,12 @@ class Html 'h6' => array('Heading', null, $element, $styles, null, 'Heading6', null), '#text' => array('Text', $node, $element, $styles, null, null, null), 'strong' => array('Property', null, null, $styles, null, 'bold', true), + 'b' => array('Property', null, null, $styles, null, 'bold', true), 'em' => array('Property', null, null, $styles, null, 'italic', true), + 'i' => array('Property', null, null, $styles, null, 'italic', true), 'sup' => array('Property', null, null, $styles, null, 'superScript', true), 'sub' => array('Property', null, null, $styles, null, 'subScript', true), + 'span' => array('Property', null, null, $styles, null, 'span', $node), 'table' => array('Table', $node, $element, $styles, null, 'addTable', true), 'tr' => array('Table', $node, $element, $styles, null, 'addRow', true), 'td' => array('Table', $node, $element, $styles, null, 'addCell', true), @@ -246,7 +249,16 @@ class Html */ private static function parseProperty(&$styles, $argument1, $argument2) { - $styles['font'][$argument1] = $argument2; + if ($argument1 !== 'span') { + $styles['font'][$argument1] = $argument2; + } else { + if (!is_null($argument2->attributes)) { + $nodeAttr = $argument2->attributes->getNamedItem('style'); + if (!is_null($nodeAttr) && property_exists($nodeAttr, 'value')) { + $styles['font'] = self::parseStyle($nodeAttr, $styles['font']); + } + } + } return null; } @@ -362,6 +374,20 @@ class Html case 'background-color': $styles['bgColor'] = trim($cValue, '#'); break; + case 'font-weight': + $tValue = false; + if (preg_match('#bold#', $cValue)) { + $tValue = true; // also match bolder + } + $styles['bold'] = $tValue; + break; + case 'font-style': + $tValue = false; + if (preg_match('#(?:italic|oblique)#', $cValue)) { + $tValue = true; + } + $styles['italic'] = $tValue; + break; } } From 07c9d9fd005b0746580f8fc153e4b93fdaf5b0dc Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 9 Nov 2017 00:41:56 +0100 Subject: [PATCH 134/370] Add unit tests for Html parser --- src/PhpWord/Shared/Html.php | 41 ++++----- tests/PhpWord/Reader/MsDocTest.php | 20 +++++ tests/PhpWord/Shared/HtmlTest.php | 110 +++++++++++++++++++++++- tests/PhpWord/_includes/XmlDocument.php | 12 ++- 4 files changed, 156 insertions(+), 27 deletions(-) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 369b57fe..876d0a3a 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -18,6 +18,7 @@ namespace PhpOffice\PhpWord\Shared; use PhpOffice\PhpWord\Element\AbstractContainer; +use PhpOffice\PhpWord\SimpleType\Jc; /** * Common Html functions @@ -120,9 +121,10 @@ class Html 'b' => array('Property', null, null, $styles, null, 'bold', true), 'em' => array('Property', null, null, $styles, null, 'italic', true), 'i' => array('Property', null, null, $styles, null, 'italic', true), + 'u' => array('Property', null, null, $styles, null, 'underline', 'single'), 'sup' => array('Property', null, null, $styles, null, 'superScript', true), 'sub' => array('Property', null, null, $styles, null, 'subScript', true), - 'span' => array('Property', null, null, $styles, null, 'span', $node), + 'span' => array('Property', null, null, $styles, null, 'span', $node), 'table' => array('Table', $node, $element, $styles, null, 'addTable', true), 'tr' => array('Table', $node, $element, $styles, null, 'addRow', true), 'td' => array('Table', $node, $element, $styles, null, 'addCell', true), @@ -236,8 +238,6 @@ class Html // if (method_exists($element, 'addText')) { $element->addText($node->nodeValue, $styles['font'], $styles['paragraph']); // } - - return null; } /** @@ -259,8 +259,6 @@ class Html } } } - - return null; } /** @@ -310,8 +308,6 @@ class Html $data['listdepth'] = 0; } $styles['list']['listType'] = $argument1; - - return null; } /** @@ -337,8 +333,6 @@ class Html } $element->addListItem($text, $data['listdepth'], $styles['font'], $styles['list'], $styles['paragraph']); } - - return null; } /** @@ -366,7 +360,20 @@ class Html } break; case 'text-align': - $styles['alignment'] = $cValue; // todo: any mapping? + switch ($cValue) { + case 'left': + $styles['alignment'] = Jc::START; + break; + case 'right': + $styles['alignment'] = Jc::END; + break; + case 'center': + $styles['alignment'] = Jc::CENTER; + break; + case 'justify': + $styles['alignment'] = Jc::BOTH; + break; + } break; case 'color': $styles['color'] = trim($cValue, '#'); @@ -374,20 +381,6 @@ class Html case 'background-color': $styles['bgColor'] = trim($cValue, '#'); break; - case 'font-weight': - $tValue = false; - if (preg_match('#bold#', $cValue)) { - $tValue = true; // also match bolder - } - $styles['bold'] = $tValue; - break; - case 'font-style': - $tValue = false; - if (preg_match('#(?:italic|oblique)#', $cValue)) { - $tValue = true; - } - $styles['italic'] = $tValue; - break; } } diff --git a/tests/PhpWord/Reader/MsDocTest.php b/tests/PhpWord/Reader/MsDocTest.php index 12d50247..e407547d 100644 --- a/tests/PhpWord/Reader/MsDocTest.php +++ b/tests/PhpWord/Reader/MsDocTest.php @@ -56,4 +56,24 @@ class MsDocTest extends \PHPUnit\Framework\TestCase $phpWord = IOFactory::load($filename, 'MsDoc'); $this->assertInstanceOf('PhpOffice\\PhpWord\\PhpWord', $phpWord); } + + /** + * Test exception on not existing file + * @expectedException \Exception + */ + public function testFailIfFileNotReadable() + { + $filename = __DIR__ . '/../_files/documents/not_existing_reader.doc'; + IOFactory::load($filename, 'MsDoc'); + } + + /** + * Test exception on non OLE document + * @expectedException \Exception + */ + public function testFailIfFileNotOle() + { + $filename = __DIR__ . '/../_files/documents/reader.odt'; + IOFactory::load($filename, 'MsDoc'); + } } diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index 0ba7717f..b89adec9 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -18,9 +18,12 @@ namespace PhpOffice\PhpWord\Shared; use PhpOffice\PhpWord\Element\Section; +use PhpOffice\PhpWord\SimpleType\Jc; +use PhpOffice\PhpWord\TestHelperDOCX; /** * Test class for PhpOffice\PhpWord\Shared\Html + * @coversDefaultClass \PhpOffice\PhpWord\Shared\Html */ class HtmlTest extends \PHPUnit\Framework\TestCase { @@ -43,7 +46,7 @@ class HtmlTest extends \PHPUnit\Framework\TestCase // Styles $content .= '

'; + . 'text-align: center; color: #999; background-color: #000; font-weight: bold; font-style: italic;">'; foreach ($styles as $style) { $content .= "<{$style}>{$style}"; } @@ -67,4 +70,109 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $content .= '–   ²³¼½¾'; Html::addHtml($section, $content); } + + /** + * Test that html already in body element can be read + * @ignore + */ + public function testParseFullHtml() + { + $section = new Section(1); + Html::addHtml($section, '

test paragraph1

test paragraph2

', true); + + $this->assertCount(2, $section->getElements()); + } + + /** + * Test underline + */ + public function testParseUnderline() + { + $html = 'test'; + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + Html::addHtml($section, $html); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:rPr/w:u')); + $this->assertEquals('single', $doc->getElementAttribute('/w:document/w:body/w:p/w:r/w:rPr/w:u', 'w:val')); + } + + /** + * Test text-decoration style + */ + public function testParseTextDecoration() + { + $html = 'test'; + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + Html::addHtml($section, $html); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:rPr/w:u')); + $this->assertEquals('single', $doc->getElementAttribute('/w:document/w:body/w:p/w:r/w:rPr/w:u', 'w:val')); + } + + /** + * Test text-align style + */ + public function testParseTextAlign() + { + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + Html::addHtml($section, '

test

'); + Html::addHtml($section, '

test

'); + Html::addHtml($section, '

test

'); + Html::addHtml($section, '

test

'); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:pPr/w:jc')); + $this->assertEquals('start', $doc->getElementAttribute('/w:document/w:body/w:p[1]/w:pPr/w:jc', 'w:val')); + $this->assertEquals('end', $doc->getElementAttribute('/w:document/w:body/w:p[2]/w:pPr/w:jc', 'w:val')); + $this->assertEquals('center', $doc->getElementAttribute('/w:document/w:body/w:p[3]/w:pPr/w:jc', 'w:val')); + $this->assertEquals('both', $doc->getElementAttribute('/w:document/w:body/w:p[4]/w:pPr/w:jc', 'w:val')); + } + + /** + * Test parsing paragraph and span styles + */ + public function testParseParagraphAndSpanStyle() + { + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + Html::addHtml($section, '

test

'); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:pPr/w:jc')); + $this->assertEquals('center', $doc->getElementAttribute('/w:document/w:body/w:p[1]/w:pPr/w:jc', 'w:val')); + $this->assertEquals('single', $doc->getElementAttribute('/w:document/w:body/w:p[1]/w:r/w:rPr/w:u', 'w:val')); + } + + /** + * Test parsing table + */ + public function testParseTable() + { + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $html = ' + + + + + + + + + + + + +
abc
12
456
'; + Html::addHtml($section, $html); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); +// echo $doc->printXml(); +// $this->assertTrue($doc->elementExists('/w:document/w:body/w:tbl/w:tr/w:tc')); + } } diff --git a/tests/PhpWord/_includes/XmlDocument.php b/tests/PhpWord/_includes/XmlDocument.php index eb335278..c82c5a8e 100644 --- a/tests/PhpWord/_includes/XmlDocument.php +++ b/tests/PhpWord/_includes/XmlDocument.php @@ -170,12 +170,20 @@ class XmlDocument * @param string $file * @return string */ - public function printXml($path = '/w:document', $file = 'word/document.xml') + public function printXml($path = '/', $file = 'word/document.xml') { + $element = $this->getElement($path, $file); + if ($element instanceof \DOMDocument) { + $element->formatOutput = true; + $element->preserveWhiteSpace = false; + + return $element->saveXML(); + } + $newdoc = new \DOMDocument(); $newdoc->formatOutput = true; $newdoc->preserveWhiteSpace = false; - $node = $newdoc->importNode($this->getElement($path, $file), true); + $node = $newdoc->importNode($element, true); $newdoc->appendChild($node); return $newdoc->saveXML($node); From 8bb9a999751671ee715b35b3efa110691fb0ff34 Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 9 Nov 2017 23:07:17 +0100 Subject: [PATCH 135/370] fix warning --- tests/PhpWord/Shared/HtmlTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index b89adec9..8ec6840f 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -173,6 +173,7 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); // echo $doc->printXml(); -// $this->assertTrue($doc->elementExists('/w:document/w:body/w:tbl/w:tr/w:tc')); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p')); +// $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:tbl/w:tr/w:tc')); } } From ff8234bce46c01b8e9ecf4910e1b6c70bcfbdebc Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 10 Nov 2017 23:37:02 +0100 Subject: [PATCH 136/370] add tests --- src/PhpWord/Element/AbstractContainer.php | 2 +- .../Writer/ODText/Part/ContentTest.php | 1 + tests/PhpWord/Writer/Word2007/ElementTest.php | 62 +++++++++++++++++++ .../Writer/Word2007/Style/FontTest.php | 15 +++++ .../Writer/Word2007/Style/ParagraphTest.php | 52 ++++++++++++++++ 5 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 tests/PhpWord/Writer/Word2007/Style/ParagraphTest.php diff --git a/src/PhpWord/Element/AbstractContainer.php b/src/PhpWord/Element/AbstractContainer.php index d7171798..cb42cf3d 100644 --- a/src/PhpWord/Element/AbstractContainer.php +++ b/src/PhpWord/Element/AbstractContainer.php @@ -23,7 +23,7 @@ namespace PhpOffice\PhpWord\Element; * @method Text addText(string $text, mixed $fStyle = null, mixed $pStyle = null) * @method TextRun addTextRun(mixed $pStyle = null) * @method Bookmark addBookmark(string $name) - * @method Link addLink(string $target, string $text = null, mixed $fStyle = null, mixed $pStyle = null) + * @method Link addLink(string $target, string $text = null, mixed $fStyle = null, mixed $pStyle = null, boolean $internal = false) * @method PreserveText addPreserveText(string $text, mixed $fStyle = null, mixed $pStyle = null) * @method void addTextBreak(int $count = 1, mixed $fStyle = null, mixed $pStyle = null) * @method ListItem addListItem(string $txt, int $depth = 0, mixed $font = null, mixed $list = null, mixed $para = null) diff --git a/tests/PhpWord/Writer/ODText/Part/ContentTest.php b/tests/PhpWord/Writer/ODText/Part/ContentTest.php index 28542379..d5681143 100644 --- a/tests/PhpWord/Writer/ODText/Part/ContentTest.php +++ b/tests/PhpWord/Writer/ODText/Part/ContentTest.php @@ -83,6 +83,7 @@ class ContentTest extends \PHPUnit\Framework\TestCase $cell->addObject($objectSrc); $textrun = $cell->addTextRun(); $textrun->addText('Test text run'); + $section->addPageBreak(); $footer = $section->addFooter(); $footer->addPreserveText('{PAGE}'); diff --git a/tests/PhpWord/Writer/Word2007/ElementTest.php b/tests/PhpWord/Writer/Word2007/ElementTest.php index 85a9bb38..a81a617b 100644 --- a/tests/PhpWord/Writer/Word2007/ElementTest.php +++ b/tests/PhpWord/Writer/Word2007/ElementTest.php @@ -71,6 +71,68 @@ class ElementTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists($element)); } + /** + * Test bookmark element + */ + public function testBookmark() + { + $phpWord = new PhpWord(); + $section = $phpWord->addSection(); + + $section->addBookmark('test_bookmark'); + $doc = TestHelperDOCX::getDocument($phpWord); + + $element = '/w:document/w:body/w:bookmarkStart'; + $this->assertTrue($doc->elementExists($element)); + $this->assertEquals('test_bookmark', $doc->getElementAttribute($element, 'w:name')); + + $element = '/w:document/w:body/w:bookmarkEnd'; + $this->assertTrue($doc->elementExists($element)); + } + + /** + * Test link element + */ + public function testLinkElement() + { + $phpWord = new PhpWord(); + $section = $phpWord->addSection(); + + $section->addLink('https://github.com/PHPOffice/PHPWord'); + $section->addLink('internal_link', null, null, null, true); + $doc = TestHelperDOCX::getDocument($phpWord); + + $element = '/w:document/w:body/w:p[1]/w:hyperlink/w:r/w:t'; + $this->assertTrue($doc->elementExists($element)); + + $element = '/w:document/w:body/w:p[2]/w:hyperlink/w:r/w:t'; + $this->assertTrue($doc->elementExists($element)); + $this->assertEquals('internal_link', $doc->getElementAttribute('/w:document/w:body/w:p[2]/w:hyperlink', 'w:anchor')); + } + + /** + * Basic test for table element + */ + public function testTableElements() + { + $phpWord = new PhpWord(); + $section = $phpWord->addSection(); + + $table = $section->addTable(array('alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER)); + $table->addRow(900); + $table->addCell(2000)->addText('Row 1'); + $table->addCell(2000)->addText('Row 2'); + $table->addCell(2000)->addText('Row 3'); + $table->addCell(2000)->addText('Row 4'); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $tableRootElement = '/w:document/w:body/w:tbl'; + $this->assertTrue($doc->elementExists($tableRootElement . '/w:tblGrid/w:gridCol')); + $this->assertTrue($doc->elementExists($tableRootElement . '/w:tblPr/w:jc')); + $this->assertEquals('center', $doc->getElementAttribute($tableRootElement . '/w:tblPr/w:jc', 'w:val')); + } + /** * Test shape elements */ diff --git a/tests/PhpWord/Writer/Word2007/Style/FontTest.php b/tests/PhpWord/Writer/Word2007/Style/FontTest.php index 78b2c320..d36a3037 100644 --- a/tests/PhpWord/Writer/Word2007/Style/FontTest.php +++ b/tests/PhpWord/Writer/Word2007/Style/FontTest.php @@ -50,4 +50,19 @@ class FontTest extends \PHPUnit\Framework\TestCase $path = '/w:document/w:body/w:p/w:r/w:rPr/w:rtl'; $this->assertTrue($doc->elementExists($path, $file)); } + + /** + * Test writing font with language + */ + public function testFontWithLang() + { + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $section->addText('Ce texte-ci est en français.', array('lang' => \PhpOffice\PhpWord\Style\Language::FR_BE)); + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + + $file = 'word/document.xml'; + $path = '/w:document/w:body/w:p/w:r/w:rPr/w:lang'; + $this->assertTrue($doc->elementExists($path, $file)); + } } diff --git a/tests/PhpWord/Writer/Word2007/Style/ParagraphTest.php b/tests/PhpWord/Writer/Word2007/Style/ParagraphTest.php new file mode 100644 index 00000000..9bc2756b --- /dev/null +++ b/tests/PhpWord/Writer/Word2007/Style/ParagraphTest.php @@ -0,0 +1,52 @@ +addParagraphStyle('testStyle', array('indent' => '10')); + $section = $phpWord->addSection(); + $section->addText('test', null, array('numStyle' => 'testStyle', 'numLevel' => '1')); + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + + $path = '/w:document/w:body/w:p/w:pPr/w:numPr/w:ilvl'; + $this->assertTrue($doc->elementExists($path)); + } +} From e72446442bd213b2c26bcc5d36fda588c54291c4 Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 10 Nov 2017 23:47:10 +0100 Subject: [PATCH 137/370] fix format --- tests/PhpWord/Writer/Word2007/ElementTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/PhpWord/Writer/Word2007/ElementTest.php b/tests/PhpWord/Writer/Word2007/ElementTest.php index a81a617b..b31b223a 100644 --- a/tests/PhpWord/Writer/Word2007/ElementTest.php +++ b/tests/PhpWord/Writer/Word2007/ElementTest.php @@ -78,7 +78,7 @@ class ElementTest extends \PHPUnit\Framework\TestCase { $phpWord = new PhpWord(); $section = $phpWord->addSection(); - + $section->addBookmark('test_bookmark'); $doc = TestHelperDOCX::getDocument($phpWord); From a01d22ed67b4ac43ff99ea932a1ed9bc4c63c5e8 Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 11 Nov 2017 23:49:23 +0100 Subject: [PATCH 138/370] improve HTML parser and add tests --- src/PhpWord/Element/Image.php | 2 +- src/PhpWord/Shared/Converter.php | 42 ++++++++++++++++++ src/PhpWord/Shared/Html.php | 15 ++++--- src/PhpWord/Shared/OLERead.php | 8 +++- src/PhpWord/Writer/HTML/Style/Paragraph.php | 7 +-- .../Word2007/Element/AbstractElement.php | 12 +++--- src/PhpWord/Writer/Word2007/Part/Comments.php | 6 ++- src/PhpWord/Writer/Word2007/Style/Font.php | 1 + tests/PhpWord/Element/ImageTest.php | 3 ++ tests/PhpWord/Shared/ConverterTest.php | 17 ++++++++ tests/PhpWord/Shared/HtmlTest.php | 42 +++++++++++++++--- tests/PhpWord/Writer/HTMLTest.php | 16 ++++++- tests/PhpWord/Writer/PDF/MPDFTest.php | 1 + tests/PhpWord/Writer/Word2007/ElementTest.php | 43 +++++++++++++++++++ 14 files changed, 187 insertions(+), 28 deletions(-) diff --git a/src/PhpWord/Element/Image.php b/src/PhpWord/Element/Image.php index c9620b6b..a5bd7283 100644 --- a/src/PhpWord/Element/Image.php +++ b/src/PhpWord/Element/Image.php @@ -449,7 +449,7 @@ class Image extends AbstractElement $tempFilename = tempnam(Settings::getTempDir(), 'PHPWordImage'); if (false === $tempFilename) { - throw new CreateTemporaryFileException(); + throw new CreateTemporaryFileException(); // @codeCoverageIgnore } $zip = new ZipArchive(); diff --git a/src/PhpWord/Shared/Converter.php b/src/PhpWord/Shared/Converter.php index 6ba2b567..43c2f299 100644 --- a/src/PhpWord/Shared/Converter.php +++ b/src/PhpWord/Shared/Converter.php @@ -26,6 +26,7 @@ class Converter const INCH_TO_TWIP = 1440; const INCH_TO_PIXEL = 96; const INCH_TO_POINT = 72; + const INCH_TO_PICA = 6; const PIXEL_TO_EMU = 9525; const DEGREE_TO_ANGLE = 60000; @@ -227,6 +228,17 @@ class Converter return round($emu / self::PIXEL_TO_EMU); } + /** + * Convert pica to point + * + * @param int $pica + * @return float + */ + public static function picaToPoint($pica = 1) + { + return $pica / self::INCH_TO_PICA * self::INCH_TO_POINT; + } + /** * Convert degree to angle * @@ -275,4 +287,34 @@ class Converter return array($red, $green, $blue); } + + /** + * Transforms a size in CSS format (eg. 10px, 10px, ...) to points + * + * @param string $value + * @return float + */ + public static function cssToPoint($value) + { + preg_match('/^[+-]?([0-9]+.?[0-9]+)?(px|em|ex|%|in|cm|mm|pt|pc)$/i', $value, $matches); + $size = $matches[1]; + $unit = $matches[2]; + + switch ($unit) { + case 'pt': + return $size; + case 'px': + return self::pixelToPoint($size); + case 'cm': + return self::cmToPoint($size); + case 'mm': + return self::cmToPoint($size / 10); + case 'in': + return self::inchToPoint($size); + case 'pc': + return self::picaToPoint($size); + default: + return null; + } + } } diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 620839b4..c4292eb4 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -233,11 +233,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')) { - $element->addText($node->nodeValue, $styles['font'], $styles['paragraph']); - // } + if (is_callable(array($element, 'addText'))) { + $element->addText($node->nodeValue, $styles['font'], $styles['paragraph']); + } } /** @@ -375,6 +373,13 @@ class Html break; } break; + case 'font-size': + $styles['size'] = Converter::cssToPoint($cValue); + break; + case 'font-family': + $cValue = array_map('trim', explode(',', $cValue)); + $styles['name'] = ucwords($cValue[0]); + break; case 'color': $styles['color'] = trim($cValue, '#'); break; diff --git a/src/PhpWord/Shared/OLERead.php b/src/PhpWord/Shared/OLERead.php index e4efd7da..1321b8da 100644 --- a/src/PhpWord/Shared/OLERead.php +++ b/src/PhpWord/Shared/OLERead.php @@ -110,15 +110,18 @@ class OLERead $bbdBlocks = $this->numBigBlockDepotBlocks; + // @codeCoverageIgnoreStart if ($this->numExtensionBlocks != 0) { $bbdBlocks = (self::BIG_BLOCK_SIZE - self::BIG_BLOCK_DEPOT_BLOCKS_POS)/4; } - + // @codeCoverageIgnoreEnd + for ($i = 0; $i < $bbdBlocks; ++$i) { $bigBlockDepotBlocks[$i] = self::getInt4d($this->data, $pos); $pos += 4; } + // @codeCoverageIgnoreStart for ($j = 0; $j < $this->numExtensionBlocks; ++$j) { $pos = ($this->extensionBlock + 1) * self::BIG_BLOCK_SIZE; $blocksToRead = min($this->numBigBlockDepotBlocks - $bbdBlocks, self::BIG_BLOCK_SIZE / 4 - 1); @@ -133,6 +136,7 @@ class OLERead $this->extensionBlock = self::getInt4d($this->data, $pos); } } + // @codeCoverageIgnoreEnd $pos = 0; $this->bigBlockChain = ''; @@ -196,7 +200,7 @@ class OLERead } if ($numBlocks == 0) { - return ''; + return '';// @codeCoverageIgnore } $block = $this->props[$stream]['startBlock']; diff --git a/src/PhpWord/Writer/HTML/Style/Paragraph.php b/src/PhpWord/Writer/HTML/Style/Paragraph.php index af551dc5..57e44e85 100644 --- a/src/PhpWord/Writer/HTML/Style/Paragraph.php +++ b/src/PhpWord/Writer/HTML/Style/Paragraph.php @@ -44,11 +44,6 @@ class Paragraph extends AbstractStyle $textAlign = ''; switch ($style->getAlignment()) { - case Jc::START: - case Jc::NUM_TAB: - case Jc::LEFT: - $textAlign = 'left'; - break; case Jc::CENTER: $textAlign = 'center'; break; @@ -65,7 +60,7 @@ class Paragraph extends AbstractStyle case Jc::JUSTIFY: $textAlign = 'justify'; break; - default: + default: //all others, align left $textAlign = 'left'; break; } diff --git a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php index 07ffc286..86018fd2 100644 --- a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php +++ b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php @@ -139,10 +139,10 @@ abstract class AbstractElement { if ($this->element->getCommentRangeEnd() != null) { $comment = $this->element->getCommentRangeEnd(); - //only set the ID if it is not yet set, otherwise it will overwrite it + //only set the ID if it is not yet set, otherwise it will overwrite it, this should normally not happen if ($comment->getElementId() == null) { - $comment->setElementId(); - } + $comment->setElementId(); // @codeCoverageIgnore + } // @codeCoverageIgnore $this->xmlWriter->writeElementBlock('w:commentRangeEnd', array('w:id' => $comment->getElementId())); $this->xmlWriter->startElement('w:r'); @@ -150,10 +150,10 @@ abstract class AbstractElement $this->xmlWriter->endElement(); } elseif ($this->element->getCommentRangeStart() != null && $this->element->getCommentRangeStart()->getEndElement() == null) { $comment = $this->element->getCommentRangeStart(); - //only set the ID if it is not yet set, otherwise it will overwrite it + //only set the ID if it is not yet set, otherwise it will overwrite it, this should normally not happen if ($comment->getElementId() == null) { - $comment->setElementId(); - } + $comment->setElementId(); // @codeCoverageIgnore + } // @codeCoverageIgnore $this->xmlWriter->writeElementBlock('w:commentRangeEnd', array('w:id' => $comment->getElementId())); $this->xmlWriter->startElement('w:r'); diff --git a/src/PhpWord/Writer/Word2007/Part/Comments.php b/src/PhpWord/Writer/Word2007/Part/Comments.php index b2b49864..4551ca92 100644 --- a/src/PhpWord/Writer/Word2007/Part/Comments.php +++ b/src/PhpWord/Writer/Word2007/Part/Comments.php @@ -78,8 +78,10 @@ class Comments extends AbstractPart $xmlWriter->startElement('w:comment'); $xmlWriter->writeAttribute('w:id', $comment->getElementId()); $xmlWriter->writeAttribute('w:author', $comment->getAuthor()); - $xmlWriter->writeAttribute('w:date', $comment->getDate()->format($this->dateFormat)); - $xmlWriter->writeAttribute('w:initials', $comment->getInitials()); + if ($comment->getDate() != null) { + $xmlWriter->writeAttribute('w:date', $comment->getDate()->format($this->dateFormat)); + } + $xmlWriter->writeAttributeIf($comment->getInitials() != null, 'w:initials', $comment->getInitials()); $containerWriter = new Container($xmlWriter, $comment); $containerWriter->write(); diff --git a/src/PhpWord/Writer/Word2007/Style/Font.php b/src/PhpWord/Writer/Word2007/Style/Font.php index 0cb3209f..3fbff63d 100644 --- a/src/PhpWord/Writer/Word2007/Style/Font.php +++ b/src/PhpWord/Writer/Word2007/Style/Font.php @@ -59,6 +59,7 @@ class Font extends AbstractStyle if (!$style instanceof \PhpOffice\PhpWord\Style\Font) { return; } + $xmlWriter = $this->getXmlWriter(); $xmlWriter->startElement('w:rPr'); diff --git a/tests/PhpWord/Element/ImageTest.php b/tests/PhpWord/Element/ImageTest.php index 00449e1f..381b9086 100644 --- a/tests/PhpWord/Element/ImageTest.php +++ b/tests/PhpWord/Element/ImageTest.php @@ -206,6 +206,9 @@ class ImageTest extends \PHPUnit\Framework\TestCase $this->assertEquals('imagecreatefromstring', $image->getImageCreateFunction()); $this->assertEquals('imagejpeg', $image->getImageFunction()); $this->assertTrue($image->isMemImage()); + + $this->assertNotNull($image->getImageStringData()); + $this->assertNotNull($image->getImageStringData(true)); } /** diff --git a/tests/PhpWord/Shared/ConverterTest.php b/tests/PhpWord/Shared/ConverterTest.php index a71046aa..28d68e17 100644 --- a/tests/PhpWord/Shared/ConverterTest.php +++ b/tests/PhpWord/Shared/ConverterTest.php @@ -88,6 +88,9 @@ class ConverterTest extends \PHPUnit\Framework\TestCase $result = Converter::emuToPixel($value); $this->assertEquals(round($value / 9525), $result); + $result = Converter::picaToPoint($value); + $this->assertEquals($value / 6 * 72, $result, '', 0.00001); + $result = Converter::degreeToAngle($value); $this->assertEquals((int) round($value * 60000), $result); @@ -112,4 +115,18 @@ class ConverterTest extends \PHPUnit\Framework\TestCase $this->assertEquals($value[1], $result); } } + + /** + * Test css size to point + */ + public function testCssSizeParser() + { + $this->assertEquals(null, Converter::cssToPoint('10em')); + $this->assertEquals(10, Converter::cssToPoint('10pt')); + $this->assertEquals(7.5, Converter::cssToPoint('10px')); + $this->assertEquals(720, Converter::cssToPoint('10in')); + $this->assertEquals(120, Converter::cssToPoint('10pc')); + $this->assertEquals(28.346457, Converter::cssToPoint('10mm'), '', 0.000001); + $this->assertEquals(283.464567, Converter::cssToPoint('10cm'), '', 0.000001); + } } diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index 8ec6840f..c50df5af 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -127,10 +127,42 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:pPr/w:jc')); - $this->assertEquals('start', $doc->getElementAttribute('/w:document/w:body/w:p[1]/w:pPr/w:jc', 'w:val')); - $this->assertEquals('end', $doc->getElementAttribute('/w:document/w:body/w:p[2]/w:pPr/w:jc', 'w:val')); - $this->assertEquals('center', $doc->getElementAttribute('/w:document/w:body/w:p[3]/w:pPr/w:jc', 'w:val')); - $this->assertEquals('both', $doc->getElementAttribute('/w:document/w:body/w:p[4]/w:pPr/w:jc', 'w:val')); + $this->assertEquals(Jc::START, $doc->getElementAttribute('/w:document/w:body/w:p[1]/w:pPr/w:jc', 'w:val')); + $this->assertEquals(Jc::END, $doc->getElementAttribute('/w:document/w:body/w:p[2]/w:pPr/w:jc', 'w:val')); + $this->assertEquals(Jc::CENTER, $doc->getElementAttribute('/w:document/w:body/w:p[3]/w:pPr/w:jc', 'w:val')); + $this->assertEquals(Jc::BOTH, $doc->getElementAttribute('/w:document/w:body/w:p[4]/w:pPr/w:jc', 'w:val')); + } + + /** + * Test font-size style + */ + public function testParseFontSize() + { + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + Html::addHtml($section, 'test'); + Html::addHtml($section, 'test'); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:rPr/w:sz')); + $this->assertEquals('20', $doc->getElementAttribute('/w:document/w:body/w:p[1]/w:r/w:rPr/w:sz', 'w:val')); + $this->assertEquals('15', $doc->getElementAttribute('/w:document/w:body/w:p[2]/w:r/w:rPr/w:sz', 'w:val')); + } + + /** + * Test font-family style + */ + public function testParseFontFamily() + { + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + Html::addHtml($section, 'test'); + Html::addHtml($section, 'test'); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:rPr/w:rFonts')); + $this->assertEquals('Arial', $doc->getElementAttribute('/w:document/w:body/w:p[1]/w:r/w:rPr/w:rFonts', 'w:ascii')); + $this->assertEquals('Times New Roman', $doc->getElementAttribute('/w:document/w:body/w:p[2]/w:r/w:rPr/w:rFonts', 'w:ascii')); } /** @@ -144,7 +176,7 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:pPr/w:jc')); - $this->assertEquals('center', $doc->getElementAttribute('/w:document/w:body/w:p[1]/w:pPr/w:jc', 'w:val')); + $this->assertEquals(Jc::CENTER, $doc->getElementAttribute('/w:document/w:body/w:p[1]/w:pPr/w:jc', 'w:val')); $this->assertEquals('single', $doc->getElementAttribute('/w:document/w:body/w:p[1]/w:r/w:rPr/w:u', 'w:val')); } diff --git a/tests/PhpWord/Writer/HTMLTest.php b/tests/PhpWord/Writer/HTMLTest.php index 4d75ea5a..bdfc44e3 100644 --- a/tests/PhpWord/Writer/HTMLTest.php +++ b/tests/PhpWord/Writer/HTMLTest.php @@ -18,6 +18,7 @@ namespace PhpOffice\PhpWord\Writer; use PhpOffice\PhpWord\PhpWord; +use PhpOffice\PhpWord\Settings; use PhpOffice\PhpWord\SimpleType\Jc; /** @@ -95,6 +96,15 @@ class HTMLTest extends \PHPUnit\Framework\TestCase $textrun->addText(htmlspecialchars('Test 3', ENT_COMPAT, 'UTF-8')); $textrun->addTextBreak(); + $textrun = $section->addTextRun(array('alignment' => Jc::START)); + $textrun->addText(htmlspecialchars('Text left aligned', ENT_COMPAT, 'UTF-8')); + + $textrun = $section->addTextRun(array('alignment' => Jc::BOTH)); + $textrun->addText(htmlspecialchars('Text justified', ENT_COMPAT, 'UTF-8')); + + $textrun = $section->addTextRun(array('alignment' => Jc::END)); + $textrun->addText(htmlspecialchars('Text right aligned', ENT_COMPAT, 'UTF-8')); + $textrun = $section->addTextRun('Paragraph'); $textrun->addLink('https://github.com/PHPOffice/PHPWord'); $textrun->addImage($localImage); @@ -120,10 +130,14 @@ class HTMLTest extends \PHPUnit\Framework\TestCase $cell = $table->addRow()->addCell(); $writer = new HTML($phpWord); + $writer->save($file); - $this->assertFileExists($file); + unlink($file); + Settings::setOutputEscapingEnabled(true); + $writer->save($file); + $this->assertFileExists($file); unlink($file); } } diff --git a/tests/PhpWord/Writer/PDF/MPDFTest.php b/tests/PhpWord/Writer/PDF/MPDFTest.php index 0e6cf308..330125fb 100644 --- a/tests/PhpWord/Writer/PDF/MPDFTest.php +++ b/tests/PhpWord/Writer/PDF/MPDFTest.php @@ -38,6 +38,7 @@ class MPDFTest extends \PHPUnit\Framework\TestCase $phpWord = new PhpWord(); $section = $phpWord->addSection(); $section->addText('Test 1'); + $section->addPageBreak(); $rendererName = Settings::PDF_RENDERER_MPDF; $rendererLibraryPath = realpath(PHPWORD_TESTS_BASE_DIR . '/../vendor/mpdf/mpdf'); diff --git a/tests/PhpWord/Writer/Word2007/ElementTest.php b/tests/PhpWord/Writer/Word2007/ElementTest.php index b31b223a..0f0b323a 100644 --- a/tests/PhpWord/Writer/Word2007/ElementTest.php +++ b/tests/PhpWord/Writer/Word2007/ElementTest.php @@ -18,6 +18,8 @@ namespace PhpOffice\PhpWord\Writer\Word2007; use PhpOffice\Common\XMLWriter; +use PhpOffice\PhpWord\Element\Comment; +use PhpOffice\PhpWord\Element\Text; use PhpOffice\PhpWord\Element\TextRun; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\TestHelperDOCX; @@ -351,4 +353,45 @@ class ElementTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists($path . '[3]/w:sdt/w:sdtPr/w:alias')); $this->assertTrue($doc->elementExists($path . '[3]/w:sdt/w:sdtPr/w:tag')); } + + /** + * Test Comment element + */ + public function testCommentWithoutEndElement() + { + $phpWord = new PhpWord(); + $section = $phpWord->addSection(); + + $comment = new Comment('tester'); + $phpWord->addComment($comment); + + $element = $section->addText('this is a test'); + $element->setCommentRangeStart($comment); + + $doc = TestHelperDOCX::getDocument($phpWord); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:commentRangeStart')); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:commentRangeEnd')); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:commentReference')); + } + + /** + * Test Comment element + */ + public function testCommentWithEndElement() + { + $phpWord = new PhpWord(); + $section = $phpWord->addSection(); + + $comment = new Comment('tester'); + $phpWord->addComment($comment); + + $element = $section->addText('this is a test'); + $element->setCommentRangeStart($comment); + $element->setCommentRangeEnd($comment); + + $doc = TestHelperDOCX::getDocument($phpWord); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:commentRangeStart')); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:commentRangeEnd')); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:commentReference')); + } } From 8eb72c976a66bdcb9c76ef3e9e63763fa43f0ab8 Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 15 Nov 2017 22:49:13 +0100 Subject: [PATCH 139/370] add HTML table parsing --- samples/Sample_26_Html.php | 14 ++ src/PhpWord/Shared/Converter.php | 53 +++--- src/PhpWord/Shared/Html.php | 158 +++++++++++++++--- src/PhpWord/Style/Border.php | 151 +++++++++++++++++ src/PhpWord/Style/Cell.php | 85 +++++++++- src/PhpWord/Writer/Word2007/Style/Cell.php | 1 + .../Writer/Word2007/Style/MarginBorder.php | 27 ++- src/PhpWord/Writer/Word2007/Style/Shading.php | 6 +- tests/PhpWord/Shared/HtmlTest.php | 16 +- tests/PhpWord/Writer/Word2007/ElementTest.php | 2 +- 10 files changed, 452 insertions(+), 61 deletions(-) diff --git a/samples/Sample_26_Html.php b/samples/Sample_26_Html.php index 4235c946..8e6e9a33 100644 --- a/samples/Sample_26_Html.php +++ b/samples/Sample_26_Html.php @@ -14,6 +14,20 @@ $html .= '
  • Item 1
  • Item 2
    • Item 2.1
    • Item 2.1 array('Property', null, null, $styles, null, 'underline', 'single'), 'sup' => array('Property', null, null, $styles, null, 'superScript', true), 'sub' => array('Property', null, null, $styles, null, 'subScript', true), - 'span' => array('Property', null, null, $styles, null, 'span', $node), - 'table' => array('Table', $node, $element, $styles, null, 'addTable', true), - 'tr' => array('Table', $node, $element, $styles, null, 'addRow', true), - 'td' => array('Table', $node, $element, $styles, null, 'addCell', true), + 'span' => array('Span', $node, null, $styles, null, null, null), + 'table' => array('Table', $node, $element, $styles, null, null, null), + 'tr' => array('Row', $node, $element, $styles, null, null, null), + 'td' => array('Cell', $node, $element, $styles, null, null, null), + 'th' => array('Cell', $node, $element, $styles, null, null, null), 'ul' => array('List', null, null, $styles, $data, 3, null), 'ol' => array('List', null, null, $styles, $data, 7, null), 'li' => array('ListItem', $node, $element, $styles, $data, null, null), @@ -179,7 +182,7 @@ class Html $cNodes = $node->childNodes; if (count($cNodes) > 0) { foreach ($cNodes as $cNode) { - if ($element instanceof AbstractContainer) { + if ($element instanceof AbstractContainer || $element instanceof Table || $element instanceof Row) { self::parseNode($cNode, $element, $styles, $data); } } @@ -197,7 +200,7 @@ class Html */ private static function parseParagraph($node, $element, &$styles) { - $styles['paragraph'] = self::parseInlineStyle($node, $styles['paragraph']); + $styles['paragraph'] = self::recursiveParseStylesInHierarchy($node, $styles['paragraph']); $newElement = $element->addTextRun($styles['paragraph']); return $newElement; @@ -231,7 +234,12 @@ class Html */ private static function parseText($node, $element, &$styles) { - $styles['font'] = self::parseInlineStyle($node, $styles['font']); + $styles['font'] = self::recursiveParseStylesInHierarchy($node, $styles['font']); + + //alignment applies on paragraph, not on font. Let's copy it there + if (isset($styles['font']['alignment'])) { + $styles['paragraph']['alignment'] = $styles['font']['alignment']; + } if (is_callable(array($element, 'addText'))) { $element->addText($node->nodeValue, $styles['font'], $styles['paragraph']); @@ -247,16 +255,18 @@ class Html */ private static function parseProperty(&$styles, $argument1, $argument2) { - if ($argument1 !== 'span') { - $styles['font'][$argument1] = $argument2; - } else { - if (!is_null($argument2->attributes)) { - $nodeAttr = $argument2->attributes->getNamedItem('style'); - if (!is_null($nodeAttr) && property_exists($nodeAttr, 'value')) { - $styles['font'] = self::parseStyle($nodeAttr, $styles['font']); - } - } - } + $styles['font'][$argument1] = $argument2; + } + + /** + * Parse span node + * + * @param \DOMNode $node + * @param array &$styles + */ + private static function parseSpan($node, &$styles) + { + self::parseInlineStyle($node, $styles['font']); } /** @@ -270,11 +280,11 @@ class Html * * @todo As soon as TableItem, RowItem and CellItem support relative width and height */ - private static function parseTable($node, $element, &$styles, $argument1) + private static function parseTable($node, $element, &$styles) { - $styles['paragraph'] = self::parseInlineStyle($node, $styles['paragraph']); + $elementStyles = self::parseInlineStyle($node, $styles['table']); - $newElement = $element->$argument1(); + $newElement = $element->addTable($elementStyles); // $attributes = $node->attributes; // if ($attributes->getNamedItem('width') !== null) { @@ -291,6 +301,62 @@ class Html return $newElement; } + /** + * Parse a table row + * + * @param \DOMNode $node + * @param \PhpOffice\PhpWord\Element\Table $element + * @param array &$styles + * @return \PhpOffice\PhpWord\Element\AbstractContainer $element + */ + private static function parseRow($node, $element, &$styles) + { + $rowStyles = self::parseInlineStyle($node, $styles['row']); + if ($node->parentNode->nodeName == 'thead') { + $rowStyles['tblHeader'] = true; + } + + return $element->addRow(null, $rowStyles); + } + + /** + * Parse table cell + * + * @param \DOMNode $node + * @param \PhpOffice\PhpWord\Element\Table $element + * @param array &$styles + * @return \PhpOffice\PhpWord\Element\AbstractContainer $element + */ + private static function parseCell($node, $element, &$styles) + { + $cellStyles = self::recursiveParseStylesInHierarchy($node, $styles['cell']); + + $colspan = $node->getAttribute('colspan'); + if (!empty($colspan)) { + $cellStyles['gridSpan'] = $colspan - 0; + } + + return $element->addCell(null, $cellStyles); + } + + /** + * Recursively parses styles on parent nodes + * TODO if too slow, add caching of parent nodes, !! everything is static here so watch out for concurrency !! + * + * @param \DOMNode $node + * @param array &$styles + */ + private static function recursiveParseStylesInHierarchy(\DOMNode $node, array $style) + { + $parentStyle = self::parseInlineStyle($node, array()); + $style = array_merge($parentStyle, $style); + if ($node->parentNode != null && XML_ELEMENT_NODE == $node->parentNode->nodeType) { + $style = self::recursiveParseStylesInHierarchy($node->parentNode, $style); + } + + return $style; + } + /** * Parse list node * @@ -400,9 +466,59 @@ class Html } $styles['italic'] = $tValue; break; + case 'border-color': + $styles['color'] = trim($cValue, '#'); + break; + case 'border-width': + $styles['borderSize'] = Converter::cssToPoint($cValue); + break; + case 'border-style': + $styles['borderStyle'] = self::mapBorderStyle($cValue); + break; + case 'width': + if (preg_match('/([0-9]+[a-z]+)/', $cValue, $matches)) { + $styles['width'] = Converter::cssToTwip($matches[1]); + $styles['unit'] = \PhpOffice\PhpWord\Style\Table::WIDTH_TWIP; + } elseif (preg_match('/([0-9]+)%/', $cValue, $matches)) { + $styles['width'] = $matches[1] * 50; + $styles['unit'] = \PhpOffice\PhpWord\Style\Table::WIDTH_PERCENT; + } elseif (preg_match('/([0-9]+)/', $cValue, $matches)) { + $styles['width'] = $matches[1]; + $styles['unit'] = \PhpOffice\PhpWord\Style\Table::WIDTH_AUTO; + } + break; + case 'border': + if (preg_match('/([0-9]+[^0-9]*)\s+(\#[a-fA-F0-9]+)\s+([a-z]+)/', $cValue, $matches)) { + $styles['borderSize'] = Converter::cssToPoint($matches[1]); + $styles['borderColor'] = trim($matches[2], '#'); + $styles['borderStyle'] = self::mapBorderStyle($matches[3]); + } + break; } } return $styles; } + + /** + * Transforms a CSS border style into a word border style + * + * @param string $cssBorderStyle + * @return null|string + */ + private static function mapBorderStyle($cssBorderStyle) + { + if ($cssBorderStyle == null) { + return null; + } + switch ($cssBorderStyle) { + case 'none': + case 'dashed': + case 'dotted': + case 'double': + return $cssBorderStyle; + case 'solid': + return 'single'; + } + } } diff --git a/src/PhpWord/Style/Border.php b/src/PhpWord/Style/Border.php index 5c62afcd..ab6aef18 100644 --- a/src/PhpWord/Style/Border.php +++ b/src/PhpWord/Style/Border.php @@ -36,6 +36,13 @@ class Border extends AbstractStyle */ protected $borderTopColor; + /** + * Border Top Style + * + * @var string + */ + protected $borderTopStyle; + /** * Border Left Size * @@ -50,6 +57,13 @@ class Border extends AbstractStyle */ protected $borderLeftColor; + /** + * Border Left Style + * + * @var string + */ + protected $borderLeftStyle; + /** * Border Right Size * @@ -64,6 +78,13 @@ class Border extends AbstractStyle */ protected $borderRightColor; + /** + * Border Right Style + * + * @var string + */ + protected $borderRightStyle; + /** * Border Bottom Size * @@ -78,6 +99,13 @@ class Border extends AbstractStyle */ protected $borderBottomColor; + /** + * Border Bottom Style + * + * @var string + */ + protected $borderBottomStyle; + /** * Get border size * @@ -140,6 +168,37 @@ class Border extends AbstractStyle return $this; } + /** + * Get border style + * + * @return string[] + */ + public function getBorderStyle() + { + return array( + $this->getBorderTopStyle(), + $this->getBorderLeftStyle(), + $this->getBorderRightStyle(), + $this->getBorderBottomStyle(), + ); + } + + /** + * Set border style + * + * @param string $value + * @return self + */ + public function setBorderStyle($value = null) + { + $this->setBorderTopStyle($value); + $this->setBorderLeftStyle($value); + $this->setBorderRightStyle($value); + $this->setBorderBottomStyle($value); + + return $this; + } + /** * Get border top size * @@ -186,6 +245,29 @@ class Border extends AbstractStyle return $this; } + /** + * Get border top style + * + * @return string + */ + public function getBorderTopStyle() + { + return $this->borderTopStyle; + } + + /** + * Set border top Style + * + * @param string $value + * @return self + */ + public function setBorderTopStyle($value = null) + { + $this->borderTopStyle = $value; + + return $this; + } + /** * Get border left size * @@ -232,6 +314,29 @@ class Border extends AbstractStyle return $this; } + /** + * Get border left style + * + * @return string + */ + public function getBorderLeftStyle() + { + return $this->borderLeftStyle; + } + + /** + * Set border left style + * + * @param string $value + * @return self + */ + public function setBorderLeftStyle($value = null) + { + $this->borderLeftStyle = $value; + + return $this; + } + /** * Get border right size * @@ -278,6 +383,29 @@ class Border extends AbstractStyle return $this; } + /** + * Get border right style + * + * @return string + */ + public function getBorderRightStyle() + { + return $this->borderRightStyle; + } + + /** + * Set border right style + * + * @param string $value + * @return self + */ + public function setBorderRightStyle($value = null) + { + $this->borderRightStyle = $value; + + return $this; + } + /** * Get border bottom size * @@ -324,6 +452,29 @@ class Border extends AbstractStyle return $this; } + /** + * Get border bottom style + * + * @return string + */ + public function getBorderBottomStyle() + { + return $this->borderBottomStyle; + } + + /** + * Set border bottom style + * + * @param string $value + * @return self + */ + public function setBorderBottomStyle($value = null) + { + $this->borderBottomStyle = $value; + + return $this; + } + /** * Check if any of the border is not null * diff --git a/src/PhpWord/Style/Cell.php b/src/PhpWord/Style/Cell.php index 0c4ca2e1..7fd5814d 100644 --- a/src/PhpWord/Style/Cell.php +++ b/src/PhpWord/Style/Cell.php @@ -32,13 +32,31 @@ class Cell extends Border const VALIGN_BOTTOM = 'bottom'; const VALIGN_BOTH = 'both'; + //Text direction constants /** - * Text direction constants - * - * @const string + * Left to Right, Top to Bottom + */ + const TEXT_DIR_LRTB = 'lrTb'; + /** + * Top to Bottom, Right to Left + */ + const TEXT_DIR_TBRL = 'tbRl'; + /** + * Bottom to Top, Left to Right */ const TEXT_DIR_BTLR = 'btLr'; - const TEXT_DIR_TBRL = 'tbRl'; + /** + * Left to Right, Top to Bottom Rotated + */ + const TEXT_DIR_LRTBV = 'lrTbV'; + /** + * Top to Bottom, Right to Left Rotated + */ + const TEXT_DIR_TBRLV = 'tbRlV'; + /** + * Top to Bottom, Left to Right Rotated + */ + const TEXT_DIR_TBLRV = 'tbLrV'; /** * Vertical merge (rowspan) constants @@ -93,6 +111,20 @@ class Cell extends Border */ private $shading; + /** + * Width + * + * @var int + */ + private $width; + + /** + * Width type + * + * @var string + */ + private $widthType = Table::WIDTH_TWIP; + /** * Get vertical align. * @@ -236,6 +268,51 @@ class Cell extends Border return $this; } + /** + * Get cell width + * + * @return int + */ + public function getWidth() + { + return $this->width; + } + + /** + * Set cell width + * + * @param int $value + * @return self + */ + public function setWidth($value) + { + $this->setIntVal($value); + + return $this; + } + + /** + * Get width type + * + * @return string + */ + public function getWidthType() + { + return $this->widthType; + } + + /** + * Set width type + * + * @param string $value + */ + public function setWidthType($value) + { + $this->widthType = $this->setEnumVal($value, array(Table::WIDTH_AUTO, Table::WIDTH_PERCENT, Table::WIDTH_TWIP), Table::WIDTH_TWIP); + + return $this; + } + /** * Get default border color * diff --git a/src/PhpWord/Writer/Word2007/Style/Cell.php b/src/PhpWord/Writer/Word2007/Style/Cell.php index c2cf1c7c..82944d2c 100644 --- a/src/PhpWord/Writer/Word2007/Style/Cell.php +++ b/src/PhpWord/Writer/Word2007/Style/Cell.php @@ -65,6 +65,7 @@ class Cell extends AbstractStyle $styleWriter = new MarginBorder($xmlWriter); $styleWriter->setSizes($style->getBorderSize()); $styleWriter->setColors($style->getBorderColor()); + $styleWriter->setStyles($style->getBorderStyle()); $styleWriter->setAttributes(array('defaultColor' => CellStyle::DEFAULT_BORDER_COLOR)); $styleWriter->write(); diff --git a/src/PhpWord/Writer/Word2007/Style/MarginBorder.php b/src/PhpWord/Writer/Word2007/Style/MarginBorder.php index 3d877384..5c3ecde2 100644 --- a/src/PhpWord/Writer/Word2007/Style/MarginBorder.php +++ b/src/PhpWord/Writer/Word2007/Style/MarginBorder.php @@ -40,6 +40,13 @@ class MarginBorder extends AbstractStyle */ private $colors = array(); + /** + * Border styles + * + * @var string[] + */ + private $styles = array(); + /** * Other attributes * @@ -62,7 +69,8 @@ class MarginBorder extends AbstractStyle if (isset($this->colors[$i])) { $color = $this->colors[$i]; } - $this->writeSide($xmlWriter, $sides[$i], $this->sizes[$i], $color); + $style = isset($this->styles[$i]) ? $this->styles[$i] : 'single'; + $this->writeSide($xmlWriter, $sides[$i], $this->sizes[$i], $color, $style); } } } @@ -74,8 +82,9 @@ class MarginBorder extends AbstractStyle * @param string $side * @param int $width * @param string $color + * @param string $borderStyle */ - private function writeSide(XMLWriter $xmlWriter, $side, $width, $color = null) + private function writeSide(XMLWriter $xmlWriter, $side, $width, $color = null, $borderStyle = 'solid') { $xmlWriter->startElement('w:' . $side); if (!empty($this->colors)) { @@ -84,9 +93,9 @@ class MarginBorder extends AbstractStyle $color = $this->attributes['defaultColor']; } } - $xmlWriter->writeAttribute('w:val', 'single'); + $xmlWriter->writeAttribute('w:val', $borderStyle); $xmlWriter->writeAttribute('w:sz', $width); - $xmlWriter->writeAttribute('w:color', $color); + $xmlWriter->writeAttributeIf($color != null, 'w:color', $color); if (!empty($this->attributes)) { if (isset($this->attributes['space'])) { $xmlWriter->writeAttribute('w:space', $this->attributes['space']); @@ -119,6 +128,16 @@ class MarginBorder extends AbstractStyle $this->colors = $value; } + /** + * Set border styles. + * + * @param string[] $value + */ + public function setStyles($value) + { + $this->styles = $value; + } + /** * Set attributes. * diff --git a/src/PhpWord/Writer/Word2007/Style/Shading.php b/src/PhpWord/Writer/Word2007/Style/Shading.php index a8e6592a..00680687 100644 --- a/src/PhpWord/Writer/Word2007/Style/Shading.php +++ b/src/PhpWord/Writer/Word2007/Style/Shading.php @@ -36,9 +36,9 @@ class Shading extends AbstractStyle $xmlWriter = $this->getXmlWriter(); $xmlWriter->startElement('w:shd'); - $xmlWriter->writeAttribute('w:val', $style->getPattern()); - $xmlWriter->writeAttribute('w:color', $style->getColor()); - $xmlWriter->writeAttribute('w:fill', $style->getFill()); + $xmlWriter->writeAttributeIf(!is_null($style->getPattern()), 'w:val', $style->getPattern()); + $xmlWriter->writeAttributeIf(!is_null($style->getColor()), 'w:color', $style->getColor()); + $xmlWriter->writeAttributeIf(!is_null($style->getFill()), 'w:fill', $style->getFill()); $xmlWriter->endElement(); } } diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index c50df5af..39db0acf 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -187,25 +187,23 @@ class HtmlTest extends \PHPUnit\Framework\TestCase { $phpWord = new \PhpOffice\PhpWord\PhpWord(); $section = $phpWord->addSection(); - $html = ' - + $html = '
      - - - + + + - +
      abcheader aheader bheader c
      12
      12
      456
      '; Html::addHtml($section, $html); $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); -// echo $doc->printXml(); - $this->assertTrue($doc->elementExists('/w:document/w:body/w:p')); -// $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:tbl/w:tr/w:tc')); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:tbl')); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:tbl/w:tr/w:tc')); } } diff --git a/tests/PhpWord/Writer/Word2007/ElementTest.php b/tests/PhpWord/Writer/Word2007/ElementTest.php index 0f0b323a..aeceaebc 100644 --- a/tests/PhpWord/Writer/Word2007/ElementTest.php +++ b/tests/PhpWord/Writer/Word2007/ElementTest.php @@ -45,7 +45,7 @@ class ElementTest extends \PHPUnit\Framework\TestCase $elements = array( 'CheckBox', 'Container', 'Footnote', 'Image', 'Link', 'ListItem', 'ListItemRun', 'Object', 'PreserveText', 'Table', 'Text', 'TextBox', 'TextBreak', 'Title', 'TOC', - 'Field', 'Line', 'Shape', 'Chart', 'FormField', 'SDT', + 'Field', 'Line', 'Shape', 'Chart', 'FormField', 'SDT', 'Bookmark', ); foreach ($elements as $element) { $objectClass = 'PhpOffice\\PhpWord\\Writer\\Word2007\\Element\\' . $element; From 5ad68e0ba63cfcd3d8fef2adc9148bcedc3f8afc Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 15 Nov 2017 22:58:28 +0100 Subject: [PATCH 140/370] add tests, improve code coverage --- src/PhpWord/Metadata/DocInfo.php | 2 ++ .../Writer/Word2007/Element/CheckBox.php | 8 +----- .../Writer/Word2007/Element/FormField.php | 7 +---- src/PhpWord/Writer/Word2007/Element/Link.php | 8 +----- .../Writer/Word2007/Element/PreserveText.php | 14 ++-------- src/PhpWord/Writer/Word2007/Element/TOC.php | 11 +++----- src/PhpWord/Writer/Word2007/Element/Text.php | 8 +----- src/PhpWord/Writer/Word2007/Element/Title.php | 14 +++------- src/PhpWord/Writer/Word2007/Part/Chart.php | 10 +++---- .../Writer/Word2007/Part/DocPropsCustom.php | 6 ++++- tests/PhpWord/Metadata/DocInfoTest.php | 6 ++--- tests/PhpWord/Writer/Word2007/ElementTest.php | 10 ++++--- .../Writer/Word2007/Part/DocumentTest.php | 26 +++++++++++++++++++ 13 files changed, 57 insertions(+), 73 deletions(-) diff --git a/src/PhpWord/Metadata/DocInfo.php b/src/PhpWord/Metadata/DocInfo.php index 0508dcd0..e5dee659 100644 --- a/src/PhpWord/Metadata/DocInfo.php +++ b/src/PhpWord/Metadata/DocInfo.php @@ -467,6 +467,8 @@ class DocInfo $propertyType = self::PROPERTY_TYPE_INTEGER; } elseif (is_bool($propertyValue)) { $propertyType = self::PROPERTY_TYPE_BOOLEAN; + } elseif ($propertyValue instanceof \DateTime) { + $propertyType = self::PROPERTY_TYPE_DATE; } else { $propertyType = self::PROPERTY_TYPE_STRING; } diff --git a/src/PhpWord/Writer/Word2007/Element/CheckBox.php b/src/PhpWord/Writer/Word2007/Element/CheckBox.php index 31dcb867..83e8af81 100644 --- a/src/PhpWord/Writer/Word2007/Element/CheckBox.php +++ b/src/PhpWord/Writer/Word2007/Element/CheckBox.php @@ -17,8 +17,6 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Element; -use PhpOffice\PhpWord\Settings; - /** * CheckBox element writer * @@ -83,11 +81,7 @@ class CheckBox extends Text $xmlWriter->startElement('w:t'); $xmlWriter->writeAttribute('xml:space', 'preserve'); - if (Settings::isOutputEscapingEnabled()) { - $xmlWriter->text($this->getText($element->getText())); - } else { - $xmlWriter->writeRaw($this->getText($element->getText())); - } + $xmlWriter->writeText($this->getText($element->getText())); $xmlWriter->endElement(); // w:t $xmlWriter->endElement(); // w:r diff --git a/src/PhpWord/Writer/Word2007/Element/FormField.php b/src/PhpWord/Writer/Word2007/Element/FormField.php index 91fb28ab..d4afdec1 100644 --- a/src/PhpWord/Writer/Word2007/Element/FormField.php +++ b/src/PhpWord/Writer/Word2007/Element/FormField.php @@ -19,7 +19,6 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Element\FormField as FormFieldElement; -use PhpOffice\PhpWord\Settings; /** * FormField element writer @@ -90,11 +89,7 @@ class FormField extends Text $this->writeFontStyle(); $xmlWriter->startElement('w:t'); $xmlWriter->writeAttribute('xml:space', 'preserve'); - if (Settings::isOutputEscapingEnabled()) { - $xmlWriter->text($value); - } else { - $xmlWriter->writeRaw($value); - } + $xmlWriter->writeText($value); $xmlWriter->endElement(); // w:t $xmlWriter->endElement(); // w:r diff --git a/src/PhpWord/Writer/Word2007/Element/Link.php b/src/PhpWord/Writer/Word2007/Element/Link.php index 8ea3f53c..072d665e 100644 --- a/src/PhpWord/Writer/Word2007/Element/Link.php +++ b/src/PhpWord/Writer/Word2007/Element/Link.php @@ -17,8 +17,6 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Element; -use PhpOffice\PhpWord\Settings; - /** * Link element writer * @@ -54,11 +52,7 @@ class Link extends Text $xmlWriter->startElement('w:t'); $xmlWriter->writeAttribute('xml:space', 'preserve'); - if (Settings::isOutputEscapingEnabled()) { - $xmlWriter->text($element->getText()); - } else { - $xmlWriter->writeRaw($element->getText()); - } + $xmlWriter->writeText($element->getText()); $xmlWriter->endElement(); // w:t $xmlWriter->endElement(); // w:r $xmlWriter->endElement(); // w:hyperlink diff --git a/src/PhpWord/Writer/Word2007/Element/PreserveText.php b/src/PhpWord/Writer/Word2007/Element/PreserveText.php index 92b9ea40..cf26a587 100644 --- a/src/PhpWord/Writer/Word2007/Element/PreserveText.php +++ b/src/PhpWord/Writer/Word2007/Element/PreserveText.php @@ -17,8 +17,6 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Element; -use PhpOffice\PhpWord\Settings; - /** * PreserveText element writer * @@ -60,11 +58,7 @@ class PreserveText extends Text $xmlWriter->startElement('w:instrText'); $xmlWriter->writeAttribute('xml:space', 'preserve'); - if (Settings::isOutputEscapingEnabled()) { - $xmlWriter->text($text); - } else { - $xmlWriter->writeRaw($text); - } + $xmlWriter->writeText($text); $xmlWriter->endElement(); $xmlWriter->endElement(); @@ -86,11 +80,7 @@ class PreserveText extends Text $xmlWriter->startElement('w:t'); $xmlWriter->writeAttribute('xml:space', 'preserve'); - if (Settings::isOutputEscapingEnabled()) { - $xmlWriter->text($this->getText($text)); - } else { - $xmlWriter->writeRaw($this->getText($text)); - } + $xmlWriter->writeText($this->getText($text)); $xmlWriter->endElement(); $xmlWriter->endElement(); } diff --git a/src/PhpWord/Writer/Word2007/Element/TOC.php b/src/PhpWord/Writer/Word2007/Element/TOC.php index a679188f..18a9399a 100644 --- a/src/PhpWord/Writer/Word2007/Element/TOC.php +++ b/src/PhpWord/Writer/Word2007/Element/TOC.php @@ -19,7 +19,6 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Element\TOC as TOCElement; -use PhpOffice\PhpWord\Settings; use PhpOffice\PhpWord\Style\Font; use PhpOffice\PhpWord\Writer\Word2007\Style\Font as FontStyleWriter; use PhpOffice\PhpWord\Writer\Word2007\Style\Paragraph as ParagraphStyleWriter; @@ -97,13 +96,9 @@ class TOC extends AbstractElement $styleWriter = new FontStyleWriter($xmlWriter, $fontStyle); $styleWriter->write(); } - if (Settings::isOutputEscapingEnabled()) { - $xmlWriter->writeElement('w:t', $title->getText()); - } else { - $xmlWriter->startElement('w:t'); - $xmlWriter->writeRaw($title->getText()); - $xmlWriter->endElement(); - } + $xmlWriter->startElement('w:t'); + $xmlWriter->writeText($title->getText()); + $xmlWriter->endElement(); // w:t $xmlWriter->endElement(); // w:r $xmlWriter->startElement('w:r'); diff --git a/src/PhpWord/Writer/Word2007/Element/Text.php b/src/PhpWord/Writer/Word2007/Element/Text.php index 694a834a..85052226 100644 --- a/src/PhpWord/Writer/Word2007/Element/Text.php +++ b/src/PhpWord/Writer/Word2007/Element/Text.php @@ -17,8 +17,6 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Element; -use PhpOffice\PhpWord\Settings; - /** * Text element writer * @@ -45,11 +43,7 @@ class Text extends AbstractElement $xmlWriter->startElement('w:t'); $xmlWriter->writeAttribute('xml:space', 'preserve'); - if (Settings::isOutputEscapingEnabled()) { - $xmlWriter->text($this->getText($element->getText())); - } else { - $xmlWriter->writeRaw($this->getText($element->getText())); - } + $xmlWriter->writeText($this->getText($element->getText())); $xmlWriter->endElement(); $xmlWriter->endElement(); // w:r diff --git a/src/PhpWord/Writer/Word2007/Element/Title.php b/src/PhpWord/Writer/Word2007/Element/Title.php index 63ed94de..f2a1d1ca 100644 --- a/src/PhpWord/Writer/Word2007/Element/Title.php +++ b/src/PhpWord/Writer/Word2007/Element/Title.php @@ -17,8 +17,6 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Element; -use PhpOffice\PhpWord\Settings; - /** * TextRun element writer * @@ -60,14 +58,10 @@ class Title extends AbstractElement // Actual text $xmlWriter->startElement('w:r'); - if (Settings::isOutputEscapingEnabled()) { - $xmlWriter->writeElement('w:t', $this->getText($element->getText())); - } else { - $xmlWriter->startElement('w:t'); - $xmlWriter->writeRaw($this->getText($element->getText())); - $xmlWriter->endElement(); - } - $xmlWriter->endElement(); + $xmlWriter->startElement('w:t'); + $xmlWriter->writeText($this->getText($element->getText())); + $xmlWriter->endElement(); // w:t + $xmlWriter->endElement(); // w:r // Bookmark end $xmlWriter->startElement('w:bookmarkEnd'); diff --git a/src/PhpWord/Writer/Word2007/Part/Chart.php b/src/PhpWord/Writer/Word2007/Part/Chart.php index 2f162108..2d8f618d 100644 --- a/src/PhpWord/Writer/Word2007/Part/Chart.php +++ b/src/PhpWord/Writer/Word2007/Part/Chart.php @@ -235,13 +235,9 @@ class Chart extends AbstractPart foreach ($values as $value) { $xmlWriter->startElement('c:pt'); $xmlWriter->writeAttribute('idx', $index); - if (\PhpOffice\PhpWord\Settings::isOutputEscapingEnabled()) { - $xmlWriter->writeElement('c:v', $value); - } else { - $xmlWriter->startElement('c:v'); - $xmlWriter->writeRaw($value); - $xmlWriter->endElement(); - } + $xmlWriter->startElement('c:v'); + $xmlWriter->writeText($value); + $xmlWriter->endElement(); // c:v $xmlWriter->endElement(); // c:pt $index++; } diff --git a/src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php b/src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php index 212e9d27..8ee2f028 100644 --- a/src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php +++ b/src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php @@ -60,7 +60,11 @@ class DocPropsCustom extends AbstractPart $xmlWriter->writeElement('vt:bool', ($propertyValue) ? 'true' : 'false'); break; case 'd': - $xmlWriter->writeElement('vt:filetime', date($this->dateFormat, $propertyValue)); + if ($propertyValue instanceof \DateTime) { + $xmlWriter->writeElement('vt:filetime', $propertyValue->format($this->dateFormat)); + } else { + $xmlWriter->writeElement('vt:filetime', date($this->dateFormat, $propertyValue)); + } break; default: $xmlWriter->writeElement('vt:lpwstr', $propertyValue); diff --git a/tests/PhpWord/Metadata/DocInfoTest.php b/tests/PhpWord/Metadata/DocInfoTest.php index 01659773..d9b44dc6 100644 --- a/tests/PhpWord/Metadata/DocInfoTest.php +++ b/tests/PhpWord/Metadata/DocInfoTest.php @@ -193,8 +193,7 @@ class DocInfoTest extends \PHPUnit\Framework\TestCase $this->assertEquals('value5', $oProperties->getCustomPropertyValue('key5')); $this->assertNull($oProperties->getCustomPropertyValue('key6')); $this->assertTrue($oProperties->isCustomPropertySet('key5')); - // todo: change to assertNotTrue when got upgraded to PHPUnit 4.x - $this->assertEquals(false, $oProperties->isCustomPropertySet('key6')); + $this->assertNotTrue($oProperties->isCustomPropertySet('key6')); $this->assertEquals(array('key1', 'key2', 'key3', 'key4', 'key5'), $oProperties->getCustomProperties()); } @@ -211,8 +210,7 @@ class DocInfoTest extends \PHPUnit\Framework\TestCase $this->assertEquals('8.3', DocInfo::convertProperty('8.3', 'lpstr')); $this->assertEquals(strtotime('10/11/2013'), DocInfo::convertProperty('10/11/2013', 'date')); $this->assertTrue(DocInfo::convertProperty('true', 'bool')); - // todo: change to assertNotTrue when got upgraded to PHPUnit 4.x - $this->assertEquals(false, DocInfo::convertProperty('1', 'bool')); + $this->assertNotTrue(DocInfo::convertProperty('1', 'bool')); $this->assertEquals('1', DocInfo::convertProperty('1', 'array')); $this->assertEquals('1', DocInfo::convertProperty('1', '')); diff --git a/tests/PhpWord/Writer/Word2007/ElementTest.php b/tests/PhpWord/Writer/Word2007/ElementTest.php index aeceaebc..f3c0d553 100644 --- a/tests/PhpWord/Writer/Word2007/ElementTest.php +++ b/tests/PhpWord/Writer/Word2007/ElementTest.php @@ -313,14 +313,16 @@ class ElementTest extends \PHPUnit\Framework\TestCase $section->addFormField('textinput')->setName('MyTextBox'); $section->addFormField('checkbox')->setDefault(true)->setValue('Your name'); + $section->addFormField('checkbox')->setDefault(true); $section->addFormField('dropdown')->setEntries(array('Choice 1', 'Choice 2', 'Choice 3')); $doc = TestHelperDOCX::getDocument($phpWord); - $path = '/w:document/w:body/w:p/w:r/w:fldChar/w:ffData'; - $this->assertTrue($doc->elementExists($path . '/w:textInput')); - $this->assertTrue($doc->elementExists($path . '/w:checkBox')); - $this->assertTrue($doc->elementExists($path . '/w:ddList')); + $path = '/w:document/w:body/w:p[%d]/w:r/w:fldChar/w:ffData'; + $this->assertTrue($doc->elementExists(sprintf($path, 1) . '/w:textInput')); + $this->assertTrue($doc->elementExists(sprintf($path, 2) . '/w:checkBox')); + $this->assertTrue($doc->elementExists(sprintf($path, 3) . '/w:checkBox')); + $this->assertTrue($doc->elementExists(sprintf($path, 4) . '/w:ddList')); } /** diff --git a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php index 9bad19fe..bc3a2aa8 100644 --- a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php @@ -18,6 +18,7 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\ComplexType\FootnoteProperties; +use PhpOffice\PhpWord\Metadata\DocInfo; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\SimpleType\Jc; use PhpOffice\PhpWord\SimpleType\NumberFormat; @@ -39,6 +40,31 @@ class DocumentTest extends \PHPUnit\Framework\TestCase TestHelperDOCX::clear(); } + /** + * Write custom properties + */ + public function testWriteCustomProps() + { + $phpWord = new PhpWord(); + $docInfo = $phpWord->getDocInfo(); + + $docInfo->setCustomProperty('key1', null); + $docInfo->setCustomProperty('key2', true); + $docInfo->setCustomProperty('key3', 3); + $docInfo->setCustomProperty('key4', 4.4); + $docInfo->setCustomProperty('key5', 'value5'); + $docInfo->setCustomProperty('key6', new \DateTime()); + $docInfo->setCustomProperty('key7', time(), DocInfo::PROPERTY_TYPE_DATE); + + $doc = TestHelperDOCX::getDocument($phpWord); + +// $this->assertTrue($doc->elementExists('/Properties/property[name="key1"]/vt:lpwstr')); +// $this->assertTrue($doc->elementExists('/Properties/property[name="key2"]/vt:bool')); +// $this->assertTrue($doc->elementExists('/Properties/property[name="key3"]/vt:i4')); +// $this->assertTrue($doc->elementExists('/Properties/property[name="key4"]/vt:r8')); +// $this->assertTrue($doc->elementExists('/Properties/property[name="key5"]/vt:lpwstr')); + } + /** * Write end section page numbering */ From 9cd373806c9d5e5362d479ae5e0398393220759d Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 16 Nov 2017 17:47:48 +0100 Subject: [PATCH 141/370] fix build --- CHANGELOG.md | 3 +++ samples/Sample_Header.php | 6 ++++++ .../Writer/Word2007/Element/AbstractElement.php | 16 ++++++++++++++++ src/PhpWord/Writer/Word2007/Element/CheckBox.php | 2 +- .../Writer/Word2007/Element/FormField.php | 2 +- src/PhpWord/Writer/Word2007/Element/Link.php | 2 +- .../Writer/Word2007/Element/PreserveText.php | 4 ++-- src/PhpWord/Writer/Word2007/Element/TOC.php | 2 +- src/PhpWord/Writer/Word2007/Element/Text.php | 2 +- src/PhpWord/Writer/Word2007/Element/Title.php | 2 +- .../Writer/Word2007/Part/AbstractPart.php | 15 +++++++++++++++ src/PhpWord/Writer/Word2007/Part/Chart.php | 2 +- 12 files changed, 49 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6579d2ef..af109b3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ This is the last version to support PHP 5.3 - Possiblity to set default document language as well as changing the language for each text element - @troosan #1108 - Support for Comments - @troosan #1067 - Support for paragraph textAlignment - @troosan #1165 +- Add support for HTML underline tag in addHtml - @zNightFalLz #1186 ### Fixed - Loosen dependency to Zend @@ -34,6 +35,8 @@ This is the last version to support PHP 5.3 - Fixed read docx error when document contains image from remote url - @FBnil #1173 #1176 - Padded the $args array to remove error - @kaigoh #1150, @reformed #870 - Fix incorrect image size between windows and mac - @bskrtich #874 +- Fix adding HTML table to document - @mogilvie @arivanbastos #324 + v0.13.0 (31 July 2016) ------------------- This release brings several improvements in `TemplateProcessor`, automatic output escaping feature for OOXML, ODF, HTML, and RTF (turned off, by default). diff --git a/samples/Sample_Header.php b/samples/Sample_Header.php index 1d6b14a1..c4996049 100644 --- a/samples/Sample_Header.php +++ b/samples/Sample_Header.php @@ -12,6 +12,12 @@ define('IS_INDEX', SCRIPT_FILENAME == 'index'); Settings::loadConfig(); +$dompdfPath = $vendorDirPath . '/dompdf/dompdf'; +if (file_exists($dompdfPath)) { + define('DOMPDF_ENABLE_AUTOLOAD', false); + Settings::setPdfRenderer(Settings::PDF_RENDERER_DOMPDF, $vendorDirPath . '/dompdf/dompdf'); +} + // Set writers $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf', 'HTML' => 'html', 'PDF' => 'pdf'); diff --git a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php index 86018fd2..8c9f0bb7 100644 --- a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php +++ b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php @@ -20,6 +20,7 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\Common\Text as CommonText; use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Element\AbstractElement as Element; +use PhpOffice\PhpWord\Settings; /** * Abstract element writer @@ -208,4 +209,19 @@ abstract class AbstractElement { return CommonText::controlCharacterPHP2OOXML($text); } + + /** + * Write an XML text, this will call text() or writeRaw() depending on the value of Settings::isOutputEscapingEnabled() + * + * @param string $content The text string to write + * @return bool Returns true on success or false on failure + */ + protected function writeText($content) + { + if (Settings::isOutputEscapingEnabled()) { + return $this->getXmlWriter()->text($content); + } + + return $this->getXmlWriter()->writeRaw($content); + } } diff --git a/src/PhpWord/Writer/Word2007/Element/CheckBox.php b/src/PhpWord/Writer/Word2007/Element/CheckBox.php index 83e8af81..ab888f67 100644 --- a/src/PhpWord/Writer/Word2007/Element/CheckBox.php +++ b/src/PhpWord/Writer/Word2007/Element/CheckBox.php @@ -81,7 +81,7 @@ class CheckBox extends Text $xmlWriter->startElement('w:t'); $xmlWriter->writeAttribute('xml:space', 'preserve'); - $xmlWriter->writeText($this->getText($element->getText())); + $this->writeText($this->getText($element->getText())); $xmlWriter->endElement(); // w:t $xmlWriter->endElement(); // w:r diff --git a/src/PhpWord/Writer/Word2007/Element/FormField.php b/src/PhpWord/Writer/Word2007/Element/FormField.php index d4afdec1..73e9f4c4 100644 --- a/src/PhpWord/Writer/Word2007/Element/FormField.php +++ b/src/PhpWord/Writer/Word2007/Element/FormField.php @@ -89,7 +89,7 @@ class FormField extends Text $this->writeFontStyle(); $xmlWriter->startElement('w:t'); $xmlWriter->writeAttribute('xml:space', 'preserve'); - $xmlWriter->writeText($value); + $this->writeText($value); $xmlWriter->endElement(); // w:t $xmlWriter->endElement(); // w:r diff --git a/src/PhpWord/Writer/Word2007/Element/Link.php b/src/PhpWord/Writer/Word2007/Element/Link.php index 072d665e..dc708a61 100644 --- a/src/PhpWord/Writer/Word2007/Element/Link.php +++ b/src/PhpWord/Writer/Word2007/Element/Link.php @@ -52,7 +52,7 @@ class Link extends Text $xmlWriter->startElement('w:t'); $xmlWriter->writeAttribute('xml:space', 'preserve'); - $xmlWriter->writeText($element->getText()); + $this->writeText($element->getText()); $xmlWriter->endElement(); // w:t $xmlWriter->endElement(); // w:r $xmlWriter->endElement(); // w:hyperlink diff --git a/src/PhpWord/Writer/Word2007/Element/PreserveText.php b/src/PhpWord/Writer/Word2007/Element/PreserveText.php index cf26a587..13887866 100644 --- a/src/PhpWord/Writer/Word2007/Element/PreserveText.php +++ b/src/PhpWord/Writer/Word2007/Element/PreserveText.php @@ -58,7 +58,7 @@ class PreserveText extends Text $xmlWriter->startElement('w:instrText'); $xmlWriter->writeAttribute('xml:space', 'preserve'); - $xmlWriter->writeText($text); + $this->writeText($text); $xmlWriter->endElement(); $xmlWriter->endElement(); @@ -80,7 +80,7 @@ class PreserveText extends Text $xmlWriter->startElement('w:t'); $xmlWriter->writeAttribute('xml:space', 'preserve'); - $xmlWriter->writeText($this->getText($text)); + $this->writeText($this->getText($text)); $xmlWriter->endElement(); $xmlWriter->endElement(); } diff --git a/src/PhpWord/Writer/Word2007/Element/TOC.php b/src/PhpWord/Writer/Word2007/Element/TOC.php index 18a9399a..36ed7f88 100644 --- a/src/PhpWord/Writer/Word2007/Element/TOC.php +++ b/src/PhpWord/Writer/Word2007/Element/TOC.php @@ -97,7 +97,7 @@ class TOC extends AbstractElement $styleWriter->write(); } $xmlWriter->startElement('w:t'); - $xmlWriter->writeText($title->getText()); + $this->writeText($title->getText()); $xmlWriter->endElement(); // w:t $xmlWriter->endElement(); // w:r diff --git a/src/PhpWord/Writer/Word2007/Element/Text.php b/src/PhpWord/Writer/Word2007/Element/Text.php index 85052226..e7149432 100644 --- a/src/PhpWord/Writer/Word2007/Element/Text.php +++ b/src/PhpWord/Writer/Word2007/Element/Text.php @@ -43,7 +43,7 @@ class Text extends AbstractElement $xmlWriter->startElement('w:t'); $xmlWriter->writeAttribute('xml:space', 'preserve'); - $xmlWriter->writeText($this->getText($element->getText())); + $this->writeText($this->getText($element->getText())); $xmlWriter->endElement(); $xmlWriter->endElement(); // w:r diff --git a/src/PhpWord/Writer/Word2007/Element/Title.php b/src/PhpWord/Writer/Word2007/Element/Title.php index f2a1d1ca..f204ab16 100644 --- a/src/PhpWord/Writer/Word2007/Element/Title.php +++ b/src/PhpWord/Writer/Word2007/Element/Title.php @@ -59,7 +59,7 @@ class Title extends AbstractElement // Actual text $xmlWriter->startElement('w:r'); $xmlWriter->startElement('w:t'); - $xmlWriter->writeText($this->getText($element->getText())); + $this->writeText($this->getText($element->getText())); $xmlWriter->endElement(); // w:t $xmlWriter->endElement(); // w:r diff --git a/src/PhpWord/Writer/Word2007/Part/AbstractPart.php b/src/PhpWord/Writer/Word2007/Part/AbstractPart.php index 0b9d8b88..038eb21d 100644 --- a/src/PhpWord/Writer/Word2007/Part/AbstractPart.php +++ b/src/PhpWord/Writer/Word2007/Part/AbstractPart.php @@ -89,4 +89,19 @@ abstract class AbstractPart return new XMLWriter(XMLWriter::STORAGE_MEMORY, './', Settings::hasCompatibility()); } + + /** + * Write an XML text, this will call text() or writeRaw() depending on the value of Settings::isOutputEscapingEnabled() + * + * @param string $content The text string to write + * @return bool Returns true on success or false on failure + */ + protected function writeText($content) + { + if (Settings::isOutputEscapingEnabled()) { + return $this->getXmlWriter()->text($content); + } + + return $this->getXmlWriter()->writeRaw($content); + } } diff --git a/src/PhpWord/Writer/Word2007/Part/Chart.php b/src/PhpWord/Writer/Word2007/Part/Chart.php index 2d8f618d..c3703f9f 100644 --- a/src/PhpWord/Writer/Word2007/Part/Chart.php +++ b/src/PhpWord/Writer/Word2007/Part/Chart.php @@ -236,7 +236,7 @@ class Chart extends AbstractPart $xmlWriter->startElement('c:pt'); $xmlWriter->writeAttribute('idx', $index); $xmlWriter->startElement('c:v'); - $xmlWriter->writeText($value); + $this->writeText($value); $xmlWriter->endElement(); // c:v $xmlWriter->endElement(); // c:pt $index++; From ab9a3dbc638ef262f3817a039d3b773cb7cb82ae Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 16 Nov 2017 18:03:37 +0100 Subject: [PATCH 142/370] fix warning --- tests/PhpWord/Writer/Word2007/Part/DocumentTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php index bc3a2aa8..ddc7fc10 100644 --- a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php @@ -56,7 +56,7 @@ class DocumentTest extends \PHPUnit\Framework\TestCase $docInfo->setCustomProperty('key6', new \DateTime()); $docInfo->setCustomProperty('key7', time(), DocInfo::PROPERTY_TYPE_DATE); - $doc = TestHelperDOCX::getDocument($phpWord); + TestHelperDOCX::getDocument($phpWord); // $this->assertTrue($doc->elementExists('/Properties/property[name="key1"]/vt:lpwstr')); // $this->assertTrue($doc->elementExists('/Properties/property[name="key2"]/vt:bool')); From b22208f810556ea2048796895a2473867ea28392 Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 16 Nov 2017 23:09:56 +0100 Subject: [PATCH 143/370] format --- src/PhpWord/Writer/ODText/Part/Styles.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/PhpWord/Writer/ODText/Part/Styles.php b/src/PhpWord/Writer/ODText/Part/Styles.php index ce9dbb60..e49fa25e 100644 --- a/src/PhpWord/Writer/ODText/Part/Styles.php +++ b/src/PhpWord/Writer/ODText/Part/Styles.php @@ -52,7 +52,9 @@ class Styles extends AbstractPart // Automatic styles $xmlWriter->startElement('office:automatic-styles'); $this->writePageLayout($xmlWriter); - $xmlWriter->endElement(); + $xmlWriter->endElement(); // office:automatic-styles + + // Master style $this->writeMaster($xmlWriter); $xmlWriter->endElement(); // office:document-styles From ac357d10d52b8c2e491e56683f8a07665d3fa5ff Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 18 Nov 2017 15:55:05 +0100 Subject: [PATCH 144/370] Various fixes - parse text inside list items - add tests - rename Cell widthType attribute to unit --- docs/elements.rst | 2 +- samples/Sample_26_Html.php | 20 ++++++++++-- src/PhpWord/Element/AbstractContainer.php | 2 -- src/PhpWord/Element/Footnote.php | 5 ++- src/PhpWord/Element/Section.php | 6 ---- src/PhpWord/Settings.php | 4 --- src/PhpWord/Shared/Html.php | 14 ++++---- src/PhpWord/SimpleType/Jc.php | 2 -- src/PhpWord/SimpleType/JcTable.php | 2 -- src/PhpWord/Style/Cell.php | 16 +++++----- src/PhpWord/Writer/AbstractWriter.php | 4 +-- src/PhpWord/Writer/Word2007/Style/Cell.php | 12 ++++--- tests/PhpWord/Shared/ConverterTest.php | 1 + tests/PhpWord/Shared/HtmlTest.php | 32 +++++++++++++++++-- tests/PhpWord/Writer/Word2007/ElementTest.php | 19 +++++++++++ 15 files changed, 96 insertions(+), 45 deletions(-) diff --git a/docs/elements.rst b/docs/elements.rst index e27b45d9..a2e41566 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -415,7 +415,7 @@ Line elements can be added to sections by using ``addLine``. .. code-block:: php $lineStyle = array('weight' => 1, 'width' => 100, 'height' => 0, 'color' => 635552); - $section->addLine($lineStyle) + $section->addLine($lineStyle); Available line style attributes: diff --git a/samples/Sample_26_Html.php b/samples/Sample_26_Html.php index 8e6e9a33..ba06b063 100644 --- a/samples/Sample_26_Html.php +++ b/samples/Sample_26_Html.php @@ -14,11 +14,25 @@ $html .= '
      • Item 1
      • Item 2
        • Item 2.1
        • Item 2.1 '; -\PhpOffice\PhpWord\Shared\Html::addHtml($section, $html); +\PhpOffice\PhpWord\Shared\Html::addHtml($section, $html, false, false); // Save file echo write($phpWord, basename(__FILE__, '.php'), $writers); diff --git a/src/PhpWord/Element/AbstractContainer.php b/src/PhpWord/Element/AbstractContainer.php index cb42cf3d..d44160d8 100644 --- a/src/PhpWord/Element/AbstractContainer.php +++ b/src/PhpWord/Element/AbstractContainer.php @@ -157,8 +157,6 @@ abstract class AbstractContainer extends AbstractElement * Get all elements * * @return array - * - * @codeCoverageIgnore */ public function getElements() { diff --git a/src/PhpWord/Element/Footnote.php b/src/PhpWord/Element/Footnote.php index 9acdc4c3..e9a1bfc2 100644 --- a/src/PhpWord/Element/Footnote.php +++ b/src/PhpWord/Element/Footnote.php @@ -19,9 +19,6 @@ namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\Style\Paragraph; -/** - * @codeCoverageIgnore - */ class Footnote extends AbstractContainer { /** @@ -68,6 +65,7 @@ class Footnote extends AbstractContainer * Get Footnote Reference ID * * @deprecated 0.10.0 + * @codeCoverageIgnore * * @return int */ @@ -80,6 +78,7 @@ class Footnote extends AbstractContainer * Set Footnote Reference ID * * @deprecated 0.10.0 + * @codeCoverageIgnore * * @param int $rId */ diff --git a/src/PhpWord/Element/Section.php b/src/PhpWord/Element/Section.php index ffc98435..8238277e 100644 --- a/src/PhpWord/Element/Section.php +++ b/src/PhpWord/Element/Section.php @@ -85,8 +85,6 @@ class Section extends AbstractContainer * Get section style * * @return \PhpOffice\PhpWord\Style\Section - * - * @codeCoverageIgnore */ public function getStyle() { @@ -125,8 +123,6 @@ class Section extends AbstractContainer * Get header elements * * @return Header[] - * - * @codeCoverageIgnore */ public function getHeaders() { @@ -137,8 +133,6 @@ class Section extends AbstractContainer * Get footer elements * * @return Footer[] - * - * @codeCoverageIgnore */ public function getFooters() { diff --git a/src/PhpWord/Settings.php b/src/PhpWord/Settings.php index 91efa1a6..144b0fc5 100644 --- a/src/PhpWord/Settings.php +++ b/src/PhpWord/Settings.php @@ -318,8 +318,6 @@ class Settings * @since 0.13.0 * * @return bool - * - * @codeCoverageIgnore */ public static function isOutputEscapingEnabled() { @@ -330,8 +328,6 @@ class Settings * @since 0.13.0 * * @param bool $outputEscapingEnabled - * - * @codeCoverageIgnore */ public static function setOutputEscapingEnabled($outputEscapingEnabled) { diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 7239a046..479e0f46 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -37,8 +37,9 @@ class Html * @param \PhpOffice\PhpWord\Element\AbstractContainer $element Where the parts need to be added * @param string $html The code to parse * @param bool $fullHTML If it's a full HTML, no need to add 'body' tag + * @param bool $preserveWhiteSpace If false, the whitespaces between nodes will be removed */ - public static function addHtml($element, $html, $fullHTML = false) + public static function addHtml($element, $html, $fullHTML = false, $preserveWhiteSpace = true) { /* * @todo parse $stylesheet for default styles. Should result in an array based on id, class and element, @@ -59,7 +60,7 @@ class Html // Load DOM $dom = new \DOMDocument(); - $dom->preserveWhiteSpace = true; + $dom->preserveWhiteSpace = $preserveWhiteSpace; $dom->loadXML($html); $node = $dom->getElementsByTagName('body'); @@ -395,6 +396,10 @@ class Html $text = $cNode->nodeValue; } } + //ideally we should be parsing child nodes for any style, for now just take the text + if ('' == trim($text) && '' != trim($node->textContent)) { + $text = trim($node->textContent); + } $element->addListItem($text, $data['listdepth'], $styles['font'], $styles['list'], $styles['paragraph']); } } @@ -508,16 +513,13 @@ class Html */ private static function mapBorderStyle($cssBorderStyle) { - if ($cssBorderStyle == null) { - return null; - } switch ($cssBorderStyle) { case 'none': case 'dashed': case 'dotted': case 'double': return $cssBorderStyle; - case 'solid': + default: return 'single'; } } diff --git a/src/PhpWord/SimpleType/Jc.php b/src/PhpWord/SimpleType/Jc.php index 1a5d33ad..5d0ee33b 100644 --- a/src/PhpWord/SimpleType/Jc.php +++ b/src/PhpWord/SimpleType/Jc.php @@ -29,8 +29,6 @@ use PhpOffice\PhpWord\Shared\AbstractEnum; * * @see \PhpOffice\PhpWord\SimpleType\JcTable For table alignment modes available since ISO/IEC-29500:2008. * @see http://www.datypic.com/sc/ooxml/t-w_ST_Jc.html - * - * @codeCoverageIgnore */ final class Jc extends AbstractEnum { diff --git a/src/PhpWord/SimpleType/JcTable.php b/src/PhpWord/SimpleType/JcTable.php index e1af89ad..71e07397 100644 --- a/src/PhpWord/SimpleType/JcTable.php +++ b/src/PhpWord/SimpleType/JcTable.php @@ -25,8 +25,6 @@ use PhpOffice\PhpWord\Shared\AbstractEnum; * Introduced in ISO/IEC-29500:2008. * * @since 0.13.0 - * - * @codeCoverageIgnore */ final class JcTable extends AbstractEnum { diff --git a/src/PhpWord/Style/Cell.php b/src/PhpWord/Style/Cell.php index 7fd5814d..c281f998 100644 --- a/src/PhpWord/Style/Cell.php +++ b/src/PhpWord/Style/Cell.php @@ -119,11 +119,11 @@ class Cell extends Border private $width; /** - * Width type + * Width unit * * @var string */ - private $widthType = Table::WIDTH_TWIP; + private $unit = Table::WIDTH_TWIP; /** * Get vertical align. @@ -292,23 +292,23 @@ class Cell extends Border } /** - * Get width type + * Get width unit * * @return string */ - public function getWidthType() + public function getUnit() { - return $this->widthType; + return $this->unit; } /** - * Set width type + * Set width unit * * @param string $value */ - public function setWidthType($value) + public function setUnit($value) { - $this->widthType = $this->setEnumVal($value, array(Table::WIDTH_AUTO, Table::WIDTH_PERCENT, Table::WIDTH_TWIP), Table::WIDTH_TWIP); + $this->unit = $this->setEnumVal($value, array(Table::WIDTH_AUTO, Table::WIDTH_PERCENT, Table::WIDTH_TWIP), Table::WIDTH_TWIP); return $this; } diff --git a/src/PhpWord/Writer/AbstractWriter.php b/src/PhpWord/Writer/AbstractWriter.php index 09a00990..50a0cad3 100644 --- a/src/PhpWord/Writer/AbstractWriter.php +++ b/src/PhpWord/Writer/AbstractWriter.php @@ -223,8 +223,8 @@ abstract class AbstractWriter implements WriterInterface if (strtolower($filename) == 'php://output' || strtolower($filename) == 'php://stdout') { $filename = tempnam(Settings::getTempDir(), 'PhpWord'); if (false === $filename) { - $filename = $this->originalFilename; - } + $filename = $this->originalFilename; // @codeCoverageIgnore + } // @codeCoverageIgnore } $this->tempFilename = $filename; diff --git a/src/PhpWord/Writer/Word2007/Style/Cell.php b/src/PhpWord/Writer/Word2007/Style/Cell.php index 82944d2c..b889aa55 100644 --- a/src/PhpWord/Writer/Word2007/Style/Cell.php +++ b/src/PhpWord/Writer/Word2007/Style/Cell.php @@ -45,10 +45,14 @@ class Cell extends AbstractStyle $xmlWriter->startElement('w:tcPr'); // Width - $xmlWriter->startElement('w:tcW'); - $xmlWriter->writeAttribute('w:w', $this->width); - $xmlWriter->writeAttribute('w:type', 'dxa'); - $xmlWriter->endElement(); // w:tcW + if (!is_null($this->width) || !is_null($style->getWidth())) { + $width = is_null($this->width) ? $style->getWidth() : $this->width; + + $xmlWriter->startElement('w:tcW'); + $xmlWriter->writeAttribute('w:w', $width); + $xmlWriter->writeAttribute('w:type', $style->getUnit()); + $xmlWriter->endElement(); // w:tcW + } // Text direction $textDir = $style->getTextDirection(); diff --git a/tests/PhpWord/Shared/ConverterTest.php b/tests/PhpWord/Shared/ConverterTest.php index 28d68e17..49d5ef6e 100644 --- a/tests/PhpWord/Shared/ConverterTest.php +++ b/tests/PhpWord/Shared/ConverterTest.php @@ -122,6 +122,7 @@ class ConverterTest extends \PHPUnit\Framework\TestCase public function testCssSizeParser() { $this->assertEquals(null, Converter::cssToPoint('10em')); + $this->assertEquals(0, Converter::cssToPoint('0')); $this->assertEquals(10, Converter::cssToPoint('10pt')); $this->assertEquals(7.5, Converter::cssToPoint('10px')); $this->assertEquals(720, Converter::cssToPoint('10in')); diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index 39db0acf..58b0d977 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -190,8 +190,8 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $html = ' - - + + @@ -206,4 +206,32 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists('/w:document/w:body/w:tbl')); $this->assertTrue($doc->elementExists('/w:document/w:body/w:tbl/w:tr/w:tc')); } + + /** + * Tests parsing of ul/li + */ + public function testParseList() + { + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $html = '
            +
          • + + list item1 + +
          • +
          • + + list item2 + +
          • +
          '; + Html::addHtml($section, $html, false, false); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:pPr/w:numPr/w:numId')); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:t')); + $this->assertEquals('list item1', $doc->getElement('/w:document/w:body/w:p[1]/w:r/w:t')->nodeValue); + $this->assertEquals('list item2', $doc->getElement('/w:document/w:body/w:p[2]/w:r/w:t')->nodeValue); + } } diff --git a/tests/PhpWord/Writer/Word2007/ElementTest.php b/tests/PhpWord/Writer/Word2007/ElementTest.php index f3c0d553..12f810ce 100644 --- a/tests/PhpWord/Writer/Word2007/ElementTest.php +++ b/tests/PhpWord/Writer/Word2007/ElementTest.php @@ -135,6 +135,25 @@ class ElementTest extends \PHPUnit\Framework\TestCase $this->assertEquals('center', $doc->getElementAttribute($tableRootElement . '/w:tblPr/w:jc', 'w:val')); } + /** + * Tests that the style name gets added + */ + public function testTableWithStyleName() + { + $phpWord = new PhpWord(); + $section = $phpWord->addSection(); + + $table = $section->addTable('my_predefined_style'); + $table->setWidth(75); + $table->addRow(900); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $tableRootElement = '/w:document/w:body/w:tbl'; + $this->assertTrue($doc->elementExists($tableRootElement . '/w:tblPr/w:tblStyle')); + $this->assertEquals('my_predefined_style', $doc->getElementAttribute($tableRootElement . '/w:tblPr/w:tblStyle', 'w:val')); + } + /** * Test shape elements */ From 670d46e5434993fba296e70e11e3bb3928db25cf Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 22 Nov 2017 00:14:31 +0100 Subject: [PATCH 145/370] add getter/setter on paragraph for child spacing rule --- CHANGELOG.md | 2 + docs/styles.rst | 2 + src/PhpWord/Element/Field.php | 6 +-- src/PhpWord/Metadata/Settings.php | 2 +- src/PhpWord/Shared/Html.php | 8 ++-- src/PhpWord/SimpleType/LineSpacingRule.php | 45 +++++++++++++++++++ src/PhpWord/Style/Paragraph.php | 22 +++++++++ src/PhpWord/Style/Spacing.php | 36 +++++++++++++-- .../Writer/HTML/Element/AbstractElement.php | 2 +- src/PhpWord/Writer/Word2007/Style/Spacing.php | 2 +- tests/PhpWord/Style/ParagraphTest.php | 2 + tests/PhpWord/Style/SpacingTest.php | 8 ++-- 12 files changed, 120 insertions(+), 17 deletions(-) create mode 100644 src/PhpWord/SimpleType/LineSpacingRule.php diff --git a/CHANGELOG.md b/CHANGELOG.md index af109b3f..5e39ed3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ This is the last version to support PHP 5.3 - Support for Comments - @troosan #1067 - Support for paragraph textAlignment - @troosan #1165 - Add support for HTML underline tag in addHtml - @zNightFalLz #1186 +- Allow to change cell width unit - guillaume-ro-fr #986 +- Allow to change the line height rule @troosan ### Fixed - Loosen dependency to Zend diff --git a/docs/styles.rst b/docs/styles.rst index f223574f..6166f5c9 100644 --- a/docs/styles.rst +++ b/docs/styles.rst @@ -79,6 +79,8 @@ Available Paragraph style options: - ``pageBreakBefore``. Start paragraph on next page, *true* or *false*. - ``spaceBefore``. Space before paragraph. - ``spaceAfter``. Space after paragraph. +- ``spacing``. Space between lines. +- ``spacingLineRule``. Line Spacing Rule. *auto*, *exact*, *atLeast* - ``tabs``. Set of custom tab stops. - ``widowControl``. Allow first/last line to display on a separate page, *true* or *false*. - ``contextualSpacing``. Ignore Spacing Above and Below When Using Identical Styles, *true* or *false*. diff --git a/src/PhpWord/Element/Field.php b/src/PhpWord/Element/Field.php index 726938b5..d51cba8d 100644 --- a/src/PhpWord/Element/Field.php +++ b/src/PhpWord/Element/Field.php @@ -206,10 +206,10 @@ class Field extends AbstractElement /** * Set Field text * - * @param string | TextRun $text + * @param string|TextRun $text * * @throws \InvalidArgumentException - * @return string | TextRun + * @return string|TextRun */ public function setText($text) { @@ -227,7 +227,7 @@ class Field extends AbstractElement /** * Get Field text * - * @return string | TextRun + * @return string|TextRun */ public function getText() { diff --git a/src/PhpWord/Metadata/Settings.php b/src/PhpWord/Metadata/Settings.php index 412f5c52..33f72cca 100644 --- a/src/PhpWord/Metadata/Settings.php +++ b/src/PhpWord/Metadata/Settings.php @@ -91,7 +91,7 @@ class Settings /** * Spelling and Grammatical Checking State * - * @var \PhpOffice\PhpWord\Metadata\ProofState + * @var \PhpOffice\PhpWord\ComplexType\ProofState */ private $proofState; diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 479e0f46..5319c879 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -21,6 +21,7 @@ use PhpOffice\PhpWord\Element\AbstractContainer; use PhpOffice\PhpWord\Element\Row; use PhpOffice\PhpWord\Element\Table; use PhpOffice\PhpWord\SimpleType\Jc; +use PhpOffice\PhpWord\Element\Cell; /** * Common Html functions @@ -276,8 +277,7 @@ class Html * @param \DOMNode $node * @param \PhpOffice\PhpWord\Element\AbstractContainer $element * @param array &$styles - * @param string $argument1 Method name - * @return \PhpOffice\PhpWord\Element\AbstractContainer $element + * @return Table $element * * @todo As soon as TableItem, RowItem and CellItem support relative width and height */ @@ -308,7 +308,7 @@ class Html * @param \DOMNode $node * @param \PhpOffice\PhpWord\Element\Table $element * @param array &$styles - * @return \PhpOffice\PhpWord\Element\AbstractContainer $element + * @return Row $element */ private static function parseRow($node, $element, &$styles) { @@ -326,7 +326,7 @@ class Html * @param \DOMNode $node * @param \PhpOffice\PhpWord\Element\Table $element * @param array &$styles - * @return \PhpOffice\PhpWord\Element\AbstractContainer $element + * @return Cell $element */ private static function parseCell($node, $element, &$styles) { diff --git a/src/PhpWord/SimpleType/LineSpacingRule.php b/src/PhpWord/SimpleType/LineSpacingRule.php new file mode 100644 index 00000000..f2cc5e63 --- /dev/null +++ b/src/PhpWord/SimpleType/LineSpacingRule.php @@ -0,0 +1,45 @@ +setSpace(array('line' => $value)); } + /** + * Get spacing line rule + * + * @return string + */ + public function getSpacingLineRule() + { + return $this->getChildStyleValue($this->spacing, 'lineRule'); + } + + /** + * Set the spacing line rule + * + * @param string $value Possible values are defined in LineSpacingRule + * @return \PhpOffice\PhpWord\Style\Paragraph + */ + public function setSpacingLineRule($value) + { + return $this->setSpace(array('lineRule' => $value)); + } + /** * Get line height * diff --git a/src/PhpWord/Style/Spacing.php b/src/PhpWord/Style/Spacing.php index e0eee374..a932eb1a 100644 --- a/src/PhpWord/Style/Spacing.php +++ b/src/PhpWord/Style/Spacing.php @@ -17,10 +17,12 @@ namespace PhpOffice\PhpWord\Style; +use PhpOffice\PhpWord\SimpleType\LineSpacingRule; + /** * Spacing between lines and above/below paragraph style * - * @see http://www.schemacentral.com/sc/ooxml/t-w_CT_Spacing.html + * @see http://www.datypic.com/sc/ooxml/t-w_CT_Spacing.html * @since 0.10.0 */ class Spacing extends AbstractStyle @@ -51,7 +53,7 @@ class Spacing extends AbstractStyle * * @var string */ - private $rule = 'auto'; + private $lineRule = LineSpacingRule::AUTO; /** * Create a new instance @@ -137,6 +139,32 @@ class Spacing extends AbstractStyle * * @return string */ + public function getLineRule() + { + return $this->lineRule; + } + + /** + * Set line rule + * + * @param string $value + * @return self + */ + public function setLineRule($value = null) + { + LineSpacingRule::validate($value); + $this->lineRule = $value; + + return $this; + } + + /** + * Get line rule + * + * @return string + * @deprecated Use getLineRule() instead + * @codeCoverageIgnore + */ public function getRule() { return $this->rule; @@ -147,10 +175,12 @@ class Spacing extends AbstractStyle * * @param string $value * @return self + * @deprecated Use setLineRule() instead + * @codeCoverageIgnore */ public function setRule($value = null) { - $this->rule = $value; + $this->rule = value; return $this; } diff --git a/src/PhpWord/Writer/HTML/Element/AbstractElement.php b/src/PhpWord/Writer/HTML/Element/AbstractElement.php index f6e06258..47f0f93c 100644 --- a/src/PhpWord/Writer/HTML/Element/AbstractElement.php +++ b/src/PhpWord/Writer/HTML/Element/AbstractElement.php @@ -50,7 +50,7 @@ abstract class AbstractElement protected $withoutP = false; /** - * @var \Zend\Escaper\Escaper + * @var \Zend\Escaper\Escaper|\PhpOffice\PhpWord\Escaper\AbstractEscaper */ protected $escaper; diff --git a/src/PhpWord/Writer/Word2007/Style/Spacing.php b/src/PhpWord/Writer/Word2007/Style/Spacing.php index 8db78161..c18339bd 100644 --- a/src/PhpWord/Writer/Word2007/Style/Spacing.php +++ b/src/PhpWord/Writer/Word2007/Style/Spacing.php @@ -46,7 +46,7 @@ class Spacing extends AbstractStyle $line = $style->getLine(); $xmlWriter->writeAttributeIf(!is_null($line), 'w:line', $line); - $xmlWriter->writeAttributeIf(!is_null($line), 'w:lineRule', $style->getRule()); + $xmlWriter->writeAttributeIf(!is_null($line), 'w:lineRule', $style->getLineRule()); $xmlWriter->endElement(); } diff --git a/tests/PhpWord/Style/ParagraphTest.php b/tests/PhpWord/Style/ParagraphTest.php index 48acc600..68c0c12e 100644 --- a/tests/PhpWord/Style/ParagraphTest.php +++ b/tests/PhpWord/Style/ParagraphTest.php @@ -19,6 +19,7 @@ namespace PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\TestHelperDOCX; +use PhpOffice\PhpWord\SimpleType\LineSpacingRule; /** * Test class for PhpOffice\PhpWord\Style\Paragraph @@ -71,6 +72,7 @@ class ParagraphTest extends \PHPUnit\Framework\TestCase 'indent' => 1, 'hanging' => 1, 'spacing' => 120, + 'spacingLineRule' => LineSpacingRule::AT_LEAST, 'basedOn' => 'Normal', 'next' => 'Normal', 'numStyle' => 'numStyle', diff --git a/tests/PhpWord/Style/SpacingTest.php b/tests/PhpWord/Style/SpacingTest.php index 2c26f68b..65be8092 100644 --- a/tests/PhpWord/Style/SpacingTest.php +++ b/tests/PhpWord/Style/SpacingTest.php @@ -31,10 +31,10 @@ class SpacingTest extends \PHPUnit\Framework\TestCase { $object = new Spacing(); $properties = array( - 'before' => array(null, 10), - 'after' => array(null, 10), - 'line' => array(null, 10), - 'rule' => array('auto', 'exact'), + 'before' => array(null, 10), + 'after' => array(null, 10), + 'line' => array(null, 10), + 'lineRule' => array('auto', 'exact'), ); foreach ($properties as $property => $value) { list($default, $expected) = $value; From e07195c512a066db0469259290391f3ea6bf6a62 Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 22 Nov 2017 08:14:22 +0100 Subject: [PATCH 146/370] add test, fix warnings --- src/PhpWord/Shared/Html.php | 2 +- src/PhpWord/Style/Paragraph.php | 2 +- src/PhpWord/Style/Spacing.php | 2 +- tests/PhpWord/Style/ParagraphTest.php | 2 +- .../Writer/Word2007/Part/DocumentTest.php | 23 ++++++++++++++++++- 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 5319c879..027d5798 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -18,10 +18,10 @@ namespace PhpOffice\PhpWord\Shared; use PhpOffice\PhpWord\Element\AbstractContainer; +use PhpOffice\PhpWord\Element\Cell; use PhpOffice\PhpWord\Element\Row; use PhpOffice\PhpWord\Element\Table; use PhpOffice\PhpWord\SimpleType\Jc; -use PhpOffice\PhpWord\Element\Cell; /** * Common Html functions diff --git a/src/PhpWord/Style/Paragraph.php b/src/PhpWord/Style/Paragraph.php index 3b45344c..c00dc97c 100644 --- a/src/PhpWord/Style/Paragraph.php +++ b/src/PhpWord/Style/Paragraph.php @@ -20,8 +20,8 @@ namespace PhpOffice\PhpWord\Style; use PhpOffice\Common\Text; use PhpOffice\PhpWord\Exception\InvalidStyleException; use PhpOffice\PhpWord\SimpleType\Jc; -use PhpOffice\PhpWord\SimpleType\TextAlignment; use PhpOffice\PhpWord\SimpleType\LineSpacingRule; +use PhpOffice\PhpWord\SimpleType\TextAlignment; /** * Paragraph style diff --git a/src/PhpWord/Style/Spacing.php b/src/PhpWord/Style/Spacing.php index a932eb1a..eaa15814 100644 --- a/src/PhpWord/Style/Spacing.php +++ b/src/PhpWord/Style/Spacing.php @@ -143,7 +143,7 @@ class Spacing extends AbstractStyle { return $this->lineRule; } - + /** * Set line rule * diff --git a/tests/PhpWord/Style/ParagraphTest.php b/tests/PhpWord/Style/ParagraphTest.php index 68c0c12e..e961f36a 100644 --- a/tests/PhpWord/Style/ParagraphTest.php +++ b/tests/PhpWord/Style/ParagraphTest.php @@ -18,8 +18,8 @@ namespace PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\PhpWord; -use PhpOffice\PhpWord\TestHelperDOCX; use PhpOffice\PhpWord\SimpleType\LineSpacingRule; +use PhpOffice\PhpWord\TestHelperDOCX; /** * Test class for PhpOffice\PhpWord\Style\Paragraph diff --git a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php index ddc7fc10..42c098cd 100644 --- a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php @@ -22,7 +22,9 @@ use PhpOffice\PhpWord\Metadata\DocInfo; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\SimpleType\Jc; use PhpOffice\PhpWord\SimpleType\NumberFormat; +use PhpOffice\PhpWord\Style\Cell; use PhpOffice\PhpWord\Style\Font; +use PhpOffice\PhpWord\Style\Paragraph; use PhpOffice\PhpWord\TestHelperDOCX; /** @@ -532,6 +534,25 @@ class DocumentTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists("{$parent}/w:smallCaps")); } + /** + * Tests that if no color is set on a cell a border gets writen with the default color + */ + public function testWriteDefaultColor() + { + $phpWord = new PhpWord(); + $section = $phpWord->addSection(); + + $cStyles['borderTopSize'] = 120; + + $table = $section->addTable(); + $table->addRow(); + $cell = $table->addCell(null, $cStyles); + $cell->addText('Test'); + + $doc = TestHelperDOCX::getDocument($phpWord); + $this->assertEquals(Cell::DEFAULT_BORDER_COLOR, $doc->getElementAttribute('/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:tcBorders/w:top', 'w:color')); + } + /** * covers ::_writeTableStyle */ @@ -565,7 +586,7 @@ class DocumentTest extends \PHPUnit\Framework\TestCase $section = $phpWord->addSection(); $table = $section->addTable($tStyles); - $table->setWidth = 100; + $table->setWidth(100); $table->addRow($rHeight, $rStyles); $cell = $table->addCell($cWidth, $cStyles); $cell->addText('Test'); From 38ea5ecb5fc76edaf7ad3887e48514aefbb85df3 Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 22 Nov 2017 08:41:42 +0100 Subject: [PATCH 147/370] fix wrong variable --- src/PhpWord/Style/Spacing.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/Style/Spacing.php b/src/PhpWord/Style/Spacing.php index eaa15814..489eb5d7 100644 --- a/src/PhpWord/Style/Spacing.php +++ b/src/PhpWord/Style/Spacing.php @@ -167,7 +167,7 @@ class Spacing extends AbstractStyle */ public function getRule() { - return $this->rule; + return $this->lineRule; } /** @@ -180,7 +180,7 @@ class Spacing extends AbstractStyle */ public function setRule($value = null) { - $this->rule = value; + $this->lineRule = $value; return $this; } From 6a5d2a636debeeea57e594835151df0af13e3f99 Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 22 Nov 2017 09:02:16 +0100 Subject: [PATCH 148/370] CS fixer warning --- src/PhpWord/Settings.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/PhpWord/Settings.php b/src/PhpWord/Settings.php index 6c28f737..22b8ba1f 100644 --- a/src/PhpWord/Settings.php +++ b/src/PhpWord/Settings.php @@ -310,6 +310,7 @@ class Settings } else { $tempDir = sys_get_temp_dir(); } + return $tempDir; } From b4b87cd1dc20cb5e2e7fad8ed3a1f1697487994a Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 22 Nov 2017 09:43:35 +0100 Subject: [PATCH 149/370] CS fixer stronger checks --- tests/PhpWord/Element/ImageTest.php | 3 +-- tests/PhpWord/Shared/ConverterTest.php | 2 +- tests/PhpWord/Style/AbstractStyleTest.php | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/PhpWord/Element/ImageTest.php b/tests/PhpWord/Element/ImageTest.php index 381b9086..0966ea4d 100644 --- a/tests/PhpWord/Element/ImageTest.php +++ b/tests/PhpWord/Element/ImageTest.php @@ -37,8 +37,7 @@ class ImageTest extends \PHPUnit\Framework\TestCase $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Image', $oImage); $this->assertEquals($src, $oImage->getSource()); $this->assertEquals(md5($src), $oImage->getMediaId()); - // todo: change to assertNotTrue when got upgraded to PHPUnit 4.x - $this->assertEquals(false, $oImage->isWatermark()); + $this->assertFalse($oImage->isWatermark()); $this->assertEquals(Image::SOURCE_LOCAL, $oImage->getSourceType()); $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Image', $oImage->getStyle()); } diff --git a/tests/PhpWord/Shared/ConverterTest.php b/tests/PhpWord/Shared/ConverterTest.php index 49d5ef6e..c7e0483d 100644 --- a/tests/PhpWord/Shared/ConverterTest.php +++ b/tests/PhpWord/Shared/ConverterTest.php @@ -121,7 +121,7 @@ class ConverterTest extends \PHPUnit\Framework\TestCase */ public function testCssSizeParser() { - $this->assertEquals(null, Converter::cssToPoint('10em')); + $this->assertNull(Converter::cssToPoint('10em')); $this->assertEquals(0, Converter::cssToPoint('0')); $this->assertEquals(10, Converter::cssToPoint('10pt')); $this->assertEquals(7.5, Converter::cssToPoint('10px')); diff --git a/tests/PhpWord/Style/AbstractStyleTest.php b/tests/PhpWord/Style/AbstractStyleTest.php index d4291c2a..c0263b1b 100644 --- a/tests/PhpWord/Style/AbstractStyleTest.php +++ b/tests/PhpWord/Style/AbstractStyleTest.php @@ -56,8 +56,7 @@ class AbstractStyleTest extends \PHPUnit\Framework\TestCase { $stub = $this->getMockForAbstractClass('\PhpOffice\PhpWord\Style\AbstractStyle'); - // todo: change to assertNotTrue when got upgraded to PHPUnit 4.x - $this->assertEquals(false, self::callProtectedMethod($stub, 'setBoolVal', array('a', false))); + $this->assertNotTrue(self::callProtectedMethod($stub, 'setBoolVal', array('a', false))); $this->assertEquals(200, self::callProtectedMethod($stub, 'setIntVal', array('foo', 200))); $this->assertEquals(2.1, self::callProtectedMethod($stub, 'setFloatVal', array('foo', 2.1))); $this->assertEquals('b', self::callProtectedMethod($stub, 'setEnumVal', array(null, array('a', 'b'), 'b'))); From ffa9c156d7a2944f069bdd8e3ddb4c5051f87e47 Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 22 Nov 2017 22:31:59 +0100 Subject: [PATCH 150/370] fix formatting --- docs/elements.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/elements.rst b/docs/elements.rst index a2e41566..bf3eb5ac 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -297,7 +297,7 @@ Your TOC can only be generated if you have add at least one title (See "Titles") Options for ``$tocStyle``: -- ``tabLeader``. Fill type between the title text and the page number. Use the defined constants in PHPWord\\Style\\TOC. +- ``tabLeader``. Fill type between the title text and the page number. Use the defined constants in ``\PhpOffice\PhpWord\Style\TOC``. - ``tabPos``. The position of the tab where the page number appears in twips. - ``indent``. The indent factor of the titles in twips. From ad83196a052b4fcb0b00a278a16dc0ef53ec6c74 Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 23 Nov 2017 22:49:21 +0100 Subject: [PATCH 151/370] move password encoding in separate class fix PHPCS errors add documentation add sample --- docs/general.rst | 11 + samples/Sample_38_Protection.php | 21 ++ src/PhpWord/Metadata/Protection.php | 23 +- .../Shared/Microsoft/PasswordEncoder.php | 205 +++++++++++++++++ src/PhpWord/SimpleType/DocProtect.php | 55 +++++ src/PhpWord/Writer/Word2007/Part/Settings.php | 208 ++---------------- tests/PhpWord/Metadata/SettingsTest.php | 13 +- .../Writer/Word2007/Part/SettingsTest.php | 33 ++- 8 files changed, 360 insertions(+), 209 deletions(-) create mode 100644 samples/Sample_38_Protection.php create mode 100644 src/PhpWord/Shared/Microsoft/PasswordEncoder.php create mode 100644 src/PhpWord/SimpleType/DocProtect.php diff --git a/docs/general.rst b/docs/general.rst index b11734b1..f6c8df1c 100644 --- a/docs/general.rst +++ b/docs/general.rst @@ -271,3 +271,14 @@ points to twips. $sectionStyle->setMarginLeft(\PhpOffice\PhpWord\Shared\Converter::inchToTwip(.5)); // 2 cm right margin $sectionStyle->setMarginRight(\PhpOffice\PhpWord\Shared\Converter::cmToTwip(2)); + +Document protection +------------------- + +The document (or parts of it) can be password protected. + +.. code-block:: php + + $documentProtection = $phpWord->getSettings()->getDocumentProtection(); + $documentProtection->setEditing(DocProtect::READ_ONLY); + $documentProtection->setPassword('myPassword'); diff --git a/samples/Sample_38_Protection.php b/samples/Sample_38_Protection.php new file mode 100644 index 00000000..ee2b460b --- /dev/null +++ b/samples/Sample_38_Protection.php @@ -0,0 +1,21 @@ +getSettings()->getDocumentProtection(); +$documentProtection->setEditing(DocProtect::READ_ONLY); +$documentProtection->setPassword('myPassword'); + +$section = $phpWord->addSection(); +$section->addText('this document is password protected'); + +// Save file +echo write($phpWord, basename(__FILE__, '.php'), $writers); +if (!CLI) { + include_once 'Sample_Footer.php'; +} diff --git a/src/PhpWord/Metadata/Protection.php b/src/PhpWord/Metadata/Protection.php index be78c055..09d08aac 100644 --- a/src/PhpWord/Metadata/Protection.php +++ b/src/PhpWord/Metadata/Protection.php @@ -17,6 +17,8 @@ namespace PhpOffice\PhpWord\Metadata; +use PhpOffice\PhpWord\SimpleType\DocProtect; + /** * Document protection class * @@ -38,28 +40,28 @@ class Protection * * @var string */ - private $password = ''; + private $password; /** - * Number of hashing iterations + * Iterations to Run Hashing Algorithm * * @var int */ private $spinCount = 100000; /** - * Algorithm-SID (see to \PhpOffice\PhpWord\Writer\Word2007\Part\Settings::$algorithmMapping) + * Cryptographic Hashing Algorithm (see to \PhpOffice\PhpWord\Writer\Word2007\Part\Settings::$algorithmMapping) * * @var int */ private $mswordAlgorithmSid = 4; /** - * salt + * Salt for Password Verifier * * @var string */ - private $salt = ''; + private $salt; /** * Create a new instance @@ -68,7 +70,9 @@ class Protection */ public function __construct($editing = null) { - $this->setEditing($editing); + if ($editing != null) { + $this->setEditing($editing); + } } /** @@ -84,11 +88,12 @@ class Protection /** * Set editing protection * - * @param string $editing + * @param string $editing Any value of \PhpOffice\PhpWord\SimpleType\DocProtect * @return self */ public function setEditing($editing = null) { + DocProtect::validate($editing); $this->editing = $editing; return $this; @@ -177,12 +182,12 @@ class Protection * Set salt. Salt HAS to be 16 characters, or an exception will be thrown. * * @param $salt - * @return self * @throws \InvalidArgumentException + * @return self */ public function setSalt($salt) { - if ($salt !== null && strlen($salt) !== 16){ + if ($salt !== null && strlen($salt) !== 16) { throw new \InvalidArgumentException('salt has to be of exactly 16 bytes length'); } diff --git a/src/PhpWord/Shared/Microsoft/PasswordEncoder.php b/src/PhpWord/Shared/Microsoft/PasswordEncoder.php new file mode 100644 index 00000000..40a3ea12 --- /dev/null +++ b/src/PhpWord/Shared/Microsoft/PasswordEncoder.php @@ -0,0 +1,205 @@ + 'md2', + 2 => 'md4', + 3 => 'md5', + 4 => 'sha1', + 5 => '', // 'mac' -> not possible with hash() + 6 => 'ripemd', + 7 => 'ripemd160', + 8 => '', + 9 => '', //'hmac' -> not possible with hash() + 10 => '', + 11 => '', + 12 => 'sha256', + 13 => 'sha384', + 14 => 'sha512', + ); + + private static $initialCodeArray = array( + 0xE1F0, + 0x1D0F, + 0xCC9C, + 0x84C0, + 0x110C, + 0x0E10, + 0xF1CE, + 0x313E, + 0x1872, + 0xE139, + 0xD40F, + 0x84F9, + 0x280C, + 0xA96A, + 0x4EC3, + ); + + private static $encryptionMatrix = array( + array(0xAEFC, 0x4DD9, 0x9BB2, 0x2745, 0x4E8A, 0x9D14, 0x2A09), + array(0x7B61, 0xF6C2, 0xFDA5, 0xEB6B, 0xC6F7, 0x9DCF, 0x2BBF), + array(0x4563, 0x8AC6, 0x05AD, 0x0B5A, 0x16B4, 0x2D68, 0x5AD0), + array(0x0375, 0x06EA, 0x0DD4, 0x1BA8, 0x3750, 0x6EA0, 0xDD40), + array(0xD849, 0xA0B3, 0x5147, 0xA28E, 0x553D, 0xAA7A, 0x44D5), + array(0x6F45, 0xDE8A, 0xAD35, 0x4A4B, 0x9496, 0x390D, 0x721A), + array(0xEB23, 0xC667, 0x9CEF, 0x29FF, 0x53FE, 0xA7FC, 0x5FD9), + array(0x47D3, 0x8FA6, 0x0F6D, 0x1EDA, 0x3DB4, 0x7B68, 0xF6D0), + array(0xB861, 0x60E3, 0xC1C6, 0x93AD, 0x377B, 0x6EF6, 0xDDEC), + array(0x45A0, 0x8B40, 0x06A1, 0x0D42, 0x1A84, 0x3508, 0x6A10), + array(0xAA51, 0x4483, 0x8906, 0x022D, 0x045A, 0x08B4, 0x1168), + array(0x76B4, 0xED68, 0xCAF1, 0x85C3, 0x1BA7, 0x374E, 0x6E9C), + array(0x3730, 0x6E60, 0xDCC0, 0xA9A1, 0x4363, 0x86C6, 0x1DAD), + array(0x3331, 0x6662, 0xCCC4, 0x89A9, 0x0373, 0x06E6, 0x0DCC), + array(0x1021, 0x2042, 0x4084, 0x8108, 0x1231, 0x2462, 0x48C4), + ); + + private static $passwordMaxLength = 15; + + /** + * Create a hashed password that MS Word will be able to work with + * @see https://blogs.msdn.microsoft.com/vsod/2010/04/05/how-to-set-the-editing-restrictions-in-word-using-open-xml-sdk-2-0/ + * + * @param string $password + * @param number $algorithmSid + * @param string $salt + * @param number $spinCount + * @return string + */ + public static function hashPassword($password, $algorithmSid = 4, $salt = null, $spinCount = 10000) + { + $origEncoding = mb_internal_encoding(); + mb_internal_encoding('UTF-8'); + + $password = mb_substr($password, 0, min(self::$passwordMaxLength, mb_strlen($password))); + + // Get the single-byte values by iterating through the Unicode characters of the truncated password. + // For each character, if the low byte is not equal to 0, take it. Otherwise, take the high byte. + $passUtf8 = mb_convert_encoding($password, 'UCS-2LE', 'UTF-8'); + $byteChars = array(); + for ($i = 0; $i < mb_strlen($password); $i++) { + $byteChars[$i] = ord(substr($passUtf8, $i * 2, 1)); + if ($byteChars[$i] == 0) { + $byteChars[$i] = ord(substr($passUtf8, $i * 2 + 1, 1)); + } + } + + // build low-order word and hig-order word and combine them + $combinedKey = self::buildCombinedKey($byteChars); + // build reversed hexadecimal string + $hex = str_pad(strtoupper(dechex($combinedKey & 0xFFFFFFFF)), 8, '0', \STR_PAD_LEFT); + $reversedHex = $hex[6] . $hex[7] . $hex[4] . $hex[5] . $hex[2] . $hex[3] . $hex[0] . $hex[1]; + + $generatedKey = mb_convert_encoding($reversedHex, 'UCS-2LE', 'UTF-8'); + + // Implementation Notes List: + // Word requires that the initial hash of the password with the salt not be considered in the count. + // The initial hash of salt + key is not included in the iteration count. + $algorithm = self::getAlgorithm($algorithmSid); + $generatedKey = hash($algorithm, $salt . $generatedKey, true); + + for ($i = 0; $i < $spinCount; $i++) { + $generatedKey = hash($algorithm, $generatedKey . pack('CCCC', $i, $i >> 8, $i >> 16, $i >> 24), true); + } + $generatedKey = base64_encode($generatedKey); + + mb_internal_encoding($origEncoding); + + return $generatedKey; + } + + /** + * Get algorithm from self::$algorithmMapping + * + * @param int $sid + * @return string + */ + private static function getAlgorithm($sid) + { + $algorithm = self::$algorithmMapping[$sid]; + if ($algorithm == '') { + $algorithm = 'sha1'; + } + + return $algorithm; + } + + /** + * Build combined key from low-order word and high-order word + * + * @param array $byteChars byte array representation of password + * @return int + */ + private static function buildCombinedKey($byteChars) + { + // Compute the high-order word + // Initialize from the initial code array (see above), depending on the passwords length. + $highOrderWord = self::$initialCodeArray[count($byteChars) - 1]; + + // For each character in the password: + // For every bit in the character, starting with the least significant and progressing to (but excluding) + // the most significant, if the bit is set, XOR the key’s high-order word with the corresponding word from + // the Encryption Matrix + for ($i = 0; $i < count($byteChars); $i++) { + $tmp = self::$passwordMaxLength - count($byteChars) + $i; + $matrixRow = self::$encryptionMatrix[$tmp]; + for ($intBit = 0; $intBit < 7; $intBit++) { + if (($byteChars[$i] & (0x0001 << $intBit)) != 0) { + $highOrderWord = ($highOrderWord ^ $matrixRow[$intBit]); + } + } + } + + // Compute low-order word + // Initialize with 0 + $lowOrderWord = 0; + // For each character in the password, going backwards + for ($i = count($byteChars) - 1; $i >= 0; $i--) { + // low-order word = (((low-order word SHR 14) AND 0x0001) OR (low-order word SHL 1) AND 0x7FFF)) XOR character + $lowOrderWord = (((($lowOrderWord >> 14) & 0x0001) | (($lowOrderWord << 1) & 0x7FFF)) ^ $byteChars[$i]); + } + // Lastly, low-order word = (((low-order word SHR 14) AND 0x0001) OR (low-order word SHL 1) AND 0x7FFF)) XOR strPassword length XOR 0xCE4B. + $lowOrderWord = (((($lowOrderWord >> 14) & 0x0001) | (($lowOrderWord << 1) & 0x7FFF)) ^ count($byteChars) ^ 0xCE4B); + + // Combine the Low and High Order Word + return self::int32(($highOrderWord << 16) + $lowOrderWord); + } + + /** + * Simulate behaviour of (signed) int32 + * + * @param int $value + * @return int + */ + private static function int32($value) + { + $value = ($value & 0xFFFFFFFF); + + if ($value & 0x80000000) { + $value = -((~$value & 0xFFFFFFFF) + 1); + } + + return $value; + } +} diff --git a/src/PhpWord/SimpleType/DocProtect.php b/src/PhpWord/SimpleType/DocProtect.php new file mode 100644 index 00000000..cffa0003 --- /dev/null +++ b/src/PhpWord/SimpleType/DocProtect.php @@ -0,0 +1,55 @@ + 'md2', - 2 => 'md4', - 3 => 'md5', - 4 => 'sha1', - 5 => '', // 'mac' -> not possible with hash() - 6 => 'ripemd', - 7 => 'ripemd160', - 8 => '', - 9 => '', //'hmac' -> not possible with hash() - 10 => '', - 11 => '', - 12 => 'sha256', - 13 => 'sha384', - 14 => 'sha512', - ]; - static $initialCodeArray = [ - 0xE1F0, - 0x1D0F, - 0xCC9C, - 0x84C0, - 0x110C, - 0x0E10, - 0xF1CE, - 0x313E, - 0x1872, - 0xE139, - 0xD40F, - 0x84F9, - 0x280C, - 0xA96A, - 0x4EC3 - ]; - static $encryptionMatrix = - [ - [0xAEFC, 0x4DD9, 0x9BB2, 0x2745, 0x4E8A, 0x9D14, 0x2A09], - [0x7B61, 0xF6C2, 0xFDA5, 0xEB6B, 0xC6F7, 0x9DCF, 0x2BBF], - [0x4563, 0x8AC6, 0x05AD, 0x0B5A, 0x16B4, 0x2D68, 0x5AD0], - [0x0375, 0x06EA, 0x0DD4, 0x1BA8, 0x3750, 0x6EA0, 0xDD40], - [0xD849, 0xA0B3, 0x5147, 0xA28E, 0x553D, 0xAA7A, 0x44D5], - [0x6F45, 0xDE8A, 0xAD35, 0x4A4B, 0x9496, 0x390D, 0x721A], - [0xEB23, 0xC667, 0x9CEF, 0x29FF, 0x53FE, 0xA7FC, 0x5FD9], - [0x47D3, 0x8FA6, 0x0F6D, 0x1EDA, 0x3DB4, 0x7B68, 0xF6D0], - [0xB861, 0x60E3, 0xC1C6, 0x93AD, 0x377B, 0x6EF6, 0xDDEC], - [0x45A0, 0x8B40, 0x06A1, 0x0D42, 0x1A84, 0x3508, 0x6A10], - [0xAA51, 0x4483, 0x8906, 0x022D, 0x045A, 0x08B4, 0x1168], - [0x76B4, 0xED68, 0xCAF1, 0x85C3, 0x1BA7, 0x374E, 0x6E9C], - [0x3730, 0x6E60, 0xDCC0, 0xA9A1, 0x4363, 0x86C6, 0x1DAD], - [0x3331, 0x6662, 0xCCC4, 0x89A9, 0x0373, 0x06E6, 0x0DCC], - [0x1021, 0x2042, 0x4084, 0x8108, 0x1231, 0x2462, 0x48C4] - ]; - static $passwordMaxLength = 15; - /** * Settings value * @@ -238,25 +186,26 @@ class Settings extends AbstractPart $this->settings['w:documentProtection'] = array( '@attributes' => array( 'w:enforcement' => 1, - 'w:edit' => $documentProtection->getEditing(), - ) + 'w:edit' => $documentProtection->getEditing(), + ), ); } else { if ($documentProtection->getSalt() == null) { $documentProtection->setSalt(openssl_random_pseudo_bytes(16)); } + $passwordHash = PasswordEncoder::hashPassword($documentProtection->getPassword(), $documentProtection->getMswordAlgorithmSid(), $documentProtection->getSalt(), $documentProtection->getSpinCount()); $this->settings['w:documentProtection'] = array( '@attributes' => array( - 'w:enforcement' => 1, - 'w:edit' => $documentProtection->getEditing(), - 'w:cryptProviderType' => 'rsaFull', + 'w:enforcement' => 1, + 'w:edit' => $documentProtection->getEditing(), + 'w:cryptProviderType' => 'rsaFull', 'w:cryptAlgorithmClass' => 'hash', - 'w:cryptAlgorithmType' => 'typeAny', - 'w:cryptAlgorithmSid' => $documentProtection->getMswordAlgorithmSid(), - 'w:cryptSpinCount' => $documentProtection->getSpinCount(), - 'w:hash' => $this->getEncodedPasswordHash($documentProtection), - 'w:salt' => base64_encode($documentProtection->getSalt()), - ) + 'w:cryptAlgorithmType' => 'typeAny', + 'w:cryptAlgorithmSid' => $documentProtection->getMswordAlgorithmSid(), + 'w:cryptSpinCount' => $documentProtection->getSpinCount(), + 'w:hash' => $passwordHash, + 'w:salt' => base64_encode($documentProtection->getSalt()), + ), ); } } @@ -337,135 +286,10 @@ class Settings extends AbstractPart $this->settings['w:compat']['w:compatSetting'] = array( '@attributes' => array( 'w:name' => 'compatibilityMode', - 'w:uri' => 'http://schemas.microsoft.com/office/word', - 'w:val' => $compatibility->getOoxmlVersion(), - ) + 'w:uri' => 'http://schemas.microsoft.com/office/word', + 'w:val' => $compatibility->getOoxmlVersion(), + ), ); } } - - - /** - * Create a hashed password that MS Word will be able to work with - * @link https://blogs.msdn.microsoft.com/vsod/2010/04/05/how-to-set-the-editing-restrictions-in-word-using-open-xml-sdk-2-0/ - * - * @param \PhpOffice\PhpWord\Metadata\Protection $protection - * @return string - */ - private function getEncodedPasswordHash($protection) - { - $orig_encoding = mb_internal_encoding(); - mb_internal_encoding("UTF-8"); - - $password = $protection->getPassword(); - $password = mb_substr($password, 0, min(self::$passwordMaxLength, mb_strlen($password))); - - // Get the single-byte values by iterating through the Unicode characters of the truncated password. - // For each character, if the low byte is not equal to 0, take it. Otherwise, take the high byte. - $pass_utf8 = mb_convert_encoding($password, 'UCS-2LE', 'UTF-8'); - $byteChars = []; - for ($i = 0; $i < mb_strlen($password); $i++) { - $byteChars[$i] = ord(substr($pass_utf8, $i * 2, 1)); - if ($byteChars[$i] == 0) { - $byteChars[$i] = ord(substr($pass_utf8, $i * 2 + 1, 1)); - } - } - - // build low-order word and hig-order word and combine them - $combinedKey = $this->buildCombinedKey($byteChars); - // build reversed hexadecimal string - $hex = str_pad(strtoupper(dechex($combinedKey & 0xFFFFFFFF)), 8, '0', \STR_PAD_LEFT); - $reversedHex = $hex[6] . $hex[7] . $hex[4] . $hex[5] . $hex[2] . $hex[3] . $hex[0] . $hex[1]; - - $generatedKey = mb_convert_encoding($reversedHex, 'UCS-2LE', 'UTF-8'); - - // Implementation Notes List: - // Word requires that the initial hash of the password with the salt not be considered in the count. - // The initial hash of salt + key is not included in the iteration count. - $algorithm = $this->getAlgorithm($protection->getMswordAlgorithmSid()); - $generatedKey = hash($algorithm, $protection->getSalt() . $generatedKey, true); - - for ($i = 0; $i < $protection->getSpinCount(); $i++) { - $generatedKey = hash($algorithm, $generatedKey . pack("CCCC", $i, $i >> 8, $i >> 16, $i >> 24), true); - } - $generatedKey = base64_encode($generatedKey); - - mb_internal_encoding($orig_encoding); - - return $generatedKey; - } - - /** - * Get algorithm from self::$algorithmMapping - * - * @param int $sid - * @return string - */ - private function getAlgorithm($sid) - { - $algorithm = self::$algorithmMapping[$sid]; - if ($algorithm == '') { - $algorithm = 'sha1'; - } - - return $algorithm; - } - - /** - * Build combined key from low-order word and high-order word - * - * @param array $byteChars -> byte array representation of password - * @return int - */ - private function buildCombinedKey($byteChars) - { - // Compute the high-order word - // Initialize from the initial code array (see above), depending on the passwords length. - $highOrderWord = self::$initialCodeArray[sizeof($byteChars) - 1]; - - // For each character in the password: - // For every bit in the character, starting with the least significant and progressing to (but excluding) - // the most significant, if the bit is set, XOR the key’s high-order word with the corresponding word from - // the Encryption Matrix - for ($i = 0; $i < sizeof($byteChars); $i++) { - $tmp = self::$passwordMaxLength - sizeof($byteChars) + $i; - $matrixRow = self::$encryptionMatrix[$tmp]; - for ($intBit = 0; $intBit < 7; $intBit++) { - if (($byteChars[$i] & (0x0001 << $intBit)) != 0) { - $highOrderWord = ($highOrderWord ^ $matrixRow[$intBit]); - } - } - } - - // Compute low-order word - // Initialize with 0 - $lowOrderWord = 0; - // For each character in the password, going backwards - for ($i = sizeof($byteChars) - 1; $i >= 0; $i--) { - // low-order word = (((low-order word SHR 14) AND 0x0001) OR (low-order word SHL 1) AND 0x7FFF)) XOR character - $lowOrderWord = (((($lowOrderWord >> 14) & 0x0001) | (($lowOrderWord << 1) & 0x7FFF)) ^ $byteChars[$i]); - } - // Lastly, low-order word = (((low-order word SHR 14) AND 0x0001) OR (low-order word SHL 1) AND 0x7FFF)) XOR strPassword length XOR 0xCE4B. - $lowOrderWord = (((($lowOrderWord >> 14) & 0x0001) | (($lowOrderWord << 1) & 0x7FFF)) ^ sizeof($byteChars) ^ 0xCE4B); - - // Combine the Low and High Order Word - return $this->int32(($highOrderWord << 16) + $lowOrderWord); - } - - /** - * Simulate behaviour of (signed) int32 - * - * @param int $value - * @return int - */ - private function int32($value) - { - $value = ($value & 0xFFFFFFFF); - - if ($value & 0x80000000) { - $value = -((~$value & 0xFFFFFFFF) + 1); - } - - return $value; - } } diff --git a/tests/PhpWord/Metadata/SettingsTest.php b/tests/PhpWord/Metadata/SettingsTest.php index bee8d0ca..a2a80b12 100644 --- a/tests/PhpWord/Metadata/SettingsTest.php +++ b/tests/PhpWord/Metadata/SettingsTest.php @@ -63,13 +63,22 @@ class SettingsTest extends \PHPUnit\Framework\TestCase public function testDocumentProtection() { $oSettings = new Settings(); - $oSettings->setDocumentProtection(new Protection()); + $oSettings->setDocumentProtection(new Protection('trackedChanges')); $this->assertNotNull($oSettings->getDocumentProtection()); - $oSettings->getDocumentProtection()->setEditing('trackedChanges'); $this->assertEquals('trackedChanges', $oSettings->getDocumentProtection()->getEditing()); } + /** + * Test setting an invalid salt + * @expectedException \InvalidArgumentException + */ + public function testInvalidSalt() + { + $p = new Protection(); + $p->setSalt('123'); + } + /** * TrackRevistions */ diff --git a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php index 8c47cb52..7d4ef491 100644 --- a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php @@ -58,15 +58,15 @@ class SettingsTest extends \PHPUnit\Framework\TestCase /** * Test document protection with password - * - * Note: to get comparison values, a docx was generated in Word2010 and the values taken from the settings.xml */ public function testDocumentProtectionWithPassword() { $phpWord = new PhpWord(); - $phpWord->getProtection()->setEditing('readOnly'); - $phpWord->getProtection()->setPassword('testÄö@€!$&'); - $phpWord->getProtection()->setSalt(base64_decode("uq81pJRRGFIY5U+E9gt8tA==")); + $phpWord->getSettings()->getDocumentProtection()->setEditing('readOnly'); + $phpWord->getSettings()->getDocumentProtection()->setPassword('testÄö@€!$&'); + $phpWord->getSettings()->getDocumentProtection()->setSalt(base64_decode('uq81pJRRGFIY5U+E9gt8tA==')); + $phpWord->getSettings()->getDocumentProtection()->setMswordAlgorithmSid(1); + $phpWord->getSettings()->getDocumentProtection()->setSpinCount(10); $doc = TestHelperDOCX::getDocument($phpWord); @@ -74,7 +74,28 @@ class SettingsTest extends \PHPUnit\Framework\TestCase $path = '/w:settings/w:documentProtection'; $this->assertTrue($doc->elementExists($path, $file)); - $this->assertEquals($doc->getElement($path, $file)->getAttribute('w:hash'), "RA9jfY/u3DX114PMcl+uSekxsYk="); + $this->assertEquals('rUuJbk6LuN2/qFyp7IUPQA==', $doc->getElement($path, $file)->getAttribute('w:hash')); + $this->assertEquals('1', $doc->getElement($path, $file)->getAttribute('w:cryptAlgorithmSid')); + $this->assertEquals('10', $doc->getElement($path, $file)->getAttribute('w:cryptSpinCount')); + } + + /** + * Test document protection with password only + */ + public function testDocumentProtectionWithPasswordOnly() + { + $phpWord = new PhpWord(); + $phpWord->getSettings()->getDocumentProtection()->setEditing('readOnly'); + $phpWord->getSettings()->getDocumentProtection()->setPassword('testÄö@€!$&'); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:documentProtection'; + $this->assertTrue($doc->elementExists($path, $file)); + $this->assertEquals('4', $doc->getElement($path, $file)->getAttribute('w:cryptAlgorithmSid')); + $this->assertEquals('100000', $doc->getElement($path, $file)->getAttribute('w:cryptSpinCount')); } /** From 2e562512f4d969edfd500252b9fe7107c1d45f74 Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 24 Nov 2017 14:45:05 +0100 Subject: [PATCH 152/370] Add unit tests for PasswordEncoder --- .../Shared/Microsoft/PasswordEncoder.php | 3 + tests/PhpWord/Metadata/SettingsTest.php | 4 +- .../Shared/Microsoft/PasswordEncoderTest.php | 91 +++++++++++++++++++ .../Writer/Word2007/Part/SettingsTest.php | 19 ---- 4 files changed, 96 insertions(+), 21 deletions(-) create mode 100644 tests/PhpWord/Shared/Microsoft/PasswordEncoderTest.php diff --git a/src/PhpWord/Shared/Microsoft/PasswordEncoder.php b/src/PhpWord/Shared/Microsoft/PasswordEncoder.php index 40a3ea12..cddcfcd3 100644 --- a/src/PhpWord/Shared/Microsoft/PasswordEncoder.php +++ b/src/PhpWord/Shared/Microsoft/PasswordEncoder.php @@ -98,8 +98,10 @@ class PasswordEncoder // For each character, if the low byte is not equal to 0, take it. Otherwise, take the high byte. $passUtf8 = mb_convert_encoding($password, 'UCS-2LE', 'UTF-8'); $byteChars = array(); + for ($i = 0; $i < mb_strlen($password); $i++) { $byteChars[$i] = ord(substr($passUtf8, $i * 2, 1)); + if ($byteChars[$i] == 0) { $byteChars[$i] = ord(substr($passUtf8, $i * 2 + 1, 1)); } @@ -189,6 +191,7 @@ class PasswordEncoder /** * Simulate behaviour of (signed) int32 * + * @codeCoverageIgnore * @param int $value * @return int */ diff --git a/tests/PhpWord/Metadata/SettingsTest.php b/tests/PhpWord/Metadata/SettingsTest.php index a2a80b12..9830fd28 100644 --- a/tests/PhpWord/Metadata/SettingsTest.php +++ b/tests/PhpWord/Metadata/SettingsTest.php @@ -75,8 +75,8 @@ class SettingsTest extends \PHPUnit\Framework\TestCase */ public function testInvalidSalt() { - $p = new Protection(); - $p->setSalt('123'); + $protection = new Protection(); + $protection->setSalt('123'); } /** diff --git a/tests/PhpWord/Shared/Microsoft/PasswordEncoderTest.php b/tests/PhpWord/Shared/Microsoft/PasswordEncoderTest.php new file mode 100644 index 00000000..7b2bd3e7 --- /dev/null +++ b/tests/PhpWord/Shared/Microsoft/PasswordEncoderTest.php @@ -0,0 +1,91 @@ +assertEquals('10', $doc->getElement($path, $file)->getAttribute('w:cryptSpinCount')); } - /** - * Test document protection with password only - */ - public function testDocumentProtectionWithPasswordOnly() - { - $phpWord = new PhpWord(); - $phpWord->getSettings()->getDocumentProtection()->setEditing('readOnly'); - $phpWord->getSettings()->getDocumentProtection()->setPassword('testÄö@€!$&'); - - $doc = TestHelperDOCX::getDocument($phpWord); - - $file = 'word/settings.xml'; - - $path = '/w:settings/w:documentProtection'; - $this->assertTrue($doc->elementExists($path, $file)); - $this->assertEquals('4', $doc->getElement($path, $file)->getAttribute('w:cryptAlgorithmSid')); - $this->assertEquals('100000', $doc->getElement($path, $file)->getAttribute('w:cryptSpinCount')); - } - /** * Test compatibility */ From 446d3478e491bed828e1a33f20442f57d1a85abe Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 25 Nov 2017 01:45:27 +0100 Subject: [PATCH 153/370] Create ISSUE_TEMPLATE.md --- docs/ISSUE_TEMPLATE.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 docs/ISSUE_TEMPLATE.md diff --git a/docs/ISSUE_TEMPLATE.md b/docs/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..58981f8e --- /dev/null +++ b/docs/ISSUE_TEMPLATE.md @@ -0,0 +1,28 @@ +Issue tracker is **ONLY** used for reporting bugs. NO NEW FEATURE ACCEPTED! Use [stackoverflow](https://stackoverflow.com/questions/tagged/phpword) for supporting issues. + +# Expected Behavior + +Please describe the behavior you are expecting. + +# Current Behavior + +What is the current behavior? + +# Failure Information + +Please help provide information about the failure. + +## How to Reproduce + +Please provide a code sample that reproduces the issue. + +```php +$phpWord = new \PhpOffice\PhpWord\PhpWord(); +$section = $phpWord->addSection(); +$section->... +``` + +## Context + +* PHP version: +* PHPWord version: 0.14 From 3429c443ad3b18396769da0680806ab7808f1a97 Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 25 Nov 2017 01:46:20 +0100 Subject: [PATCH 154/370] Create PULL_REQUEST_TEMPLATE.md --- docs/PULL_REQUEST_TEMPLATE.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 docs/PULL_REQUEST_TEMPLATE.md diff --git a/docs/PULL_REQUEST_TEMPLATE.md b/docs/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..ad9788c4 --- /dev/null +++ b/docs/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,12 @@ +# Description + +Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. + +Fixes # (issue) + +# Checklist: + +- [ ] I have commented my code, particularly in hard-to-understand areas +- [ ] I have run phpunit, phpcs, php-cs-fixer, phpmd +- [ ] The new code is covered by unit tests +- [ ] I have update the documentation to describe the changes From ab5d4468f908ac6df7cbef11b465f13cb22a363e Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 25 Nov 2017 01:48:30 +0100 Subject: [PATCH 155/370] add the updateFields option on document settings When set to true, word will ask you to update the fields in the document when you open the document. --- CHANGELOG.md | 3 ++- docs/general.rst | 9 ++++++++ samples/Sample_17_TitleTOC.php | 1 + src/PhpWord/Metadata/Settings.php | 23 +++++++++++++++++++ src/PhpWord/Writer/Word2007/Part/Settings.php | 1 + tests/PhpWord/Metadata/SettingsTest.php | 10 ++++++++ 6 files changed, 46 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e39ed3f..d26f6eba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,8 +18,9 @@ This is the last version to support PHP 5.3 - Support for Comments - @troosan #1067 - Support for paragraph textAlignment - @troosan #1165 - Add support for HTML underline tag in addHtml - @zNightFalLz #1186 -- Allow to change cell width unit - guillaume-ro-fr #986 +- Allow to change cell width unit - @guillaume-ro-fr #986 - Allow to change the line height rule @troosan +- Allow to force an update of all fields on opening a document - @troosan #951 ### Fixed - Loosen dependency to Zend diff --git a/docs/general.rst b/docs/general.rst index b11734b1..da80e5f9 100644 --- a/docs/general.rst +++ b/docs/general.rst @@ -271,3 +271,12 @@ points to twips. $sectionStyle->setMarginLeft(\PhpOffice\PhpWord\Shared\Converter::inchToTwip(.5)); // 2 cm right margin $sectionStyle->setMarginRight(\PhpOffice\PhpWord\Shared\Converter::cmToTwip(2)); + +Automatically Recalculate Fields on Open +---------------------------------------- + +To force an update of the fields present in the document, set updateFields to true + +.. code-block:: php + + $phpWord->getSettings()->setUpdateFields(true); diff --git a/samples/Sample_17_TitleTOC.php b/samples/Sample_17_TitleTOC.php index 306595eb..f99b73ea 100644 --- a/samples/Sample_17_TitleTOC.php +++ b/samples/Sample_17_TitleTOC.php @@ -4,6 +4,7 @@ include_once 'Sample_Header.php'; // New Word document echo date('H:i:s'), ' Create new PhpWord object', EOL; $phpWord = new \PhpOffice\PhpWord\PhpWord(); +$phpWord->getSettings()->setUpdateFields(true); // New section $section = $phpWord->addSection(); diff --git a/src/PhpWord/Metadata/Settings.php b/src/PhpWord/Metadata/Settings.php index 33f72cca..728cc823 100644 --- a/src/PhpWord/Metadata/Settings.php +++ b/src/PhpWord/Metadata/Settings.php @@ -116,6 +116,13 @@ class Settings */ private $themeFontLang; + /** + * Automatically Recalculate Fields on Open + * + * @var bool + */ + private $updateFields = false; + /** * Radix Point for Field Code Evaluation * @@ -345,6 +352,22 @@ class Settings $this->themeFontLang = $themeFontLang; } + /** + * @return bool + */ + public function hasUpdateFields() + { + return $this->updateFields; + } + + /** + * @param bool $updateFields + */ + public function setUpdateFields($updateFields) + { + $this->updateFields = $updateFields === null ? false : $updateFields; + } + /** * Returns the Radix Point for Field Code Evaluation * diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index c8772e71..65cbf274 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -147,6 +147,7 @@ class Settings extends AbstractPart $this->setOnOffValue('w:doNotTrackMoves', $documentSettings->hasDoNotTrackMoves()); $this->setOnOffValue('w:doNotTrackFormatting', $documentSettings->hasDoNotTrackFormatting()); $this->setOnOffValue('w:evenAndOddHeaders', $documentSettings->hasEvenAndOddHeaders()); + $this->setOnOffValue('w:updateFields', $documentSettings->hasUpdateFields()); $this->setThemeFontLang($documentSettings->getThemeFontLang()); $this->setRevisionView($documentSettings->getRevisionView()); diff --git a/tests/PhpWord/Metadata/SettingsTest.php b/tests/PhpWord/Metadata/SettingsTest.php index bee8d0ca..e5b50cb7 100644 --- a/tests/PhpWord/Metadata/SettingsTest.php +++ b/tests/PhpWord/Metadata/SettingsTest.php @@ -153,4 +153,14 @@ class SettingsTest extends \PHPUnit\Framework\TestCase $oSettings->setZoom(Zoom::FULL_PAGE); $this->assertEquals('fullPage', $oSettings->getZoom()); } + + /** + * Test Update Fields on update + */ + public function testUpdateFields() + { + $oSettings = new Settings(); + $oSettings->setUpdateFields(true); + $this->assertTrue($oSettings->hasUpdateFields()); + } } From 5a5ae48bb6fa1891623bbf2a0b7448bf36f7e77a Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 25 Nov 2017 21:37:11 +0100 Subject: [PATCH 156/370] also add w:bCs --- src/PhpWord/Writer/Word2007/Style/Font.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/PhpWord/Writer/Word2007/Style/Font.php b/src/PhpWord/Writer/Word2007/Style/Font.php index 3fbff63d..9c2714dc 100644 --- a/src/PhpWord/Writer/Word2007/Style/Font.php +++ b/src/PhpWord/Writer/Word2007/Style/Font.php @@ -104,6 +104,7 @@ class Font extends AbstractStyle // Bold, italic $xmlWriter->writeElementIf($style->isBold(), 'w:b'); + $xmlWriter->writeElementIf($style->isBold(), 'w:bCs'); $xmlWriter->writeElementIf($style->isItalic(), 'w:i'); $xmlWriter->writeElementIf($style->isItalic(), 'w:iCs'); From 5d928db91627245a79cdc38e626208b274b8cc2a Mon Sep 17 00:00:00 2001 From: Michael Spahn Date: Tue, 16 Aug 2016 17:10:51 +0200 Subject: [PATCH 157/370] Implement PageBreak for odt writer --- .../Writer/ODText/Element/PageBreak.php | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/PhpWord/Writer/ODText/Element/PageBreak.php diff --git a/src/PhpWord/Writer/ODText/Element/PageBreak.php b/src/PhpWord/Writer/ODText/Element/PageBreak.php new file mode 100644 index 00000000..47b4eeba --- /dev/null +++ b/src/PhpWord/Writer/ODText/Element/PageBreak.php @@ -0,0 +1,36 @@ +getXmlWriter(); + + $xmlWriter->startElement('text:p'); + $xmlWriter->writeAttribute('text:style-name', 'P1'); + $xmlWriter->endElement(); + } +} From 72a6b1b19fb26ffcf2871ef41ee95617cc20a55e Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 25 Nov 2017 23:44:22 +0100 Subject: [PATCH 158/370] Add unit test --- tests/PhpWord/Writer/ODText/ElementTest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/PhpWord/Writer/ODText/ElementTest.php b/tests/PhpWord/Writer/ODText/ElementTest.php index 253c8e11..f56114ea 100644 --- a/tests/PhpWord/Writer/ODText/ElementTest.php +++ b/tests/PhpWord/Writer/ODText/ElementTest.php @@ -18,6 +18,8 @@ namespace PhpOffice\PhpWord\Writer\ODText; use PhpOffice\Common\XMLWriter; +use PhpOffice\PhpWord\PhpWord; +use PhpOffice\PhpWord\TestHelperDOCX; /** * Test class for PhpOffice\PhpWord\Writer\ODText\Element subnamespace @@ -40,4 +42,21 @@ class ElementTest extends \PHPUnit\Framework\TestCase $this->assertEquals('', $xmlWriter->getData()); } } + + /** + * Test PageBreak + */ + public function testPageBreak() + { + $phpWord = new PhpWord(); + $section = $phpWord->addSection(); + $section->addText('test'); + $section->addPageBreak(); + + $doc = TestHelperDOCX::getDocument($phpWord, 'ODText'); + + $element = '/office:document-content/office:body/office:text/text:section/text:p[2]'; + $this->assertTrue($doc->elementExists($element, 'content.xml')); + $this->assertEquals('P1', $doc->getElementAttribute($element, 'text:style-name', 'content.xml')); + } } From 355027d854b27889a64de6e74634c9589ea27853 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 26 Nov 2017 00:11:09 +0100 Subject: [PATCH 159/370] PHP-CS fix, improve code coverage --- src/PhpWord/Writer/ODText/Element/Link.php | 8 +------- src/PhpWord/Writer/ODText/Element/PageBreak.php | 4 ++-- src/PhpWord/Writer/ODText/Element/Text.php | 12 ++---------- src/PhpWord/Writer/ODText/Element/Title.php | 8 +------- src/PhpWord/Writer/ODText/Part/Meta.php | 7 +------ 5 files changed, 7 insertions(+), 32 deletions(-) diff --git a/src/PhpWord/Writer/ODText/Element/Link.php b/src/PhpWord/Writer/ODText/Element/Link.php index c996ab59..34d72c1a 100644 --- a/src/PhpWord/Writer/ODText/Element/Link.php +++ b/src/PhpWord/Writer/ODText/Element/Link.php @@ -17,8 +17,6 @@ namespace PhpOffice\PhpWord\Writer\ODText\Element; -use PhpOffice\PhpWord\Settings; - /** * Text element writer * @@ -44,11 +42,7 @@ class Link extends AbstractElement $xmlWriter->startElement('text:a'); $xmlWriter->writeAttribute('xlink:type', 'simple'); $xmlWriter->writeAttribute('xlink:href', $element->getSource()); - if (Settings::isOutputEscapingEnabled()) { - $xmlWriter->text($element->getText()); - } else { - $xmlWriter->writeRaw($element->getText()); - } + $this->writeText($element->getText()); $xmlWriter->endElement(); // text:a if (!$this->withoutP) { diff --git a/src/PhpWord/Writer/ODText/Element/PageBreak.php b/src/PhpWord/Writer/ODText/Element/PageBreak.php index 47b4eeba..6eee6cfc 100644 --- a/src/PhpWord/Writer/ODText/Element/PageBreak.php +++ b/src/PhpWord/Writer/ODText/Element/PageBreak.php @@ -10,8 +10,8 @@ * file that was distributed with this source code. For the full list of * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * - * @link https://github.com/PHPOffice/PHPWord - * @copyright 2010-2016 PHPWord contributors + * @see https://github.com/PHPOffice/PHPWord + * @copyright 2010-2017 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/Text.php b/src/PhpWord/Writer/ODText/Element/Text.php index 3b06217d..dc377699 100644 --- a/src/PhpWord/Writer/ODText/Element/Text.php +++ b/src/PhpWord/Writer/ODText/Element/Text.php @@ -58,11 +58,7 @@ class Text extends AbstractElement } elseif (is_string($paragraphStyle)) { $xmlWriter->writeAttribute('text:style-name', $paragraphStyle); } - if (Settings::isOutputEscapingEnabled()) { - $xmlWriter->text($element->getText()); - } else { - $xmlWriter->writeRaw($element->getText()); - } + $this->writeText($element->getText()); } else { if (empty($paragraphStyle)) { $xmlWriter->writeAttribute('text:style-name', 'Standard'); @@ -74,11 +70,7 @@ class Text extends AbstractElement if (is_string($fontStyle)) { $xmlWriter->writeAttribute('text:style-name', $fontStyle); } - if (Settings::isOutputEscapingEnabled()) { - $xmlWriter->text($element->getText()); - } else { - $xmlWriter->writeRaw($element->getText()); - } + $this->writeText($element->getText()); $xmlWriter->endElement(); } if (!$this->withoutP) { diff --git a/src/PhpWord/Writer/ODText/Element/Title.php b/src/PhpWord/Writer/ODText/Element/Title.php index bf9bf9d6..769d293f 100644 --- a/src/PhpWord/Writer/ODText/Element/Title.php +++ b/src/PhpWord/Writer/ODText/Element/Title.php @@ -17,8 +17,6 @@ namespace PhpOffice\PhpWord\Writer\ODText\Element; -use PhpOffice\PhpWord\Settings; - /** * Title element writer * @@ -39,11 +37,7 @@ class Title extends AbstractElement $xmlWriter->startElement('text:h'); $xmlWriter->writeAttribute('text:outline-level', $element->getDepth()); - if (Settings::isOutputEscapingEnabled()) { - $xmlWriter->text($element->getText()); - } else { - $xmlWriter->writeRaw($element->getText()); - } + $this->writeText($element->getText()); $xmlWriter->endElement(); // text:h } } diff --git a/src/PhpWord/Writer/ODText/Part/Meta.php b/src/PhpWord/Writer/ODText/Part/Meta.php index 72d03ae6..f592c5f0 100644 --- a/src/PhpWord/Writer/ODText/Part/Meta.php +++ b/src/PhpWord/Writer/ODText/Part/Meta.php @@ -18,7 +18,6 @@ namespace PhpOffice\PhpWord\Writer\ODText\Part; use PhpOffice\Common\XMLWriter; -use PhpOffice\PhpWord\Settings; /** * ODText meta part writer: meta.xml @@ -100,11 +99,7 @@ class Meta extends AbstractPart // if ($type !== null) { // $xmlWriter->writeAttribute('meta:value-type', $type); // } - if (Settings::isOutputEscapingEnabled()) { - $xmlWriter->text($value); - } else { - $xmlWriter->writeRaw($value); - } + $this->writeText($value); $xmlWriter->endElement(); // meta:user-defined } } From 01008a591b731579f960bed7093853da6c690d03 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 26 Nov 2017 00:35:21 +0100 Subject: [PATCH 160/370] update changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e39ed3f..7f5376a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ Change Log All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). -v0.14.0 (?? ???? 2017) +v0.14.0 (?? Dec 2017) ---------------------- This release fixes several bugs and adds some new features. This is the last version to support PHP 5.3 @@ -20,6 +20,7 @@ This is the last version to support PHP 5.3 - Add support for HTML underline tag in addHtml - @zNightFalLz #1186 - Allow to change cell width unit - guillaume-ro-fr #986 - Allow to change the line height rule @troosan +- Implement PageBreak for odt writer @cookiekiller #863 #824 ### Fixed - Loosen dependency to Zend From 23bc8376668cfff4a2be8ff7286c5ba5ee399f36 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 26 Nov 2017 17:54:47 +0100 Subject: [PATCH 161/370] Scrutinizer fixes --- run_tests.sh | 8 +++++++- src/PhpWord/Element/Field.php | 4 ++-- src/PhpWord/Element/TrackChange.php | 2 +- src/PhpWord/Reader/Word2007/Settings.php | 6 +++--- src/PhpWord/Shared/AbstractEnum.php | 2 +- src/PhpWord/Shared/ZipArchive.php | 2 +- src/PhpWord/Writer/ODText/Element/Text.php | 1 - 7 files changed, 15 insertions(+), 10 deletions(-) diff --git a/run_tests.sh b/run_tests.sh index 6b81d69c..a5d94259 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -1,14 +1,20 @@ #!/bin/bash +echo "Running composer update" +composer update ## PHP_CodeSniffer +echo "Running CodeSniffer" ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip ## PHP-CS-Fixer +echo "Running CS Fixer" ./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run ## PHP Mess Detector +echo "Running Mess Detector" ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php ## PHPUnit -./vendor/bin/phpunit -c ./ --no-coverage +echo "Running PHPUnit" +./vendor/bin/phpunit -c ./ diff --git a/src/PhpWord/Element/Field.php b/src/PhpWord/Element/Field.php index d51cba8d..4481f16b 100644 --- a/src/PhpWord/Element/Field.php +++ b/src/PhpWord/Element/Field.php @@ -74,7 +74,7 @@ class Field extends AbstractElement /** * Field text * - * @var TextRun | string + * @var TextRun|string */ protected $text; @@ -98,7 +98,7 @@ class Field extends AbstractElement * @param string $type * @param array $properties * @param array $options - * @param TextRun | string $text + * @param TextRun|string $text */ public function __construct($type = null, $properties = array(), $options = array(), $text = null) { diff --git a/src/PhpWord/Element/TrackChange.php b/src/PhpWord/Element/TrackChange.php index d900b053..9ed623f9 100644 --- a/src/PhpWord/Element/TrackChange.php +++ b/src/PhpWord/Element/TrackChange.php @@ -37,7 +37,7 @@ class TrackChange extends AbstractContainer /** * Date * - * @var DateTime + * @var \DateTime */ private $date; diff --git a/src/PhpWord/Reader/Word2007/Settings.php b/src/PhpWord/Reader/Word2007/Settings.php index 2580209e..c116425e 100644 --- a/src/PhpWord/Reader/Word2007/Settings.php +++ b/src/PhpWord/Reader/Word2007/Settings.php @@ -150,11 +150,11 @@ class Settings extends AbstractPart protected function setRevisionView(XMLReader $xmlReader, PhpWord $phpWord, \DOMElement $node) { $revisionView = new TrackChangesView(); - $revisionView->setMarkup($xmlReader->getAttribute('w:markup', $node)); + $revisionView->setMarkup(filter_var($xmlReader->getAttribute('w:markup', $node), FILTER_VALIDATE_BOOLEAN)); $revisionView->setComments($xmlReader->getAttribute('w:comments', $node)); $revisionView->setInsDel($xmlReader->getAttribute('w:insDel', $node)); - $revisionView->setFormatting($xmlReader->getAttribute('w:formatting', $node)); - $revisionView->setInkAnnotations($xmlReader->getAttribute('w:inkAnnotations', $node)); + $revisionView->setFormatting(filter_var($xmlReader->getAttribute('w:formatting', $node), FILTER_VALIDATE_BOOLEAN)); + $revisionView->setInkAnnotations(filter_var($xmlReader->getAttribute('w:inkAnnotations', $node), FILTER_VALIDATE_BOOLEAN)); $phpWord->getSettings()->setRevisionView($revisionView); } } diff --git a/src/PhpWord/Shared/AbstractEnum.php b/src/PhpWord/Shared/AbstractEnum.php index 58601a14..442d8251 100644 --- a/src/PhpWord/Shared/AbstractEnum.php +++ b/src/PhpWord/Shared/AbstractEnum.php @@ -48,7 +48,7 @@ abstract class AbstractEnum /** * Returns true the value is valid for this enum * - * @param strign $value + * @param string $value * @return bool true if value is valid */ public static function isValid($value) diff --git a/src/PhpWord/Shared/ZipArchive.php b/src/PhpWord/Shared/ZipArchive.php index d73f6c33..77a84488 100644 --- a/src/PhpWord/Shared/ZipArchive.php +++ b/src/PhpWord/Shared/ZipArchive.php @@ -351,7 +351,7 @@ class ZipArchive * Returns the name of an entry using its index (emulate \ZipArchive) * * @param int $index - * @return string + * @return string|bool * @since 0.10.0 */ public function pclzipGetNameIndex($index) diff --git a/src/PhpWord/Writer/ODText/Element/Text.php b/src/PhpWord/Writer/ODText/Element/Text.php index dc377699..1fc0b800 100644 --- a/src/PhpWord/Writer/ODText/Element/Text.php +++ b/src/PhpWord/Writer/ODText/Element/Text.php @@ -18,7 +18,6 @@ namespace PhpOffice\PhpWord\Writer\ODText\Element; use PhpOffice\PhpWord\Exception\Exception; -use PhpOffice\PhpWord\Settings; /** * Text element writer From ca25eba8aa6b2e07d0d345d2104c21014ccc0e92 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 26 Nov 2017 22:55:37 +0100 Subject: [PATCH 162/370] Scrutinizer fixes --- phpstan.neon | 13 +++++++++++++ src/PhpWord/Element/Endnote.php | 4 +--- src/PhpWord/Element/Field.php | 4 ++-- src/PhpWord/Element/Image.php | 2 +- src/PhpWord/Element/ListItemRun.php | 3 +-- src/PhpWord/Element/Section.php | 2 +- src/PhpWord/Metadata/DocInfo.php | 2 +- src/PhpWord/Shared/PCLZip/pclzip.lib.php | 4 ++-- src/PhpWord/Writer/PDF/TCPDF.php | 17 ++++++++--------- src/PhpWord/Writer/Word2007/Element/SDT.php | 2 +- tests/PhpWord/Shared/ConverterTest.php | 6 +++--- tests/PhpWord/Style/NumberingTest.php | 16 ++++++++-------- tests/PhpWord/Style/TableTest.php | 3 +++ 13 files changed, 45 insertions(+), 33 deletions(-) create mode 100644 phpstan.neon diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 00000000..5ae6d0f2 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,13 @@ +includes: + - vendor/phpstan/phpstan/conf/config.level1.neon +parameters: + memory-limit: 200000 + autoload_directories: + - tests + autoload_files: + - tests/bootstrap.php + excludes_analyse: + - */pclzip.lib.php + - src/PhpWord/Shared/OLERead.php + - src/PhpWord/Reader/MsDoc.php + - src/PhpWord/Writer/PDF/MPDF.php \ No newline at end of file diff --git a/src/PhpWord/Element/Endnote.php b/src/PhpWord/Element/Endnote.php index 6565c039..b6e94fba 100644 --- a/src/PhpWord/Element/Endnote.php +++ b/src/PhpWord/Element/Endnote.php @@ -17,8 +17,6 @@ namespace PhpOffice\PhpWord\Element; -use PhpOffice\PhpWord\Style\Paragraph; - /** * Endnote element * @@ -38,6 +36,6 @@ class Endnote extends Footnote */ public function __construct($paragraphStyle = null) { - $this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle); + parent::__construct($paragraphStyle); } } diff --git a/src/PhpWord/Element/Field.php b/src/PhpWord/Element/Field.php index 4481f16b..6ea63c6b 100644 --- a/src/PhpWord/Element/Field.php +++ b/src/PhpWord/Element/Field.php @@ -98,7 +98,7 @@ class Field extends AbstractElement * @param string $type * @param array $properties * @param array $options - * @param TextRun|string $text + * @param TextRun|string|null $text */ public function __construct($type = null, $properties = array(), $options = array(), $text = null) { @@ -209,7 +209,7 @@ class Field extends AbstractElement * @param string|TextRun $text * * @throws \InvalidArgumentException - * @return string|TextRun + * @return null|string|TextRun */ public function setText($text) { diff --git a/src/PhpWord/Element/Image.php b/src/PhpWord/Element/Image.php index a5bd7283..f1f6bab5 100644 --- a/src/PhpWord/Element/Image.php +++ b/src/PhpWord/Element/Image.php @@ -137,7 +137,7 @@ class Image extends AbstractElement $this->setIsWatermark($watermark); $this->style = $this->setNewStyle(new ImageStyle(), $style, true); - $this->checkImage($source); + $this->checkImage(); } /** diff --git a/src/PhpWord/Element/ListItemRun.php b/src/PhpWord/Element/ListItemRun.php index 5286f662..e311dc24 100644 --- a/src/PhpWord/Element/ListItemRun.php +++ b/src/PhpWord/Element/ListItemRun.php @@ -18,7 +18,6 @@ namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\Style\ListItem as ListItemStyle; -use PhpOffice\PhpWord\Style\Paragraph; /** * List item element @@ -61,7 +60,7 @@ class ListItemRun extends TextRun } else { $this->style = $this->setNewStyle(new ListItemStyle(), $listStyle, true); } - $this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle); + parent::__construct($paragraphStyle); } /** diff --git a/src/PhpWord/Element/Section.php b/src/PhpWord/Element/Section.php index 8238277e..06acf1f9 100644 --- a/src/PhpWord/Element/Section.php +++ b/src/PhpWord/Element/Section.php @@ -142,7 +142,7 @@ class Section extends AbstractContainer /** * Get the footnote properties * - * @return \PhpOffice\PhpWord\Element\FooterProperties + * @return FootnoteProperties */ public function getFootnotePropoperties() { diff --git a/src/PhpWord/Metadata/DocInfo.php b/src/PhpWord/Metadata/DocInfo.php index e5dee659..09714f9e 100644 --- a/src/PhpWord/Metadata/DocInfo.php +++ b/src/PhpWord/Metadata/DocInfo.php @@ -410,7 +410,7 @@ class DocInfo * Get a Custom Property Value * * @param string $propertyName - * @return string + * @return mixed */ public function getCustomPropertyValue($propertyName) { diff --git a/src/PhpWord/Shared/PCLZip/pclzip.lib.php b/src/PhpWord/Shared/PCLZip/pclzip.lib.php index 0a69f687..5620c754 100644 --- a/src/PhpWord/Shared/PCLZip/pclzip.lib.php +++ b/src/PhpWord/Shared/PCLZip/pclzip.lib.php @@ -3790,7 +3790,7 @@ class PclZip } // ----- Write gz file format header - $v_binary_data = pack('va1a1Va1a1', 0x8b1f, Chr($p_entry['compression']), Chr(0x00), time(), Chr(0x00), Chr(3)); + $v_binary_data = pack('va1a1Va1a1', 0x8b1f, chr($p_entry['compression']), chr(0x00), time(), chr(0x00), chr(3)); @fwrite($v_dest_file, $v_binary_data, 10); // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks @@ -4383,7 +4383,7 @@ class PclZip //$v_bytes = ($v_bytes << 8) | Ord($v_byte); // Note we mask the old value down such that once shifted we can never end up with more than a 32bit number // Otherwise on systems where we have 64bit integers the check below for the magic number will fail. - $v_bytes = (($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); + $v_bytes = (($v_bytes & 0xFFFFFF) << 8) | ord($v_byte); // ----- Compare the bytes if ($v_bytes == 0x504b0506) { diff --git a/src/PhpWord/Writer/PDF/TCPDF.php b/src/PhpWord/Writer/PDF/TCPDF.php index 3b82511a..85e3614c 100644 --- a/src/PhpWord/Writer/PDF/TCPDF.php +++ b/src/PhpWord/Writer/PDF/TCPDF.php @@ -40,7 +40,6 @@ class TCPDF extends AbstractRenderer implements WriterInterface * Save PhpWord to file. * * @param string $filename Name of the file to save as - * @return vois */ public function save($filename = null) { @@ -55,21 +54,21 @@ class TCPDF extends AbstractRenderer implements WriterInterface $pdf->setFontSubsetting(false); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); - $pdf->addPage(); - $pdf->setFont($this->getFont()); + $pdf->AddPage(); + $pdf->SetFont($this->getFont()); $pdf->writeHTML($this->getContent()); // Write document properties $phpWord = $this->getPhpWord(); $docProps = $phpWord->getDocInfo(); - $pdf->setTitle($docProps->getTitle()); - $pdf->setAuthor($docProps->getCreator()); - $pdf->setSubject($docProps->getSubject()); - $pdf->setKeywords($docProps->getKeywords()); - $pdf->setCreator($docProps->getCreator()); + $pdf->SetTitle($docProps->getTitle()); + $pdf->SetAuthor($docProps->getCreator()); + $pdf->SetSubject($docProps->getSubject()); + $pdf->SetKeywords($docProps->getKeywords()); + $pdf->SetCreator($docProps->getCreator()); // Write to file - fwrite($fileHandle, $pdf->output($filename, 'S')); + fwrite($fileHandle, $pdf->Output($filename, 'S')); parent::restoreStateAfterSave($fileHandle); } diff --git a/src/PhpWord/Writer/Word2007/Element/SDT.php b/src/PhpWord/Writer/Word2007/Element/SDT.php index 8899a1d8..6a202564 100644 --- a/src/PhpWord/Writer/Word2007/Element/SDT.php +++ b/src/PhpWord/Writer/Word2007/Element/SDT.php @@ -101,7 +101,7 @@ class SDT extends Text */ private function writeDropDownList(XMLWriter $xmlWriter, SDTElement $element) { - $this->writecomboBox($xmlWriter, $element); + $this->writeComboBox($xmlWriter, $element); } /** diff --git a/tests/PhpWord/Shared/ConverterTest.php b/tests/PhpWord/Shared/ConverterTest.php index c7e0483d..752b9a8a 100644 --- a/tests/PhpWord/Shared/ConverterTest.php +++ b/tests/PhpWord/Shared/ConverterTest.php @@ -73,7 +73,7 @@ class ConverterTest extends \PHPUnit\Framework\TestCase $result = Converter::pixelToPoint($value); $this->assertEquals($value / 96 * 72, $result); - $result = Converter::pixelToEMU($value); + $result = Converter::pixelToEmu($value); $this->assertEquals(round($value * 9525), $result); $result = Converter::pointToTwip($value); @@ -82,7 +82,7 @@ class ConverterTest extends \PHPUnit\Framework\TestCase $result = Converter::pointToPixel($value); $this->assertEquals($value / 72 * 96, $result); - $result = Converter::pointToEMU($value); + $result = Converter::pointToEmu($value); $this->assertEquals(round($value / 72 * 96 * 9525), $result); $result = Converter::emuToPixel($value); @@ -111,7 +111,7 @@ class ConverterTest extends \PHPUnit\Framework\TestCase $values[] = array('0F9D', false); // 4 characters // Conduct test foreach ($values as $value) { - $result = Converter::htmlToRGB($value[0]); + $result = Converter::htmlToRgb($value[0]); $this->assertEquals($value[1], $result); } } diff --git a/tests/PhpWord/Style/NumberingTest.php b/tests/PhpWord/Style/NumberingTest.php index 0103c503..4ec12366 100644 --- a/tests/PhpWord/Style/NumberingTest.php +++ b/tests/PhpWord/Style/NumberingTest.php @@ -29,21 +29,21 @@ class NumberingTest extends \PHPUnit\Framework\TestCase */ public function testGetSetProperties() { - $this->object = new Numbering(); - $this->properties = array( + $object = new Numbering(); + $properties = array( 'numId' => array(null, 1), 'type' => array(null, 'singleLevel'), ); - foreach ($this->properties as $property => $value) { + foreach ($properties as $property => $value) { list($default, $expected) = $value; $get = "get{$property}"; $set = "set{$property}"; - $this->assertEquals($default, $this->object->$get()); // Default value + $this->assertEquals($default, $object->$get()); // Default value - $this->object->$set($expected); + $object->$set($expected); - $this->assertEquals($expected, $this->object->$get()); // New value + $this->assertEquals($expected, $object->$get()); // New value } } @@ -52,8 +52,8 @@ class NumberingTest extends \PHPUnit\Framework\TestCase */ public function testGetLevels() { - $this->object = new Numbering(); + $object = new Numbering(); - $this->assertEmpty($this->object->getLevels()); + $this->assertEmpty($object->getLevels()); } } diff --git a/tests/PhpWord/Style/TableTest.php b/tests/PhpWord/Style/TableTest.php index ff813927..2d57b1b8 100644 --- a/tests/PhpWord/Style/TableTest.php +++ b/tests/PhpWord/Style/TableTest.php @@ -99,6 +99,7 @@ class TableTest extends \PHPUnit\Framework\TestCase $value = 'FF0000'; $object->setBorderColor($value); + $values = array(); foreach ($parts as $part) { $get = "getBorder{$part}Color"; $values[] = $value; @@ -121,6 +122,7 @@ class TableTest extends \PHPUnit\Framework\TestCase $value = 4; $object->setBorderSize($value); + $values = array(); foreach ($parts as $part) { $get = "getBorder{$part}Size"; $values[] = $value; @@ -143,6 +145,7 @@ class TableTest extends \PHPUnit\Framework\TestCase $value = 240; $object->setCellMargin($value); + $values = array(); foreach ($parts as $part) { $get = "getCellMargin{$part}"; $values[] = $value; From 274f50ce5a6cef27bd863ed813f854600d61ac35 Mon Sep 17 00:00:00 2001 From: troosan Date: Mon, 4 Dec 2017 22:30:49 +0100 Subject: [PATCH 163/370] Add unit tests & add array type checks --- CHANGELOG.md | 5 ++++- src/PhpWord/Shared/Html.php | 4 ++-- src/PhpWord/Shared/ZipArchive.php | 3 ++- src/PhpWord/Writer/RTF/Style/Border.php | 2 +- src/PhpWord/Writer/Word2007/Part/Settings.php | 7 ++++--- tests/PhpWord/Writer/RTF/StyleTest.php | 20 +++++++++++++++++++ 6 files changed, 33 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 442f6dc0..f9679faf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,7 @@ This is the last version to support PHP 5.3 ### Fixed - Loosen dependency to Zend - Images are not being printed when generating PDF - @hubertinio #1074 #431 -- Fixed some PHP 7 warnings - @ likeuntomurphy #927 +- Fixed some PHP 7 warnings - @likeuntomurphy #927 - Fixed Word 97 reader - @alsofronie @Benpxpx @mario-rivera #912 #920 #892 - Fixed image loading over https - @troosan #988 - Impossibility to set different even and odd page headers - @troosan #981 @@ -41,6 +41,9 @@ This is the last version to support PHP 5.3 - Fix incorrect image size between windows and mac - @bskrtich #874 - Fix adding HTML table to document - @mogilvie @arivanbastos #324 +###Deprecated +- PhpWord->getProtection(), get it from the settings instead PhpWord->getSettings()->getDocumentProtection(); + v0.13.0 (31 July 2016) ------------------- This release brings several improvements in `TemplateProcessor`, automatic output escaping feature for OOXML, ODF, HTML, and RTF (turned off, by default). diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 027d5798..3f94e2ba 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -182,7 +182,7 @@ class Html { if ('li' != $node->nodeName) { $cNodes = $node->childNodes; - if (count($cNodes) > 0) { + if (!empty($cNodes)) { foreach ($cNodes as $cNode) { if ($element instanceof AbstractContainer || $element instanceof Table || $element instanceof Row) { self::parseNode($cNode, $element, $styles, $data); @@ -389,7 +389,7 @@ class Html private static function parseListItem($node, $element, &$styles, $data) { $cNodes = $node->childNodes; - if (count($cNodes) > 0) { + if (!empty($cNodes)) { $text = ''; foreach ($cNodes as $cNode) { if ($cNode->nodeName == '#text') { diff --git a/src/PhpWord/Shared/ZipArchive.php b/src/PhpWord/Shared/ZipArchive.php index 77a84488..bb42a92a 100644 --- a/src/PhpWord/Shared/ZipArchive.php +++ b/src/PhpWord/Shared/ZipArchive.php @@ -140,7 +140,8 @@ class ZipArchive } else { $zip = new \PclZip($this->filename); $this->tempDir = Settings::getTempDir(); - $this->numFiles = count($zip->listContent()); + $zipContent = $zip->listContent(); + $this->numFiles = is_array($zipContent) ? count($zipContent) : 0; } $this->zip = $zip; diff --git a/src/PhpWord/Writer/RTF/Style/Border.php b/src/PhpWord/Writer/RTF/Style/Border.php index e63d767f..0ba9f602 100644 --- a/src/PhpWord/Writer/RTF/Style/Border.php +++ b/src/PhpWord/Writer/RTF/Style/Border.php @@ -48,7 +48,7 @@ class Border extends AbstractStyle $content = ''; $sides = array('top', 'left', 'right', 'bottom'); - $sizeCount = count($this->sizes) - 1; + $sizeCount = count($this->sizes); // Page border measure // 8 = from text, infront off; 32 = from edge, infront on; 40 = from edge, infront off diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index 65cbf274..eafb6734 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -76,7 +76,7 @@ class Settings extends AbstractPart { if ($settingValue == '') { $xmlWriter->writeElement($settingKey); - } else { + } elseif (is_array($settingValue) && !empty($settingValue)) { $xmlWriter->startElement($settingKey); /** @var array $settingValue Type hint */ @@ -154,7 +154,7 @@ class Settings extends AbstractPart $this->setDocumentProtection($documentSettings->getDocumentProtection()); $this->setProofState($documentSettings->getProofState()); $this->setZoom($documentSettings->getZoom()); - $this->getCompatibility(); + $this->setCompatibility(); } /** @@ -216,6 +216,7 @@ class Settings extends AbstractPart private function setRevisionView(TrackChangesView $trackChangesView = null) { if ($trackChangesView != null) { + $revisionView = array(); $revisionView['w:markup'] = $trackChangesView->hasMarkup() ? 'true' : 'false'; $revisionView['w:comments'] = $trackChangesView->hasComments() ? 'true' : 'false'; $revisionView['w:insDel'] = $trackChangesView->hasInsDel() ? 'true' : 'false'; @@ -259,7 +260,7 @@ class Settings extends AbstractPart /** * Get compatibility setting. */ - private function getCompatibility() + private function setCompatibility() { $compatibility = $this->getParentWriter()->getPhpWord()->getCompatibility(); if ($compatibility->getOoxmlVersion() !== null) { diff --git a/tests/PhpWord/Writer/RTF/StyleTest.php b/tests/PhpWord/Writer/RTF/StyleTest.php index b9dc7b45..42f76430 100644 --- a/tests/PhpWord/Writer/RTF/StyleTest.php +++ b/tests/PhpWord/Writer/RTF/StyleTest.php @@ -17,6 +17,8 @@ namespace PhpOffice\PhpWord\Writer\RTF; +use PhpOffice\PhpWord\Writer\RTF\Style\Border; + /** * Test class for PhpOffice\PhpWord\Writer\RTF\Style subnamespace */ @@ -35,4 +37,22 @@ class StyleTest extends \PHPUnit\Framework\TestCase $this->assertEquals('', $object->write()); } } + + public function testBorderWithNonRegisteredColors() + { + $border = new Border(); + $border->setSizes(array(1, 2, 3, 4)); + $border->setColors(array('#FF0000', '#FF0000', '#FF0000', '#FF0000')); + $border->setSizes(array(20, 20, 20, 20)); + + $content = $border->write(); + + $expected = '\pgbrdropt32'; + $expected .= '\pgbrdrt\brdrs\brdrw20\brdrcf0\brsp480 '; + $expected .= '\pgbrdrl\brdrs\brdrw20\brdrcf0\brsp480 '; + $expected .= '\pgbrdrr\brdrs\brdrw20\brdrcf0\brsp480 '; + $expected .= '\pgbrdrb\brdrs\brdrw20\brdrcf0\brsp480 '; + + $this->assertEquals($expected, $content); + } } From 3b6f9cea212d319251d5912c4943ac0526b1c0d2 Mon Sep 17 00:00:00 2001 From: troosan Date: Mon, 4 Dec 2017 22:31:10 +0100 Subject: [PATCH 164/370] Allow use of stdlib 3.x --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ee4f9bd5..70b60b46 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "php": ">=5.3.3", "ext-xml": "*", "zendframework/zend-escaper": "^2.2", - "zendframework/zend-stdlib": "^2.2", + "zendframework/zend-stdlib": "^2.2 || ^3.0", "phpoffice/common": "^0.2" }, "require-dev": { From 86115b9e2dcaa8efd10c7d6e3f2415ea36380cd6 Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 5 Dec 2017 00:14:57 +0100 Subject: [PATCH 165/370] update installation instructions --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f712c6c6..85808888 100644 --- a/README.md +++ b/README.md @@ -67,10 +67,18 @@ PHPWord requires the following: ## Installation PHPWord is installed via [Composer](https://getcomposer.org/). -You just need to [add dependency](https://getcomposer.org/doc/04-schema.md#package-links>) on PHPWord into your package. +To [add a dependency](https://getcomposer.org/doc/04-schema.md#package-links>) to PHPWord in your project, either -Example: +Run the following to use the latest stable version +```sh + composer require phpoffice/phpword +``` +or if you want the latest master version +```sh + composer require phpoffice/phpword:dev-master +``` +You can of course also manually edit your composer.json file ```json { "require": { From 05e2f1bf638655793c032961d8166af993ee9c5b Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 5 Dec 2017 08:02:23 +0100 Subject: [PATCH 166/370] use non deprecated method --- src/PhpWord/Reader/MsDoc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Reader/MsDoc.php b/src/PhpWord/Reader/MsDoc.php index 297a85b4..c134377a 100644 --- a/src/PhpWord/Reader/MsDoc.php +++ b/src/PhpWord/Reader/MsDoc.php @@ -2224,7 +2224,7 @@ class MsDoc extends AbstractReader implements ReaderInterface { foreach ($this->arraySections as $itmSection) { $oSection = $this->phpWord->addSection(); - $oSection->setSettings($itmSection->styleSection); + $oSection->setStyle($itmSection->styleSection); $sHYPERLINK = ''; foreach ($this->arrayParagraphs as $itmParagraph) { From 9081ed9868f517d84a83599a5ccd4325677736a1 Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 5 Dec 2017 17:40:23 +0100 Subject: [PATCH 167/370] fix warning --- src/PhpWord/Shared/Html.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index e19c3fb6..d448e697 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -527,11 +527,11 @@ class Html /** * Parse line break - * - * @param \PhpOffice\PhpWord\Element\AbstractContainer $element - */ + * + * @param \PhpOffice\PhpWord\Element\AbstractContainer $element + */ private static function parseLineBreak($element) { $element->addTextBreak(); } -} \ No newline at end of file +} From c079bf7f10123b3b7190c25b2deb58484da2e37a Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 5 Dec 2017 20:47:34 +0100 Subject: [PATCH 168/370] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e39ed3f..82f1cc59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ This is the last version to support PHP 5.3 - Support for Comments - @troosan #1067 - Support for paragraph textAlignment - @troosan #1165 - Add support for HTML underline tag in addHtml - @zNightFalLz #1186 +- Add support for HTML
          in addHtml - @anrikun @troosan #659 - Allow to change cell width unit - guillaume-ro-fr #986 - Allow to change the line height rule @troosan From f6dd78daa6b1c7d50a06c65801c54b15f598f23a Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 5 Dec 2017 21:39:28 +0100 Subject: [PATCH 169/370] update doc and changelog --- CHANGELOG.md | 3 ++- docs/elements.rst | 21 ++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9679faf..0752a42a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ This is the last version to support PHP 5.3 - Allow to change the line height rule @troosan - Implement PageBreak for odt writer @cookiekiller #863 #824 - Allow to force an update of all fields on opening a document - @troosan #951 +- Allow adding a CheckBox in a TextRun - @irond #727 ### Fixed - Loosen dependency to Zend @@ -41,7 +42,7 @@ This is the last version to support PHP 5.3 - Fix incorrect image size between windows and mac - @bskrtich #874 - Fix adding HTML table to document - @mogilvie @arivanbastos #324 -###Deprecated +### Deprecated - PhpWord->getProtection(), get it from the settings instead PhpWord->getSettings()->getDocumentProtection(); v0.13.0 (31 July 2016) diff --git a/docs/elements.rst b/docs/elements.rst index bf3eb5ac..c73ffa06 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -39,7 +39,7 @@ column shows the containers while the rows lists the elements. +-------+-----------------+-----------+----------+----------+---------+------------+------------+ | 15 | Endnote | v | - | - | v\*\* | v\*\* | - | +-------+-----------------+-----------+----------+----------+---------+------------+------------+ -| 16 | CheckBox | v | v | v | v | - | - | +| 16 | CheckBox | v | v | v | v | v | - | +-------+-----------------+-----------+----------+----------+---------+------------+------------+ | 17 | TextBox | v | v | v | v | - | - | +-------+-----------------+-----------+----------+----------+---------+------------+------------+ @@ -47,6 +47,8 @@ column shows the containers while the rows lists the elements. +-------+-----------------+-----------+----------+----------+---------+------------+------------+ | 19 | Line | v | v | v | v | v | v | +-------+-----------------+-----------+----------+----------+---------+------------+------------+ +| 20 | Chart | v | | | v | | | ++-------+-----------------+-----------+----------+----------+---------+------------+------------+ Legend: @@ -408,7 +410,7 @@ For instance for the INDEX field, you can do the following (See `Index Field for $section->addField('INDEX', array(), array('\\e " " \\h "A" \\c "3"'), $fieldText); Line ------- +---- Line elements can be added to sections by using ``addLine``. @@ -428,8 +430,21 @@ Available line style attributes: - ``height``. Line-object height in pt. - ``flip``. Flip the line element: true, false. +Chart +----- + +Charts can be added using + +.. code-block:: php + + $categories = array('A', 'B', 'C', 'D', 'E'); + $series = array(1, 3, 2, 5, 4); + $chart = $section->addChart('line', $categories, $series); + +check out the Sample_32_Chart.php for more options and styling. + Comments ---------- +-------- Comments can be added to a document by using ``addComment``. The comment can contain formatted text. Once the comment has been added, it can be linked to any element with ``setCommentStart``. From 253b0602417e14755bdfa0b4cb17b9154cd8f2bc Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 13 Dec 2017 07:47:49 +0100 Subject: [PATCH 170/370] correctly parse on/off values (w:val="true|false|1|0|on|off") --- src/PhpWord/Reader/Word2007/AbstractPart.php | 18 +++++++++++++++--- tests/PhpWord/Reader/Word2007Test.php | 8 ++++++++ tests/PhpWord/_files/documents/reader.docx | Bin 105546 -> 105726 bytes tests/PhpWord/_includes/XmlDocument.php | 1 + 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index 521c8a7f..4b7f6e0a 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -223,7 +223,7 @@ abstract class AbstractPart // $rIdIcon = $xmlReader->getAttribute('r:id', $domNode, 'w:object/v:shape/v:imagedata'); $target = $this->getMediaTarget($docPart, $rId); if (!is_null($target)) { - $textContent = ""; + $textContent = "<Object: {$target}>"; $parent->addText($textContent, $fontStyle, $paragraphStyle); } } else { @@ -477,9 +477,9 @@ abstract class AbstractPart if (self::READ_SIZE == $method) { $style = $attributeValue / 2; } elseif (self::READ_TRUE == $method) { - $style = true; + $style = $this->isOn($attributeValue); } elseif (self::READ_FALSE == $method) { - $style = false; + $style = !$this->isOn($attributeValue); } elseif (self::READ_EQUAL == $method) { $style = $attributeValue == $expected; } @@ -487,6 +487,18 @@ abstract class AbstractPart return $style; } + /** + * Parses the value of the on/off value, null is considered true as it means the w:val attribute was not present + * + * @see http://www.datypic.com/sc/ooxml/t-w_ST_OnOff.html + * @param string $value + * @return bool + */ + private function isOn($value = null) + { + return $value == null || $value == '1' || $value == 'true' || $value == 'on'; + } + /** * Returns the target of image, object, or link as stored in ::readMainRels * diff --git a/tests/PhpWord/Reader/Word2007Test.php b/tests/PhpWord/Reader/Word2007Test.php index 8b787247..9a555672 100644 --- a/tests/PhpWord/Reader/Word2007Test.php +++ b/tests/PhpWord/Reader/Word2007Test.php @@ -18,6 +18,7 @@ namespace PhpOffice\PhpWord\Reader; use PhpOffice\PhpWord\IOFactory; +use PhpOffice\PhpWord\TestHelperDOCX; /** * Test class for PhpOffice\PhpWord\Reader\Word2007 @@ -54,6 +55,13 @@ class Word2007Test extends \PHPUnit\Framework\TestCase { $filename = __DIR__ . '/../_files/documents/reader.docx'; $phpWord = IOFactory::load($filename); + $this->assertInstanceOf('PhpOffice\\PhpWord\\PhpWord', $phpWord); + $this->assertTrue($phpWord->getSettings()->hasDoNotTrackMoves()); + $this->assertFalse($phpWord->getSettings()->hasDoNotTrackFormatting()); + $this->assertEquals(100, $phpWord->getSettings()->getZoom()); + + $doc = TestHelperDOCX::getDocument($phpWord); + $this->assertFalse($doc->elementExists('/w:document/w:body/w:p/w:r[w:t/node()="italics"]/w:rPr/w:b')); } } diff --git a/tests/PhpWord/_files/documents/reader.docx b/tests/PhpWord/_files/documents/reader.docx index ef6b6615a90234c26186e5ea689de97d045c378a..65c761e0a6a7ebfc3594466155b30e98bc273072 100644 GIT binary patch delta 4496 zcmZXXWmJ@3)b{6|8R-V;Q3R#Ch7cqK6hT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gf7{GDo`=SCm1CUM-VdB0_RxDM@)JE5{RJP_i;*3#BM&PKxC*5ddV}k?YjT|3! zuUv1(oox3RzU~h#vX5_88B?>%f4`t!smbOqwKxb833b=odc!RRTP!~s#0=jw@@Pnd zZ+3?c&SR$Nq;zL_mvo(4_5_cxOaK%C0Tw!12$jY|7l(g?Ttam?4^DnZ_JpnicLJff z0ld_SfM;nzan|HNXqHU&f#M`ce}p?p7Yb%(1B|%UJ^qtgAxa1ohp1FK5q6c+0Pb?` zACaG12L+2C11vb}9Nv?3WX=R|f^f%}R(J3R(~hAMH+vv=QX%oXF6sDCzm^E(QQ_m>B{&qGw29q-GA}f58;2&ICmMt6QTIPzVHUs8UKGxU6a|@IxAK z21I2awT9>bowETg(E9O_Xzc?19|PJTIrB)U_kz2bfF>w+ET;Rxi^t;V?Rcmh-$HO} zd+cCeHo*61rizTC8tx&mF9VSO69JARdL)oP15gF^Qvn!QdhDPw0(L(>sySKY$&{DI zK>D1cDYM2v=N!P1%H0zHTN44UKRrG;GN-b<3E--S*}?kbp+16u02MSC05`#-ejeeE z@&fk&kbnoQsCZ%l@DLA}QMnu)EV2OQlU{I?&x}m}y{>?yqbwef0~c}t##58Y$4mSd DJ_F4a diff --git a/tests/PhpWord/_includes/XmlDocument.php b/tests/PhpWord/_includes/XmlDocument.php index c82c5a8e..21a12105 100644 --- a/tests/PhpWord/_includes/XmlDocument.php +++ b/tests/PhpWord/_includes/XmlDocument.php @@ -97,6 +97,7 @@ class XmlDocument if (null === $this->xpath) { $this->xpath = new \DOMXpath($this->dom); + $this->xpath->registerNamespace('w14', 'http://schemas.microsoft.com/office/word/2010/wordml'); } return $this->xpath->query($path); From dc7cb1ee75b2edcc3ab1c19671f3b245ec353e3f Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 13 Dec 2017 22:48:58 +0100 Subject: [PATCH 171/370] update changelog & doc --- CHANGELOG.md | 1 + src/PhpWord/Element/Comment.php | 1 + src/PhpWord/Element/TrackChange.php | 1 + src/PhpWord/Reader/Word2007/AbstractPart.php | 4 ++-- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7dc8b458..51f92434 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ This is the last version to support PHP 5.3 - Padded the $args array to remove error - @kaigoh #1150, @reformed #870 - Fix incorrect image size between windows and mac - @bskrtich #874 - Fix adding HTML table to document - @mogilvie @arivanbastos #324 +- Fix parsing on/off values (w:val="true|false|1|0|on|off") - @troosan #1221 #1219 ### Deprecated - PhpWord->getProtection(), get it from the settings instead PhpWord->getSettings()->getDocumentProtection(); diff --git a/src/PhpWord/Element/Comment.php b/src/PhpWord/Element/Comment.php index 908b8785..18836929 100644 --- a/src/PhpWord/Element/Comment.php +++ b/src/PhpWord/Element/Comment.php @@ -19,6 +19,7 @@ namespace PhpOffice\PhpWord\Element; /** * Comment element + * @see http://datypic.com/sc/ooxml/t-w_CT_Comment.html */ class Comment extends TrackChange { diff --git a/src/PhpWord/Element/TrackChange.php b/src/PhpWord/Element/TrackChange.php index 9ed623f9..d14fc201 100644 --- a/src/PhpWord/Element/TrackChange.php +++ b/src/PhpWord/Element/TrackChange.php @@ -19,6 +19,7 @@ namespace PhpOffice\PhpWord\Element; /** * TrackChange element + * @see http://datypic.com/sc/ooxml/t-w_CT_TrackChange.html */ class TrackChange extends AbstractContainer { diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index 4b7f6e0a..6a48fd46 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -384,7 +384,7 @@ abstract class AbstractPart { $style = null; $margins = array('top', 'left', 'bottom', 'right'); - $borders = $margins + array('insideH', 'insideV'); + $borders = array_merge($margins, array('insideH', 'insideV')); if ($xmlReader->elementExists('w:tblPr', $domNode)) { if ($xmlReader->elementExists('w:tblPr/w:tblStyle', $domNode)) { @@ -422,7 +422,7 @@ abstract class AbstractPart 'textDirection' => array(self::READ_VALUE, 'w:textDirection'), 'gridSpan' => array(self::READ_VALUE, 'w:gridSpan'), 'vMerge' => array(self::READ_VALUE, 'w:vMerge'), - 'bgColor' => array(self::READ_VALUE, 'w:shd/w:fill'), + 'bgColor' => array(self::READ_VALUE, 'w:shd', 'w:fill'), ); return $this->readStyleDefs($xmlReader, $domNode, $styleDefs); From 9e029415cc3eafad7581346b8ed84e05d7674b08 Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 13 Dec 2017 23:17:01 +0100 Subject: [PATCH 172/370] align with pull request submitted in PHPOffice/Commom --- src/PhpWord/Metadata/Protection.php | 23 ++++--- .../Shared/Microsoft/PasswordEncoder.php | 68 ++++++++++++------- src/PhpWord/Writer/Word2007/Part/Settings.php | 2 +- .../Shared/Microsoft/PasswordEncoderTest.php | 6 +- 4 files changed, 58 insertions(+), 41 deletions(-) diff --git a/src/PhpWord/Metadata/Protection.php b/src/PhpWord/Metadata/Protection.php index 09d08aac..bb1cc1ad 100644 --- a/src/PhpWord/Metadata/Protection.php +++ b/src/PhpWord/Metadata/Protection.php @@ -18,6 +18,7 @@ namespace PhpOffice\PhpWord\Metadata; use PhpOffice\PhpWord\SimpleType\DocProtect; +use PhpOffice\PhpWord\Shared\Microsoft\PasswordEncoder; /** * Document protection class @@ -50,11 +51,11 @@ class Protection private $spinCount = 100000; /** - * Cryptographic Hashing Algorithm (see to \PhpOffice\PhpWord\Writer\Word2007\Part\Settings::$algorithmMapping) + * Cryptographic Hashing Algorithm (see constants defined in \PhpOffice\PhpWord\Shared\Microsoft\PasswordEncoder) * - * @var int + * @var string */ - private $mswordAlgorithmSid = 4; + private $algorithm = PasswordEncoder::ALGORITHM_SHA_1; /** * Salt for Password Verifier @@ -146,24 +147,24 @@ class Protection } /** - * Get algorithm-sid + * Get algorithm * - * @return int + * @return string */ - public function getMswordAlgorithmSid() + public function getAlgorithm() { - return $this->mswordAlgorithmSid; + return $this->algorithm; } /** - * Set algorithm-sid (see \PhpOffice\PhpWord\Writer\Word2007\Part\Settings::$algorithmMapping) + * Set algorithm * - * @param $mswordAlgorithmSid + * @param $algorithm * @return self */ - public function setMswordAlgorithmSid($mswordAlgorithmSid) + public function setMswordAlgorithmSid($algorithm) { - $this->mswordAlgorithmSid = $mswordAlgorithmSid; + $this->algorithm = $algorithm; return $this; } diff --git a/src/PhpWord/Shared/Microsoft/PasswordEncoder.php b/src/PhpWord/Shared/Microsoft/PasswordEncoder.php index cddcfcd3..a3ba345c 100644 --- a/src/PhpWord/Shared/Microsoft/PasswordEncoder.php +++ b/src/PhpWord/Shared/Microsoft/PasswordEncoder.php @@ -22,21 +22,36 @@ namespace PhpOffice\PhpWord\Shared\Microsoft; */ class PasswordEncoder { + const ALGORITHM_MD2 = 'MD2'; + const ALGORITHM_MD4 = 'MD4'; + const ALGORITHM_MD5 = 'MD5'; + const ALGORITHM_SHA_1 = 'SHA-1'; + const ALGORITHM_SHA_256 = 'SHA-256'; + const ALGORITHM_SHA_384 = 'SHA-384'; + const ALGORITHM_SHA_512 = 'SHA-512'; + const ALGORITHM_RIPEMD = 'RIPEMD'; + const ALGORITHM_RIPEMD_160 = 'RIPEMD-160'; + const ALGORITHM_MAC = 'MAC'; + const ALGORITHM_HMAC= 'HMAC'; + + /** + * Mapping between algorithm name and algorithm ID + * + * @var array + * @see https://msdn.microsoft.com/en-us/library/documentformat.openxml.wordprocessing.writeprotection.cryptographicalgorithmsid(v=office.14).aspx + */ private static $algorithmMapping = array( - 1 => 'md2', - 2 => 'md4', - 3 => 'md5', - 4 => 'sha1', - 5 => '', // 'mac' -> not possible with hash() - 6 => 'ripemd', - 7 => 'ripemd160', - 8 => '', - 9 => '', //'hmac' -> not possible with hash() - 10 => '', - 11 => '', - 12 => 'sha256', - 13 => 'sha384', - 14 => 'sha512', + self::ALGORITHM_MD2 => array(1, 'md2'), + self::ALGORITHM_MD4 => array(2, 'md4'), + self::ALGORITHM_MD5 => array(3, 'md5'), + self::ALGORITHM_SHA_1 => array(4, 'sha1'), + self::ALGORITHM_MAC => array(5, ''), // 'mac' -> not possible with hash() + self::ALGORITHM_RIPEMD => array(6, 'ripemd'), + self::ALGORITHM_RIPEMD_160 => array(7, 'ripemd160'), + self::ALGORITHM_HMAC => array(9, ''), //'hmac' -> not possible with hash() + self::ALGORITHM_SHA_256 => array(12, 'sha256'), + self::ALGORITHM_SHA_384 => array(13, 'sha384'), + self::ALGORITHM_SHA_512 => array(14, 'sha512'), ); private static $initialCodeArray = array( @@ -82,12 +97,12 @@ class PasswordEncoder * @see https://blogs.msdn.microsoft.com/vsod/2010/04/05/how-to-set-the-editing-restrictions-in-word-using-open-xml-sdk-2-0/ * * @param string $password - * @param number $algorithmSid + * @param string $algorithmName * @param string $salt - * @param number $spinCount + * @param integer $spinCount * @return string */ - public static function hashPassword($password, $algorithmSid = 4, $salt = null, $spinCount = 10000) + public static function hashPassword($password, $algorithmName = PasswordEncoder::ALGORITHM_SHA_1, $salt = null, $spinCount = 10000) { $origEncoding = mb_internal_encoding(); mb_internal_encoding('UTF-8'); @@ -118,7 +133,7 @@ class PasswordEncoder // Implementation Notes List: // Word requires that the initial hash of the password with the salt not be considered in the count. // The initial hash of salt + key is not included in the iteration count. - $algorithm = self::getAlgorithm($algorithmSid); + $algorithm = self::getAlgorithm($algorithmName); $generatedKey = hash($algorithm, $salt . $generatedKey, true); for ($i = 0; $i < $spinCount; $i++) { @@ -134,12 +149,12 @@ class PasswordEncoder /** * Get algorithm from self::$algorithmMapping * - * @param int $sid + * @param string $algorithmName * @return string */ - private static function getAlgorithm($sid) + private static function getAlgorithm($algorithmName) { - $algorithm = self::$algorithmMapping[$sid]; + $algorithm = self::$algorithmMapping[$algorithmName][1]; if ($algorithm == '') { $algorithm = 'sha1'; } @@ -155,16 +170,17 @@ class PasswordEncoder */ private static function buildCombinedKey($byteChars) { + $byteCharsLength = count($byteChars); // Compute the high-order word // Initialize from the initial code array (see above), depending on the passwords length. - $highOrderWord = self::$initialCodeArray[count($byteChars) - 1]; + $highOrderWord = self::$initialCodeArray[$byteCharsLength - 1]; // For each character in the password: // For every bit in the character, starting with the least significant and progressing to (but excluding) // the most significant, if the bit is set, XOR the key’s high-order word with the corresponding word from // the Encryption Matrix - for ($i = 0; $i < count($byteChars); $i++) { - $tmp = self::$passwordMaxLength - count($byteChars) + $i; + for ($i = 0; $i < $byteCharsLength; $i++) { + $tmp = self::$passwordMaxLength - $byteCharsLength + $i; $matrixRow = self::$encryptionMatrix[$tmp]; for ($intBit = 0; $intBit < 7; $intBit++) { if (($byteChars[$i] & (0x0001 << $intBit)) != 0) { @@ -177,12 +193,12 @@ class PasswordEncoder // Initialize with 0 $lowOrderWord = 0; // For each character in the password, going backwards - for ($i = count($byteChars) - 1; $i >= 0; $i--) { + for ($i = $byteCharsLength - 1; $i >= 0; $i--) { // low-order word = (((low-order word SHR 14) AND 0x0001) OR (low-order word SHL 1) AND 0x7FFF)) XOR character $lowOrderWord = (((($lowOrderWord >> 14) & 0x0001) | (($lowOrderWord << 1) & 0x7FFF)) ^ $byteChars[$i]); } // Lastly, low-order word = (((low-order word SHR 14) AND 0x0001) OR (low-order word SHL 1) AND 0x7FFF)) XOR strPassword length XOR 0xCE4B. - $lowOrderWord = (((($lowOrderWord >> 14) & 0x0001) | (($lowOrderWord << 1) & 0x7FFF)) ^ count($byteChars) ^ 0xCE4B); + $lowOrderWord = (((($lowOrderWord >> 14) & 0x0001) | (($lowOrderWord << 1) & 0x7FFF)) ^ $byteCharsLength ^ 0xCE4B); // Combine the Low and High Order Word return self::int32(($highOrderWord << 16) + $lowOrderWord); diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index 565aab2c..f292583e 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -193,7 +193,7 @@ class Settings extends AbstractPart if ($documentProtection->getSalt() == null) { $documentProtection->setSalt(openssl_random_pseudo_bytes(16)); } - $passwordHash = PasswordEncoder::hashPassword($documentProtection->getPassword(), $documentProtection->getMswordAlgorithmSid(), $documentProtection->getSalt(), $documentProtection->getSpinCount()); + $passwordHash = PasswordEncoder::hashPassword($documentProtection->getPassword(), $documentProtection->getAlgorithm(), $documentProtection->getSalt(), $documentProtection->getSpinCount()); $this->settings['w:documentProtection'] = array( '@attributes' => array( 'w:enforcement' => 1, diff --git a/tests/PhpWord/Shared/Microsoft/PasswordEncoderTest.php b/tests/PhpWord/Shared/Microsoft/PasswordEncoderTest.php index 7b2bd3e7..c42a6eb4 100644 --- a/tests/PhpWord/Shared/Microsoft/PasswordEncoderTest.php +++ b/tests/PhpWord/Shared/Microsoft/PasswordEncoderTest.php @@ -51,7 +51,7 @@ class PasswordEncoderTest extends \PHPUnit\Framework\TestCase $salt = base64_decode('uq81pJRRGFIY5U+E9gt8tA=='); //when - $hashPassword = PasswordEncoder::hashPassword($password, 4, $salt); + $hashPassword = PasswordEncoder::hashPassword($password, PasswordEncoder::ALGORITHM_SHA_1, $salt); //then TestCase::assertEquals('QiDOcpia1YzSVJPiKPwWebl9p/0=', $hashPassword); @@ -67,7 +67,7 @@ class PasswordEncoderTest extends \PHPUnit\Framework\TestCase $salt = base64_decode('uq81pJRRGFIY5U+E9gt8tA=='); //when - $hashPassword = PasswordEncoder::hashPassword($password, 5, $salt); + $hashPassword = PasswordEncoder::hashPassword($password, PasswordEncoder::ALGORITHM_MAC, $salt); //then TestCase::assertEquals('QiDOcpia1YzSVJPiKPwWebl9p/0=', $hashPassword); @@ -83,7 +83,7 @@ class PasswordEncoderTest extends \PHPUnit\Framework\TestCase $salt = base64_decode('uq81pJRRGFIY5U+E9gt8tA=='); //when - $hashPassword = PasswordEncoder::hashPassword($password, 5, $salt, 1); + $hashPassword = PasswordEncoder::hashPassword($password, PasswordEncoder::ALGORITHM_MAC, $salt, 1); //then TestCase::assertEquals('rDV9sgdDsztoCQlvRCb1lF2wxNg=', $hashPassword); From f7d2ad7201bc91f79253a6e0fdbcdaf0154679d5 Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 13 Dec 2017 23:24:37 +0100 Subject: [PATCH 173/370] formatting --- src/PhpWord/Metadata/Protection.php | 2 +- .../Shared/Microsoft/PasswordEncoder.php | 26 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/PhpWord/Metadata/Protection.php b/src/PhpWord/Metadata/Protection.php index bb1cc1ad..634751fb 100644 --- a/src/PhpWord/Metadata/Protection.php +++ b/src/PhpWord/Metadata/Protection.php @@ -17,8 +17,8 @@ namespace PhpOffice\PhpWord\Metadata; -use PhpOffice\PhpWord\SimpleType\DocProtect; use PhpOffice\PhpWord\Shared\Microsoft\PasswordEncoder; +use PhpOffice\PhpWord\SimpleType\DocProtect; /** * Document protection class diff --git a/src/PhpWord/Shared/Microsoft/PasswordEncoder.php b/src/PhpWord/Shared/Microsoft/PasswordEncoder.php index a3ba345c..a6a607a1 100644 --- a/src/PhpWord/Shared/Microsoft/PasswordEncoder.php +++ b/src/PhpWord/Shared/Microsoft/PasswordEncoder.php @@ -32,7 +32,7 @@ class PasswordEncoder const ALGORITHM_RIPEMD = 'RIPEMD'; const ALGORITHM_RIPEMD_160 = 'RIPEMD-160'; const ALGORITHM_MAC = 'MAC'; - const ALGORITHM_HMAC= 'HMAC'; + const ALGORITHM_HMAC = 'HMAC'; /** * Mapping between algorithm name and algorithm ID @@ -41,17 +41,17 @@ class PasswordEncoder * @see https://msdn.microsoft.com/en-us/library/documentformat.openxml.wordprocessing.writeprotection.cryptographicalgorithmsid(v=office.14).aspx */ private static $algorithmMapping = array( - self::ALGORITHM_MD2 => array(1, 'md2'), - self::ALGORITHM_MD4 => array(2, 'md4'), - self::ALGORITHM_MD5 => array(3, 'md5'), - self::ALGORITHM_SHA_1 => array(4, 'sha1'), - self::ALGORITHM_MAC => array(5, ''), // 'mac' -> not possible with hash() - self::ALGORITHM_RIPEMD => array(6, 'ripemd'), + self::ALGORITHM_MD2 => array(1, 'md2'), + self::ALGORITHM_MD4 => array(2, 'md4'), + self::ALGORITHM_MD5 => array(3, 'md5'), + self::ALGORITHM_SHA_1 => array(4, 'sha1'), + self::ALGORITHM_MAC => array(5, ''), // 'mac' -> not possible with hash() + self::ALGORITHM_RIPEMD => array(6, 'ripemd'), self::ALGORITHM_RIPEMD_160 => array(7, 'ripemd160'), - self::ALGORITHM_HMAC => array(9, ''), //'hmac' -> not possible with hash() - self::ALGORITHM_SHA_256 => array(12, 'sha256'), - self::ALGORITHM_SHA_384 => array(13, 'sha384'), - self::ALGORITHM_SHA_512 => array(14, 'sha512'), + self::ALGORITHM_HMAC => array(9, ''), //'hmac' -> not possible with hash() + self::ALGORITHM_SHA_256 => array(12, 'sha256'), + self::ALGORITHM_SHA_384 => array(13, 'sha384'), + self::ALGORITHM_SHA_512 => array(14, 'sha512'), ); private static $initialCodeArray = array( @@ -99,10 +99,10 @@ class PasswordEncoder * @param string $password * @param string $algorithmName * @param string $salt - * @param integer $spinCount + * @param int $spinCount * @return string */ - public static function hashPassword($password, $algorithmName = PasswordEncoder::ALGORITHM_SHA_1, $salt = null, $spinCount = 10000) + public static function hashPassword($password, $algorithmName = self::ALGORITHM_SHA_1, $salt = null, $spinCount = 10000) { $origEncoding = mb_internal_encoding(); mb_internal_encoding('UTF-8'); From 5a57409df028bb609f9f180424c0a0f489334b6f Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 13 Dec 2017 23:55:48 +0100 Subject: [PATCH 174/370] fix tests --- src/PhpWord/Metadata/Protection.php | 2 +- src/PhpWord/Shared/Microsoft/PasswordEncoder.php | 11 +++++++++++ src/PhpWord/Writer/Word2007/Part/Settings.php | 4 ++-- tests/PhpWord/Writer/Word2007/Part/SettingsTest.php | 3 ++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/PhpWord/Metadata/Protection.php b/src/PhpWord/Metadata/Protection.php index 634751fb..35391cb2 100644 --- a/src/PhpWord/Metadata/Protection.php +++ b/src/PhpWord/Metadata/Protection.php @@ -162,7 +162,7 @@ class Protection * @param $algorithm * @return self */ - public function setMswordAlgorithmSid($algorithm) + public function setAlgorithm($algorithm) { $this->algorithm = $algorithm; diff --git a/src/PhpWord/Shared/Microsoft/PasswordEncoder.php b/src/PhpWord/Shared/Microsoft/PasswordEncoder.php index a6a607a1..d3a03d97 100644 --- a/src/PhpWord/Shared/Microsoft/PasswordEncoder.php +++ b/src/PhpWord/Shared/Microsoft/PasswordEncoder.php @@ -162,6 +162,17 @@ class PasswordEncoder return $algorithm; } + /** + * Returns the algorithm ID + * + * @param sting $algorithmName + * @return int + */ + public static function getAlgorithmId($algorithmName) + { + return self::$algorithmMapping[$algorithmName][0]; + } + /** * Build combined key from low-order word and high-order word * diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index 6ac5ec4a..e56e2612 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -183,7 +183,7 @@ class Settings extends AbstractPart private function setDocumentProtection($documentProtection) { if ($documentProtection->getEditing() !== null) { - if (empty($documentProtection->getPassword())) { + if ($documentProtection->getPassword() == null) { $this->settings['w:documentProtection'] = array( '@attributes' => array( 'w:enforcement' => 1, @@ -202,7 +202,7 @@ class Settings extends AbstractPart 'w:cryptProviderType' => 'rsaFull', 'w:cryptAlgorithmClass' => 'hash', 'w:cryptAlgorithmType' => 'typeAny', - 'w:cryptAlgorithmSid' => $documentProtection->getMswordAlgorithmSid(), + 'w:cryptAlgorithmSid' => PasswordEncoder::getAlgorithmId($documentProtection->getAlgorithm()), 'w:cryptSpinCount' => $documentProtection->getSpinCount(), 'w:hash' => $passwordHash, 'w:salt' => base64_encode($documentProtection->getSalt()), diff --git a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php index 7a355042..1e6af567 100644 --- a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php @@ -24,6 +24,7 @@ use PhpOffice\PhpWord\Settings; use PhpOffice\PhpWord\SimpleType\Zoom; use PhpOffice\PhpWord\Style\Language; use PhpOffice\PhpWord\TestHelperDOCX; +use PhpOffice\PhpWord\Shared\Microsoft\PasswordEncoder; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Settings @@ -65,7 +66,7 @@ class SettingsTest extends \PHPUnit\Framework\TestCase $phpWord->getSettings()->getDocumentProtection()->setEditing('readOnly'); $phpWord->getSettings()->getDocumentProtection()->setPassword('testÄö@€!$&'); $phpWord->getSettings()->getDocumentProtection()->setSalt(base64_decode('uq81pJRRGFIY5U+E9gt8tA==')); - $phpWord->getSettings()->getDocumentProtection()->setMswordAlgorithmSid(1); + $phpWord->getSettings()->getDocumentProtection()->setAlgorithm(PasswordEncoder::ALGORITHM_MD2); $phpWord->getSettings()->getDocumentProtection()->setSpinCount(10); $doc = TestHelperDOCX::getDocument($phpWord); From 5d5362a3fda20d3e79c089510a19e696d836cf63 Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 14 Dec 2017 00:15:23 +0100 Subject: [PATCH 175/370] sort imports --- tests/PhpWord/Writer/Word2007/Part/SettingsTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php index 1e6af567..50b444b8 100644 --- a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php @@ -21,10 +21,10 @@ use PhpOffice\PhpWord\ComplexType\ProofState; use PhpOffice\PhpWord\ComplexType\TrackChangesView; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\Settings; +use PhpOffice\PhpWord\Shared\Microsoft\PasswordEncoder; use PhpOffice\PhpWord\SimpleType\Zoom; use PhpOffice\PhpWord\Style\Language; use PhpOffice\PhpWord\TestHelperDOCX; -use PhpOffice\PhpWord\Shared\Microsoft\PasswordEncoder; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Settings From 87acd3764bb0a3ce435475cca9b3a123d8df944f Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Thu, 14 Dec 2017 12:21:16 -0200 Subject: [PATCH 176/370] Clean elses --- src/PhpWord/Shared/OLERead.php | 40 ++++++++++++------------ src/PhpWord/Shared/PCLZip/pclzip.lib.php | 20 ++++++------ 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/PhpWord/Shared/OLERead.php b/src/PhpWord/Shared/OLERead.php index 1321b8da..bcdda0c3 100644 --- a/src/PhpWord/Shared/OLERead.php +++ b/src/PhpWord/Shared/OLERead.php @@ -115,7 +115,7 @@ class OLERead $bbdBlocks = (self::BIG_BLOCK_SIZE - self::BIG_BLOCK_DEPOT_BLOCKS_POS)/4; } // @codeCoverageIgnoreEnd - + for ($i = 0; $i < $bbdBlocks; ++$i) { $bigBlockDepotBlocks[$i] = self::getInt4d($this->data, $pos); $pos += 4; @@ -192,27 +192,27 @@ class OLERead $block = self::getInt4d($this->smallBlockChain, $block*4); } - return $streamData; - } else { - $numBlocks = $this->props[$stream]['size'] / self::BIG_BLOCK_SIZE; - if ($this->props[$stream]['size'] % self::BIG_BLOCK_SIZE != 0) { - ++$numBlocks; - } - - if ($numBlocks == 0) { - return '';// @codeCoverageIgnore - } - - $block = $this->props[$stream]['startBlock']; - - while ($block != -2) { - $pos = ($block + 1) * self::BIG_BLOCK_SIZE; - $streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE); - $block = self::getInt4d($this->bigBlockChain, $block*4); - } - return $streamData; } + + $numBlocks = $this->props[$stream]['size'] / self::BIG_BLOCK_SIZE; + if ($this->props[$stream]['size'] % self::BIG_BLOCK_SIZE != 0) { + ++$numBlocks; + } + + if ($numBlocks == 0) { + return '';// @codeCoverageIgnore + } + + $block = $this->props[$stream]['startBlock']; + + while ($block != -2) { + $pos = ($block + 1) * self::BIG_BLOCK_SIZE; + $streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE); + $block = self::getInt4d($this->bigBlockChain, $block*4); + } + + return $streamData; } /** diff --git a/src/PhpWord/Shared/PCLZip/pclzip.lib.php b/src/PhpWord/Shared/PCLZip/pclzip.lib.php index 5620c754..3fbc9327 100644 --- a/src/PhpWord/Shared/PCLZip/pclzip.lib.php +++ b/src/PhpWord/Shared/PCLZip/pclzip.lib.php @@ -1244,9 +1244,9 @@ class PclZip { if (PCLZIP_ERROR_EXTERNAL == 1) { return (PclErrorCode()); - } else { - return ($this->error_code); } + + return ($this->error_code); } // -------------------------------------------------------------------------------- @@ -1289,9 +1289,9 @@ class PclZip if ($p_with_code) { return ($v_value . ' (' . $this->error_code . ')'); - } else { - return ($v_value); } + + return ($v_value); } // -------------------------------------------------------------------------------- @@ -1304,13 +1304,13 @@ class PclZip { if (PCLZIP_ERROR_EXTERNAL == 1) { return (PclErrorString()); - } else { - if ($p_full) { - return ($this->errorName(true) . " : " . $this->error_string); - } else { - return ($this->error_string . " [code " . $this->error_code . "]"); - } } + + if ($p_full) { + return ($this->errorName(true) . " : " . $this->error_string); + } + + return ($this->error_string . " [code " . $this->error_code . "]"); } // -------------------------------------------------------------------------------- From 46a037ebd0ace99f10052d19aa6511a85b471f69 Mon Sep 17 00:00:00 2001 From: troosan Date: Mon, 18 Dec 2017 17:02:34 +0100 Subject: [PATCH 177/370] add composer scripts --- composer.json | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 70b60b46..41730374 100644 --- a/composer.json +++ b/composer.json @@ -34,12 +34,22 @@ "name": "Antoine de Troostembergh" } ], + "scripts": { + "check": [ + "./vendor/bin/php-cs-fixer fix --ansi --dry-run --diff", + "./vendor/bin/phpcs --report-width=200 --report-summary --report-full samples/ src/ tests/ --ignore=src/PhpWord/Shared/PCLZip --standard=PSR2 -n", + "./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php", + "./vendor/bin/phpunit --color=always" + ], + "fix": [ + "./vendor/bin/php-cs-fixer fix --ansi" + ] + }, "require": { "php": ">=5.3.3", "ext-xml": "*", "zendframework/zend-escaper": "^2.2", - "zendframework/zend-stdlib": "^2.2 || ^3.0", - "phpoffice/common": "^0.2" + "zendframework/zend-stdlib": "^2.2 || ^3.0" }, "require-dev": { "phpunit/phpunit": "^4.8.36", From 7908491ba3e24f170da5aea61fbf9b85c6c21abb Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 19 Dec 2017 22:14:52 +0100 Subject: [PATCH 178/370] revert mistakenly deleted line --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 41730374..2774ad98 100644 --- a/composer.json +++ b/composer.json @@ -49,7 +49,8 @@ "php": ">=5.3.3", "ext-xml": "*", "zendframework/zend-escaper": "^2.2", - "zendframework/zend-stdlib": "^2.2 || ^3.0" + "zendframework/zend-stdlib": "^2.2 || ^3.0", + "phpoffice/common": "^0.2" }, "require-dev": { "phpunit/phpunit": "^4.8.36", From 3e6745f14697d74b74e8d3ab9af670c8fad2ee3f Mon Sep 17 00:00:00 2001 From: SRG Group Date: Thu, 21 Dec 2017 00:03:52 +0100 Subject: [PATCH 179/370] HTML image support & TextRun paragraph style (#934) * Adding setParagraphStyle to Textrun for indentation * Html Image support added * fix formatting, add tests & update changelog --- CHANGELOG.md | 3 ++ src/PhpWord/Element/TextRun.php | 24 +++++++++- src/PhpWord/Shared/Html.php | 58 +++++++++++++++++++++++ tests/PhpWord/Element/ListItemRunTest.php | 4 +- tests/PhpWord/Element/TextRunTest.php | 33 ++++++++++++- tests/PhpWord/Shared/HtmlTest.php | 19 ++++++++ 6 files changed, 136 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51f92434..ae1618a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ This is the last version to support PHP 5.3 - Implement PageBreak for odt writer @cookiekiller #863 #824 - Allow to force an update of all fields on opening a document - @troosan #951 - Allow adding a CheckBox in a TextRun - @irond #727 +- Add support for HTML img tag - @srggroup #934 +- Add support for password protection for docx - @mariahaubner #1019 ### Fixed - Loosen dependency to Zend @@ -43,6 +45,7 @@ This is the last version to support PHP 5.3 - Fix incorrect image size between windows and mac - @bskrtich #874 - Fix adding HTML table to document - @mogilvie @arivanbastos #324 - Fix parsing on/off values (w:val="true|false|1|0|on|off") - @troosan #1221 #1219 +- Fix error on Empty Dropdown Entry - @ComputerTinker #592 ### Deprecated - PhpWord->getProtection(), get it from the settings instead PhpWord->getSettings()->getDocumentProtection(); diff --git a/src/PhpWord/Element/TextRun.php b/src/PhpWord/Element/TextRun.php index d8a898b4..6d9ae9f4 100644 --- a/src/PhpWord/Element/TextRun.php +++ b/src/PhpWord/Element/TextRun.php @@ -43,7 +43,7 @@ class TextRun extends AbstractContainer */ public function __construct($paragraphStyle = null) { - $this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle); + $this->paragraphStyle = $this->setParagraphStyle($paragraphStyle); } /** @@ -55,4 +55,26 @@ class TextRun extends AbstractContainer { return $this->paragraphStyle; } + + /** + * Set Paragraph style + * + * @param string|array|\PhpOffice\PhpWord\Style\Paragraph $style + * @return string|\PhpOffice\PhpWord\Style\Paragraph + */ + public function setParagraphStyle($style = null) + { + if (is_array($style)) { + $this->paragraphStyle = new Paragraph(); + $this->paragraphStyle->setStyleByArray($style); + } elseif ($style instanceof Paragraph) { + $this->paragraphStyle = $style; + } elseif (null === $style) { + $this->paragraphStyle = new Paragraph(); + } else { + $this->paragraphStyle = $style; + } + + return $this->paragraphStyle; + } } diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 739bfb16..8310e515 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -136,6 +136,7 @@ class Html 'ul' => array('List', null, null, $styles, $data, 3, null), 'ol' => array('List', null, null, $styles, $data, 7, null), 'li' => array('ListItem', $node, $element, $styles, $data, null, null), + 'img' => array('Image', $node, $element, $styles, null, null, null), 'br' => array('LineBreak', null, $element, $styles, null, null, null), ); @@ -506,6 +507,63 @@ class Html return $styles; } + /** + * Parse image node + * + * @param \DOMNode $node + * @param \PhpOffice\PhpWord\Element\AbstractContainer $element + * + * @return \PhpOffice\PhpWord\Element\Image + **/ + private static function parseImage($node, $element) + { + $style = array(); + foreach ($node->attributes as $attribute) { + switch ($attribute->name) { + case 'src': + $src = $attribute->value; + break; + case 'width': + $width = $attribute->value; + $style['width'] = $width; + break; + case 'height': + $height = $attribute->value; + $style['height'] = $height; + break; + case 'style': + $styleattr = explode(';', $attribute->value); + foreach ($styleattr as $attr) { + if (strpos($attr, ':')) { + list($k, $v) = explode(':', $attr); + switch ($k) { + case 'float': + if (trim($v) == 'right') { + $style['hPos'] = \PhpOffice\PhpWord\Style\Image::POS_RIGHT; + $style['hPosRelTo'] = \PhpOffice\PhpWord\Style\Image::POS_RELTO_PAGE; + $style['pos'] = \PhpOffice\PhpWord\Style\Image::POS_RELATIVE; + $style['wrap'] = \PhpOffice\PhpWord\Style\Image::WRAP_TIGHT; + $style['overlap'] = true; + } + if (trim($v) == 'left') { + $style['hPos'] = \PhpOffice\PhpWord\Style\Image::POS_LEFT; + $style['hPosRelTo'] = \PhpOffice\PhpWord\Style\Image::POS_RELTO_PAGE; + $style['pos'] = \PhpOffice\PhpWord\Style\Image::POS_RELATIVE; + $style['wrap'] = \PhpOffice\PhpWord\Style\Image::WRAP_TIGHT; + $style['overlap'] = true; + } + break; + } + } + } + break; + } + } + $newElement = $element->addImage($src, $style); + + return $newElement; + } + /** * Transforms a CSS border style into a word border style * diff --git a/tests/PhpWord/Element/ListItemRunTest.php b/tests/PhpWord/Element/ListItemRunTest.php index 999756ba..84beec02 100644 --- a/tests/PhpWord/Element/ListItemRunTest.php +++ b/tests/PhpWord/Element/ListItemRunTest.php @@ -27,13 +27,13 @@ class ListItemRunTest extends \PHPUnit\Framework\TestCase /** * New instance */ - public function testConstructNull() + public function testConstruct() { $oListItemRun = new ListItemRun(); $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\ListItemRun', $oListItemRun); $this->assertCount(0, $oListItemRun->getElements()); - $this->assertNull($oListItemRun->getParagraphStyle()); + $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Paragraph', $oListItemRun->getParagraphStyle()); } /** diff --git a/tests/PhpWord/Element/TextRunTest.php b/tests/PhpWord/Element/TextRunTest.php index 27f5af6b..59b8b89f 100644 --- a/tests/PhpWord/Element/TextRunTest.php +++ b/tests/PhpWord/Element/TextRunTest.php @@ -18,6 +18,8 @@ namespace PhpOffice\PhpWord\Element; use PhpOffice\PhpWord\PhpWord; +use PhpOffice\PhpWord\SimpleType\Jc; +use PhpOffice\PhpWord\Style\Paragraph; /** * Test class for PhpOffice\PhpWord\Element\TextRun @@ -29,13 +31,13 @@ class TextRunTest extends \PHPUnit\Framework\TestCase /** * New instance */ - public function testConstructNull() + public function testConstruct() { $oTextRun = new TextRun(); $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\TextRun', $oTextRun); $this->assertCount(0, $oTextRun->getElements()); - $this->assertNull($oTextRun->getParagraphStyle()); + $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Paragraph', $oTextRun->getParagraphStyle()); } /** @@ -62,6 +64,21 @@ class TextRunTest extends \PHPUnit\Framework\TestCase $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Paragraph', $oTextRun->getParagraphStyle()); } + /** + * New instance with object + */ + public function testConstructObject() + { + $oParagraphStyle = new Paragraph(); + $oParagraphStyle->setAlignment(Jc::BOTH); + $oTextRun = new TextRun($oParagraphStyle); + + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\TextRun', $oTextRun); + $this->assertCount(0, $oTextRun->getElements()); + $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Paragraph', $oTextRun->getParagraphStyle()); + $this->assertEquals(Jc::BOTH, $oTextRun->getParagraphStyle()->getAlignment()); + } + /** * Add text */ @@ -152,4 +169,16 @@ class TextRunTest extends \PHPUnit\Framework\TestCase $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Footnote', $element); $this->assertCount(1, $oTextRun->getElements()); } + + /** + * Get paragraph style + */ + public function testParagraph() + { + $oText = new TextRun('paragraphStyle'); + $this->assertEquals('paragraphStyle', $oText->getParagraphStyle()); + + $oText->setParagraphStyle(array('alignment' => Jc::CENTER, 'spaceAfter' => 100)); + $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Paragraph', $oText->getParagraphStyle()); + } } diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index bfe24c58..d168c09e 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -252,4 +252,23 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $this->assertEquals('This is some text', $doc->getElement('/w:document/w:body/w:p/w:r[1]/w:t')->nodeValue); $this->assertEquals('with a linebreak.', $doc->getElement('/w:document/w:body/w:p/w:r[2]/w:t')->nodeValue); } + + public function testParseImage() + { + $src = __DIR__ . '/../_files/images/firefox.png'; + + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $html = '

          '; + Html::addHtml($section, $html); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + + $baseXpath = '/w:document/w:body/w:p/w:r'; + $this->assertTrue($doc->elementExists($baseXpath . '/w:pict/v:shape')); + $this->assertStringMatchesFormat('%Swidth:150pt%S', $doc->getElementAttribute($baseXpath . '[1]/w:pict/v:shape', 'style')); + $this->assertStringMatchesFormat('%Sheight:200pt%S', $doc->getElementAttribute($baseXpath . '[1]/w:pict/v:shape', 'style')); + $this->assertStringMatchesFormat('%Smso-position-horizontal:right%S', $doc->getElementAttribute($baseXpath . '[1]/w:pict/v:shape', 'style')); + $this->assertStringMatchesFormat('%Smso-position-horizontal:left%S', $doc->getElementAttribute($baseXpath . '[2]/w:pict/v:shape', 'style')); + } } From ed704da5b2fcf76f8c0dca4b9836ae3bcda65604 Mon Sep 17 00:00:00 2001 From: troosan Date: Mon, 25 Dec 2017 01:24:20 +0100 Subject: [PATCH 180/370] set release date --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae1618a2..47567dfc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ Change Log All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). -v0.14.0 (?? Dec 2017) +v0.14.0 (28 Dec 2017) ---------------------- This release fixes several bugs and adds some new features. This is the last version to support PHP 5.3 From 56720df4875df75ed42ed07f4e3bdfc851cccce1 Mon Sep 17 00:00:00 2001 From: troosan Date: Mon, 25 Dec 2017 01:32:34 +0100 Subject: [PATCH 181/370] update version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 85808888..ac5f3b95 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ You can of course also manually edit your composer.json file ```json { "require": { - "phpoffice/phpword": "v0.13.*" + "phpoffice/phpword": "v0.14.*" } } ``` From 7250b15e74ff91c72d103ca40ae12f4524a0bf76 Mon Sep 17 00:00:00 2001 From: troosan Date: Mon, 25 Dec 2017 08:33:02 +0100 Subject: [PATCH 182/370] Title can be added in Cell --- src/PhpWord/Element/AbstractContainer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Element/AbstractContainer.php b/src/PhpWord/Element/AbstractContainer.php index 0de0cbce..e3022b50 100644 --- a/src/PhpWord/Element/AbstractContainer.php +++ b/src/PhpWord/Element/AbstractContainer.php @@ -209,7 +209,7 @@ abstract class AbstractContainer extends AbstractElement 'Footnote' => array('Section', 'TextRun', 'Cell'), 'Endnote' => array('Section', 'TextRun', 'Cell'), 'PreserveText' => array('Section', 'Header', 'Footer', 'Cell'), - 'Title' => array('Section'), + 'Title' => array('Section', 'Cell'), 'TOC' => array('Section'), 'PageBreak' => array('Section'), 'Chart' => array('Section', 'Cell'), From 512cf952aeaaa9badcce3c0eb88114f6beaeeb22 Mon Sep 17 00:00:00 2001 From: troosan Date: Mon, 25 Dec 2017 20:42:37 +0100 Subject: [PATCH 183/370] randomise temp directory name to avoid collisions --- src/PhpWord/Writer/AbstractWriter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Writer/AbstractWriter.php b/src/PhpWord/Writer/AbstractWriter.php index 50a0cad3..2be03b06 100644 --- a/src/PhpWord/Writer/AbstractWriter.php +++ b/src/PhpWord/Writer/AbstractWriter.php @@ -216,7 +216,7 @@ abstract class AbstractWriter implements WriterInterface protected function getTempFile($filename) { // Temporary directory - $this->setTempDir(Settings::getTempDir() . '/PHPWordWriter/'); + $this->setTempDir(Settings::getTempDir() . uniqid('/PHPWordWriter_'). '/'); // Temporary file $this->originalFilename = $filename; From fce1bf28c870132bef8c0f604477e14b2fa54185 Mon Sep 17 00:00:00 2001 From: troosan Date: Mon, 25 Dec 2017 22:05:46 +0100 Subject: [PATCH 184/370] format code --- src/PhpWord/Writer/AbstractWriter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Writer/AbstractWriter.php b/src/PhpWord/Writer/AbstractWriter.php index 2be03b06..884769d7 100644 --- a/src/PhpWord/Writer/AbstractWriter.php +++ b/src/PhpWord/Writer/AbstractWriter.php @@ -216,7 +216,7 @@ abstract class AbstractWriter implements WriterInterface protected function getTempFile($filename) { // Temporary directory - $this->setTempDir(Settings::getTempDir() . uniqid('/PHPWordWriter_'). '/'); + $this->setTempDir(Settings::getTempDir() . uniqid('/PHPWordWriter_') . '/'); // Temporary file $this->originalFilename = $filename; From b614497ae6dd44280be1c2dda56772198bcd25ae Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 29 Dec 2017 02:30:53 +0100 Subject: [PATCH 185/370] fix dependencies to have 7.1 compatible build (#1228) * add assertions in test methods without assertions * loosen dependencies so 7.0 & 7.1 builds can succeed * fix some scrutinizer errors * update release date --- .scrutinizer.yml | 2 +- .travis.yml | 4 +- CHANGELOG.md | 4 +- composer.json | 9 ++-- docs/ISSUE_TEMPLATE.md | 17 +++++-- docs/PULL_REQUEST_TEMPLATE.md | 7 ++- run_tests.sh | 20 -------- src/PhpWord/Element/AbstractElement.php | 12 ++--- src/PhpWord/Element/Field.php | 2 +- src/PhpWord/Element/TrackChange.php | 2 - src/PhpWord/Metadata/Protection.php | 2 +- src/PhpWord/Reader/Word2007/Settings.php | 2 +- src/PhpWord/Shared/Converter.php | 38 +++++++-------- src/PhpWord/Shared/Html.php | 1 + .../Shared/Microsoft/PasswordEncoder.php | 2 +- src/PhpWord/Shared/ZipArchive.php | 2 +- src/PhpWord/Style/Paper.php | 8 ++-- src/PhpWord/Writer/PDF/MPDF.php | 24 +++++++--- src/PhpWord/Writer/Word2007/Part/Comments.php | 4 +- tests/PhpWord/Shared/ZipArchiveTest.php | 46 +++++++++---------- tests/PhpWord/Writer/ODTextTest.php | 1 + tests/PhpWord/Writer/RTFTest.php | 1 + .../Writer/Word2007/Part/DocumentTest.php | 3 +- 23 files changed, 105 insertions(+), 108 deletions(-) delete mode 100755 run_tests.sh diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 6f982d8e..c8fe57cf 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -15,7 +15,7 @@ tools: ruleset: phpmd.xml.dist external_code_coverage: enabled: true - timeout: 900 + timeout: 1200 php_cpd: true # php_sim: # Temporarily disabled to allow focus on things other than duplicates # min_mass: 40 diff --git a/.travis.yml b/.travis.yml index 0ec84081..d63b7bb2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,14 +9,14 @@ php: - 5.6 - 7.0 - 7.1 + - 7.2 matrix: include: - php: 5.6 env: COVERAGE=1 allow_failures: - - php: 7.0 - - php: 7.1 + - php: 7.2 cache: directories: diff --git a/CHANGELOG.md b/CHANGELOG.md index 47567dfc..93945189 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,10 +3,10 @@ Change Log All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). -v0.14.0 (28 Dec 2017) +v0.14.0 (29 Dec 2017) ---------------------- This release fixes several bugs and adds some new features. -This is the last version to support PHP 5.3 +This version brings compatibility with PHP 7.0 & 7.1 ### Added - Possibility to control the footnote numbering - @troosan #1068 diff --git a/composer.json b/composer.json index 2774ad98..3cc4b131 100644 --- a/composer.json +++ b/composer.json @@ -46,23 +46,22 @@ ] }, "require": { - "php": ">=5.3.3", + "php": "^5.3.3 || ^7.0", "ext-xml": "*", "zendframework/zend-escaper": "^2.2", "zendframework/zend-stdlib": "^2.2 || ^3.0", "phpoffice/common": "^0.2" }, "require-dev": { - "phpunit/phpunit": "^4.8.36", + "phpunit/phpunit": "^4.8.36 || ^5.0", "phpdocumentor/phpdocumentor":"2.*", - "twig/twig":"1.27", "squizlabs/php_codesniffer": "^2.7", "friendsofphp/php-cs-fixer": "^2.0", "phpmd/phpmd": "2.*", - "phploc/phploc": "2.*", + "phploc/phploc": "2.* || 3.* || 4.*", "dompdf/dompdf":"0.8.*", "tecnickcom/tcpdf": "6.*", - "mpdf/mpdf": "5.*" + "mpdf/mpdf": "5.* || 6.* || 7.*" }, "suggest": { "ext-zip": "Allows writing OOXML and ODF", diff --git a/docs/ISSUE_TEMPLATE.md b/docs/ISSUE_TEMPLATE.md index 58981f8e..ee811b00 100644 --- a/docs/ISSUE_TEMPLATE.md +++ b/docs/ISSUE_TEMPLATE.md @@ -1,28 +1,35 @@ -Issue tracker is **ONLY** used for reporting bugs. NO NEW FEATURE ACCEPTED! Use [stackoverflow](https://stackoverflow.com/questions/tagged/phpword) for supporting issues. +This is: + +- [ ] a bug report +- [ ] a feature request +- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpword) # Expected Behavior Please describe the behavior you are expecting. -# Current Behavior +### Current Behavior What is the current behavior? -# Failure Information +### Failure Information Please help provide information about the failure. -## How to Reproduce +### How to Reproduce Please provide a code sample that reproduces the issue. ```php +addSection(); $section->... ``` -## Context +### Context * PHP version: * PHPWord version: 0.14 diff --git a/docs/PULL_REQUEST_TEMPLATE.md b/docs/PULL_REQUEST_TEMPLATE.md index ad9788c4..cff513a3 100644 --- a/docs/PULL_REQUEST_TEMPLATE.md +++ b/docs/PULL_REQUEST_TEMPLATE.md @@ -1,12 +1,11 @@ -# Description +### Description Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. Fixes # (issue) -# Checklist: +### Checklist: -- [ ] I have commented my code, particularly in hard-to-understand areas -- [ ] I have run phpunit, phpcs, php-cs-fixer, phpmd +- [ ] I have run `composer check` and no errors were reported - [ ] The new code is covered by unit tests - [ ] I have update the documentation to describe the changes diff --git a/run_tests.sh b/run_tests.sh deleted file mode 100755 index a5d94259..00000000 --- a/run_tests.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -echo "Running composer update" -composer update - -## PHP_CodeSniffer -echo "Running CodeSniffer" -./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip - -## PHP-CS-Fixer -echo "Running CS Fixer" -./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run - -## PHP Mess Detector -echo "Running Mess Detector" -./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php - -## PHPUnit -echo "Running PHPUnit" -./vendor/bin/phpunit -c ./ - diff --git a/src/PhpWord/Element/AbstractElement.php b/src/PhpWord/Element/AbstractElement.php index 81e18528..a65c50f4 100644 --- a/src/PhpWord/Element/AbstractElement.php +++ b/src/PhpWord/Element/AbstractElement.php @@ -228,7 +228,7 @@ abstract class AbstractElement /** * Get element unique ID * - * @return int + * @return string */ public function getElementId() { @@ -425,18 +425,18 @@ abstract class AbstractElement /** * Set enum value * - * @param mixed $value - * @param array $enum - * @param mixed $default + * @param string|null $value + * @param string[] $enum + * @param string|null $default * * @throws \InvalidArgumentException - * @return mixed + * @return string|null * * @todo Merge with the same method in AbstractStyle */ protected function setEnumVal($value = null, $enum = array(), $default = null) { - if ($value != null && trim($value) != '' && !empty($enum) && !in_array($value, $enum)) { + if ($value !== null && trim($value) != '' && !empty($enum) && !in_array($value, $enum)) { throw new \InvalidArgumentException("Invalid style value: {$value}"); } elseif ($value === null || trim($value) == '') { $value = $default; diff --git a/src/PhpWord/Element/Field.php b/src/PhpWord/Element/Field.php index 6ea63c6b..7b33a479 100644 --- a/src/PhpWord/Element/Field.php +++ b/src/PhpWord/Element/Field.php @@ -211,7 +211,7 @@ class Field extends AbstractElement * @throws \InvalidArgumentException * @return null|string|TextRun */ - public function setText($text) + public function setText($text = null) { if (isset($text)) { if (is_string($text) || $text instanceof TextRun) { diff --git a/src/PhpWord/Element/TrackChange.php b/src/PhpWord/Element/TrackChange.php index d14fc201..44327f26 100644 --- a/src/PhpWord/Element/TrackChange.php +++ b/src/PhpWord/Element/TrackChange.php @@ -52,8 +52,6 @@ class TrackChange extends AbstractContainer { $this->author = $author; $this->date = $date; - - return $this; } /** diff --git a/src/PhpWord/Metadata/Protection.php b/src/PhpWord/Metadata/Protection.php index 35391cb2..39ebc3de 100644 --- a/src/PhpWord/Metadata/Protection.php +++ b/src/PhpWord/Metadata/Protection.php @@ -182,7 +182,7 @@ class Protection /** * Set salt. Salt HAS to be 16 characters, or an exception will be thrown. * - * @param $salt + * @param string $salt * @throws \InvalidArgumentException * @return self */ diff --git a/src/PhpWord/Reader/Word2007/Settings.php b/src/PhpWord/Reader/Word2007/Settings.php index c116425e..ccdbed25 100644 --- a/src/PhpWord/Reader/Word2007/Settings.php +++ b/src/PhpWord/Reader/Word2007/Settings.php @@ -152,7 +152,7 @@ class Settings extends AbstractPart $revisionView = new TrackChangesView(); $revisionView->setMarkup(filter_var($xmlReader->getAttribute('w:markup', $node), FILTER_VALIDATE_BOOLEAN)); $revisionView->setComments($xmlReader->getAttribute('w:comments', $node)); - $revisionView->setInsDel($xmlReader->getAttribute('w:insDel', $node)); + $revisionView->setInsDel(filter_var($xmlReader->getAttribute('w:insDel', $node), FILTER_VALIDATE_BOOLEAN)); $revisionView->setFormatting(filter_var($xmlReader->getAttribute('w:formatting', $node), FILTER_VALIDATE_BOOLEAN)); $revisionView->setInkAnnotations(filter_var($xmlReader->getAttribute('w:inkAnnotations', $node), FILTER_VALIDATE_BOOLEAN)); $phpWord->getSettings()->setRevisionView($revisionView); diff --git a/src/PhpWord/Shared/Converter.php b/src/PhpWord/Shared/Converter.php index bae8985d..56687c98 100644 --- a/src/PhpWord/Shared/Converter.php +++ b/src/PhpWord/Shared/Converter.php @@ -33,7 +33,7 @@ class Converter /** * Convert centimeter to twip * - * @param int $centimeter + * @param float $centimeter * @return float */ public static function cmToTwip($centimeter = 1) @@ -44,7 +44,7 @@ class Converter /** * Convert centimeter to inch * - * @param int $centimeter + * @param float $centimeter * @return float */ public static function cmToInch($centimeter = 1) @@ -55,7 +55,7 @@ class Converter /** * Convert centimeter to pixel * - * @param int $centimeter + * @param float $centimeter * @return float */ public static function cmToPixel($centimeter = 1) @@ -66,7 +66,7 @@ class Converter /** * Convert centimeter to point * - * @param int $centimeter + * @param float $centimeter * @return float */ public static function cmToPoint($centimeter = 1) @@ -77,8 +77,8 @@ class Converter /** * Convert centimeter to EMU * - * @param int $centimeter - * @return int + * @param float $centimeter + * @return float */ public static function cmToEmu($centimeter = 1) { @@ -88,8 +88,8 @@ class Converter /** * Convert inch to twip * - * @param int $inch - * @return int + * @param float $inch + * @return float */ public static function inchToTwip($inch = 1) { @@ -99,7 +99,7 @@ class Converter /** * Convert inch to centimeter * - * @param int $inch + * @param float $inch * @return float */ public static function inchToCm($inch = 1) @@ -110,8 +110,8 @@ class Converter /** * Convert inch to pixel * - * @param int $inch - * @return int + * @param float $inch + * @return float */ public static function inchToPixel($inch = 1) { @@ -121,8 +121,8 @@ class Converter /** * Convert inch to point * - * @param int $inch - * @return int + * @param float $inch + * @return float */ public static function inchToPoint($inch = 1) { @@ -132,8 +132,8 @@ class Converter /** * Convert inch to EMU * - * @param int $inch - * @return int + * @param float $inch + * @return float */ public static function inchToEmu($inch = 1) { @@ -144,7 +144,7 @@ class Converter * Convert pixel to twip * * @param int $pixel - * @return int + * @return float */ public static function pixelToTwip($pixel = 1) { @@ -188,7 +188,7 @@ class Converter * Convert point to twip unit * * @param int $point - * @return int + * @return float */ public static function pointToTwip($point = 1) { @@ -210,7 +210,7 @@ class Converter * Convert point to EMU * * @param int $point - * @return int + * @return float */ public static function pointToEmu($point = 1) { @@ -221,7 +221,7 @@ class Converter * Convert EMU to pixel * * @param int $emu - * @return int + * @return float */ public static function emuToPixel($emu = 1) { diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 8310e515..d8a10b57 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -518,6 +518,7 @@ class Html private static function parseImage($node, $element) { $style = array(); + $src = null; foreach ($node->attributes as $attribute) { switch ($attribute->name) { case 'src': diff --git a/src/PhpWord/Shared/Microsoft/PasswordEncoder.php b/src/PhpWord/Shared/Microsoft/PasswordEncoder.php index d3a03d97..1c7b4c6c 100644 --- a/src/PhpWord/Shared/Microsoft/PasswordEncoder.php +++ b/src/PhpWord/Shared/Microsoft/PasswordEncoder.php @@ -165,7 +165,7 @@ class PasswordEncoder /** * Returns the algorithm ID * - * @param sting $algorithmName + * @param string $algorithmName * @return int */ public static function getAlgorithmId($algorithmName) diff --git a/src/PhpWord/Shared/ZipArchive.php b/src/PhpWord/Shared/ZipArchive.php index bb42a92a..3d8d0a41 100644 --- a/src/PhpWord/Shared/ZipArchive.php +++ b/src/PhpWord/Shared/ZipArchive.php @@ -161,7 +161,7 @@ class ZipArchive { if (!$this->usePclzip) { if ($this->zip->close() === false) { - throw new Exception("Could not close zip file {$this->filename}."); + throw new Exception("Could not close zip file {$this->filename}: "); } } diff --git a/src/PhpWord/Style/Paper.php b/src/PhpWord/Style/Paper.php index 2fbf59d2..09e4769e 100644 --- a/src/PhpWord/Style/Paper.php +++ b/src/PhpWord/Style/Paper.php @@ -118,14 +118,14 @@ class Paper extends AbstractStyle /** * Width * - * @var int (twip) + * @var float (twip) */ private $width; /** * Height * - * @var int (twip) + * @var float (twip) */ private $height; @@ -175,7 +175,7 @@ class Paper extends AbstractStyle /** * Get width * - * @return int + * @return float */ public function getWidth() { @@ -185,7 +185,7 @@ class Paper extends AbstractStyle /** * Get height * - * @return int + * @return float */ public function getHeight() { diff --git a/src/PhpWord/Writer/PDF/MPDF.php b/src/PhpWord/Writer/PDF/MPDF.php index 80c2eccf..e238057b 100644 --- a/src/PhpWord/Writer/PDF/MPDF.php +++ b/src/PhpWord/Writer/PDF/MPDF.php @@ -17,6 +17,8 @@ namespace PhpOffice\PhpWord\Writer\PDF; +use PhpOffice\PhpWord\PhpWord; +use PhpOffice\PhpWord\Settings; use PhpOffice\PhpWord\Writer\WriterInterface; /** @@ -27,12 +29,14 @@ use PhpOffice\PhpWord\Writer\WriterInterface; */ class MPDF extends AbstractRenderer implements WriterInterface { - /** - * Name of renderer include file - * - * @var string - */ - protected $includeFile = 'mpdf.php'; + public function __construct(PhpWord $phpWord) + { + if (file_exists(Settings::getPdfRendererPath() . '/mpdf.php')) { + // MPDF version 5.* needs this file to be included, later versions not + $this->includeFile = 'mpdf.php'; + } + parent::__construct($phpWord); + } /** * Save PhpWord to file. @@ -48,7 +52,13 @@ class MPDF extends AbstractRenderer implements WriterInterface $orientation = strtoupper('portrait'); // Create PDF - $pdf = new \mpdf(); + if ($this->includeFile != null) { + // MPDF version 5.* + $pdf = new \mpdf(); + } else { + // MPDF version > 6.* + $pdf = new \Mpdf\Mpdf(); + } $pdf->_setPageSize($paperSize, $orientation); $pdf->addPage($orientation); diff --git a/src/PhpWord/Writer/Word2007/Part/Comments.php b/src/PhpWord/Writer/Word2007/Part/Comments.php index 4551ca92..2b8f9267 100644 --- a/src/PhpWord/Writer/Word2007/Part/Comments.php +++ b/src/PhpWord/Writer/Word2007/Part/Comments.php @@ -29,7 +29,7 @@ class Comments extends AbstractPart /** * Comments collection to be written * - * @var \PhpOffice\PhpWord\Collection\Comments + * @var \PhpOffice\PhpWord\Element\Comment[] */ protected $elements; @@ -92,7 +92,7 @@ class Comments extends AbstractPart /** * Set element * - * @param \PhpOffice\PhpWord\Collection\Comments $elements + * @param \PhpOffice\PhpWord\Element\Comment[] $elements * @return self */ public function setElements($elements) diff --git a/tests/PhpWord/Shared/ZipArchiveTest.php b/tests/PhpWord/Shared/ZipArchiveTest.php index 91f0f030..cb095127 100644 --- a/tests/PhpWord/Shared/ZipArchiveTest.php +++ b/tests/PhpWord/Shared/ZipArchiveTest.php @@ -27,34 +27,34 @@ use PhpOffice\PhpWord\Settings; */ class ZipArchiveTest extends \PHPUnit\Framework\TestCase { - /** - * Test close method exception: Working in local, not working in Travis - * - * expectedException \PhpOffice\PhpWord\Exception\Exception - * expectedExceptionMessage Could not close zip file - * covers ::close - */ - public function testCloseException() - { - // $zipFile = __DIR__ . "/../_files/documents/ziptest.zip"; +// /** +// * Test close method exception: Working in local, not working in Travis +// * +// * expectedException \PhpOffice\PhpWord\Exception\Exception +// * expectedExceptionMessage Could not close zip file +// * covers ::close +// */ +// public function testCloseException() +// { +// $zipFile = __DIR__ . "/../_files/documents/ziptest.zip"; - // $object = new ZipArchive(); - // $object->open($zipFile, ZipArchive::CREATE); - // $object->addFromString('content/string.txt', 'Test'); +// $object = new ZipArchive(); +// $object->open($zipFile, ZipArchive::CREATE); +// $object->addFromString('content/string.txt', 'Test'); - // // Lock the file - // $resource = fopen($zipFile, "w"); - // flock($resource, LOCK_EX); +// // Lock the file +// $resource = fopen($zipFile, "w"); +// flock($resource, LOCK_EX); - // // Closing the file should throws an exception - // $object->close(); +// // Closing the file should throws an exception +// $object->close(); - // // Unlock the file - // flock($resource, LOCK_UN); - // fclose($resource); +// // Unlock the file +// flock($resource, LOCK_UN); +// fclose($resource); - // @unlink($zipFile); - } +// @unlink($zipFile); +// } /** * Test all methods diff --git a/tests/PhpWord/Writer/ODTextTest.php b/tests/PhpWord/Writer/ODTextTest.php index bb1b9538..1984de0f 100644 --- a/tests/PhpWord/Writer/ODTextTest.php +++ b/tests/PhpWord/Writer/ODTextTest.php @@ -110,6 +110,7 @@ class ODTextTest extends \PHPUnit\Framework\TestCase $section->addText('Test'); $writer = new ODText($phpWord); $writer->save('php://output'); + $this->assertNotNull($this->getActualOutput()); } /** diff --git a/tests/PhpWord/Writer/RTFTest.php b/tests/PhpWord/Writer/RTFTest.php index f4442043..803087e5 100644 --- a/tests/PhpWord/Writer/RTFTest.php +++ b/tests/PhpWord/Writer/RTFTest.php @@ -111,5 +111,6 @@ class RTFTest extends \PHPUnit\Framework\TestCase $section->addText(htmlspecialchars('Test', ENT_COMPAT, 'UTF-8')); $writer = new RTF($phpWord); $writer->save('php://output'); + $this->assertNotNull($this->getActualOutput()); } } diff --git a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php index 42c098cd..6998e717 100644 --- a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php @@ -58,7 +58,8 @@ class DocumentTest extends \PHPUnit\Framework\TestCase $docInfo->setCustomProperty('key6', new \DateTime()); $docInfo->setCustomProperty('key7', time(), DocInfo::PROPERTY_TYPE_DATE); - TestHelperDOCX::getDocument($phpWord); + $doc = TestHelperDOCX::getDocument($phpWord); + $this->assertNotNull($doc); // $this->assertTrue($doc->elementExists('/Properties/property[name="key1"]/vt:lpwstr')); // $this->assertTrue($doc->elementExists('/Properties/property[name="key2"]/vt:bool')); From fd7ee764380ad1c99c9075be4963d19d239bec54 Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 29 Dec 2017 03:01:36 +0100 Subject: [PATCH 186/370] create alias for develop branch --- composer.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/composer.json b/composer.json index 3cc4b131..aa4a2415 100644 --- a/composer.json +++ b/composer.json @@ -74,5 +74,10 @@ "psr-4": { "PhpOffice\\PhpWord\\": "src/PhpWord" } + }, + "extra": { + "branch-alias": { + "dev-develop": "0.15.0-dev" + } } } From d2b9e88047c0533db351bcefc0bedbe703b09411 Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 29 Dec 2017 14:36:07 +0100 Subject: [PATCH 187/370] add parsing of "align" HTML attribute --- CHANGELOG.md | 7 ++++++ samples/Sample_26_Html.php | 2 +- src/PhpWord/Shared/Html.php | 39 ++++++++++++++++++++----------- tests/PhpWord/Shared/HtmlTest.php | 4 +++- 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93945189..b5396d8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,13 @@ Change Log All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +v0.15.0 (?? ??? 2018) +---------------------- +### Added +- Parsing of "align" HTML attribute - @troosan + +### Fixed + v0.14.0 (29 Dec 2017) ---------------------- This release fixes several bugs and adds some new features. diff --git a/samples/Sample_26_Html.php b/samples/Sample_26_Html.php index ba06b063..b993f834 100644 --- a/samples/Sample_26_Html.php +++ b/samples/Sample_26_Html.php @@ -28,7 +28,7 @@ $html .= '
          '; -$html .= '
          header aheader bheader aheader b header c
          +$html .= '
          diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index d8a10b57..38d326c1 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -85,6 +85,8 @@ class Html case 'style': $styles = self::parseStyle($attribute, $styles); break; + case 'align': + $styles['alignment'] = self::mapAlign($attribute->value); } } } @@ -431,20 +433,7 @@ class Html } break; case 'text-align': - switch ($cValue) { - case 'left': - $styles['alignment'] = Jc::START; - break; - case 'right': - $styles['alignment'] = Jc::END; - break; - case 'center': - $styles['alignment'] = Jc::CENTER; - break; - case 'justify': - $styles['alignment'] = Jc::BOTH; - break; - } + $styles['alignment'] = self::mapAlign($cValue); break; case 'font-size': $styles['size'] = Converter::cssToPoint($cValue); @@ -584,6 +573,28 @@ class Html } } + /** + * Transforms a HTML/CSS alignment into a \PhpOffice\PhpWord\SimpleType\Jc + * + * @param string $cssAlignment + * @return string|null + */ + private static function mapAlign($cssAlignment) + { + switch ($cssAlignment) { + case 'left': + return Jc::START; + case 'right': + return Jc::END; + case 'center': + return Jc::CENTER; + case 'justify': + return Jc::BOTH; + } + + return null; + } + /** * Parse line break * diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index d168c09e..c7d36470 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -187,7 +187,7 @@ class HtmlTest extends \PHPUnit\Framework\TestCase { $phpWord = new \PhpOffice\PhpWord\PhpWord(); $section = $phpWord->addSection(); - $html = '
          header a
          + $html = '
          @@ -205,6 +205,8 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); $this->assertTrue($doc->elementExists('/w:document/w:body/w:tbl')); $this->assertTrue($doc->elementExists('/w:document/w:body/w:tbl/w:tr/w:tc')); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:tbl/w:tblPr/w:jc')); + $this->assertEquals(Jc::START, $doc->getElementAttribute('/w:document/w:body/w:tbl/w:tblPr/w:jc', 'w:val')); } /** From 1d8e7b8374547fac04c432cda2f54503077829f2 Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 29 Dec 2017 14:36:56 +0100 Subject: [PATCH 188/370] split composer scripts, add description (only works with composer 1.6) --- composer.json | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index aa4a2415..a79c8e19 100644 --- a/composer.json +++ b/composer.json @@ -35,16 +35,28 @@ } ], "scripts": { + "test": [ + "./vendor/bin/phpunit --color=always" + ], + "test-no-coverage": [ + "./vendor/bin/phpunit --color=always --no-coverage" + ], "check": [ "./vendor/bin/php-cs-fixer fix --ansi --dry-run --diff", "./vendor/bin/phpcs --report-width=200 --report-summary --report-full samples/ src/ tests/ --ignore=src/PhpWord/Shared/PCLZip --standard=PSR2 -n", "./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php", - "./vendor/bin/phpunit --color=always" + "@test" ], "fix": [ "./vendor/bin/php-cs-fixer fix --ansi" ] }, + "scripts-descriptions": { + "test": "Runs all unit tests", + "test-no-coverage": "Runs all unit tests, without code coverage", + "check": "Runs PHP CheckStyle and PHP Mess detector", + "fix": "Fixes issues found by PHP-CS" + }, "require": { "php": "^5.3.3 || ^7.0", "ext-xml": "*", From b20cd4fa9f5db9ee8c028d7ebe34597e9c540340 Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 29 Dec 2017 14:37:26 +0100 Subject: [PATCH 189/370] output the source code of the sample that was run --- samples/Sample_Header.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/samples/Sample_Header.php b/samples/Sample_Header.php index c4996049..36478ad6 100644 --- a/samples/Sample_Header.php +++ b/samples/Sample_Header.php @@ -43,13 +43,19 @@ $pageHeading = IS_INDEX ? '' : "

          {$pageHeading}

          "; // Populate samples $files = ''; if ($handle = opendir('.')) { - while (false !== ($file = readdir($handle))) { + $sampleFiles = array(); + while (false !== ($sampleFile = readdir($handle))) { + $sampleFiles[] = $sampleFile; + } + sort($sampleFiles); + closedir($handle); + + foreach ($sampleFiles as $file) { if (preg_match('/^Sample_\d+_/', $file)) { $name = str_replace('_', ' ', preg_replace('/(Sample_|\.php)/', '', $file)); $files .= "
        • {$name}
        • "; } } - closedir($handle); } /** @@ -78,6 +84,11 @@ function write($phpWord, $filename, $writers) } $result .= getEndingNotes($writers); + $result .= '
          ';
          +    if (file_exists($filename . '.php')) {
          +        $result .= highlight_file($filename . '.php', true);
          +    }
          +    $result .= '
          '; return $result; } From 46e179d1484b12005a0882e5bf12ee76bb5c6856 Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 29 Dec 2017 14:42:48 +0100 Subject: [PATCH 190/370] add instructions on how to run the samples in a browser --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ac5f3b95..4e3d1e2d 100644 --- a/README.md +++ b/README.md @@ -161,7 +161,8 @@ $objWriter->save('helloWorld.html'); /* Note: we skip PDF, because "HTML-to-PDF" approach is used to create PDF documents. */ ``` -More examples are provided in the [samples folder](samples/). You can also read the [Developers' Documentation](http://phpword.readthedocs.org/) and the [API Documentation](http://phpoffice.github.io/PHPWord/docs/master/) for more detail. +More examples are provided in the [samples folder](samples/). For an easy access to those samples launch `php -S localhost:8000` in the samples directory then browse to [http://localhost:8000](http://localhost:8000) to view the samples. +You can also read the [Developers' Documentation](http://phpword.readthedocs.org/) and the [API Documentation](http://phpoffice.github.io/PHPWord/docs/master/) for more detail. ## Contributing From 709ea1e14c2765ef2c439a46bafde1e027bd23f1 Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 29 Dec 2017 14:48:12 +0100 Subject: [PATCH 191/370] update changelog [skip ci] --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5396d8d..1f22bb2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). v0.15.0 (?? ??? 2018) ---------------------- ### Added -- Parsing of "align" HTML attribute - @troosan +- Parsing of "align" HTML attribute - @troosan #1231 ### Fixed From 526d0ac8defcf42354a402ce6e112fe21a89848c Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 29 Dec 2017 03:01:36 +0100 Subject: [PATCH 192/370] create alias for develop branch --- composer.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/composer.json b/composer.json index 3cc4b131..aa4a2415 100644 --- a/composer.json +++ b/composer.json @@ -74,5 +74,10 @@ "psr-4": { "PhpOffice\\PhpWord\\": "src/PhpWord" } + }, + "extra": { + "branch-alias": { + "dev-develop": "0.15.0-dev" + } } } From 400a8e65d35010c88076e425aec7af1f9132e331 Mon Sep 17 00:00:00 2001 From: Maxim Date: Fri, 29 Dec 2017 21:19:35 +0200 Subject: [PATCH 193/370] rename 'Object' classes to 'ObjectElement' (php 7.2 compatibility) (#1185) merge develop branch --- .travis.yml | 5 +++++ CHANGELOG.md | 3 ++- src/PhpWord/Element/AbstractContainer.php | 6 ++--- src/PhpWord/Element/AbstractElement.php | 7 ++++-- .../Element/{Object.php => OLEObject.php} | 4 ++-- .../Element/{Object.php => OLEObject.php} | 6 ++--- tests/PhpWord/Element/CellTest.php | 2 +- tests/PhpWord/Element/ObjectTest.php | 22 +++++++++---------- tests/PhpWord/Element/SectionTest.php | 2 +- tests/PhpWord/Writer/Word2007/ElementTest.php | 2 +- 10 files changed, 34 insertions(+), 25 deletions(-) rename src/PhpWord/Element/{Object.php => OLEObject.php} (98%) rename src/PhpWord/Writer/Word2007/Element/{Object.php => OLEObject.php} (95%) diff --git a/.travis.yml b/.travis.yml index d63b7bb2..148877ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,11 @@ matrix: - php: 5.6 env: COVERAGE=1 allow_failures: +<<<<<<< HEAD +======= + - php: 7.0 + - php: 7.1 +>>>>>>> branch 'php72_support_object_classes' of https://github.com/SailorMax/PHPWord - php: 7.2 cache: diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f22bb2e..71b331d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,7 +37,8 @@ This version brings compatibility with PHP 7.0 & 7.1 ### Fixed - Loosen dependency to Zend - Images are not being printed when generating PDF - @hubertinio #1074 #431 -- Fixed some PHP 7 warnings - @likeuntomurphy #927 +- Fixed some PHP 7 warnings - @ likeuntomurphy #927 +- Fixed PHP 7.2 compatibility (renamed `Object` class names to `ObjectElement`) - @SailorMax #1185 - Fixed Word 97 reader - @alsofronie @Benpxpx @mario-rivera #912 #920 #892 - Fixed image loading over https - @troosan #988 - Impossibility to set different even and odd page headers - @troosan #981 diff --git a/src/PhpWord/Element/AbstractContainer.php b/src/PhpWord/Element/AbstractContainer.php index e3022b50..b00424b7 100644 --- a/src/PhpWord/Element/AbstractContainer.php +++ b/src/PhpWord/Element/AbstractContainer.php @@ -37,7 +37,7 @@ namespace PhpOffice\PhpWord\Element; * @method PageBreak addPageBreak() * @method Table addTable(mixed $style = null) * @method Image addImage(string $source, mixed $style = null, bool $isWatermark = false) - * @method \PhpOffice\PhpWord\Element\Object addObject(string $source, mixed $style = null) + * @method \PhpOffice\PhpWord\Element\OLEObject addObject(string $source, mixed $style = null) * @method TextBox addTextBox(mixed $style = null) * @method Field addField(string $type = null, array $properties = array(), array $options = array(), mixed $text = null) * @method Line addLine(mixed $lineStyle = null) @@ -87,7 +87,7 @@ abstract class AbstractContainer extends AbstractElement ); $functions = array(); foreach ($elements as $element) { - $functions['add' . strtolower($element)] = $element; + $functions['add' . strtolower($element)] = $element == 'Object' ? 'OLEObject' : $element; } // Run valid `add` command @@ -193,7 +193,7 @@ abstract class AbstractContainer extends AbstractElement 'Link' => $generalContainers, 'TextBreak' => $generalContainers, 'Image' => $generalContainers, - 'Object' => $generalContainers, + 'OLEObject' => $generalContainers, 'Field' => $generalContainers, 'Line' => $generalContainers, 'Shape' => $generalContainers, diff --git a/src/PhpWord/Element/AbstractElement.php b/src/PhpWord/Element/AbstractElement.php index a65c50f4..63892b74 100644 --- a/src/PhpWord/Element/AbstractElement.php +++ b/src/PhpWord/Element/AbstractElement.php @@ -358,11 +358,14 @@ abstract class AbstractElement */ private function setMediaRelation() { - if (!$this instanceof Link && !$this instanceof Image && !$this instanceof Object) { + if (!$this instanceof Link && !$this instanceof Image && !$this instanceof OLEObject) { return; } $elementName = substr(get_class($this), strrpos(get_class($this), '\\') + 1); + if ($elementName == 'OLEObject') { + $elementName = 'Object'; + } $mediaPart = $this->getMediaPart(); $source = $this->getSource(); $image = null; @@ -372,7 +375,7 @@ abstract class AbstractElement $rId = Media::addElement($mediaPart, strtolower($elementName), $source, $image); $this->setRelationId($rId); - if ($this instanceof Object) { + if ($this instanceof OLEObject) { $icon = $this->getIcon(); $rId = Media::addElement($mediaPart, 'image', $icon, new Image($icon)); $this->setImageRelationId($rId); diff --git a/src/PhpWord/Element/Object.php b/src/PhpWord/Element/OLEObject.php similarity index 98% rename from src/PhpWord/Element/Object.php rename to src/PhpWord/Element/OLEObject.php index 8fe83224..5da94c3a 100644 --- a/src/PhpWord/Element/Object.php +++ b/src/PhpWord/Element/OLEObject.php @@ -21,9 +21,9 @@ use PhpOffice\PhpWord\Exception\InvalidObjectException; use PhpOffice\PhpWord\Style\Image as ImageStyle; /** - * Object element + * OLEObject element */ -class Object extends AbstractElement +class OLEObject extends AbstractElement { /** * Ole-Object Src diff --git a/src/PhpWord/Writer/Word2007/Element/Object.php b/src/PhpWord/Writer/Word2007/Element/OLEObject.php similarity index 95% rename from src/PhpWord/Writer/Word2007/Element/Object.php rename to src/PhpWord/Writer/Word2007/Element/OLEObject.php index 8231ec0c..50891d97 100644 --- a/src/PhpWord/Writer/Word2007/Element/Object.php +++ b/src/PhpWord/Writer/Word2007/Element/OLEObject.php @@ -20,11 +20,11 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\PhpWord\Writer\Word2007\Style\Image as ImageStyleWriter; /** - * Object element writer + * OLEObject element writer * * @since 0.10.0 */ -class Object extends AbstractElement +class OLEObject extends AbstractElement { /** * Write object element. @@ -33,7 +33,7 @@ class Object extends AbstractElement { $xmlWriter = $this->getXmlWriter(); $element = $this->getElement(); - if (!$element instanceof \PhpOffice\PhpWord\Element\Object) { + if (!$element instanceof \PhpOffice\PhpWord\Element\OLEObject) { return; } diff --git a/tests/PhpWord/Element/CellTest.php b/tests/PhpWord/Element/CellTest.php index 4e8daa0e..a1132cfa 100644 --- a/tests/PhpWord/Element/CellTest.php +++ b/tests/PhpWord/Element/CellTest.php @@ -181,7 +181,7 @@ class CellTest extends \PHPUnit\Framework\TestCase $element = $oCell->addObject($src); $this->assertCount(1, $oCell->getElements()); - $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Object', $element); + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\OLEObject', $element); } /** diff --git a/tests/PhpWord/Element/ObjectTest.php b/tests/PhpWord/Element/ObjectTest.php index 71f12974..ba761b70 100644 --- a/tests/PhpWord/Element/ObjectTest.php +++ b/tests/PhpWord/Element/ObjectTest.php @@ -18,9 +18,9 @@ namespace PhpOffice\PhpWord\Element; /** - * Test class for PhpOffice\PhpWord\Element\Object + * Test class for PhpOffice\PhpWord\Element\OLEObject * - * @coversDefaultClass \PhpOffice\PhpWord\Element\Object + * @coversDefaultClass \PhpOffice\PhpWord\Element\OLEObject * @runTestsInSeparateProcesses */ class ObjectTest extends \PHPUnit\Framework\TestCase @@ -31,9 +31,9 @@ class ObjectTest extends \PHPUnit\Framework\TestCase public function testConstructWithSupportedFiles() { $src = __DIR__ . '/../_files/documents/reader.docx'; - $oObject = new Object($src); + $oObject = new OLEObject($src); - $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Object', $oObject); + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\OLEObject', $oObject); $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Image', $oObject->getStyle()); $this->assertEquals($src, $oObject->getSource()); } @@ -44,9 +44,9 @@ class ObjectTest extends \PHPUnit\Framework\TestCase public function testConstructWithSupportedFilesLong() { $src = __DIR__ . '/../_files/documents/sheet.xls'; - $oObject = new Object($src); + $oObject = new OLEObject($src); - $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Object', $oObject); + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\OLEObject', $oObject); $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Image', $oObject->getStyle()); $this->assertEquals($src, $oObject->getSource()); } @@ -59,7 +59,7 @@ class ObjectTest extends \PHPUnit\Framework\TestCase public function testConstructWithNotSupportedFiles() { $src = __DIR__ . '/../_files/xsl/passthrough.xsl'; - $oObject = new Object($src); + $oObject = new OLEObject($src); $oObject->getSource(); } @@ -69,9 +69,9 @@ class ObjectTest extends \PHPUnit\Framework\TestCase public function testConstructWithSupportedFilesAndStyle() { $src = __DIR__ . '/../_files/documents/sheet.xls'; - $oObject = new Object($src, array('width' => '230px')); + $oObject = new OLEObject($src, array('width' => '230px')); - $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Object', $oObject); + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\OLEObject', $oObject); $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Image', $oObject->getStyle()); $this->assertEquals($src, $oObject->getSource()); } @@ -82,7 +82,7 @@ class ObjectTest extends \PHPUnit\Framework\TestCase public function testRelationId() { $src = __DIR__ . '/../_files/documents/sheet.xls'; - $oObject = new Object($src); + $oObject = new OLEObject($src); $iVal = rand(1, 1000); $oObject->setRelationId($iVal); @@ -95,7 +95,7 @@ class ObjectTest extends \PHPUnit\Framework\TestCase public function testImageRelationId() { $src = __DIR__ . '/../_files/documents/sheet.xls'; - $oObject = new Object($src); + $oObject = new OLEObject($src); $iVal = rand(1, 1000); $oObject->setImageRelationId($iVal); diff --git a/tests/PhpWord/Element/SectionTest.php b/tests/PhpWord/Element/SectionTest.php index 8b6c9a43..20f0f0f7 100644 --- a/tests/PhpWord/Element/SectionTest.php +++ b/tests/PhpWord/Element/SectionTest.php @@ -70,7 +70,7 @@ class SectionTest extends \PHPUnit\Framework\TestCase 'PageBreak', 'Table', 'ListItem', - 'Object', + 'OLEObject', 'Image', 'Title', 'TextRun', diff --git a/tests/PhpWord/Writer/Word2007/ElementTest.php b/tests/PhpWord/Writer/Word2007/ElementTest.php index 12f810ce..4f0d50d9 100644 --- a/tests/PhpWord/Writer/Word2007/ElementTest.php +++ b/tests/PhpWord/Writer/Word2007/ElementTest.php @@ -44,7 +44,7 @@ class ElementTest extends \PHPUnit\Framework\TestCase { $elements = array( 'CheckBox', 'Container', 'Footnote', 'Image', 'Link', 'ListItem', 'ListItemRun', - 'Object', 'PreserveText', 'Table', 'Text', 'TextBox', 'TextBreak', 'Title', 'TOC', + 'OLEObject', 'PreserveText', 'Table', 'Text', 'TextBox', 'TextBreak', 'Title', 'TOC', 'Field', 'Line', 'Shape', 'Chart', 'FormField', 'SDT', 'Bookmark', ); foreach ($elements as $element) { From 2d87fd320dffbbdafdf280dda78dcfce34f024c1 Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 29 Dec 2017 20:27:05 +0100 Subject: [PATCH 194/370] fix merge --- .travis.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 148877ed..d63b7bb2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,11 +16,6 @@ matrix: - php: 5.6 env: COVERAGE=1 allow_failures: -<<<<<<< HEAD -======= - - php: 7.0 - - php: 7.1 ->>>>>>> branch 'php72_support_object_classes' of https://github.com/SailorMax/PHPWord - php: 7.2 cache: From d1a79b79f1cc0622bb2da1a555e0614726a5874f Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 29 Dec 2017 21:29:31 +0100 Subject: [PATCH 195/370] add branch alias for 0.15.0 [skip ci] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index aa4a2415..09e795de 100644 --- a/composer.json +++ b/composer.json @@ -77,7 +77,7 @@ }, "extra": { "branch-alias": { - "dev-develop": "0.15.0-dev" + "dev-master": "0.15.0-dev" } } } From ca29ceb1fa60c63216f15a30338c2faaeac1edb1 Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 29 Dec 2017 21:33:29 +0100 Subject: [PATCH 196/370] add branch alias for 0.15.0 [skip ci] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 09e795de..cba86eb1 100644 --- a/composer.json +++ b/composer.json @@ -77,7 +77,7 @@ }, "extra": { "branch-alias": { - "dev-master": "0.15.0-dev" + "dev-master": "0.15-dev" } } } From 23693b403c32c13a355adf0e2a32642a480066da Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 29 Dec 2017 21:47:55 +0100 Subject: [PATCH 197/370] change impl to avoid compilation issue --- src/PhpWord/Writer/PDF/MPDF.php | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/src/PhpWord/Writer/PDF/MPDF.php b/src/PhpWord/Writer/PDF/MPDF.php index e238057b..b6980a9d 100644 --- a/src/PhpWord/Writer/PDF/MPDF.php +++ b/src/PhpWord/Writer/PDF/MPDF.php @@ -29,6 +29,12 @@ use PhpOffice\PhpWord\Writer\WriterInterface; */ class MPDF extends AbstractRenderer implements WriterInterface { + /** + * Overridden to set the correct includefile, only needed for MPDF 5 + * + * @codeCoverageIgnore + * @param PhpWord $phpWord + */ public function __construct(PhpWord $phpWord) { if (file_exists(Settings::getPdfRendererPath() . '/mpdf.php')) { @@ -52,13 +58,8 @@ class MPDF extends AbstractRenderer implements WriterInterface $orientation = strtoupper('portrait'); // Create PDF - if ($this->includeFile != null) { - // MPDF version 5.* - $pdf = new \mpdf(); - } else { - // MPDF version > 6.* - $pdf = new \Mpdf\Mpdf(); - } + $mPdfClass = $this->getMPdfClassName(); + $pdf = new $mPdfClass(); $pdf->_setPageSize($paperSize, $orientation); $pdf->addPage($orientation); @@ -78,4 +79,21 @@ class MPDF extends AbstractRenderer implements WriterInterface parent::restoreStateAfterSave($fileHandle); } + + /** + * Return classname of MPDF to instantiate + * + * @codeCoverageIgnore + * @return string + */ + private function getMPdfClassName() + { + if ($this->includeFile != null) { + // MPDF version 5.* + return '\mpdf'; + } + + // MPDF version > 6.* + return '\Mpdf\Mpdf'; + } } From d480aab1b000c23f1035b62b8370492fe1d4cce2 Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 29 Dec 2017 21:29:31 +0100 Subject: [PATCH 198/370] add branch alias for 0.15.0 [skip ci] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a79c8e19..2d2743ec 100644 --- a/composer.json +++ b/composer.json @@ -89,7 +89,7 @@ }, "extra": { "branch-alias": { - "dev-develop": "0.15.0-dev" + "dev-master": "0.15.0-dev" } } } From 7d929fee8cc0aae31edbe71c7f6adf8cb3c4b545 Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 29 Dec 2017 21:33:29 +0100 Subject: [PATCH 199/370] add branch alias for 0.15.0 [skip ci] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2d2743ec..614865d8 100644 --- a/composer.json +++ b/composer.json @@ -89,7 +89,7 @@ }, "extra": { "branch-alias": { - "dev-master": "0.15.0-dev" + "dev-master": "0.15-dev" } } } From bdca366d9109d91a8deeb46558b4ed0ef347bc04 Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 3 Jan 2018 14:15:59 +0100 Subject: [PATCH 200/370] remove link to obsolete URL [skip ci] --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index ac5f3b95..61f48036 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,6 @@ Read more about PHPWord: - [Getting started](#getting-started) - [Contributing](#contributing) - [Developers' Documentation](http://phpword.readthedocs.org/) -- [API Documentation](http://phpoffice.github.io/PHPWord/docs/master/) ## Features From 4a530d1d97b064b87d9e2a1cc64cab996246569c Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 3 Jan 2018 17:16:19 +0100 Subject: [PATCH 201/370] Do not show script source when running from CLI --- samples/Sample_Header.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/samples/Sample_Header.php b/samples/Sample_Header.php index 36478ad6..ac51f983 100644 --- a/samples/Sample_Header.php +++ b/samples/Sample_Header.php @@ -84,11 +84,6 @@ function write($phpWord, $filename, $writers) } $result .= getEndingNotes($writers); - $result .= '
          ';
          -    if (file_exists($filename . '.php')) {
          -        $result .= highlight_file($filename . '.php', true);
          -    }
          -    $result .= '
          '; return $result; } @@ -127,6 +122,12 @@ function getEndingNotes($writers) } } $result .= '

          '; + + $result .= '
          ';
          +            if (file_exists($filename . '.php')) {
          +                $result .= highlight_file($filename . '.php', true);
          +            }
          +            $result .= '
          '; } } From 99b04f0353e4c2d398f8b4c4db37df5e5772fc1d Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 12 Jan 2018 23:42:22 +0100 Subject: [PATCH 202/370] fix reading of docx default style (#1238) --- CHANGELOG.md | 7 +- docs/elements.rst | 7 +- docs/general.rst | 3 +- docs/installing.rst | 1 - src/PhpWord/Reader/Word2007/AbstractPart.php | 68 +++++++++++++++++-- src/PhpWord/Reader/Word2007/Settings.php | 4 +- src/PhpWord/Reader/Word2007/Styles.php | 23 +++++++ src/PhpWord/Style/Paragraph.php | 1 - src/PhpWord/Writer/Word2007/Element/Shape.php | 4 +- src/PhpWord/Writer/Word2007/Part/Styles.php | 21 ++++-- .../Writer/Word2007/Style/Paragraph.php | 2 +- 11 files changed, 115 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71b331d6..62694eea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ v0.15.0 (?? ??? 2018) - Parsing of "align" HTML attribute - @troosan #1231 ### Fixed +- fix reading of docx default style - @troosan #1238 + + v0.14.0 (29 Dec 2017) ---------------------- @@ -58,6 +61,8 @@ This version brings compatibility with PHP 7.0 & 7.1 ### Deprecated - PhpWord->getProtection(), get it from the settings instead PhpWord->getSettings()->getDocumentProtection(); + + v0.13.0 (31 July 2016) ------------------- This release brings several improvements in `TemplateProcessor`, automatic output escaping feature for OOXML, ODF, HTML, and RTF (turned off, by default). @@ -77,7 +82,7 @@ Manual installation feature has been dropped since the release. Please, use [Com - 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 +- 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. diff --git a/docs/elements.rst b/docs/elements.rst index c73ffa06..94ff2667 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -160,7 +160,7 @@ Parameters: - ``$text``. Text that appears in the document. - ``$depth``. Depth of list item. - ``$fontStyle``. See :ref:`font-style`. -- ``$listStyle``. List style of the current element TYPE\_NUMBER, +- ``$listStyle``. List style of the current element TYPE\_NUMBER, TYPE\_ALPHANUM, TYPE\_BULLET\_FILLED, etc. See list of constants in PHPWord\\Style\\ListItem. - ``$paragraphStyle``. See :ref:`paragraph-style`. @@ -345,7 +345,7 @@ The footnote numbering can be controlled by setting the FootnoteProperties on th .. code-block:: php $fp = new PhpWord\SimpleType\FootnoteProperties(); - //sets the position of the footnote (pageBottom (default), beneathText, sectEnd, docEnd) + //sets the position of the footnote (pageBottom (default), beneathText, sectEnd, docEnd) $fp->setPos(FootnoteProperties::POSITION_DOC_END); //set the number format to use (decimal (default), upperRoman, upperLetter, ...) $fp->setNumFmt(FootnoteProperties::NUMBER_FORMAT_LOWER_ROMAN); @@ -353,7 +353,6 @@ The footnote numbering can be controlled by setting the FootnoteProperties on th $fp->setNumStart(2); //when to restart counting (continuous (default), eachSect, eachPage) $fp->setNumRestart(FootnoteProperties::RESTART_NUMBER_EACH_PAGE); - //And finaly, set it on the Section $section->setFootnoteProperties($properties); @@ -379,7 +378,7 @@ To be completed Fields ------ -Currently the following fields are supported: +Currently the following fields are supported: - PAGE - NUMPAGES diff --git a/docs/general.rst b/docs/general.rst index ae090f2d..09a23cee 100644 --- a/docs/general.rst +++ b/docs/general.rst @@ -167,7 +167,6 @@ Use mirror margins to set up facing pages for double-sided documents, such as bo $phpWord->getSettings()->setMirrorMargins(true); - Spelling and grammatical checks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -191,7 +190,7 @@ You can also specify the status of the spell and grammar checks, marking spellin Track Revisions ~~~~~~~~~~~~~~~ -Track changes can be activated using ``setTrackRevisions``, you can furture specify +Track changes can be activated using ``setTrackRevisions``, you can furture specify - Not to use move syntax, instead moved items will be seen as deleted in one place and added in another - Not track formatting revisions diff --git a/docs/installing.rst b/docs/installing.rst index 37e4d379..4f407f54 100644 --- a/docs/installing.rst +++ b/docs/installing.rst @@ -51,7 +51,6 @@ Example: } } - Using samples ------------- diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index 6a48fd46..3d853e8f 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -307,7 +307,7 @@ abstract class AbstractPart $styleNode = $xmlReader->getElement('w:pPr', $domNode); $styleDefs = array( - 'styleName' => array(self::READ_VALUE, 'w:pStyle'), + 'styleName' => array(self::READ_VALUE, array('w:pStyle', 'w:name')), 'alignment' => array(self::READ_VALUE, 'w:jc'), 'basedOn' => array(self::READ_VALUE, 'w:basedOn'), 'next' => array(self::READ_VALUE, 'w:next'), @@ -349,9 +349,9 @@ abstract class AbstractPart $styleNode = $xmlReader->getElement('w:rPr', $domNode); $styleDefs = array( 'styleName' => array(self::READ_VALUE, 'w:rStyle'), - 'name' => array(self::READ_VALUE, 'w:rFonts', 'w:ascii'), + 'name' => array(self::READ_VALUE, 'w:rFonts', array('w:ascii', 'w:hAnsi', 'w:eastAsia', 'w:cs')), 'hint' => array(self::READ_VALUE, 'w:rFonts', 'w:hint'), - 'size' => array(self::READ_SIZE, 'w:sz'), + 'size' => array(self::READ_SIZE, array('w:sz', 'w:szCs')), 'color' => array(self::READ_VALUE, 'w:color'), 'underline' => array(self::READ_VALUE, 'w:u'), 'bold' => array(self::READ_TRUE, 'w:b'), @@ -364,9 +364,7 @@ abstract class AbstractPart 'subScript' => array(self::READ_EQUAL, 'w:vertAlign', 'w:val', 'subscript'), 'fgColor' => array(self::READ_VALUE, 'w:highlight'), 'rtl' => array(self::READ_TRUE, 'w:rtl'), - 'font-latin' => array(self::READ_VALUE, 'w:font', 'w:val'), - 'font-eastAsia' => array(self::READ_VALUE, 'w:font', 'w:eastAsia'), - 'font-bidi' => array(self::READ_VALUE, 'w:font', 'w:bidi'), + 'lang' => array(self::READ_VALUE, 'w:lang'), ); return $this->readStyleDefs($xmlReader, $styleNode, $styleDefs); @@ -400,6 +398,7 @@ abstract class AbstractPart $ucfSide = ucfirst($side); $styleDefs["border{$ucfSide}Size"] = array(self::READ_VALUE, "w:tblBorders/w:$side", 'w:sz'); $styleDefs["border{$ucfSide}Color"] = array(self::READ_VALUE, "w:tblBorders/w:$side", 'w:color'); + $styleDefs["border{$ucfSide}Style"] = array(self::READ_VALUE, "w:tblBorders/w:$side", 'w:val'); } $style = $this->readStyleDefs($xmlReader, $styleNode, $styleDefs); } @@ -428,6 +427,54 @@ abstract class AbstractPart return $this->readStyleDefs($xmlReader, $domNode, $styleDefs); } + /** + * Returns the first child element found + * + * @param XMLReader $xmlReader + * @param \DOMElement $parentNode + * @param string|array $elements + * @return string|null + */ + private function findPossibleElement(XMLReader $xmlReader, \DOMElement $parentNode = null, $elements) + { + if (is_array($elements)) { + //if element is an array, we take the first element that exists in the XML + foreach ($elements as $possibleElement) { + if ($xmlReader->elementExists($possibleElement, $parentNode)) { + return $possibleElement; + } + } + } else { + return $elements; + } + + return null; + } + + /** + * Returns the first attribute found + * + * @param XMLReader $xmlReader + * @param \DOMElement $node + * @param string|array $attributes + * @return string|null + */ + private function findPossibleAttribute(XMLReader $xmlReader, \DOMElement $node, $attributes) + { + //if attribute is an array, we take the first attribute that exists in the XML + if (is_array($attributes)) { + foreach ($attributes as $possibleAttribute) { + if ($xmlReader->getAttribute($possibleAttribute, $node)) { + return $possibleAttribute; + } + } + } else { + return $attributes; + } + + return null; + } + /** * Read style definition * @@ -442,11 +489,18 @@ abstract class AbstractPart $styles = array(); foreach ($styleDefs as $styleProp => $styleVal) { - @list($method, $element, $attribute, $expected) = $styleVal; + list($method, $element, $attribute, $expected) = array_pad($styleVal, 4, null); + + $element = $this->findPossibleElement($xmlReader, $parentNode, $element); + if ($element === null) { + continue; + } if ($xmlReader->elementExists($element, $parentNode)) { $node = $xmlReader->getElement($element, $parentNode); + $attribute = $this->findPossibleAttribute($xmlReader, $node, $attribute); + // Use w:val as default if no attribute assigned $attribute = ($attribute === null) ? 'w:val' : $attribute; $attributeValue = $xmlReader->getAttribute($attribute, $node); diff --git a/src/PhpWord/Reader/Word2007/Settings.php b/src/PhpWord/Reader/Word2007/Settings.php index ccdbed25..581a546d 100644 --- a/src/PhpWord/Reader/Word2007/Settings.php +++ b/src/PhpWord/Reader/Word2007/Settings.php @@ -80,8 +80,8 @@ class Settings extends AbstractPart $themeFontLang = new Language(); $themeFontLang->setLatin($val); - $themeFontLang->setLatin($eastAsia); - $themeFontLang->setLatin($bidi); + $themeFontLang->setEastAsia($eastAsia); + $themeFontLang->setBidirectional($bidi); $phpWord->getSettings()->setThemeFontLang($themeFontLang); } diff --git a/src/PhpWord/Reader/Word2007/Styles.php b/src/PhpWord/Reader/Word2007/Styles.php index b8e6f22b..c6e64e45 100644 --- a/src/PhpWord/Reader/Word2007/Styles.php +++ b/src/PhpWord/Reader/Word2007/Styles.php @@ -19,6 +19,7 @@ namespace PhpOffice\PhpWord\Reader\Word2007; use PhpOffice\Common\XMLReader; use PhpOffice\PhpWord\PhpWord; +use PhpOffice\PhpWord\Style\Language; /** * Styles reader @@ -37,6 +38,28 @@ class Styles extends AbstractPart $xmlReader = new XMLReader(); $xmlReader->getDomFromZip($this->docFile, $this->xmlFile); + $fontDefaults = $xmlReader->getElement('w:docDefaults/w:rPrDefault'); + if ($fontDefaults !== null) { + $fontDefaultStyle = $this->readFontStyle($xmlReader, $fontDefaults); + if (array_key_exists('name', $fontDefaultStyle)) { + $phpWord->setDefaultFontName($fontDefaultStyle['name']); + } + if (array_key_exists('size', $fontDefaultStyle)) { + $phpWord->setDefaultFontSize($fontDefaultStyle['size']); + } + if (array_key_exists('lang', $fontDefaultStyle)) { + $phpWord->getSettings()->setThemeFontLang(new Language($fontDefaultStyle['lang'])); + } + } + + $paragraphDefaults = $xmlReader->getElement('w:docDefaults/w:pPrDefault'); + if ($paragraphDefaults !== null) { + $paragraphDefaultStyle = $this->readParagraphStyle($xmlReader, $paragraphDefaults); + if ($paragraphDefaultStyle != null) { + $phpWord->setDefaultParagraphStyle(); + } + } + $nodes = $xmlReader->getElements('w:style'); if ($nodes->length > 0) { foreach ($nodes as $node) { diff --git a/src/PhpWord/Style/Paragraph.php b/src/PhpWord/Style/Paragraph.php index c00dc97c..7e40d9e4 100644 --- a/src/PhpWord/Style/Paragraph.php +++ b/src/PhpWord/Style/Paragraph.php @@ -20,7 +20,6 @@ namespace PhpOffice\PhpWord\Style; use PhpOffice\Common\Text; use PhpOffice\PhpWord\Exception\InvalidStyleException; use PhpOffice\PhpWord\SimpleType\Jc; -use PhpOffice\PhpWord\SimpleType\LineSpacingRule; use PhpOffice\PhpWord\SimpleType\TextAlignment; /** diff --git a/src/PhpWord/Writer/Word2007/Element/Shape.php b/src/PhpWord/Writer/Word2007/Element/Shape.php index e384db06..9f111293 100644 --- a/src/PhpWord/Writer/Word2007/Element/Shape.php +++ b/src/PhpWord/Writer/Word2007/Element/Shape.php @@ -154,12 +154,12 @@ class Shape extends AbstractElement case 'arc': case 'line': $points = explode(' ', $value); - @list($start, $end) = $points; + list($start, $end) = array_pad($points, 2, null); $points = array('start' => $start, 'end' => $end); break; case 'curve': $points = explode(' ', $value); - @list($start, $end, $point1, $point2) = $points; + list($start, $end, $point1, $point2) = array_pad($points, 4, null); $points = array('start' => $start, 'end' => $end, 'point1' => $point1, 'point2' => $point2); break; } diff --git a/src/PhpWord/Writer/Word2007/Part/Styles.php b/src/PhpWord/Writer/Word2007/Part/Styles.php index 126cda4f..1cc94806 100644 --- a/src/PhpWord/Writer/Word2007/Part/Styles.php +++ b/src/PhpWord/Writer/Word2007/Part/Styles.php @@ -18,7 +18,6 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\Common\XMLWriter; -use PhpOffice\PhpWord\Settings as PhpWordSettings; use PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\Style\Font as FontStyle; use PhpOffice\PhpWord\Style\Paragraph as ParagraphStyle; @@ -82,9 +81,10 @@ class Styles extends AbstractPart */ private function writeDefaultStyles(XMLWriter $xmlWriter, $styles) { - $fontName = PhpWordSettings::getDefaultFontName(); - $fontSize = PhpWordSettings::getDefaultFontSize(); - $language = $this->getParentWriter()->getPhpWord()->getSettings()->getThemeFontLang(); + $phpWord = $this->getParentWriter()->getPhpWord(); + $fontName = $phpWord->getDefaultFontName(); + $fontSize = $phpWord->getDefaultFontSize(); + $language = $phpWord->getSettings()->getThemeFontLang(); $latinLanguage = ($language == null || $language->getLatin() === null) ? 'en-US' : $language->getLatin(); // Default font @@ -123,7 +123,18 @@ class Styles extends AbstractPart $xmlWriter->writeAttribute('w:val', 'Normal'); $xmlWriter->endElement(); // w:name if (isset($styles['Normal'])) { - $styleWriter = new ParagraphStyleWriter($xmlWriter, $styles['Normal']); + $normalStyle = $styles['Normal']; + // w:pPr + if ($normalStyle instanceof Fontstyle && $normalStyle->getParagraph() != null) { + $styleWriter = new ParagraphStyleWriter($xmlWriter, $normalStyle->getParagraph()); + $styleWriter->write(); + } elseif ($normalStyle instanceof ParagraphStyle) { + $styleWriter = new ParagraphStyleWriter($xmlWriter, $normalStyle); + $styleWriter->write(); + } + + // w:rPr + $styleWriter = new FontStyleWriter($xmlWriter, $normalStyle); $styleWriter->write(); } $xmlWriter->endElement(); // w:style diff --git a/src/PhpWord/Writer/Word2007/Style/Paragraph.php b/src/PhpWord/Writer/Word2007/Style/Paragraph.php index 424b87f8..8915fb4c 100644 --- a/src/PhpWord/Writer/Word2007/Style/Paragraph.php +++ b/src/PhpWord/Writer/Word2007/Style/Paragraph.php @@ -109,7 +109,7 @@ class Paragraph extends AbstractStyle //Paragraph contextualSpacing $xmlWriter->writeElementIf($styles['contextualSpacing'] === true, 'w:contextualSpacing'); - //Paragraph contextualSpacing + //Paragraph textAlignment $xmlWriter->writeElementIf($styles['textAlignment'] !== null, 'w:textAlignment', 'w:val', $styles['textAlignment']); // Child style: alignment, indentation, spacing, and shading From 4c68ebbe9dcb887c049ff1569df170551c2d5d0e Mon Sep 17 00:00:00 2001 From: samimussbach Date: Sat, 13 Jan 2018 10:03:53 +0100 Subject: [PATCH 203/370] Parse formatting inside HTML lists (#1239) --- CHANGELOG.md | 1 + README.md | 2 +- docs/elements.rst | 4 +- samples/Sample_26_Html.php | 39 +++++++++--- src/PhpWord/Element/AbstractContainer.php | 7 ++- src/PhpWord/Shared/Html.php | 75 ++++++++++++++++------ tests/PhpWord/Shared/HtmlTest.php | 76 +++++++++++++++++++++-- 7 files changed, 170 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62694eea..d6f8b2da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ v0.15.0 (?? ??? 2018) ---------------------- ### Added - Parsing of "align" HTML attribute - @troosan #1231 +- Parse formatting inside HTML lists - @troosan @samimussbach #1239 #945 #1215 #508 ### Fixed - fix reading of docx default style - @troosan #1238 diff --git a/README.md b/README.md index 07b0d439..59fc3c44 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ PHPWord is a library written in pure PHP that provides a set of classes to write to and read from different document file formats. The current version of PHPWord supports Microsoft [Office Open XML](http://en.wikipedia.org/wiki/Office_Open_XML) (OOXML or OpenXML), OASIS [Open Document Format for Office Applications](http://en.wikipedia.org/wiki/OpenDocument) (OpenDocument or ODF), [Rich Text Format](http://en.wikipedia.org/wiki/Rich_Text_Format) (RTF), HTML, and PDF. -PHPWord is an open source project licensed under the terms of [LGPL version 3](https://github.com/PHPOffice/PHPWord/blob/develop/COPYING.LESSER). PHPWord is aimed to be a high quality software product by incorporating [continuous integration](https://travis-ci.org/PHPOffice/PHPWord) and [unit testing](http://phpoffice.github.io/PHPWord/coverage/develop/). You can learn more about PHPWord by reading the [Developers' Documentation](http://phpword.readthedocs.org/) and the [API Documentation](http://phpoffice.github.io/PHPWord/docs/develop/). +PHPWord is an open source project licensed under the terms of [LGPL version 3](https://github.com/PHPOffice/PHPWord/blob/develop/COPYING.LESSER). PHPWord is aimed to be a high quality software product by incorporating [continuous integration](https://travis-ci.org/PHPOffice/PHPWord) and [unit testing](http://phpoffice.github.io/PHPWord/coverage/develop/). You can learn more about PHPWord by reading the [Developers' Documentation](http://phpword.readthedocs.org/). If you have any questions, please ask on [StackOverFlow](https://stackoverflow.com/questions/tagged/phpword) diff --git a/docs/elements.rst b/docs/elements.rst index 94ff2667..fe673304 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -405,8 +405,10 @@ For instance for the INDEX field, you can do the following (See `Index Field for $fieldText->addText('My '); $fieldText->addText('bold index', ['bold' => true]); $fieldText->addText(' entry'); + $section->addField('XE', array(), array(), $fieldText); - $section->addField('INDEX', array(), array('\\e " " \\h "A" \\c "3"'), $fieldText); + //this actually adds the index + $section->addField('INDEX', array(), array('\\e " " \\h "A" \\c "3"'), 'right click to update index'); Line ---- diff --git a/samples/Sample_26_Html.php b/samples/Sample_26_Html.php index b993f834..99a35f9c 100644 --- a/samples/Sample_26_Html.php +++ b/samples/Sample_26_Html.php @@ -9,25 +9,50 @@ $section = $phpWord->addSection(); $html = '

          Adding element via HTML

          '; $html .= '

          Some well formed HTML snippet needs to be used

          '; $html .= '

          With for example some1 inline formatting1

          '; -$html .= '

          Unordered (bulleted) list:

          '; -$html .= '
          • Item 1
          • Item 2
            • Item 2.1
            • Item 2.1
          '; -$html .= '

          Ordered (numbered) list:

          '; -$html .= '
          1. Item 1
          2. Item 2
          '; -$html .= '

          List with complex content:

          '; +$html .= '

          Unordered (bulleted) list:

          '; +$html .= '
          • Item 1
          • Item 2
            • Item 2.1
            • Item 2.1
          '; + +$html .= '

          Ordered (numbered) list:

          '; +$html .= '
            +
          1. List 1 item 1

          2. +
          3. List 1 item 2
          4. +
              +
            1. sub list 1
            2. +
            3. sub list 2
            4. +
            +
          5. List 1 item 3
          6. +
          +

          A second list, numbering should restart

          +
            +
          1. List 2 item 1
          2. +
          3. List 2 item 2
          4. +
              +
            1. sub list 1
            2. +
            3. sub list 2
            4. +
            +
          5. List 2 item 3
          6. +
              +
            1. sub list 1, restarts with a
            2. +
            3. sub list 2
            4. +
            +
          '; + +$html .= '

          List with formatted content:

          '; $html .= '
          • - list item1 + big list item1
          • - list item2 + list item2 in bold
          '; +$html .= '

          A table with formatting:

          '; $html .= '
          header a
          diff --git a/src/PhpWord/Element/AbstractContainer.php b/src/PhpWord/Element/AbstractContainer.php index b00424b7..28d45672 100644 --- a/src/PhpWord/Element/AbstractContainer.php +++ b/src/PhpWord/Element/AbstractContainer.php @@ -33,11 +33,10 @@ namespace PhpOffice\PhpWord\Element; * @method CheckBox addCheckBox(string $name, $text, mixed $fStyle = null, mixed $pStyle = null) * @method Title addTitle(string $text, int $depth = 1) * @method TOC addTOC(mixed $fontStyle = null, mixed $tocStyle = null, int $minDepth = 1, int $maxDepth = 9) - * * @method PageBreak addPageBreak() * @method Table addTable(mixed $style = null) * @method Image addImage(string $source, mixed $style = null, bool $isWatermark = false) - * @method \PhpOffice\PhpWord\Element\OLEObject addObject(string $source, mixed $style = null) + * @method OLEObject addOLEObject(string $source, mixed $style = null) * @method TextBox addTextBox(mixed $style = null) * @method Field addField(string $type = null, array $properties = array(), array $options = array(), mixed $text = null) * @method Line addLine(mixed $lineStyle = null) @@ -46,6 +45,8 @@ namespace PhpOffice\PhpWord\Element; * @method FormField addFormField(string $type, mixed $fStyle = null, mixed $pStyle = null) * @method SDT addSDT(string $type) * + * @method \PhpOffice\PhpWord\Element\OLEObject addObject(string $source, mixed $style = null) deprecated, use addOLEObject instead + * * @since 0.10.0 */ abstract class AbstractContainer extends AbstractElement @@ -200,7 +201,7 @@ abstract class AbstractContainer extends AbstractElement 'FormField' => $generalContainers, 'SDT' => $generalContainers, 'TrackChange' => $generalContainers, - 'TextRun' => array('Section', 'Header', 'Footer', 'Cell', 'TextBox', 'TrackChange'), + 'TextRun' => array('Section', 'Header', 'Footer', 'Cell', 'TextBox', 'TrackChange', 'ListItemRun'), 'ListItem' => array('Section', 'Header', 'Footer', 'Cell', 'TextBox'), 'ListItemRun' => array('Section', 'Header', 'Footer', 'Cell', 'TextBox'), 'Table' => array('Section', 'Header', 'Footer', 'Cell', 'TextBox'), diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 38d326c1..fd0bd545 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -18,10 +18,10 @@ namespace PhpOffice\PhpWord\Shared; use PhpOffice\PhpWord\Element\AbstractContainer; -use PhpOffice\PhpWord\Element\Cell; use PhpOffice\PhpWord\Element\Row; use PhpOffice\PhpWord\Element\Table; use PhpOffice\PhpWord\SimpleType\Jc; +use PhpOffice\PhpWord\SimpleType\NumberFormat; /** * Common Html functions @@ -30,6 +30,8 @@ use PhpOffice\PhpWord\SimpleType\Jc; */ class Html { + private static $listIndex = 0; + /** * Add HTML parts. * @@ -135,8 +137,8 @@ class Html 'tr' => array('Row', $node, $element, $styles, null, null, null), 'td' => array('Cell', $node, $element, $styles, null, null, null), 'th' => array('Cell', $node, $element, $styles, null, null, null), - 'ul' => array('List', null, null, $styles, $data, 3, null), - 'ol' => array('List', null, null, $styles, $data, 7, null), + 'ul' => array('List', $node, $element, $styles, $data, null, null), + 'ol' => array('List', $node, $element, $styles, $data, null, null), 'li' => array('ListItem', $node, $element, $styles, $data, null, null), 'img' => array('Image', $node, $element, $styles, null, null, null), 'br' => array('LineBreak', null, $element, $styles, null, null, null), @@ -330,7 +332,7 @@ class Html * @param \DOMNode $node * @param \PhpOffice\PhpWord\Element\Table $element * @param array &$styles - * @return Cell $element + * @return \PhpOffice\PhpWord\Element\Cell $element */ private static function parseCell($node, $element, &$styles) { @@ -365,18 +367,56 @@ class Html /** * Parse list node * + * @param \DOMNode $node + * @param \PhpOffice\PhpWord\Element\AbstractContainer $element * @param array &$styles * @param array &$data - * @param string $argument1 List type */ - private static function parseList(&$styles, &$data, $argument1) + private static function parseList($node, $element, &$styles, &$data) { + $isOrderedList = $node->nodeName == 'ol'; if (isset($data['listdepth'])) { $data['listdepth']++; } else { $data['listdepth'] = 0; + $styles['list'] = 'listStyle_' . self::$listIndex++; + $element->getPhpWord()->addNumberingStyle($styles['list'], self::getListStyle($isOrderedList)); } - $styles['list']['listType'] = $argument1; + } + + private static function getListStyle($isOrderedList) + { + if ($isOrderedList) { + return array( + 'type' => 'multilevel', + 'levels' => array( + array('format' => NumberFormat::DECIMAL, 'text' => '%1.', 'alignment' => 'left', 'tabPos' => 720, 'left' => 720, 'hanging' => 360), + array('format' => NumberFormat::LOWER_LETTER, 'text' => '%2.', 'alignment' => 'left', 'tabPos' => 1440, 'left' => 1440, 'hanging' => 360), + array('format' => NumberFormat::LOWER_ROMAN, 'text' => '%3.', 'alignment' => 'right', 'tabPos' => 2160, 'left' => 2160, 'hanging' => 180), + array('format' => NumberFormat::DECIMAL, 'text' => '%4.', 'alignment' => 'left', 'tabPos' => 2880, 'left' => 2880, 'hanging' => 360), + array('format' => NumberFormat::LOWER_LETTER, 'text' => '%5.', 'alignment' => 'left', 'tabPos' => 3600, 'left' => 3600, 'hanging' => 360), + array('format' => NumberFormat::LOWER_ROMAN, 'text' => '%6.', 'alignment' => 'right', 'tabPos' => 4320, 'left' => 4320, 'hanging' => 180), + array('format' => NumberFormat::DECIMAL, 'text' => '%7.', 'alignment' => 'left', 'tabPos' => 5040, 'left' => 5040, 'hanging' => 360), + array('format' => NumberFormat::LOWER_LETTER, 'text' => '%8.', 'alignment' => 'left', 'tabPos' => 5760, 'left' => 5760, 'hanging' => 360), + array('format' => NumberFormat::LOWER_ROMAN, 'text' => '%9.', 'alignment' => 'right', 'tabPos' => 6480, 'left' => 6480, 'hanging' => 180), + ), + ); + } + + return array( + 'type' => 'hybridMultilevel', + 'levels' => array( + array('format' => NumberFormat::BULLET, 'text' => '', 'alignment' => 'left', 'tabPos' => 720, 'left' => 720, 'hanging' => 360, 'font' => 'Symbol', 'hint' => 'default'), + array('format' => NumberFormat::BULLET, 'text' => 'o', 'alignment' => 'left', 'tabPos' => 1440, 'left' => 1440, 'hanging' => 360, 'font' => 'Courier New', 'hint' => 'default'), + array('format' => NumberFormat::BULLET, 'text' => '', 'alignment' => 'left', 'tabPos' => 2160, 'left' => 2160, 'hanging' => 360, 'font' => 'Wingdings', 'hint' => 'default'), + array('format' => NumberFormat::BULLET, 'text' => '', 'alignment' => 'left', 'tabPos' => 2880, 'left' => 2880, 'hanging' => 360, 'font' => 'Symbol', 'hint' => 'default'), + array('format' => NumberFormat::BULLET, 'text' => 'o', 'alignment' => 'left', 'tabPos' => 3600, 'left' => 3600, 'hanging' => 360, 'font' => 'Courier New', 'hint' => 'default'), + array('format' => NumberFormat::BULLET, 'text' => '', 'alignment' => 'left', 'tabPos' => 4320, 'left' => 4320, 'hanging' => 360, 'font' => 'Wingdings', 'hint' => 'default'), + array('format' => NumberFormat::BULLET, 'text' => '', 'alignment' => 'left', 'tabPos' => 5040, 'left' => 5040, 'hanging' => 360, 'font' => 'Symbol', 'hint' => 'default'), + array('format' => NumberFormat::BULLET, 'text' => 'o', 'alignment' => 'left', 'tabPos' => 5760, 'left' => 5760, 'hanging' => 360, 'font' => 'Courier New', 'hint' => 'default'), + array('format' => NumberFormat::BULLET, 'text' => '', 'alignment' => 'left', 'tabPos' => 6480, 'left' => 6480, 'hanging' => 360, 'font' => 'Wingdings', 'hint' => 'default'), + ), + ); } /** @@ -394,17 +434,10 @@ class Html { $cNodes = $node->childNodes; if (!empty($cNodes)) { - $text = ''; + $listRun = $element->addListItemRun($data['listdepth'], $styles['list'], $styles['paragraph']); foreach ($cNodes as $cNode) { - if ($cNode->nodeName == '#text') { - $text = $cNode->nodeValue; - } + self::parseNode($cNode, $listRun, $styles, $data); } - //ideally we should be parsing child nodes for any style, for now just take the text - if ('' == trim($text) && '' != trim($node->textContent)) { - $text = trim($node->textContent); - } - $element->addListItem($text, $data['listdepth'], $styles['font'], $styles['list'], $styles['paragraph']); } } @@ -462,6 +495,12 @@ class Html } $styles['italic'] = $tValue; break; + case 'margin-top': + $styles['spaceBefore'] = Converter::cssToPoint($cValue); + break; + case 'margin-bottom': + $styles['spaceAfter'] = Converter::cssToPoint($cValue); + break; case 'border-color': $styles['color'] = trim($cValue, '#'); break; @@ -582,14 +621,14 @@ class Html private static function mapAlign($cssAlignment) { switch ($cssAlignment) { - case 'left': - return Jc::START; case 'right': return Jc::END; case 'center': return Jc::CENTER; case 'justify': return Jc::BOTH; + default: + return Jc::START; } return null; diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index c7d36470..9c4cfd55 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -35,7 +35,8 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $content = ''; // Default - $section = new Section(1); + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); $this->assertCount(0, $section->getElements()); // Heading @@ -57,7 +58,7 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $this->assertCount(7, $section->getElements()); // Other parts - $section = new Section(1); + $section = $phpWord->addSection(); $content = ''; $content .= '
          HeaderContent
          '; $content .= '
          • Bullet
            • Bullet
          '; @@ -172,10 +173,11 @@ class HtmlTest extends \PHPUnit\Framework\TestCase { $phpWord = new \PhpOffice\PhpWord\PhpWord(); $section = $phpWord->addSection(); - Html::addHtml($section, '

          test

          '); + Html::addHtml($section, '

          test

          '); $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:pPr/w:jc')); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:pPr/w:spacing')); $this->assertEquals(Jc::CENTER, $doc->getElementAttribute('/w:document/w:body/w:p[1]/w:pPr/w:jc', 'w:val')); $this->assertEquals('single', $doc->getElementAttribute('/w:document/w:body/w:p[1]/w:r/w:rPr/w:u', 'w:val')); } @@ -224,7 +226,7 @@ class HtmlTest extends \PHPUnit\Framework\TestCase
        • - list item2 + list item2
        '; @@ -235,6 +237,69 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:t')); $this->assertEquals('list item1', $doc->getElement('/w:document/w:body/w:p[1]/w:r/w:t')->nodeValue); $this->assertEquals('list item2', $doc->getElement('/w:document/w:body/w:p[2]/w:r/w:t')->nodeValue); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:rPr/w:b')); + } + + /** + * Tests parsing of ul/li + */ + public function tesOrderedListNumbering() + { + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $html = '
          +
        1. List 1 item 1
        2. +
        3. List 1 item 2
        4. +
        +

        Some Text

        +
          +
        1. List 2 item 1
        2. +
        3. List 2 item 2
        4. +
        '; + Html::addHtml($section, $html, false, false); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + echo $doc->printXml(); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:pPr/w:numPr/w:numId')); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:t')); + + $this->assertEquals('List 1 item 1', $doc->getElement('/w:document/w:body/w:p[1]/w:r/w:t')->nodeValue); + $this->assertEquals('List 2 item 1', $doc->getElement('/w:document/w:body/w:p[4]/w:r/w:t')->nodeValue); + + $firstListnumId = $doc->getElementAttribute('/w:document/w:body/w:p[1]/w:pPr/w:numPr/w:numId', 'w:val'); + $secondListnumId = $doc->getElementAttribute('/w:document/w:body/w:p[4]/w:pPr/w:numPr/w:numId', 'w:val'); + + $this->assertNotEquals($firstListnumId, $secondListnumId); + } + + /** + * Tests parsing of ul/li + */ + public function testParseListWithFormat() + { + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $html = preg_replace('/\s+/', ' ', '
          +
        • Some text before + + list item1 bold with text after bold + + and some after +
        • +
        • + + list item2 + +
        • +
        '); + Html::addHtml($section, $html, false, false); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:pPr/w:numPr/w:numId')); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:t')); + $this->assertEquals('list item2', $doc->getElement('/w:document/w:body/w:p[2]/w:r/w:t')->nodeValue); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p[1]/w:r[3]/w:rPr/w:b')); + $this->assertEquals('bold', $doc->getElement('/w:document/w:body/w:p[1]/w:r[3]/w:t')->nodeValue); } /** @@ -255,6 +320,9 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $this->assertEquals('with a linebreak.', $doc->getElement('/w:document/w:body/w:p/w:r[2]/w:t')->nodeValue); } + /** + * Test parsing of img + */ public function testParseImage() { $src = __DIR__ . '/../_files/images/firefox.png'; From 8ed3cacfe8d6ddb9c44843ed981d0bede3a9aab9 Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Tue, 16 Jan 2018 20:19:54 -0200 Subject: [PATCH 204/370] Refactoring --- src/PhpWord/Writer/Word2007/Element/Container.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Writer/Word2007/Element/Container.php b/src/PhpWord/Writer/Word2007/Element/Container.php index 47dae29b..b6d1145c 100644 --- a/src/PhpWord/Writer/Word2007/Element/Container.php +++ b/src/PhpWord/Writer/Word2007/Element/Container.php @@ -46,7 +46,7 @@ class Container extends AbstractElement return; } $containerClass = substr(get_class($container), strrpos(get_class($container), '\\') + 1); - $withoutP = in_array($containerClass, array('TextRun', 'Footnote', 'Endnote', 'ListItemRun')) ? true : false; + $withoutP = in_array($containerClass, array('TextRun', 'Footnote', 'Endnote', 'ListItemRun')); $xmlWriter = $this->getXmlWriter(); // Loop through elements From 0425a25cdbbb820eded9473f4026ef32db57baa4 Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 25 Jan 2018 23:24:21 +0100 Subject: [PATCH 205/370] Add parsing of HTML links --- samples/Sample_26_Html.php | 2 ++ src/PhpWord/Shared/Html.php | 23 +++++++++++++++++++++++ tests/PhpWord/Shared/HtmlTest.php | 13 +++++++++++++ 3 files changed, 38 insertions(+) diff --git a/samples/Sample_26_Html.php b/samples/Sample_26_Html.php index 99a35f9c..69d9d131 100644 --- a/samples/Sample_26_Html.php +++ b/samples/Sample_26_Html.php @@ -10,6 +10,8 @@ $html = '

        Adding element via HTML

        '; $html .= '

        Some well formed HTML snippet needs to be used

        '; $html .= '

        With for example some1 inline formatting1

        '; +$html .= '

        A link to Read the docs

        '; + $html .= '

        Unordered (bulleted) list:

        '; $html .= '
        • Item 1
        • Item 2
          • Item 2.1
          • Item 2.1
        '; diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index fd0bd545..0f5f446a 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -142,6 +142,7 @@ class Html 'li' => array('ListItem', $node, $element, $styles, $data, null, null), 'img' => array('Image', $node, $element, $styles, null, null, null), 'br' => array('LineBreak', null, $element, $styles, null, null, null), + 'a' => array('Link', $node, $element, $styles, null, null, null), ); $newElement = null; @@ -643,4 +644,26 @@ class Html { $element->addTextBreak(); } + + /** + * Parse link node + * + * @param \DOMNode $node + * @param \PhpOffice\PhpWord\Element\AbstractContainer $element + * @param array $styles + */ + private static function parseLink($node, $element, &$styles) + { + $target = null; + foreach ($node->attributes as $attribute) { + switch ($attribute->name) { + case 'href': + $target = $attribute->value; + break; + } + } + self::parseInlineStyle($node, $styles['font']); + + return $element->addLink($target, $node->textContent, $styles['font'], $styles['paragraph']); + } } diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index 9c4cfd55..6122924f 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -341,4 +341,17 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $this->assertStringMatchesFormat('%Smso-position-horizontal:right%S', $doc->getElementAttribute($baseXpath . '[1]/w:pict/v:shape', 'style')); $this->assertStringMatchesFormat('%Smso-position-horizontal:left%S', $doc->getElementAttribute($baseXpath . '[2]/w:pict/v:shape', 'style')); } + + public function testParseLink() + { + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $html = '

        link text

        '; + Html::addHtml($section, $html); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:hyperlink')); + $this->assertEquals('link text', $doc->getElement('/w:document/w:body/w:p/w:hyperlink/w:r/w:t')->nodeValue); + } } From 30183e28810391b66c07e8f896421449830a3558 Mon Sep 17 00:00:00 2001 From: Nicolas Dermine Date: Fri, 26 Jan 2018 18:31:35 +0100 Subject: [PATCH 206/370] fix typo in comment --- src/PhpWord/TemplateProcessor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php index c46038ee..5dd7b0bf 100644 --- a/src/PhpWord/TemplateProcessor.php +++ b/src/PhpWord/TemplateProcessor.php @@ -422,7 +422,7 @@ class TemplateProcessor } /* - * Note: we do not use `rename` function here, because it looses file ownership data on Windows platform. + * Note: we do not use `rename` function here, because it loses file ownership data on Windows platform. * As a result, user cannot open the file directly getting "Access denied" message. * * @see https://github.com/PHPOffice/PHPWord/issues/532 From caba7e238ff05c2cfd2a438d3f4cb77ee235623e Mon Sep 17 00:00:00 2001 From: Samuel Laulhau Date: Wed, 31 Jan 2018 10:17:40 +0100 Subject: [PATCH 207/370] Delete VERSION Delete VERSION file since it's outdated so not usefull anymore --- VERSION | 1 - 1 file changed, 1 deletion(-) delete mode 100644 VERSION diff --git a/VERSION b/VERSION deleted file mode 100644 index 51de3305..00000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.13.0 \ No newline at end of file From 8a9a4784d91da529ab327670f6712f719541491a Mon Sep 17 00:00:00 2001 From: Sami Mussbach Date: Thu, 1 Feb 2018 13:58:08 +0100 Subject: [PATCH 208/370] add (failing) test and correct documentation sample to valid HTML --- samples/Sample_26_Html.php | 11 +++++---- tests/PhpWord/Shared/HtmlTest.php | 37 +++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/samples/Sample_26_Html.php b/samples/Sample_26_Html.php index 69d9d131..b05f8d08 100644 --- a/samples/Sample_26_Html.php +++ b/samples/Sample_26_Html.php @@ -29,10 +29,13 @@ $html .= '
          1. List 2 item 1
          2. List 2 item 2
          3. -
              -
            1. sub list 1
            2. -
            3. sub list 2
            4. -
            +
          4. +
              +
            1. sub list 1
            2. +
            3. sub list 2
            4. +
            +
          5. +
          6. List 2 item 3
            1. sub list 1, restarts with a
            2. diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index 6122924f..936c35f9 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -272,6 +272,43 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $this->assertNotEquals($firstListnumId, $secondListnumId); } + /** + * Tests parsing of nested ul/li + */ + public function testOrderedNestedListNumbering() + { + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $html = '
                +
              1. List 1 item 1
              2. +
              3. List 1 item 2
              4. +
              +

              Some Text

              +
                +
              1. List 2 item 1
              2. +
              3. +
                  +
                1. sub list 1
                2. +
                3. sub list 2
                4. +
                +
              4. +
              '; + Html::addHtml($section, $html, false, false); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + echo $doc->printXml(); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:pPr/w:numPr/w:numId')); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:t')); + + $this->assertEquals('List 1 item 1', $doc->getElement('/w:document/w:body/w:p[1]/w:r/w:t')->nodeValue); + $this->assertEquals('List 2 item 1', $doc->getElement('/w:document/w:body/w:p[4]/w:r/w:t')->nodeValue); + + $firstListnumId = $doc->getElementAttribute('/w:document/w:body/w:p[1]/w:pPr/w:numPr/w:numId', 'w:val'); + $secondListnumId = $doc->getElementAttribute('/w:document/w:body/w:p[4]/w:pPr/w:numPr/w:numId', 'w:val'); + + $this->assertNotEquals($firstListnumId, $secondListnumId); + } + /** * Tests parsing of ul/li */ From e0096dba084c767582e15917bf5b357c790a5995 Mon Sep 17 00:00:00 2001 From: Sami Mussbach Date: Thu, 1 Feb 2018 14:12:56 +0100 Subject: [PATCH 209/370] fix typo in test method name --- tests/PhpWord/Shared/HtmlTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index 6122924f..97a8fb15 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -243,7 +243,7 @@ class HtmlTest extends \PHPUnit\Framework\TestCase /** * Tests parsing of ul/li */ - public function tesOrderedListNumbering() + public function testOrderedListNumbering() { $phpWord = new \PhpOffice\PhpWord\PhpWord(); $section = $phpWord->addSection(); From 4105a9aad1bd8e08cd3e7d5a74810a9e73f80fd4 Mon Sep 17 00:00:00 2001 From: Nicolas Dermine Date: Fri, 2 Feb 2018 16:19:21 +0100 Subject: [PATCH 210/370] improve `cloneBlock` regex it wrongly matched `\${' . $blockname . '}<\/w:.*?p>)(.*)()/is', + '/(<\?xml.*)(\${' . $blockname . '}<\/w:.*?p>)(.*)()/is', $this->tempDocumentMainPart, $matches ); diff --git a/tests/PhpWord/TemplateProcessorTest.php b/tests/PhpWord/TemplateProcessorTest.php index 7b064ef7..122ed5b6 100644 --- a/tests/PhpWord/TemplateProcessorTest.php +++ b/tests/PhpWord/TemplateProcessorTest.php @@ -223,4 +223,56 @@ final class TemplateProcessorTest extends \PHPUnit\Framework\TestCase unlink($docName); $this->assertTrue($docFound); } + + /** + * @covers ::cloneBlock + * @test + */ + public function cloneBlockCanCloneABlockTwice() + { + // create template with placeholders and block + $phpWord = new PhpWord(); + $section = $phpWord->addSection(); + $documentElements = array( + 'Title: ${title}', + '${subreport}', + '${subreport.id}: ${subreport.text}. ', + '${/subreport}', + ); + foreach ($documentElements as $documentElement) { + $section->addText($documentElement); + } + $objWriter = IOFactory::createWriter($phpWord); + $templatePath = 'test.docx'; + $objWriter->save($templatePath); + + // replace placeholders and save the file + $templateProcessor = new TemplateProcessor($templatePath); + $templateProcessor->setValue('title', 'Some title'); + $templateProcessor->cloneBlock('subreport', 2); + $templateProcessor->setValue('subreport.id', '123', 1); + $templateProcessor->setValue('subreport.text', 'Some text', 1); + $templateProcessor->setValue('subreport.id', '456', 1); + $templateProcessor->setValue('subreport.text', 'Some other text', 1); + $templateProcessor->saveAs($templatePath); + + // assert the block has been cloned twice + // and the placeholders have been replaced correctly + $phpWord = IOFactory::load($templatePath); + $sections = $phpWord->getSections(); + $actualElements = $sections[0]->getElements(); + unlink($templatePath); + $expectedElements = array( + 'Title: Some title', + '123: Some text. ', + '456: Some other text. ', + ); + $this->assertCount(count($expectedElements), $actualElements); + foreach ($expectedElements as $i => $expectedElement) { + $this->assertEquals( + $expectedElement, + $actualElements[$i]->getText() + ); + } + } } From edd9617c03888ce4dd2e28c2fcacfad98194f4fc Mon Sep 17 00:00:00 2001 From: Nicolas Dermine Date: Sun, 4 Feb 2018 08:42:38 +0100 Subject: [PATCH 211/370] fix typo --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 335ad2d5..e62f2e6f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,7 @@ We want to create a high quality document writer and reader library that people - **Be brief, but be bold**. State your issues briefly. But speak out your ideas loudly, even if you can't or don't know how to implement it right away. The world will be better with limitless innovations. - **Follow PHP-FIG standards**. We follow PHP Standards Recommendations (PSRs) by [PHP Framework Interoperability Group](http://www.php-fig.org/). If you're not familiar with these standards, please, [familiarize yourself now](https://github.com/php-fig/fig-standards). Also, please, use [PHPCodeSniffer](http://pear.php.net/package/PHP_CodeSniffer/) to validate your code against PSRs. -- **Test your code**. Nobody else knows your code better than you. So, it's completely yours mission to test the changes you made before pull request submission. We use [PHPUnit](https://phpunit.de/) for our testing purposes and recommend you using this tool too. [Here](https://phpunit.de/presentations.html) you can find PHPUnit best practices and additional information on effective unit testing, which helps us making PHPWord better day to day. Do not hesitate to smoke it carefully. It's a great investment in quality of your work, and it saves you years of life. +- **Test your code**. Nobody else knows your code better than you. So, it's completely your mission to test the changes you made before pull request submission. We use [PHPUnit](https://phpunit.de/) for our testing purposes and recommend you using this tool too. [Here](https://phpunit.de/presentations.html) you can find PHPUnit best practices and additional information on effective unit testing, which helps us making PHPWord better day to day. Do not hesitate to smoke it carefully. It's a great investment in quality of your work, and it saves you years of life. - **Request pull in separate branch**. Do not submit your request to the master branch. But create a separate branch named specifically for the issue that you addressed. Read [GitHub manual](https://help.github.com/articles/using-pull-requests) to find out more about this. If you are new to GitHub, read [this short manual](https://help.github.com/articles/fork-a-repo) to get yourself familiar with forks and how git works in general. [This video](http://www.youtube.com/watch?v=-zvHQXnBO6c) explains how to synchronize your Github Fork with the Branch of PHPWord. That's it. Thank you for your interest in PHPWord, and welcome! From 46a5f96d3b5104aaa6b016e5df0730e4382058e7 Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 6 Feb 2018 23:16:32 +0100 Subject: [PATCH 212/370] fix parsing of table and p inside table cells --- CHANGELOG.md | 2 ++ samples/Sample_26_Html.php | 16 +++++++-- src/PhpWord/Shared/Html.php | 38 +++++++++++++++++++++- src/PhpWord/Writer/Word2007/Style/Font.php | 4 +++ tests/PhpWord/Shared/HtmlTest.php | 6 ++-- 5 files changed, 60 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6f8b2da..fca2922c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,11 @@ v0.15.0 (?? ??? 2018) ### Added - Parsing of "align" HTML attribute - @troosan #1231 - Parse formatting inside HTML lists - @troosan @samimussbach #1239 #945 #1215 #508 +- Parsing of CSS `direction` instruction, HTML `lang` attribute, formatting inside table cell - @troosan # ### Fixed - fix reading of docx default style - @troosan #1238 +- fix the size unit of when parsing html images - @troosan #1254 diff --git a/samples/Sample_26_Html.php b/samples/Sample_26_Html.php index 69d9d131..d54d548c 100644 --- a/samples/Sample_26_Html.php +++ b/samples/Sample_26_Html.php @@ -7,11 +7,13 @@ $phpWord = new \PhpOffice\PhpWord\PhpWord(); $section = $phpWord->addSection(); $html = '

              Adding element via HTML

              '; -$html .= '

              Some well formed HTML snippet needs to be used

              '; +$html .= '

              Some well-formed HTML snippet needs to be used

              '; $html .= '

              With for example some1 inline formatting1

              '; $html .= '

              A link to Read the docs

              '; +$html .= '

              היי, זה פסקה מימין לשמאל

              '; + $html .= '

              Unordered (bulleted) list:

              '; $html .= '
              • Item 1
              • Item 2
                • Item 2.1
                • Item 2.1
              '; @@ -65,10 +67,20 @@ $html .= ' - +
              12
              456
              This is bold text6
              '; +$html .= '

              Table inside another table:

              '; +$html .= ' + + +
              + + +
              column 1column 2
              +
              Cell in parent table
              '; + \PhpOffice\PhpWord\Shared\Html::addHtml($section, $html, false, false); // Save file diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 0f5f446a..2eeaae8b 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -31,6 +31,7 @@ use PhpOffice\PhpWord\SimpleType\NumberFormat; class Html { private static $listIndex = 0; + private static $xpath; /** * Add HTML parts. @@ -65,6 +66,7 @@ class Html $dom = new \DOMDocument(); $dom->preserveWhiteSpace = $preserveWhiteSpace; $dom->loadXML($html); + self::$xpath = new \DOMXpath($dom); $node = $dom->getElementsByTagName('body'); self::parseNode($node->item(0), $element); @@ -89,6 +91,10 @@ class Html break; case 'align': $styles['alignment'] = self::mapAlign($attribute->value); + break; + case 'lang': + $styles['lang'] = $attribute->value; + break; } } } @@ -343,8 +349,33 @@ class Html if (!empty($colspan)) { $cellStyles['gridSpan'] = $colspan - 0; } + $cell = $element->addCell(null, $cellStyles); - return $element->addCell(null, $cellStyles); + if (self::shouldAddTextRun($node)) { + return $cell->addTextRun(self::parseInlineStyle($node, $styles['paragraph'])); + } + + return $cell; + } + + /** + * Checks if $node contains an HTML element that cannot be added to TextRun + * + * @param \DOMNode $node + * @return bool Returns true if the node contains an HTML element that cannot be added to TextRun + */ + private static function shouldAddTextRun(\DOMNode $node) + { + if (!$node->hasChildNodes()) { + return false; + } + + $containsBlockElement = self::$xpath->query('.//table|./p', $node)->length > 0; + if ($containsBlockElement) { + return false; + } + + return true; } /** @@ -469,6 +500,9 @@ class Html case 'text-align': $styles['alignment'] = self::mapAlign($cValue); break; + case 'direction': + $styles['rtl'] = $cValue === 'rtl'; + break; case 'font-size': $styles['size'] = Converter::cssToPoint($cValue); break; @@ -556,10 +590,12 @@ class Html case 'width': $width = $attribute->value; $style['width'] = $width; + $style['unit'] = \PhpOffice\PhpWord\Style\Image::UNIT_PX; break; case 'height': $height = $attribute->value; $style['height'] = $height; + $style['unit'] = \PhpOffice\PhpWord\Style\Image::UNIT_PX; break; case 'style': $styleattr = explode(';', $attribute->value); diff --git a/src/PhpWord/Writer/Word2007/Style/Font.php b/src/PhpWord/Writer/Word2007/Style/Font.php index 9c2714dc..ecaad416 100644 --- a/src/PhpWord/Writer/Word2007/Style/Font.php +++ b/src/PhpWord/Writer/Word2007/Style/Font.php @@ -90,6 +90,10 @@ class Font extends AbstractStyle $xmlWriter->writeAttributeIf($language->getLatin() !== null, 'w:val', $language->getLatin()); $xmlWriter->writeAttributeIf($language->getEastAsia() !== null, 'w:eastAsia', $language->getEastAsia()); $xmlWriter->writeAttributeIf($language->getBidirectional() !== null, 'w:bidi', $language->getBidirectional()); + //if bidi is not set but we are writing RTL, write the latin language in the bidi tag + if ($style->isRTL() && $language->getBidirectional() === null && $language->getLatin() !== null) { + $xmlWriter->writeAttribute('w:bidi', $language->getLatin()); + } $xmlWriter->endElement(); } diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index 97a8fb15..7d5f0b4c 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -259,7 +259,7 @@ class HtmlTest extends \PHPUnit\Framework\TestCase Html::addHtml($section, $html, false, false); $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); - echo $doc->printXml(); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:pPr/w:numPr/w:numId')); $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:t')); @@ -336,8 +336,8 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $baseXpath = '/w:document/w:body/w:p/w:r'; $this->assertTrue($doc->elementExists($baseXpath . '/w:pict/v:shape')); - $this->assertStringMatchesFormat('%Swidth:150pt%S', $doc->getElementAttribute($baseXpath . '[1]/w:pict/v:shape', 'style')); - $this->assertStringMatchesFormat('%Sheight:200pt%S', $doc->getElementAttribute($baseXpath . '[1]/w:pict/v:shape', 'style')); + $this->assertStringMatchesFormat('%Swidth:150px%S', $doc->getElementAttribute($baseXpath . '[1]/w:pict/v:shape', 'style')); + $this->assertStringMatchesFormat('%Sheight:200px%S', $doc->getElementAttribute($baseXpath . '[1]/w:pict/v:shape', 'style')); $this->assertStringMatchesFormat('%Smso-position-horizontal:right%S', $doc->getElementAttribute($baseXpath . '[1]/w:pict/v:shape', 'style')); $this->assertStringMatchesFormat('%Smso-position-horizontal:left%S', $doc->getElementAttribute($baseXpath . '[2]/w:pict/v:shape', 'style')); } From 47c837abef8f25fa0f28da352cd3e94c8be99ece Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 6 Feb 2018 23:31:56 +0100 Subject: [PATCH 213/370] add unit tests --- src/PhpWord/Shared/Html.php | 4 ---- tests/PhpWord/Shared/HtmlTest.php | 29 ++++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 2eeaae8b..e11d7390 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -366,10 +366,6 @@ class Html */ private static function shouldAddTextRun(\DOMNode $node) { - if (!$node->hasChildNodes()) { - return false; - } - $containsBlockElement = self::$xpath->query('.//table|./p', $node)->length > 0; if ($containsBlockElement) { return false; diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index 7d5f0b4c..44fe97fc 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -150,6 +150,33 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $this->assertEquals('15', $doc->getElementAttribute('/w:document/w:body/w:p[2]/w:r/w:rPr/w:sz', 'w:val')); } + /** + * Test direction style + */ + public function testParseTextDirection() + { + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + Html::addHtml($section, 'test'); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:rPr/w:rtl')); + } + + /** + * Test html lang + */ + public function testParseLang() + { + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + Html::addHtml($section, 'test'); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:rPr/w:lang')); + $this->assertEquals('fr-BE', $doc->getElementAttribute('/w:document/w:body/w:p/w:r/w:rPr/w:lang', 'w:val')); + } + /** * Test font-family style */ @@ -199,7 +226,7 @@ class HtmlTest extends \PHPUnit\Framework\TestCase 12 - 456 + This is bold text5

              6

              '; Html::addHtml($section, $html); From 46476d71014a1136810bdf7576724edc6e50fe30 Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 7 Feb 2018 07:09:27 +0100 Subject: [PATCH 214/370] update phpdoc --- 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 e11d7390..2a92ed2a 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -339,7 +339,7 @@ class Html * @param \DOMNode $node * @param \PhpOffice\PhpWord\Element\Table $element * @param array &$styles - * @return \PhpOffice\PhpWord\Element\Cell $element + * @return \PhpOffice\PhpWord\Element\Cell|\PhpOffice\PhpWord\Element\TextRun $element */ private static function parseCell($node, $element, &$styles) { From 33739ea21cbdc74b661ed8e9de42a75db7c6391e Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 7 Feb 2018 21:39:01 +0100 Subject: [PATCH 215/370] cannot add list on textrun --- 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 2a92ed2a..a3ea0cc0 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -366,7 +366,7 @@ class Html */ private static function shouldAddTextRun(\DOMNode $node) { - $containsBlockElement = self::$xpath->query('.//table|./p', $node)->length > 0; + $containsBlockElement = self::$xpath->query('.//table|./p|./ul|./li', $node)->length > 0; if ($containsBlockElement) { return false; } From 304173c4d78b65685e2e91654beccd573fe8b4ee Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 8 Feb 2018 07:02:28 +0100 Subject: [PATCH 216/370] fix nested list --- src/PhpWord/Element/AbstractElement.php | 13 +++++++++++++ src/PhpWord/Shared/Html.php | 7 +++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/Element/AbstractElement.php b/src/PhpWord/Element/AbstractElement.php index 63892b74..52279645 100644 --- a/src/PhpWord/Element/AbstractElement.php +++ b/src/PhpWord/Element/AbstractElement.php @@ -93,6 +93,13 @@ abstract class AbstractElement */ private $nestedLevel = 0; + /** + * A reference to the parent + * + * @var \PhpOffice\PhpWord\Element\AbstractElement + */ + private $parent; + /** * Parent container type * @@ -321,6 +328,11 @@ abstract class AbstractElement $this->commentRangeEnd->setEndElement($this); } + public function getParent() + { + return $this->parent; + } + /** * Set parent container * @@ -331,6 +343,7 @@ abstract class AbstractElement public function setParentContainer(AbstractElement $container) { $this->parentContainer = substr(get_class($container), strrpos(get_class($container), '\\') + 1); + $this->parent = $container; // Set nested level $this->nestedLevel = $container->getNestedLevel(); diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index a3ea0cc0..971776ff 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -366,7 +366,7 @@ class Html */ private static function shouldAddTextRun(\DOMNode $node) { - $containsBlockElement = self::$xpath->query('.//table|./p|./ul|./li', $node)->length > 0; + $containsBlockElement = self::$xpath->query('.//table|./p|./ul|./ol', $node)->length > 0; if ($containsBlockElement) { return false; } @@ -402,7 +402,7 @@ class Html */ private static function parseList($node, $element, &$styles, &$data) { - $isOrderedList = $node->nodeName == 'ol'; + $isOrderedList = $node->nodeName === 'ol'; if (isset($data['listdepth'])) { $data['listdepth']++; } else { @@ -410,6 +410,9 @@ class Html $styles['list'] = 'listStyle_' . self::$listIndex++; $element->getPhpWord()->addNumberingStyle($styles['list'], self::getListStyle($isOrderedList)); } + if ($node->parentNode->nodeName === 'li') { + return $element->getParent(); + } } private static function getListStyle($isOrderedList) From 24f3463f9af8a4ade049d11202ee8e34bec92ec3 Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 8 Feb 2018 07:18:02 +0100 Subject: [PATCH 217/370] remove output --- CHANGELOG.md | 3 ++- tests/PhpWord/Shared/HtmlTest.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fca2922c..21f4ec81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,11 +8,12 @@ v0.15.0 (?? ??? 2018) ### Added - Parsing of "align" HTML attribute - @troosan #1231 - Parse formatting inside HTML lists - @troosan @samimussbach #1239 #945 #1215 #508 -- Parsing of CSS `direction` instruction, HTML `lang` attribute, formatting inside table cell - @troosan # +- Parsing of CSS `direction` instruction, HTML `lang` attribute, formatting inside table cell - @troosan #1273 #1252 #1254 ### Fixed - fix reading of docx default style - @troosan #1238 - fix the size unit of when parsing html images - @troosan #1254 +- fixed HTML parsing of nested lists - @troosan #1265 diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index b1ebf349..ac68b887 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -323,7 +323,7 @@ class HtmlTest extends \PHPUnit\Framework\TestCase Html::addHtml($section, $html, false, false); $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); - echo $doc->printXml(); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:pPr/w:numPr/w:numId')); $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:t')); From 9cd5ab74330f9957b99c7d4634bf95fdb7e1a9e6 Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 9 Feb 2018 17:17:13 +0100 Subject: [PATCH 218/370] update changelog --- CHANGELOG.md | 1 + samples/Sample_26_Html.php | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21f4ec81..3d3f60f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ v0.15.0 (?? ??? 2018) - fix reading of docx default style - @troosan #1238 - fix the size unit of when parsing html images - @troosan #1254 - fixed HTML parsing of nested lists - @troosan #1265 +- Save PNG alpha information when using remote images. @samsullivan #779 diff --git a/samples/Sample_26_Html.php b/samples/Sample_26_Html.php index 6e505fdb..f6086357 100644 --- a/samples/Sample_26_Html.php +++ b/samples/Sample_26_Html.php @@ -37,7 +37,6 @@ $html .= '
              1. sub list 2
              -
            3. List 2 item 3
              1. sub list 1, restarts with a
              2. From 604e60cae9cad0e5d114ddda0c88c6e2ebe93693 Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 9 Feb 2018 21:49:11 +0100 Subject: [PATCH 219/370] Add support for Track changes (#1262) * add changed information to HTML writer * add missing writeFontStyle * refactor track changes * set the style * update documentation and release note * Update the changelog and doc * fix scrutinizer issues --- CHANGELOG.md | 1 + docs/elements.rst | 41 +++++++++-- samples/Sample_16_Object.php | 2 +- samples/Sample_39_TrackChanges.php | 29 ++++++++ samples/resources/Sample_11_ReadWord2007.docx | Bin 67881 -> 63320 bytes samples/resources/Sample_24_ReadODText.odt | Bin 11952 -> 11540 bytes src/PhpWord/Element/AbstractContainer.php | 4 +- src/PhpWord/Element/AbstractElement.php | 39 +++++++++++ src/PhpWord/Element/Comment.php | 4 +- src/PhpWord/Element/TrackChange.php | 31 ++++++++- src/PhpWord/Reader/ODText/Content.php | 50 +++++++++++++- src/PhpWord/Reader/Word2007/AbstractPart.php | 27 +++++++- src/PhpWord/Reader/Word2007/Styles.php | 2 +- src/PhpWord/Writer/HTML/Element/Text.php | 65 ++++++++++++++++++ src/PhpWord/Writer/ODText/Element/Text.php | 60 +++++++++++----- src/PhpWord/Writer/ODText/Part/Content.php | 55 +++++++++++++++ src/PhpWord/Writer/Word2007/Element/Text.php | 54 ++++++++++++++- tests/PhpWord/Element/TrackChangeTest.php | 44 ++++++++++++ tests/PhpWord/Shared/HtmlTest.php | 2 +- tests/PhpWord/Writer/Word2007/ElementTest.php | 18 ++++- 20 files changed, 488 insertions(+), 40 deletions(-) create mode 100644 samples/Sample_39_TrackChanges.php create mode 100644 tests/PhpWord/Element/TrackChangeTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index d6f8b2da..f82759dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ v0.15.0 (?? ??? 2018) ### Added - Parsing of "align" HTML attribute - @troosan #1231 - Parse formatting inside HTML lists - @troosan @samimussbach #1239 #945 #1215 #508 +- Add support for Track changes @Cip @troosan #354 #1262 ### Fixed - fix reading of docx default style - @troosan #1238 diff --git a/docs/elements.rst b/docs/elements.rst index fe673304..7df3b163 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -31,7 +31,7 @@ column shows the containers while the rows lists the elements. +-------+-----------------+-----------+----------+----------+---------+------------+------------+ | 11 | Watermark | - | v | - | - | - | - | +-------+-----------------+-----------+----------+----------+---------+------------+------------+ -| 12 | Object | v | v | v | v | v | v | +| 12 | OLEObject | v | v | v | v | v | v | +-------+-----------------+-----------+----------+----------+---------+------------+------------+ | 13 | TOC | v | - | - | - | - | - | +-------+-----------------+-----------+----------+----------+---------+------------+------------+ @@ -77,6 +77,13 @@ italics, etc) or other elements, e.g. images or links. The syntaxes are as follo For available styling options see :ref:`font-style` and :ref:`paragraph-style`. +If you want to enable track changes on added text you can mark it as INSERTED or DELETED by a specific user at a given time: + +.. code-block:: php + + $text = $section->addText('Hello World!'); + $text->setChanged(\PhpOffice\PhpWord\Element\ChangedElement::TYPE_INSERTED, 'Fred', (new \DateTime())); + Titles ~~~~~~ @@ -276,11 +283,11 @@ Objects ------- You can add OLE embeddings, such as Excel spreadsheets or PowerPoint -presentations to the document by using ``addObject`` method. +presentations to the document by using ``addOLEObject`` method. .. code-block:: php - $section->addObject($src, [$style]); + $section->addOLEObject($src, [$style]); Table of contents ----------------- @@ -309,7 +316,7 @@ Footnotes & endnotes You can create footnotes with ``addFootnote`` and endnotes with ``addEndnote`` in texts or textruns, but it's recommended to use textrun to have better layout. You can use ``addText``, ``addLink``, -``addTextBreak``, ``addImage``, ``addObject`` on footnotes and endnotes. +``addTextBreak``, ``addImage``, ``addOLEObject`` on footnotes and endnotes. On textrun: @@ -465,4 +472,28 @@ The comment can contain formatted text. Once the comment has been added, it can // link the comment to the text you just created $text->setCommentStart($comment); -If no end is set for a comment using the ``setCommentEnd``, the comment will be ended automatically at the end of the element it is started on. \ No newline at end of file +If no end is set for a comment using the ``setCommentEnd``, the comment will be ended automatically at the end of the element it is started on. + +Track Changes +------------- + +Track changes can be set on text elements. There are 2 ways to set the change information on an element. +Either by calling the `setChangeInfo()`, or by setting the `TrackChange` instance on the element with `setTrackChange()`. + +.. code-block:: php + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + + // New portrait section + $section = $phpWord->addSection(); + $textRun = $section->addTextRun(); + + $text = $textRun->addText('Hello World! Time to '); + + $text = $textRun->addText('wake ', array('bold' => true)); + $text->setChangeInfo(TrackChange::INSERTED, 'Fred', time() - 1800); + + $text = $textRun->addText('up'); + $text->setTrackChange(new TrackChange(TrackChange::INSERTED, 'Fred')); + + $text = $textRun->addText('go to sleep'); + $text->setChangeInfo(TrackChange::DELETED, 'Barney', new \DateTime('@' . (time() - 3600))); diff --git a/samples/Sample_16_Object.php b/samples/Sample_16_Object.php index 8b05b9e8..c4db7f61 100644 --- a/samples/Sample_16_Object.php +++ b/samples/Sample_16_Object.php @@ -9,7 +9,7 @@ $phpWord = new \PhpOffice\PhpWord\PhpWord(); $section = $phpWord->addSection(); $section->addText('You can open this OLE object by double clicking on the icon:'); $section->addTextBreak(2); -$section->addObject('resources/_sheet.xls'); +$section->addOLEObject('resources/_sheet.xls'); // Save file echo write($phpWord, basename(__FILE__, '.php'), $writers); diff --git a/samples/Sample_39_TrackChanges.php b/samples/Sample_39_TrackChanges.php new file mode 100644 index 00000000..e6a30668 --- /dev/null +++ b/samples/Sample_39_TrackChanges.php @@ -0,0 +1,29 @@ +addSection(); +$textRun = $section->addTextRun(); + +$text = $textRun->addText('Hello World! Time to '); + +$text = $textRun->addText('wake ', array('bold' => true)); +$text->setChangeInfo(TrackChange::INSERTED, 'Fred', time() - 1800); + +$text = $textRun->addText('up'); +$text->setTrackChange(new TrackChange(TrackChange::INSERTED, 'Fred')); + +$text = $textRun->addText('go to sleep'); +$text->setChangeInfo(TrackChange::DELETED, 'Barney', new \DateTime('@' . (time() - 3600))); + +// Save file +echo write($phpWord, basename(__FILE__, '.php'), $writers); +if (!CLI) { + include_once 'Sample_Footer.php'; +} diff --git a/samples/resources/Sample_11_ReadWord2007.docx b/samples/resources/Sample_11_ReadWord2007.docx index c9a50f485a3c8d942fc7982061c5905f342c7634..3faf6f1213f13e82466ef29200862498d2ef7014 100644 GIT binary patch delta 52080 zcmeEtWpEu$mgN&OGc(I#X0VuLG1y{e2FoQTi&?TPmMmswW@fZlvY44xUr$W$Y)tRO z>~=@&pUsG@9|c+ORGoY7%~Sb`;vg4KApm7L2uMs2Gzb<10+E5#1s{zjz(62Fcn}B! z1PiV!Zg1yeYUlDr&C|iuS)a+n)`m0(5}Y;*1pa>hzn}sCf-(M?A^!jU|Cy)Po1|dB z!h#rl2JuLOsQ+Ed5~YWw_aK{OfT@$sKvNW$Abp)oBFV4@7wce6s-KZHby5%W zk^T>a!7pGntTK3M;y3Lp`WYl$o78?)^o&J5KUrr{2JY?fPgn$0_^pTa9e#hw`#k4A zeH~~*Rc|XwryVeF7*EVYPV{EbkEDw-?qZPV*(m;!4Ku`+-+lM)o^h&@9tPvsj=W>) zNB zBkx@$F&&&K3^p22^}BdvHBQD*g_V$mAm-NjX?J~BYoR?DgK9259lr054X)ZX30hnn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AX0#ESAcEx@0QVhzU8FOd<(|z>k?#KO(v-}DE$6m;Nrn?Jpqx|cRy|dDtrackChange = $trackChange; + } + + /** + * Gets the trackChange information + * + * @return TrackChange + */ + public function getTrackChange() + { + return $this->trackChange; + } + + /** + * Set changed + * + * @param string $type INSERTED|DELETED + * @param string $author + * @param null|int|\DateTime $date allways in UTC + */ + public function setChangeInfo($type, $author, $date = null) + { + $this->trackChange = new TrackChange($type, $author, $date); + } + /** * Set enum value * diff --git a/src/PhpWord/Element/Comment.php b/src/PhpWord/Element/Comment.php index 18836929..205ff598 100644 --- a/src/PhpWord/Element/Comment.php +++ b/src/PhpWord/Element/Comment.php @@ -55,12 +55,12 @@ class Comment extends TrackChange * Create a new Comment Element * * @param string $author - * @param \DateTime $date + * @param null|\DateTime $date * @param string $initials */ public function __construct($author, $date = null, $initials = null) { - parent::__construct($author, $date); + parent::__construct(null, $author, $date); $this->initials = $initials; } diff --git a/src/PhpWord/Element/TrackChange.php b/src/PhpWord/Element/TrackChange.php index 44327f26..dde616cc 100644 --- a/src/PhpWord/Element/TrackChange.php +++ b/src/PhpWord/Element/TrackChange.php @@ -20,14 +20,25 @@ namespace PhpOffice\PhpWord\Element; /** * TrackChange element * @see http://datypic.com/sc/ooxml/t-w_CT_TrackChange.html + * @see http://datypic.com/sc/ooxml/t-w_CT_RunTrackChange.html */ class TrackChange extends AbstractContainer { + const INSERTED = 'INSERTED'; + const DELETED = 'DELETED'; + /** * @var string Container type */ protected $container = 'TrackChange'; + /** + * The type of change, (insert or delete), not applicable for PhpOffice\PhpWord\Element\Comment + * + * @var string + */ + private $changeType; + /** * Author * @@ -45,13 +56,17 @@ class TrackChange extends AbstractContainer /** * Create a new TrackChange Element * + * @param string $changeType * @param string $author - * @param \DateTime $date + * @param null|int|\DateTime $date */ - public function __construct($author, \DateTime $date = null) + public function __construct($changeType = null, $author = null, $date = null) { + $this->changeType = $changeType; $this->author = $author; - $this->date = $date; + if ($date !== null) { + $this->date = ($date instanceof \DateTime) ? $date : new \DateTime('@' . $date); + } } /** @@ -73,4 +88,14 @@ class TrackChange extends AbstractContainer { return $this->date; } + + /** + * Get the Change type + * + * @return string + */ + public function getChangeType() + { + return $this->changeType; + } } diff --git a/src/PhpWord/Reader/ODText/Content.php b/src/PhpWord/Reader/ODText/Content.php index 8843d8a2..7a7a0468 100644 --- a/src/PhpWord/Reader/ODText/Content.php +++ b/src/PhpWord/Reader/ODText/Content.php @@ -18,6 +18,7 @@ namespace PhpOffice\PhpWord\Reader\ODText; use PhpOffice\Common\XMLReader; +use PhpOffice\PhpWord\Element\TrackChange; use PhpOffice\PhpWord\PhpWord; /** @@ -37,6 +38,8 @@ class Content extends AbstractPart $xmlReader = new XMLReader(); $xmlReader->getDomFromZip($this->docFile, $this->xmlFile); + $trackedChanges = array(); + $nodes = $xmlReader->getElements('office:body/office:text/*'); if ($nodes->length > 0) { $section = $phpWord->addSection(); @@ -48,7 +51,37 @@ class Content extends AbstractPart $section->addTitle($node->nodeValue, $depth); break; case 'text:p': // Paragraph - $section->addText($node->nodeValue); + $children = $node->childNodes; + foreach ($children as $child) { + switch ($child->nodeName) { + case 'text:change-start': + $changeId = $child->getAttribute('text:change-id'); + if (isset($trackedChanges[$changeId])) { + $changed = $trackedChanges[$changeId]; + } + break; + case 'text:change-end': + unset($changed); + break; + case 'text:change': + $changeId = $child->getAttribute('text:change-id'); + if (isset($trackedChanges[$changeId])) { + $changed = $trackedChanges[$changeId]; + } + break; + } + } + + $element = $section->addText($node->nodeValue); + if (isset($changed) && is_array($changed)) { + $element->setTrackChange($changed['changed']); + if (isset($changed['textNodes'])) { + foreach ($changed['textNodes'] as $changedNode) { + $element = $section->addText($changedNode->nodeValue); + $element->setTrackChange($changed['changed']); + } + } + } break; case 'text:list': // List $listItems = $xmlReader->getElements('text:list-item/text:p', $node); @@ -57,6 +90,21 @@ class Content extends AbstractPart $section->addListItem($listItem->nodeValue, 0); } break; + case 'text:tracked-changes': + $changedRegions = $xmlReader->getElements('text:changed-region', $node); + foreach ($changedRegions as $changedRegion) { + $type = ($changedRegion->firstChild->nodeName == 'text:insertion') ? TrackChange::INSERTED : TrackChange::DELETED; + $creatorNode = $xmlReader->getElements('office:change-info/dc:creator', $changedRegion->firstChild); + $author = $creatorNode[0]->nodeValue; + $dateNode = $xmlReader->getElements('office:change-info/dc:date', $changedRegion->firstChild); + $date = $dateNode[0]->nodeValue; + $date = preg_replace('/\.\d+$/', '', $date); + $date = \DateTime::createFromFormat('Y-m-d\TH:i:s', $date); + $changed = new TrackChange($type, $author, $date); + $textNodes = $xmlReader->getElements('text:deletion/text:p', $changedRegion); + $trackedChanges[$changedRegion->getAttribute('text:id')] = array('changed' => $changed, 'textNodes'=> $textNodes); + } + break; } } } diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index 3d853e8f..366bde7e 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -18,6 +18,7 @@ namespace PhpOffice\PhpWord\Reader\Word2007; use PhpOffice\Common\XMLReader; +use PhpOffice\PhpWord\Element\TrackChange; use PhpOffice\PhpWord\PhpWord; /** @@ -156,8 +157,10 @@ abstract class AbstractPart } else { // Text and TextRun $runCount = $xmlReader->countElements('w:r', $domNode); + $insCount = $xmlReader->countElements('w:ins', $domNode); + $delCount = $xmlReader->countElements('w:del', $domNode); $linkCount = $xmlReader->countElements('w:hyperlink', $domNode); - $runLinkCount = $runCount + $linkCount; + $runLinkCount = $runCount + $insCount + $delCount + $linkCount; if (0 == $runLinkCount) { $parent->addTextBreak(null, $paragraphStyle); } else { @@ -185,6 +188,13 @@ abstract class AbstractPart */ protected function readRun(XMLReader $xmlReader, \DOMElement $domNode, $parent, $docPart, $paragraphStyle = null) { + if (in_array($domNode->nodeName, array('w:ins', 'w:del'))) { + $nodes = $xmlReader->getElements('*', $domNode); + foreach ($nodes as $node) { + return $this->readRun($xmlReader, $node, $parent, $docPart, $paragraphStyle); + } + } + if (!in_array($domNode->nodeName, array('w:r', 'w:hyperlink'))) { return; } @@ -228,8 +238,19 @@ abstract class AbstractPart } } else { // TextRun - $textContent = $xmlReader->getValue('w:t', $domNode); - $parent->addText($textContent, $fontStyle, $paragraphStyle); + if ($domNode->parentNode->nodeName == 'w:del') { + $textContent = $xmlReader->getValue('w:delText', $domNode); + } else { + $textContent = $xmlReader->getValue('w:t', $domNode); + } + /** @var AbstractElement $element */ + $element = $parent->addText($textContent, $fontStyle, $paragraphStyle); + if (in_array($domNode->parentNode->nodeName, array('w:ins', 'w:del'))) { + $type = ($domNode->parentNode->nodeName == 'w:del') ? TrackChange::DELETED : TrackChange::INSERTED; + $author = $domNode->parentNode->getAttribute('w:author'); + $date = \DateTime::createFromFormat('Y-m-d\TH:i:s\Z', $domNode->parentNode->getAttribute('w:date')); + $element->setChangeInfo($type, $author, $date); + } } } } diff --git a/src/PhpWord/Reader/Word2007/Styles.php b/src/PhpWord/Reader/Word2007/Styles.php index c6e64e45..8719641e 100644 --- a/src/PhpWord/Reader/Word2007/Styles.php +++ b/src/PhpWord/Reader/Word2007/Styles.php @@ -56,7 +56,7 @@ class Styles extends AbstractPart if ($paragraphDefaults !== null) { $paragraphDefaultStyle = $this->readParagraphStyle($xmlReader, $paragraphDefaults); if ($paragraphDefaultStyle != null) { - $phpWord->setDefaultParagraphStyle(); + $phpWord->setDefaultParagraphStyle($paragraphDefaultStyle); } } diff --git a/src/PhpWord/Writer/HTML/Element/Text.php b/src/PhpWord/Writer/HTML/Element/Text.php index 71cb7566..9f8f7773 100644 --- a/src/PhpWord/Writer/HTML/Element/Text.php +++ b/src/PhpWord/Writer/HTML/Element/Text.php @@ -17,6 +17,7 @@ namespace PhpOffice\PhpWord\Writer\HTML\Element; +use PhpOffice\PhpWord\Element\TrackChange; use PhpOffice\PhpWord\Settings; use PhpOffice\PhpWord\Style\Font; use PhpOffice\PhpWord\Style\Paragraph; @@ -121,6 +122,9 @@ class Text extends AbstractElement $content .= ""; } + //open track change tag + $content .= $this->writeTrackChangeOpening(); + return $content; } @@ -132,6 +136,10 @@ class Text extends AbstractElement protected function writeClosing() { $content = ''; + + //close track change tag + $content .= $this->writeTrackChangeClosing(); + if (!$this->withoutP) { if (Settings::isOutputEscapingEnabled()) { $content .= $this->escaper->escapeHtml($this->closingText); @@ -145,6 +153,63 @@ class Text extends AbstractElement return $content; } + /** + * writes the track change opening tag + * + * @return string the HTML, an empty string if no track change information + */ + private function writeTrackChangeOpening() + { + $changed = $this->element->getTrackChange(); + if ($changed == null) { + return ''; + } + + $content = ''; + if (($changed->getChangeType() == TrackChange::INSERTED)) { + $content .= 'getChangeType() == TrackChange::DELETED) { + $content .= ' array('author'=> $changed->getAuthor(), 'id' => $this->element->getElementId())); + if ($changed->getDate() != null) { + $changedProp['changed']['date'] = $changed->getDate()->format('Y-m-d\TH:i:s\Z'); + } + $content .= json_encode($changedProp); + $content .= '\' '; + $content .= 'title="' . $changed->getAuthor(); + if ($changed->getDate() != null) { + $dateUser = $changed->getDate()->format('Y-m-d H:i:s'); + $content .= ' - ' . $dateUser; + } + $content .= '">'; + + return $content; + } + + /** + * writes the track change closing tag + * + * @return string the HTML, an empty string if no track change information + */ + private function writeTrackChangeClosing() + { + $changed = $this->element->getTrackChange(); + if ($changed == null) { + return ''; + } + + $content = ''; + if (($changed->getChangeType() == TrackChange::INSERTED)) { + $content .= ''; + } elseif ($changed->getChangeType() == TrackChange::DELETED) { + $content .= ''; + } + + return $content; + } + /** * Write paragraph style * diff --git a/src/PhpWord/Writer/ODText/Element/Text.php b/src/PhpWord/Writer/ODText/Element/Text.php index 1fc0b800..f9259fc5 100644 --- a/src/PhpWord/Writer/ODText/Element/Text.php +++ b/src/PhpWord/Writer/ODText/Element/Text.php @@ -17,6 +17,7 @@ namespace PhpOffice\PhpWord\Writer\ODText\Element; +use PhpOffice\PhpWord\Element\TrackChange; use PhpOffice\PhpWord\Exception\Exception; /** @@ -51,29 +52,50 @@ class Text extends AbstractElement if (!$this->withoutP) { $xmlWriter->startElement('text:p'); // text:p } - if (empty($fontStyle)) { - if (empty($paragraphStyle)) { - $xmlWriter->writeAttribute('text:style-name', 'P1'); - } elseif (is_string($paragraphStyle)) { - $xmlWriter->writeAttribute('text:style-name', $paragraphStyle); - } - $this->writeText($element->getText()); - } else { - if (empty($paragraphStyle)) { - $xmlWriter->writeAttribute('text:style-name', 'Standard'); - } elseif (is_string($paragraphStyle)) { - $xmlWriter->writeAttribute('text:style-name', $paragraphStyle); - } - // text:span - $xmlWriter->startElement('text:span'); - if (is_string($fontStyle)) { - $xmlWriter->writeAttribute('text:style-name', $fontStyle); - } - $this->writeText($element->getText()); + if ($element->getTrackChange() != null && $element->getTrackChange()->getChangeType() == TrackChange::DELETED) { + $xmlWriter->startElement('text:change'); + $xmlWriter->writeAttribute('text:change-id', $element->getTrackChange()->getElementId()); $xmlWriter->endElement(); + } else { + if (empty($fontStyle)) { + if (empty($paragraphStyle)) { + $xmlWriter->writeAttribute('text:style-name', 'P1'); + } elseif (is_string($paragraphStyle)) { + $xmlWriter->writeAttribute('text:style-name', $paragraphStyle); + } + $this->writeChangeInsertion(true, $element->getTrackChange()); + $this->writeText($element->getText()); + $this->writeChangeInsertion(false, $element->getTrackChange()); + } else { + if (empty($paragraphStyle)) { + $xmlWriter->writeAttribute('text:style-name', 'Standard'); + } elseif (is_string($paragraphStyle)) { + $xmlWriter->writeAttribute('text:style-name', $paragraphStyle); + } + // text:span + $xmlWriter->startElement('text:span'); + if (is_string($fontStyle)) { + $xmlWriter->writeAttribute('text:style-name', $fontStyle); + } + $this->writeChangeInsertion(true, $element->getTrackChange()); + $this->writeText($element->getText()); + $this->writeChangeInsertion(false, $element->getTrackChange()); + $xmlWriter->endElement(); + } } if (!$this->withoutP) { $xmlWriter->endElement(); // text:p } } + + private function writeChangeInsertion($start = true, TrackChange $trackChange = null) + { + if ($trackChange == null || $trackChange->getChangeType() != TrackChange::INSERTED) { + return; + } + $xmlWriter = $this->getXmlWriter(); + $xmlWriter->startElement('text:change-' . ($start ? 'start' : 'end')); + $xmlWriter->writeAttribute('text:change-id', $trackChange->getElementId()); + $xmlWriter->endElement(); + } } diff --git a/src/PhpWord/Writer/ODText/Part/Content.php b/src/PhpWord/Writer/ODText/Part/Content.php index 8ae4dca9..19d3e54a 100644 --- a/src/PhpWord/Writer/ODText/Part/Content.php +++ b/src/PhpWord/Writer/ODText/Part/Content.php @@ -18,10 +18,12 @@ namespace PhpOffice\PhpWord\Writer\ODText\Part; use PhpOffice\Common\XMLWriter; +use PhpOffice\PhpWord\Element\AbstractContainer; use PhpOffice\PhpWord\Element\Image; use PhpOffice\PhpWord\Element\Table; use PhpOffice\PhpWord\Element\Text; use PhpOffice\PhpWord\Element\TextRun; +use PhpOffice\PhpWord\Element\TrackChange; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\Style\Font; @@ -74,6 +76,40 @@ class Content extends AbstractPart $xmlWriter->startElement('office:body'); $xmlWriter->startElement('office:text'); + // Tracked changes declarations + $trackedChanges = array(); + $sections = $phpWord->getSections(); + foreach ($sections as $section) { + $this->collectTrackedChanges($section, $trackedChanges); + } + $xmlWriter->startElement('text:tracked-changes'); + foreach ($trackedChanges as $trackedElement) { + $trackedChange = $trackedElement->getTrackChange(); + $xmlWriter->startElement('text:changed-region'); + $trackedChange->setElementId(); + $xmlWriter->writeAttribute('text:id', $trackedChange->getElementId()); + + if (($trackedChange->getChangeType() == TrackChange::INSERTED)) { + $xmlWriter->startElement('text:insertion'); + } elseif ($trackedChange->getChangeType() == TrackChange::DELETED) { + $xmlWriter->startElement('text:deletion'); + } + + $xmlWriter->startElement('office:change-info'); + $xmlWriter->writeElement('dc:creator', $trackedChange->getAuthor()); + if ($trackedChange->getDate() != null) { + $xmlWriter->writeElement('dc:date', $trackedChange->getDate()->format('Y-m-d\TH:i:s\Z')); + } + $xmlWriter->endElement(); // office:change-info + if ($trackedChange->getChangeType() == TrackChange::DELETED) { + $xmlWriter->writeElement('text:p', $trackedElement->getText()); + } + + $xmlWriter->endElement(); // text:insertion|text:deletion + $xmlWriter->endElement(); // text:changed-region + } + $xmlWriter->endElement(); // text:tracked-changes + // Sequence declarations $sequences = array('Illustration', 'Table', 'Text', 'Drawing'); $xmlWriter->startElement('text:sequence-decls'); @@ -242,4 +278,23 @@ class Content extends AbstractPart $element->setParagraphStyle("P{$paragraphStyleCount}"); } } + + /** + * Finds all tracked changes + * + * @param AbstractContainer $container + * @param \PhpOffice\PhpWord\Element\AbstractElement[] $trackedChanges + */ + private function collectTrackedChanges(AbstractContainer $container, &$trackedChanges = array()) + { + $elements = $container->getElements(); + foreach ($elements as $element) { + if ($element->getTrackChange() != null) { + $trackedChanges[] = $element; + } + if (is_callable(array($element, 'getElements'))) { + $this->collectTrackedChanges($element, $trackedChanges); + } + } + } } diff --git a/src/PhpWord/Writer/Word2007/Element/Text.php b/src/PhpWord/Writer/Word2007/Element/Text.php index e7149432..130b912b 100644 --- a/src/PhpWord/Writer/Word2007/Element/Text.php +++ b/src/PhpWord/Writer/Word2007/Element/Text.php @@ -17,6 +17,8 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Element; +use PhpOffice\PhpWord\Element\TrackChange; + /** * Text element writer * @@ -37,16 +39,66 @@ class Text extends AbstractElement $this->startElementP(); + $this->writeOpeningTrackChange(); + $xmlWriter->startElement('w:r'); $this->writeFontStyle(); - $xmlWriter->startElement('w:t'); + $textElement = 'w:t'; + //'w:delText' in case of deleted text + $changed = $element->getTrackChange(); + if ($changed != null && $changed->getChangeType() == TrackChange::DELETED) { + $textElement = 'w:delText'; + } + $xmlWriter->startElement($textElement); + $xmlWriter->writeAttribute('xml:space', 'preserve'); $this->writeText($this->getText($element->getText())); $xmlWriter->endElement(); $xmlWriter->endElement(); // w:r + $this->writeClosingTrackChange(); + $this->endElementP(); // w:p } + + /** + * Write opening of changed element + */ + protected function writeOpeningTrackChange() + { + $changed = $this->getElement()->getTrackChange(); + if ($changed == null) { + return; + } + + $xmlWriter = $this->getXmlWriter(); + + if (($changed->getChangeType() == TrackChange::INSERTED)) { + $xmlWriter->startElement('w:ins'); + } elseif ($changed->getChangeType() == TrackChange::DELETED) { + $xmlWriter->startElement('w:del'); + } + $xmlWriter->writeAttribute('w:author', $changed->getAuthor()); + if ($changed->getDate() != null) { + $xmlWriter->writeAttribute('w:date', $changed->getDate()->format('Y-m-d\TH:i:s\Z')); + } + $xmlWriter->writeAttribute('w:id', $this->getElement()->getElementId()); + } + + /** + * Write ending + */ + protected function writeClosingTrackChange() + { + $changed = $this->getElement()->getTrackChange(); + if ($changed == null) { + return; + } + + $xmlWriter = $this->getXmlWriter(); + + $xmlWriter->endElement(); // w:ins|w:del + } } diff --git a/tests/PhpWord/Element/TrackChangeTest.php b/tests/PhpWord/Element/TrackChangeTest.php new file mode 100644 index 00000000..3249f10b --- /dev/null +++ b/tests/PhpWord/Element/TrackChangeTest.php @@ -0,0 +1,44 @@ +setTrackChange($oTrackChange); + + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\TrackChange', $oTrackChange); + $this->assertEquals($author, $oTrackChange->getAuthor()); + $this->assertEquals($date, $oTrackChange->getDate()); + $this->assertEquals(TrackChange::INSERTED, $oTrackChange->getChangeType()); + } +} diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index 97a8fb15..1ad2ff53 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -259,7 +259,7 @@ class HtmlTest extends \PHPUnit\Framework\TestCase Html::addHtml($section, $html, false, false); $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); - echo $doc->printXml(); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:pPr/w:numPr/w:numId')); $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:t')); diff --git a/tests/PhpWord/Writer/Word2007/ElementTest.php b/tests/PhpWord/Writer/Word2007/ElementTest.php index 4f0d50d9..f91a8479 100644 --- a/tests/PhpWord/Writer/Word2007/ElementTest.php +++ b/tests/PhpWord/Writer/Word2007/ElementTest.php @@ -19,8 +19,8 @@ namespace PhpOffice\PhpWord\Writer\Word2007; use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Element\Comment; -use PhpOffice\PhpWord\Element\Text; use PhpOffice\PhpWord\Element\TextRun; +use PhpOffice\PhpWord\Element\TrackChange; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\TestHelperDOCX; @@ -415,4 +415,20 @@ class ElementTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:commentRangeEnd')); $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:commentReference')); } + + public function testTrackChange() + { + $phpWord = new PhpWord(); + $section = $phpWord->addSection(); + $text = $section->addText('my dummy text'); + $text->setChangeInfo(TrackChange::INSERTED, 'author name'); + $text2 = $section->addText('my other text'); + $text2->setTrackChange(new TrackChange(TrackChange::DELETED, 'another author', new \DateTime())); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:ins/w:r')); + $this->assertEquals('author name', $doc->getElementAttribute('/w:document/w:body/w:p/w:ins', 'w:author')); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:del/w:r/w:delText')); + } } From 91a8dd3b221e24b9654c38576119b804f8f66634 Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 10 Feb 2018 22:16:55 +0100 Subject: [PATCH 220/370] add parsing of p:br and add unit test --- src/PhpWord/Reader/Word2007/AbstractPart.php | 10 +++- tests/PhpWord/Reader/Word2007/ElementTest.php | 46 +++++++++++++++ .../PhpWord/_includes/AbstractTestReader.php | 59 +++++++++++++++++++ 3 files changed, 112 insertions(+), 3 deletions(-) create mode 100644 tests/PhpWord/Reader/Word2007/ElementTest.php create mode 100644 tests/PhpWord/_includes/AbstractTestReader.php diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index 3d853e8f..5ce84650 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -93,7 +93,7 @@ abstract class AbstractPart * * @param \PhpOffice\Common\XMLReader $xmlReader * @param \DOMElement $domNode - * @param mixed $parent + * @param \PhpOffice\PhpWord\Element\AbstractContainer $parent * @param string $docPart * * @todo Get font style for preserve text @@ -177,7 +177,7 @@ abstract class AbstractPart * * @param \PhpOffice\Common\XMLReader $xmlReader * @param \DOMElement $domNode - * @param mixed $parent + * @param \PhpOffice\PhpWord\Element\AbstractContainer $parent * @param string $docPart * @param mixed $paragraphStyle * @@ -226,7 +226,11 @@ abstract class AbstractPart $textContent = "<Object: {$target}>"; $parent->addText($textContent, $fontStyle, $paragraphStyle); } - } else { + } + if ($xmlReader->elementExists('w:br', $domNode)) { + $parent->addTextBreak(); + } + if ($xmlReader->elementExists('w:t', $domNode)) { // TextRun $textContent = $xmlReader->getValue('w:t', $domNode); $parent->addText($textContent, $fontStyle, $paragraphStyle); diff --git a/tests/PhpWord/Reader/Word2007/ElementTest.php b/tests/PhpWord/Reader/Word2007/ElementTest.php new file mode 100644 index 00000000..67c2eb13 --- /dev/null +++ b/tests/PhpWord/Reader/Word2007/ElementTest.php @@ -0,0 +1,46 @@ + + + + test string + + '; + + $phpWord = $this->getDocumentFromString($documentXml); + + $elements = $this->get($phpWord->getSections(), 0)->getElements(); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\TextBreak', $elements[0]); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\Text', $elements[1]); + $this->assertEquals('test string', $elements[1]->getText()); + } +} diff --git a/tests/PhpWord/_includes/AbstractTestReader.php b/tests/PhpWord/_includes/AbstractTestReader.php new file mode 100644 index 00000000..f138ac76 --- /dev/null +++ b/tests/PhpWord/_includes/AbstractTestReader.php @@ -0,0 +1,59 @@ +open($file, \ZipArchive::CREATE); + $zip->addFromString('document.xml', '' . $documentXml . ''); + $zip->close(); + $documentReader = new Document($file, 'document.xml'); + $documentReader->read($phpWord); + unlink($file); + + return $phpWord; + } + + /** + * Returns the element at position $index in the array + * + * @param array $array + * @param number $index + * @return mixed + */ + protected function get(array $array, $index = 0) + { + return $array[$index]; + } +} From 874c6d6fb6083ec2902e27d4e639f0b08aa3c76d Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 10 Feb 2018 22:19:04 +0100 Subject: [PATCH 221/370] update changelog --- CHANGELOG.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d3f60f3..ae661e5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,10 +11,11 @@ v0.15.0 (?? ??? 2018) - Parsing of CSS `direction` instruction, HTML `lang` attribute, formatting inside table cell - @troosan #1273 #1252 #1254 ### Fixed -- fix reading of docx default style - @troosan #1238 -- fix the size unit of when parsing html images - @troosan #1254 -- fixed HTML parsing of nested lists - @troosan #1265 +- Fix reading of docx default style - @troosan #1238 +- Fix the size unit of when parsing html images - @troosan #1254 +- Fixed HTML parsing of nested lists - @troosan #1265 - Save PNG alpha information when using remote images. @samsullivan #779 +- fix parsing of `` tag. @troosan #1274 From 377fb99fbc85683e2efcaf4e153a76b9cd558fe7 Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 10 Feb 2018 23:43:15 +0100 Subject: [PATCH 222/370] Add HTML writer for Bookmarks + tests --- CHANGELOG.md | 3 +- src/PhpWord/Writer/HTML/Element/Bookmark.php | 45 ++++++++++++++++++++ src/PhpWord/Writer/HTML/Element/Link.php | 8 ++-- tests/PhpWord/Writer/HTML/ElementTest.php | 2 +- tests/PhpWord/Writer/HTMLTest.php | 2 + 5 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 src/PhpWord/Writer/HTML/Element/Bookmark.php diff --git a/CHANGELOG.md b/CHANGELOG.md index ae661e5b..3b0110b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,8 @@ v0.15.0 (?? ??? 2018) - Fix the size unit of when parsing html images - @troosan #1254 - Fixed HTML parsing of nested lists - @troosan #1265 - Save PNG alpha information when using remote images. @samsullivan #779 -- fix parsing of `` tag. @troosan #1274 +- Fix parsing of `` tag. @troosan #1274 +- Bookmark are not writton as internal link in html writer @troosan #1263 diff --git a/src/PhpWord/Writer/HTML/Element/Bookmark.php b/src/PhpWord/Writer/HTML/Element/Bookmark.php new file mode 100644 index 00000000..649cc7b8 --- /dev/null +++ b/src/PhpWord/Writer/HTML/Element/Bookmark.php @@ -0,0 +1,45 @@ +element instanceof \PhpOffice\PhpWord\Element\Bookmark) { + return ''; + } + + $content = ''; + $content .= $this->writeOpening(); + $content .= "element->getName()}\"/>"; + $content .= $this->writeClosing(); + + return $content; + } +} diff --git a/src/PhpWord/Writer/HTML/Element/Link.php b/src/PhpWord/Writer/HTML/Element/Link.php index bdea985a..f29880d4 100644 --- a/src/PhpWord/Writer/HTML/Element/Link.php +++ b/src/PhpWord/Writer/HTML/Element/Link.php @@ -37,12 +37,12 @@ class Link extends Text return ''; } - $content = ''; - $content .= $this->writeOpening(); + $prefix = $this->element->isInternal() ? '#' : ''; + $content = $this->writeOpening(); if (Settings::isOutputEscapingEnabled()) { - $content .= "escaper->escapeHtmlAttr($this->element->getSource())}\">{$this->escaper->escapeHtml($this->element->getText())}"; + $content .= "escaper->escapeHtmlAttr($this->element->getSource())}\">{$this->escaper->escapeHtml($this->element->getText())}"; } else { - $content .= "element->getSource()}\">{$this->element->getText()}"; + $content .= "element->getSource()}\">{$this->element->getText()}"; } $content .= $this->writeClosing(); diff --git a/tests/PhpWord/Writer/HTML/ElementTest.php b/tests/PhpWord/Writer/HTML/ElementTest.php index 86856d5c..fc092ba3 100644 --- a/tests/PhpWord/Writer/HTML/ElementTest.php +++ b/tests/PhpWord/Writer/HTML/ElementTest.php @@ -31,7 +31,7 @@ class ElementTest extends \PHPUnit\Framework\TestCase */ public function testUnmatchedElements() { - $elements = array('Container', 'Footnote', 'Image', 'Link', 'ListItem', 'Table', 'Title'); + $elements = array('Container', 'Footnote', 'Image', 'Link', 'ListItem', 'Table', 'Title', 'Bookmark'); foreach ($elements as $element) { $objectClass = 'PhpOffice\\PhpWord\\Writer\\HTML\\Element\\' . $element; $parentWriter = new HTML(); diff --git a/tests/PhpWord/Writer/HTMLTest.php b/tests/PhpWord/Writer/HTMLTest.php index bdfc44e3..f2bc7175 100644 --- a/tests/PhpWord/Writer/HTMLTest.php +++ b/tests/PhpWord/Writer/HTMLTest.php @@ -73,6 +73,7 @@ class HTMLTest extends \PHPUnit\Framework\TestCase ); $phpWord->addParagraphStyle('Paragraph', array('alignment' => Jc::CENTER, 'spaceAfter' => 20, 'spaceBefore' => 20)); $section = $phpWord->addSection(); + $section->addBookmark('top'); $section->addText(htmlspecialchars('Test 1', ENT_COMPAT, 'UTF-8'), 'Font', 'Paragraph'); $section->addTextBreak(); $section->addText( @@ -128,6 +129,7 @@ class HTMLTest extends \PHPUnit\Framework\TestCase $cell->addFootnote(); $cell->addEndnote(); $cell = $table->addRow()->addCell(); + $section->addLink('top', 'back to top', null, null, true); $writer = new HTML($phpWord); From 5ff15e06a2b2e0da4716567f20b05a89aaa7d018 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 11 Feb 2018 00:17:19 +0100 Subject: [PATCH 223/370] update testing instructions [ci skip] --- docs/PULL_REQUEST_TEMPLATE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/PULL_REQUEST_TEMPLATE.md b/docs/PULL_REQUEST_TEMPLATE.md index cff513a3..24ba001c 100644 --- a/docs/PULL_REQUEST_TEMPLATE.md +++ b/docs/PULL_REQUEST_TEMPLATE.md @@ -6,6 +6,6 @@ Fixes # (issue) ### Checklist: -- [ ] I have run `composer check` and no errors were reported -- [ ] The new code is covered by unit tests +- [ ] I have run `composer run-script check --timeout=0` and no errors were reported +- [ ] The new code is covered by unit tests (check build/coverage for coverage report) - [ ] I have update the documentation to describe the changes From e846602d1ebdab8603b8c8b7d1b69a0577d3f780 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 11 Feb 2018 13:58:26 +0100 Subject: [PATCH 224/370] fix null check [ci skip] --- src/PhpWord/Element/Image.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/Element/Image.php b/src/PhpWord/Element/Image.php index 7eff87bc..5e73d4e4 100644 --- a/src/PhpWord/Element/Image.php +++ b/src/PhpWord/Element/Image.php @@ -313,7 +313,7 @@ class Image extends AbstractElement $zip = new ZipArchive(); if ($zip->open($zipFilename) !== false) { - if ($zip->locateName($imageFilename)) { + if ($zip->locateName($imageFilename) !== false) { $isTemp = true; $zip->extractTo(Settings::getTempDir(), $imageFilename); $actualSource = Settings::getTempDir() . DIRECTORY_SEPARATOR . $imageFilename; @@ -458,7 +458,7 @@ class Image extends AbstractElement $zip = new ZipArchive(); if ($zip->open($zipFilename) !== false) { - if ($zip->locateName($imageFilename)) { + if ($zip->locateName($imageFilename) !== false) { $imageContent = $zip->getFromName($imageFilename); if ($imageContent !== false) { file_put_contents($tempFilename, $imageContent); From 7ddaed240f46398166855c807c5256330e048738 Mon Sep 17 00:00:00 2001 From: ale rimoldi Date: Mon, 25 Jul 2016 10:11:52 +0200 Subject: [PATCH 225/370] table->setStretch() optionally avoids the table to stretch to the page width (only for word output) --- src/PhpWord/Style/Table.php | 33 +++++++++++++++++++++ src/PhpWord/Writer/Word2007/Style/Table.php | 15 ++++++++++ 2 files changed, 48 insertions(+) diff --git a/src/PhpWord/Style/Table.php b/src/PhpWord/Style/Table.php index a3d454f3..aa397949 100644 --- a/src/PhpWord/Style/Table.php +++ b/src/PhpWord/Style/Table.php @@ -28,6 +28,8 @@ class Table extends Border const WIDTH_AUTO = 'auto'; // Automatically determined width const WIDTH_PERCENT = 'pct'; // Width in fiftieths (1/50) of a percent (1% = 50 unit) const WIDTH_TWIP = 'dxa'; // Width in twentieths (1/20) of a point (twip) + const STRETCH_AUTO = 'autofit'; // Automatically stretch the table to fit the page width + const STRETCH_FIXED = 'fixed'; // Do not stretch the table to fit the page width /** * Is this a first row style? @@ -121,6 +123,11 @@ class Table extends Border */ private $unit = self::WIDTH_AUTO; + /** + * @var string Stretch the table to the page width + */ + private $stretch = self::STRETCH_AUTO; + /** * Create new table style * @@ -582,6 +589,32 @@ class Table extends Border return $this; } + /** + * Get stretch + * + * @return string + */ + public function getStretch() + { + return $this->stretch; + } + + /** + * Set stretch + * + * Stretch the table to the page width + * + * @param string $value + * @return self + */ + public function setStretch($value = null) + { + $enum = array(self::STRETCH_AUTO, self::STRETCH_FIXED); + $this->stretch = $this->setEnumVal($value, $enum, $this->stretch); + + return $this; + } + /** * Get table style only property by checking if it's a firstRow * diff --git a/src/PhpWord/Writer/Word2007/Style/Table.php b/src/PhpWord/Writer/Word2007/Style/Table.php index 620e4fbf..2c4066f1 100644 --- a/src/PhpWord/Writer/Word2007/Style/Table.php +++ b/src/PhpWord/Writer/Word2007/Style/Table.php @@ -77,6 +77,7 @@ class Table extends AbstractStyle } $this->writeWidth($xmlWriter, $style->getWidth(), $style->getUnit()); + $this->writeLayout($xmlWriter, $style->getStretch()); $this->writeMargin($xmlWriter, $style); $this->writeBorder($xmlWriter, $style); @@ -106,6 +107,20 @@ class Table extends AbstractStyle $xmlWriter->endElement(); // w:tblW } + /** + * Enable/Disable automatic resizing of the table + * + * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter + * @param string $layout autofit / fixed + * @return void + */ + private function writeLayout(XMLWriter $xmlWriter, $stretch) + { + $xmlWriter->startElement('w:tblLayout'); + $xmlWriter->writeAttribute('w:type', $stretch); + $xmlWriter->endElement(); // w:tblLayout + } + /** * Write margin. * From 6a926e26f136a41937c8f5aa2eaef79d40cadcd8 Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 14 Feb 2018 00:39:37 +0100 Subject: [PATCH 226/370] refactor attribute name to layout, add doc and tests --- CHANGELOG.md | 1 + docs/styles.rst | 1 + src/PhpWord/Reader/Word2007/AbstractPart.php | 1 + src/PhpWord/Style/Table.php | 36 +++++++----- src/PhpWord/Writer/Word2007/Style/Table.php | 7 +-- tests/PhpWord/Element/ImageTest.php | 21 +++++++ tests/PhpWord/Reader/Word2007/StyleTest.php | 46 +++++++++++++++ tests/PhpWord/Style/TableTest.php | 11 ++++ .../Writer/Word2007/Style/TableTest.php | 58 +++++++++++++++++++ 9 files changed, 165 insertions(+), 17 deletions(-) create mode 100644 tests/PhpWord/Reader/Word2007/StyleTest.php create mode 100644 tests/PhpWord/Writer/Word2007/Style/TableTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 344517c7..762bf560 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ v0.15.0 (?? ??? 2018) - Parse formatting inside HTML lists - @troosan @samimussbach #1239 #945 #1215 #508 - Parsing of CSS `direction` instruction, HTML `lang` attribute, formatting inside table cell - @troosan #1273 #1252 #1254 - Add support for Track changes @Cip @troosan #354 #1262 +- Add support for fixed Table Layout @aoloe @ekopach @troosan #841 #1276 ### Fixed - Fix reading of docx default style - @troosan #1238 diff --git a/docs/styles.rst b/docs/styles.rst index 6166f5c9..031f3759 100644 --- a/docs/styles.rst +++ b/docs/styles.rst @@ -103,6 +103,7 @@ Available Table style options: - ``border(Top|Right|Bottom|Left)Size``. Border size in twips. - ``cellMargin(Top|Right|Bottom|Left)``. Cell margin in twips. - ``width``. Table width in percent. +- ``layout``. Table layout, either *fixed* or *autofit* See ``\PhpOffice\PhpWord\Style\Table`` for constants. Available Row style options: diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index 9276823b..09d32dbb 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -425,6 +425,7 @@ abstract class AbstractPart $styleDefs["border{$ucfSide}Color"] = array(self::READ_VALUE, "w:tblBorders/w:$side", 'w:color'); $styleDefs["border{$ucfSide}Style"] = array(self::READ_VALUE, "w:tblBorders/w:$side", 'w:val'); } + $styleDefs['layout'] = array(self::READ_VALUE, 'w:tblLayout', 'w:type'); $style = $this->readStyleDefs($xmlReader, $styleNode, $styleDefs); } } diff --git a/src/PhpWord/Style/Table.php b/src/PhpWord/Style/Table.php index aa397949..d0ff47ed 100644 --- a/src/PhpWord/Style/Table.php +++ b/src/PhpWord/Style/Table.php @@ -28,8 +28,20 @@ class Table extends Border const WIDTH_AUTO = 'auto'; // Automatically determined width const WIDTH_PERCENT = 'pct'; // Width in fiftieths (1/50) of a percent (1% = 50 unit) const WIDTH_TWIP = 'dxa'; // Width in twentieths (1/20) of a point (twip) - const STRETCH_AUTO = 'autofit'; // Automatically stretch the table to fit the page width - const STRETCH_FIXED = 'fixed'; // Do not stretch the table to fit the page width + + //values for http://www.datypic.com/sc/ooxml/t-w_ST_TblLayoutType.html + /** + * AutoFit Table Layout + * + * @var string + */ + const LAYOUT_AUTO = 'autofit'; + /** + * Fixed Width Table Layout + * + * @var string + */ + const LAYOUT_FIXED = 'fixed'; /** * Is this a first row style? @@ -124,9 +136,9 @@ class Table extends Border private $unit = self::WIDTH_AUTO; /** - * @var string Stretch the table to the page width + * @var string Table Layout */ - private $stretch = self::STRETCH_AUTO; + private $layout = self::LAYOUT_AUTO; /** * Create new table style @@ -590,27 +602,25 @@ class Table extends Border } /** - * Get stretch + * Get layout * * @return string */ - public function getStretch() + public function getLayout() { - return $this->stretch; + return $this->layout; } /** - * Set stretch - * - * Stretch the table to the page width + * Set layout * * @param string $value * @return self */ - public function setStretch($value = null) + public function setLayout($value = null) { - $enum = array(self::STRETCH_AUTO, self::STRETCH_FIXED); - $this->stretch = $this->setEnumVal($value, $enum, $this->stretch); + $enum = array(self::LAYOUT_AUTO, self::LAYOUT_FIXED); + $this->layout = $this->setEnumVal($value, $enum, $this->layout); return $this; } diff --git a/src/PhpWord/Writer/Word2007/Style/Table.php b/src/PhpWord/Writer/Word2007/Style/Table.php index 26df8436..e2e8f978 100644 --- a/src/PhpWord/Writer/Word2007/Style/Table.php +++ b/src/PhpWord/Writer/Word2007/Style/Table.php @@ -77,7 +77,7 @@ class Table extends AbstractStyle } $this->writeWidth($xmlWriter, $style->getWidth(), $style->getUnit()); - $this->writeLayout($xmlWriter, $style->getStretch()); + $this->writeLayout($xmlWriter, $style->getLayout()); $this->writeMargin($xmlWriter, $style); $this->writeBorder($xmlWriter, $style); @@ -112,12 +112,11 @@ class Table extends AbstractStyle * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param string $layout autofit / fixed - * @return void */ - private function writeLayout(XMLWriter $xmlWriter, $stretch) + private function writeLayout(XMLWriter $xmlWriter, $layout) { $xmlWriter->startElement('w:tblLayout'); - $xmlWriter->writeAttribute('w:type', $stretch); + $xmlWriter->writeAttribute('w:type', $layout); $xmlWriter->endElement(); // w:tblLayout } diff --git a/tests/PhpWord/Element/ImageTest.php b/tests/PhpWord/Element/ImageTest.php index 0966ea4d..8bebce91 100644 --- a/tests/PhpWord/Element/ImageTest.php +++ b/tests/PhpWord/Element/ImageTest.php @@ -210,6 +210,27 @@ class ImageTest extends \PHPUnit\Framework\TestCase $this->assertNotNull($image->getImageStringData(true)); } + /** + * Test construct from GD + */ + public function testConstructFromGd() + { + $source = 'http://php.net/images/logos/php-icon.png'; + + $image = new Image($source); + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Image', $image); + $this->assertEquals($source, $image->getSource()); + $this->assertEquals(md5($source), $image->getMediaId()); + $this->assertEquals('image/png', $image->getImageType()); + $this->assertEquals('png', $image->getImageExtension()); + $this->assertEquals('imagecreatefrompng', $image->getImageCreateFunction()); + $this->assertEquals('imagepng', $image->getImageFunction()); + $this->assertTrue($image->isMemImage()); + + $this->assertNotNull($image->getImageStringData()); + $this->assertNotNull($image->getImageStringData(true)); + } + /** * Test invalid string image * diff --git a/tests/PhpWord/Reader/Word2007/StyleTest.php b/tests/PhpWord/Reader/Word2007/StyleTest.php new file mode 100644 index 00000000..ce59f4c3 --- /dev/null +++ b/tests/PhpWord/Reader/Word2007/StyleTest.php @@ -0,0 +1,46 @@ + + + + + '; + + $phpWord = $this->getDocumentFromString($documentXml); + + $elements = $this->get($phpWord->getSections(), 0)->getElements(); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\Table', $elements[0]); + $this->assertInstanceOf('PhpOffice\PhpWord\Style\Table', $elements[0]->getStyle()); + $this->assertEquals(Table::LAYOUT_FIXED, $elements[0]->getStyle()->getLayout()); + } +} diff --git a/tests/PhpWord/Style/TableTest.php b/tests/PhpWord/Style/TableTest.php index 2d57b1b8..dafdeb31 100644 --- a/tests/PhpWord/Style/TableTest.php +++ b/tests/PhpWord/Style/TableTest.php @@ -172,4 +172,15 @@ class TableTest extends \PHPUnit\Framework\TestCase $object->getBorderColor() ); } + + /** + * Tests table layout + */ + public function testTableLayout() + { + $object = new Table(); + $this->assertEquals(Table::LAYOUT_AUTO, $object->getLayout()); + $object->setLayout(Table::LAYOUT_FIXED); + $this->assertEquals(Table::LAYOUT_FIXED, $object->getLayout()); + } } diff --git a/tests/PhpWord/Writer/Word2007/Style/TableTest.php b/tests/PhpWord/Writer/Word2007/Style/TableTest.php new file mode 100644 index 00000000..a89dd610 --- /dev/null +++ b/tests/PhpWord/Writer/Word2007/Style/TableTest.php @@ -0,0 +1,58 @@ +setLayout(Table::LAYOUT_FIXED); + + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $table = $section->addTable($tableStyle); + $table->addRow(); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + + $path = '/w:document/w:body/w:tbl/w:tblPr/w:tblLayout'; + $this->assertTrue($doc->elementExists($path)); + $this->assertEquals(Table::LAYOUT_FIXED, $doc->getElementAttribute($path, 'w:type')); + } +} From e7232a715b26f77d75c2055e8f9259869d83cdf8 Mon Sep 17 00:00:00 2001 From: Frank Liepert Date: Fri, 16 Feb 2018 14:34:37 +0100 Subject: [PATCH 227/370] Use singular form of twip --- docs/elements.rst | 6 +++--- docs/general.rst | 2 +- docs/styles.rst | 28 ++++++++++++++-------------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/elements.rst b/docs/elements.rst index 7df3b163..12d46908 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -307,8 +307,8 @@ Your TOC can only be generated if you have add at least one title (See "Titles") Options for ``$tocStyle``: - ``tabLeader``. Fill type between the title text and the page number. Use the defined constants in ``\PhpOffice\PhpWord\Style\TOC``. -- ``tabPos``. The position of the tab where the page number appears in twips. -- ``indent``. The indent factor of the titles in twips. +- ``tabPos``. The position of the tab where the page number appears in twip. +- ``indent``. The indent factor of the titles in twip. Footnotes & endnotes -------------------- @@ -429,7 +429,7 @@ Line elements can be added to sections by using ``addLine``. Available line style attributes: -- ``weight``. Line width in twips. +- ``weight``. Line width in twip. - ``color``. Defines the color of stroke. - ``dash``. Line types: dash, rounddot, squaredot, dashdot, longdash, longdashdot, longdashdotdot. - ``beginArrow``. Start type of arrow: block, open, classic, diamond, oval. diff --git a/docs/general.rst b/docs/general.rst index 09a23cee..99d8b3ba 100644 --- a/docs/general.rst +++ b/docs/general.rst @@ -255,7 +255,7 @@ The base length unit in Open Office XML is twip. Twip means "TWentieth of an Inch Point", i.e. 1 twip = 1/1440 inch. You can use PHPWord helper functions to convert inches, centimeters, or -points to twips. +points to twip. .. code-block:: php diff --git a/docs/styles.rst b/docs/styles.rst index 031f3759..8f462a8c 100644 --- a/docs/styles.rst +++ b/docs/styles.rst @@ -11,26 +11,26 @@ Section Available Section style options: - ``borderBottomColor``. Border bottom color. -- ``borderBottomSize``. Border bottom size (in twips). +- ``borderBottomSize``. Border bottom size (in twip). - ``borderLeftColor``. Border left color. -- ``borderLeftSize``. Border left size (in twips). +- ``borderLeftSize``. Border left size (in twip). - ``borderRightColor``. Border right color. -- ``borderRightSize``. Border right size (in twips). +- ``borderRightSize``. Border right size (in twip). - ``borderTopColor``. Border top color. -- ``borderTopSize``. Border top size (in twips). +- ``borderTopSize``. Border top size (in twip). - ``breakType``. Section break type (nextPage, nextColumn, continuous, evenPage, oddPage). - ``colsNum``. Number of columns. - ``colsSpace``. Spacing between columns. - ``footerHeight``. Spacing to bottom of footer. - ``gutter``. Page gutter spacing. - ``headerHeight``. Spacing to top of header. -- ``marginTop``. Page margin top (in twips). -- ``marginLeft``. Page margin left (in twips). -- ``marginRight``. Page margin right (in twips). -- ``marginBottom``. Page margin bottom (in twips). +- ``marginTop``. Page margin top (in twip). +- ``marginLeft``. Page margin left (in twip). +- ``marginRight``. Page margin right (in twip). +- ``marginBottom``. Page margin bottom (in twip). - ``orientation``. Page orientation (``portrait``, which is default, or ``landscape``). -- ``pageSizeH``. Page height (in twips). Implicitly defined by ``orientation`` option. Any changes are discouraged. -- ``pageSizeW``. Page width (in twips). Implicitly defined by ``orientation`` option. Any changes are discouraged. +- ``pageSizeH``. Page height (in twip). Implicitly defined by ``orientation`` option. Any changes are discouraged. +- ``pageSizeW``. Page width (in twip). Implicitly defined by ``orientation`` option. Any changes are discouraged. .. _font-style: @@ -100,8 +100,8 @@ Available Table style options: See ``\PhpOffice\PhpWord\SimpleType\JcTable`` and ``\PhpOffice\PhpWord\SimpleType\Jc`` classes for the details. - ``bgColor``. Background color, e.g. '9966CC'. - ``border(Top|Right|Bottom|Left)Color``. Border color, e.g. '9966CC'. -- ``border(Top|Right|Bottom|Left)Size``. Border size in twips. -- ``cellMargin(Top|Right|Bottom|Left)``. Cell margin in twips. +- ``border(Top|Right|Bottom|Left)Size``. Border size in twip. +- ``cellMargin(Top|Right|Bottom|Left)``. Cell margin in twip. - ``width``. Table width in percent. - ``layout``. Table layout, either *fixed* or *autofit* See ``\PhpOffice\PhpWord\Style\Table`` for constants. @@ -115,13 +115,13 @@ Available Cell style options: - ``bgColor``. Background color, e.g. '9966CC'. - ``border(Top|Right|Bottom|Left)Color``. Border color, e.g. '9966CC'. -- ``border(Top|Right|Bottom|Left)Size``. Border size in twips. +- ``border(Top|Right|Bottom|Left)Size``. Border size in twip. - ``gridSpan``. Number of columns spanned. - ``textDirection(btLr|tbRl)``. Direction of text. You can use constants ``\PhpOffice\PhpWord\Style\Cell::TEXT_DIR_BTLR`` and ``\PhpOffice\PhpWord\Style\Cell::TEXT_DIR_TBRL`` - ``valign``. Vertical alignment, *top*, *center*, *both*, *bottom*. - ``vMerge``. *restart* or *continue*. -- ``width``. Cell width in twips. +- ``width``. Cell width in twip. .. _image-style: From ab978356c38ffda37a3d5302cce64d66721b7e37 Mon Sep 17 00:00:00 2001 From: Frank Liepert Date: Fri, 16 Feb 2018 14:40:31 +0100 Subject: [PATCH 228/370] Use same markup for describing unit of measurement --- docs/containers.rst | 2 +- docs/elements.rst | 6 +++--- docs/styles.rst | 28 ++++++++++++++-------------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/containers.rst b/docs/containers.rst index 3569cc50..dc194d59 100644 --- a/docs/containers.rst +++ b/docs/containers.rst @@ -79,7 +79,7 @@ Below are the properties of the line numbering style. - ``start`` Line numbering starting value - ``increment`` Line number increments -- ``distance`` Distance between text and line numbering in twip +- ``distance`` Distance between text and line numbering in *twip* - ``restart`` Line numbering restart setting continuous\|newPage\|newSection diff --git a/docs/elements.rst b/docs/elements.rst index 12d46908..d13abc56 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -307,8 +307,8 @@ Your TOC can only be generated if you have add at least one title (See "Titles") Options for ``$tocStyle``: - ``tabLeader``. Fill type between the title text and the page number. Use the defined constants in ``\PhpOffice\PhpWord\Style\TOC``. -- ``tabPos``. The position of the tab where the page number appears in twip. -- ``indent``. The indent factor of the titles in twip. +- ``tabPos``. The position of the tab where the page number appears in *twip*. +- ``indent``. The indent factor of the titles in *twip*. Footnotes & endnotes -------------------- @@ -429,7 +429,7 @@ Line elements can be added to sections by using ``addLine``. Available line style attributes: -- ``weight``. Line width in twip. +- ``weight``. Line width in *twip*. - ``color``. Defines the color of stroke. - ``dash``. Line types: dash, rounddot, squaredot, dashdot, longdash, longdashdot, longdashdotdot. - ``beginArrow``. Start type of arrow: block, open, classic, diamond, oval. diff --git a/docs/styles.rst b/docs/styles.rst index 8f462a8c..9d1cc4c5 100644 --- a/docs/styles.rst +++ b/docs/styles.rst @@ -11,26 +11,26 @@ Section Available Section style options: - ``borderBottomColor``. Border bottom color. -- ``borderBottomSize``. Border bottom size (in twip). +- ``borderBottomSize``. Border bottom size in *twip*. - ``borderLeftColor``. Border left color. -- ``borderLeftSize``. Border left size (in twip). +- ``borderLeftSize``. Border left size in *twip*. - ``borderRightColor``. Border right color. -- ``borderRightSize``. Border right size (in twip). +- ``borderRightSize``. Border right size in *twip*. - ``borderTopColor``. Border top color. -- ``borderTopSize``. Border top size (in twip). +- ``borderTopSize``. Border top size in *twip*. - ``breakType``. Section break type (nextPage, nextColumn, continuous, evenPage, oddPage). - ``colsNum``. Number of columns. - ``colsSpace``. Spacing between columns. - ``footerHeight``. Spacing to bottom of footer. - ``gutter``. Page gutter spacing. - ``headerHeight``. Spacing to top of header. -- ``marginTop``. Page margin top (in twip). -- ``marginLeft``. Page margin left (in twip). -- ``marginRight``. Page margin right (in twip). -- ``marginBottom``. Page margin bottom (in twip). +- ``marginTop``. Page margin top in *twip*. +- ``marginLeft``. Page margin left in *twip*. +- ``marginRight``. Page margin right in *twip*. +- ``marginBottom``. Page margin bottom in *twip*. - ``orientation``. Page orientation (``portrait``, which is default, or ``landscape``). -- ``pageSizeH``. Page height (in twip). Implicitly defined by ``orientation`` option. Any changes are discouraged. -- ``pageSizeW``. Page width (in twip). Implicitly defined by ``orientation`` option. Any changes are discouraged. +- ``pageSizeH``. Page height in *twip*. Implicitly defined by ``orientation`` option. Any changes are discouraged. +- ``pageSizeW``. Page width in *twip*. Implicitly defined by ``orientation`` option. Any changes are discouraged. .. _font-style: @@ -100,8 +100,8 @@ Available Table style options: See ``\PhpOffice\PhpWord\SimpleType\JcTable`` and ``\PhpOffice\PhpWord\SimpleType\Jc`` classes for the details. - ``bgColor``. Background color, e.g. '9966CC'. - ``border(Top|Right|Bottom|Left)Color``. Border color, e.g. '9966CC'. -- ``border(Top|Right|Bottom|Left)Size``. Border size in twip. -- ``cellMargin(Top|Right|Bottom|Left)``. Cell margin in twip. +- ``border(Top|Right|Bottom|Left)Size``. Border size in *twip*. +- ``cellMargin(Top|Right|Bottom|Left)``. Cell margin in *twip*. - ``width``. Table width in percent. - ``layout``. Table layout, either *fixed* or *autofit* See ``\PhpOffice\PhpWord\Style\Table`` for constants. @@ -115,13 +115,13 @@ Available Cell style options: - ``bgColor``. Background color, e.g. '9966CC'. - ``border(Top|Right|Bottom|Left)Color``. Border color, e.g. '9966CC'. -- ``border(Top|Right|Bottom|Left)Size``. Border size in twip. +- ``border(Top|Right|Bottom|Left)Size``. Border size in *twip*. - ``gridSpan``. Number of columns spanned. - ``textDirection(btLr|tbRl)``. Direction of text. You can use constants ``\PhpOffice\PhpWord\Style\Cell::TEXT_DIR_BTLR`` and ``\PhpOffice\PhpWord\Style\Cell::TEXT_DIR_TBRL`` - ``valign``. Vertical alignment, *top*, *center*, *both*, *bottom*. - ``vMerge``. *restart* or *continue*. -- ``width``. Cell width in twip. +- ``width``. Cell width in *twip*. .. _image-style: From fede4f736eac05f0444eb5a6bad7875356b00c94 Mon Sep 17 00:00:00 2001 From: Frank Liepert Date: Fri, 16 Feb 2018 15:45:20 +0100 Subject: [PATCH 229/370] Add missing unit of measurement descriptions --- docs/styles.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/styles.rst b/docs/styles.rst index 9d1cc4c5..8e155ca2 100644 --- a/docs/styles.rst +++ b/docs/styles.rst @@ -70,15 +70,15 @@ Available Paragraph style options: - ``alignment``. Supports all alignment modes since 1st Edition of ECMA-376 standard up till ISO/IEC 29500:2012. See ``\PhpOffice\PhpWord\SimpleType\Jc`` class for the details. - ``basedOn``. Parent style. -- ``hanging``. Hanging by how much. -- ``indent``. Indent by how much. +- ``hanging``. Hanging in *twip*. +- ``indent``. Indent in *twip*. - ``keepLines``. Keep all lines on one page, *true* or *false*. - ``keepNext``. Keep paragraph with next paragraph, *true* or *false*. - ``lineHeight``. Text line height, e.g. *1.0*, *1.5*, etc. - ``next``. Style for next paragraph. - ``pageBreakBefore``. Start paragraph on next page, *true* or *false*. -- ``spaceBefore``. Space before paragraph. -- ``spaceAfter``. Space after paragraph. +- ``spaceBefore``. Space before paragraph in *twip*. +- ``spaceAfter``. Space after paragraph in *twip*. - ``spacing``. Space between lines. - ``spacingLineRule``. Line Spacing Rule. *auto*, *exact*, *atLeast* - ``tabs``. Set of custom tab stops. From d061c6dc7c2a8bb21639300a8de5ab2b0d4c357a Mon Sep 17 00:00:00 2001 From: Frank Liepert Date: Thu, 15 Feb 2018 22:45:07 +0100 Subject: [PATCH 230/370] Remove zend-stdlib dependency --- composer.json | 1 - src/PhpWord/TemplateProcessor.php | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 614865d8..bceb5998 100644 --- a/composer.json +++ b/composer.json @@ -61,7 +61,6 @@ "php": "^5.3.3 || ^7.0", "ext-xml": "*", "zendframework/zend-escaper": "^2.2", - "zendframework/zend-stdlib": "^2.2 || ^3.0", "phpoffice/common": "^0.2" }, "require-dev": { diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php index 5dd7b0bf..269b25e9 100644 --- a/src/PhpWord/TemplateProcessor.php +++ b/src/PhpWord/TemplateProcessor.php @@ -17,13 +17,13 @@ namespace PhpOffice\PhpWord; +use PhpOffice\Common\Text; use PhpOffice\PhpWord\Escaper\RegExp; use PhpOffice\PhpWord\Escaper\Xml; use PhpOffice\PhpWord\Exception\CopyFileException; use PhpOffice\PhpWord\Exception\CreateTemporaryFileException; use PhpOffice\PhpWord\Exception\Exception; use PhpOffice\PhpWord\Shared\ZipArchive; -use Zend\Stdlib\StringUtils; class TemplateProcessor { @@ -192,7 +192,7 @@ class TemplateProcessor */ protected static function ensureUtf8Encoded($subject) { - if (!StringUtils::isValidUtf8($subject)) { + if (!Text::isUTF8($subject)) { $subject = utf8_encode($subject); } From ba035185c7f50cf66e78589cd158b22e516ddb8d Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 18 Feb 2018 00:09:14 +0100 Subject: [PATCH 231/370] point next dev version to develop branch [ci skip] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index bceb5998..d1c35b40 100644 --- a/composer.json +++ b/composer.json @@ -88,7 +88,7 @@ }, "extra": { "branch-alias": { - "dev-master": "0.15-dev" + "dev-develop": "0.15-dev" } } } From 04d0c02e2374624bfb408da42fb4e81bcdbfe362 Mon Sep 17 00:00:00 2001 From: dox07 Date: Sun, 18 Feb 2018 02:10:10 +0300 Subject: [PATCH 232/370] Add support for cellSpacing for tables (#1040) * Add cellSpacing into table * add word 2007 reader * add tests * add documentation --- CHANGELOG.md | 3 +- docs/styles.rst | 2 + samples/Sample_09_Tables.php | 2 +- src/PhpWord/Reader/Word2007/AbstractPart.php | 1 + src/PhpWord/SimpleType/TblWidth.php | 42 +++++++++++++++++++ src/PhpWord/Style/Table.php | 38 ++++++++++++++--- src/PhpWord/Writer/Word2007/Style/Table.php | 40 ++++++++++-------- tests/PhpWord/Reader/Word2007/StyleTest.php | 23 ++++++++++ tests/PhpWord/Style/TableTest.php | 28 +++++++++---- .../Writer/Word2007/Style/TableTest.php | 21 ++++++++++ 10 files changed, 168 insertions(+), 32 deletions(-) create mode 100644 src/PhpWord/SimpleType/TblWidth.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 762bf560..2dca8348 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,11 +6,12 @@ This project adheres to [Semantic Versioning](http://semver.org/). v0.15.0 (?? ??? 2018) ---------------------- ### Added -- Parsing of "align" HTML attribute - @troosan #1231 +- Parsing of `align` HTML attribute - @troosan #1231 - Parse formatting inside HTML lists - @troosan @samimussbach #1239 #945 #1215 #508 - Parsing of CSS `direction` instruction, HTML `lang` attribute, formatting inside table cell - @troosan #1273 #1252 #1254 - Add support for Track changes @Cip @troosan #354 #1262 - Add support for fixed Table Layout @aoloe @ekopach @troosan #841 #1276 +- Add support for Cell Spacing @dox07 @troosan #1040 ### Fixed - Fix reading of docx default style - @troosan #1238 diff --git a/docs/styles.rst b/docs/styles.rst index 8e155ca2..0ec0ec38 100644 --- a/docs/styles.rst +++ b/docs/styles.rst @@ -103,7 +103,9 @@ Available Table style options: - ``border(Top|Right|Bottom|Left)Size``. Border size in *twip*. - ``cellMargin(Top|Right|Bottom|Left)``. Cell margin in *twip*. - ``width``. Table width in percent. +- ``unit``. The unit to use for the width. One of ``\PhpOffice\PhpWord\SimpleType\TblWidth``. Defaults to *auto*. - ``layout``. Table layout, either *fixed* or *autofit* See ``\PhpOffice\PhpWord\Style\Table`` for constants. +- ``cellSpacing`` Cell spacing in *twip* Available Row style options: diff --git a/samples/Sample_09_Tables.php b/samples/Sample_09_Tables.php index c4be7c9e..ba41aa54 100644 --- a/samples/Sample_09_Tables.php +++ b/samples/Sample_09_Tables.php @@ -27,7 +27,7 @@ $section->addTextBreak(1); $section->addText('Fancy table', $header); $fancyTableStyleName = 'Fancy Table'; -$fancyTableStyle = array('borderSize' => 6, 'borderColor' => '006699', 'cellMargin' => 80, 'alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER); +$fancyTableStyle = array('borderSize' => 6, 'borderColor' => '006699', 'cellMargin' => 80, 'alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER, 'cellSpacing' => 50); $fancyTableFirstRowStyle = array('borderBottomSize' => 18, 'borderBottomColor' => '0000FF', 'bgColor' => '66BBFF'); $fancyTableCellStyle = array('valign' => 'center'); $fancyTableCellBtlrStyle = array('valign' => 'center', 'textDirection' => \PhpOffice\PhpWord\Style\Cell::TEXT_DIR_BTLR); diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index 09d32dbb..511e9081 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -426,6 +426,7 @@ abstract class AbstractPart $styleDefs["border{$ucfSide}Style"] = array(self::READ_VALUE, "w:tblBorders/w:$side", 'w:val'); } $styleDefs['layout'] = array(self::READ_VALUE, 'w:tblLayout', 'w:type'); + $styleDefs['cellSpacing'] = array(self::READ_VALUE, 'w:tblCellSpacing', 'w:w'); $style = $this->readStyleDefs($xmlReader, $styleNode, $styleDefs); } } diff --git a/src/PhpWord/SimpleType/TblWidth.php b/src/PhpWord/SimpleType/TblWidth.php new file mode 100644 index 00000000..3d947bce --- /dev/null +++ b/src/PhpWord/SimpleType/TblWidth.php @@ -0,0 +1,42 @@ +firstRowStyle = clone $this; $this->firstRowStyle->isFirstRow = true; - unset($this->firstRowStyle->firstRowStyle, $this->firstRowStyle->borderInsideHSize, $this->firstRowStyle->borderInsideHColor, $this->firstRowStyle->borderInsideVSize, $this->firstRowStyle->borderInsideVColor, $this->firstRowStyle->cellMarginTop, $this->firstRowStyle->cellMarginLeft, $this->firstRowStyle->cellMarginRight, $this->firstRowStyle->cellMarginBottom); + unset($this->firstRowStyle->firstRowStyle, $this->firstRowStyle->borderInsideHSize, $this->firstRowStyle->borderInsideHColor, $this->firstRowStyle->borderInsideVSize, $this->firstRowStyle->borderInsideVColor, $this->firstRowStyle->cellMarginTop, $this->firstRowStyle->cellMarginLeft, $this->firstRowStyle->cellMarginRight, $this->firstRowStyle->cellMarginBottom, $this->firstRowStyle->cellSpacing); $this->firstRowStyle->setStyleByArray($firstRowStyle); } @@ -161,6 +173,22 @@ class Table extends Border } } + /** + * @param float|int $cellSpacing + */ + public function setCellSpacing($cellSpacing = null) + { + $this->cellSpacing = $cellSpacing; + } + + /** + * @return float|int + */ + public function getCellSpacing() + { + return $this->cellSpacing; + } + /** * Set first row * @@ -595,8 +623,8 @@ class Table extends Border */ public function setUnit($value = null) { - $enum = array(self::WIDTH_AUTO, self::WIDTH_PERCENT, self::WIDTH_TWIP); - $this->unit = $this->setEnumVal($value, $enum, $this->unit); + TblWidth::validate($value); + $this->unit = $value; return $this; } diff --git a/src/PhpWord/Writer/Word2007/Style/Table.php b/src/PhpWord/Writer/Word2007/Style/Table.php index e2e8f978..14226212 100644 --- a/src/PhpWord/Writer/Word2007/Style/Table.php +++ b/src/PhpWord/Writer/Word2007/Style/Table.php @@ -18,6 +18,7 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Style; use PhpOffice\Common\XMLWriter; +use PhpOffice\PhpWord\SimpleType\TblWidth; use PhpOffice\PhpWord\Style\Table as TableStyle; use PhpOffice\PhpWord\Writer\Word2007\Element\TableAlignment; @@ -49,7 +50,7 @@ class Table extends AbstractStyle $xmlWriter->writeAttribute('w:val', $style); $xmlWriter->endElement(); if (null !== $this->width) { - $this->writeWidth($xmlWriter, $this->width, 'pct'); + $this->writeTblWidth($xmlWriter, 'w:tblW', TblWidth::PERCENT, $this->width); } $xmlWriter->endElement(); } @@ -76,7 +77,8 @@ class Table extends AbstractStyle $xmlWriter->endElement(); } - $this->writeWidth($xmlWriter, $style->getWidth(), $style->getUnit()); + $this->writeTblWidth($xmlWriter, 'w:tblW', $style->getUnit(), $style->getWidth()); + $this->writeTblWidth($xmlWriter, 'w:tblCellSpacing', TblWidth::TWIP, $style->getCellSpacing()); $this->writeLayout($xmlWriter, $style->getLayout()); $this->writeMargin($xmlWriter, $style); $this->writeBorder($xmlWriter, $style); @@ -92,21 +94,6 @@ class Table extends AbstractStyle } } - /** - * Write width. - * - * @param \PhpOffice\Common\XMLWriter $xmlWriter - * @param int $width - * @param string $unit - */ - private function writeWidth(XMLWriter $xmlWriter, $width, $unit) - { - $xmlWriter->startElement('w:tblW'); - $xmlWriter->writeAttribute('w:w', $width); - $xmlWriter->writeAttribute('w:type', $unit); - $xmlWriter->endElement(); // w:tblW - } - /** * Enable/Disable automatic resizing of the table * @@ -159,6 +146,25 @@ class Table extends AbstractStyle } } + /** + * Writes a table width + * + * @param \PhpOffice\Common\XMLWriter $xmlWriter + * @param string $elementName + * @param string $unit + * @param int|float $width + */ + private function writeTblWidth(XMLWriter $xmlWriter, $elementName, $unit, $width = null) + { + if (null === $width) { + return; + } + $xmlWriter->startElement($elementName); + $xmlWriter->writeAttributeIf(null !== $width, 'w:w', $width); + $xmlWriter->writeAttribute('w:type', $unit); + $xmlWriter->endElement(); + } + /** * Write row style. * diff --git a/tests/PhpWord/Reader/Word2007/StyleTest.php b/tests/PhpWord/Reader/Word2007/StyleTest.php index ce59f4c3..4375df47 100644 --- a/tests/PhpWord/Reader/Word2007/StyleTest.php +++ b/tests/PhpWord/Reader/Word2007/StyleTest.php @@ -18,6 +18,7 @@ namespace PhpOffice\PhpWord\Reader\Word2007; use PhpOffice\PhpWord\AbstractTestReader; +use PhpOffice\PhpWord\SimpleType\TblWidth; use PhpOffice\PhpWord\Style\Table; /** @@ -43,4 +44,26 @@ class StyleTest extends AbstractTestReader $this->assertInstanceOf('PhpOffice\PhpWord\Style\Table', $elements[0]->getStyle()); $this->assertEquals(Table::LAYOUT_FIXED, $elements[0]->getStyle()->getLayout()); } + + /** + * Test reading of cell spacing + */ + public function testReadCellSpacing() + { + $documentXml = ' + + + + '; + + $phpWord = $this->getDocumentFromString($documentXml); + + $elements = $this->get($phpWord->getSections(), 0)->getElements(); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\Table', $elements[0]); + $this->assertInstanceOf('PhpOffice\PhpWord\Style\Table', $elements[0]->getStyle()); + $this->assertEquals(TblWidth::AUTO, $elements[0]->getStyle()->getUnit()); + /** @var \PhpOffice\PhpWord\Style\Table $tableStyle */ + $tableStyle = $elements[0]->getStyle(); + $this->assertEquals(10.5, $tableStyle->getCellSpacing()); + } } diff --git a/tests/PhpWord/Style/TableTest.php b/tests/PhpWord/Style/TableTest.php index dafdeb31..9dec422e 100644 --- a/tests/PhpWord/Style/TableTest.php +++ b/tests/PhpWord/Style/TableTest.php @@ -18,6 +18,7 @@ namespace PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\SimpleType\JcTable; +use PhpOffice\PhpWord\SimpleType\TblWidth; /** * Test class for PhpOffice\PhpWord\Style\Table @@ -38,9 +39,6 @@ class TableTest extends \PHPUnit\Framework\TestCase $styleTable = array('bgColor' => 'FF0000'); $styleFirstRow = array('borderBottomSize' => 3); - $object = new Table(); - $this->assertNull($object->getBgColor()); - $object = new Table($styleTable, $styleFirstRow); $this->assertEquals('FF0000', $object->getBgColor()); @@ -49,6 +47,18 @@ class TableTest extends \PHPUnit\Framework\TestCase $this->assertEquals(3, $firstRow->getBorderBottomSize()); } + /** + * Test default values when passing no style + */ + public function testDefaultValues() + { + $object = new Table(); + + $this->assertNull($object->getBgColor()); + $this->assertEquals(Table::LAYOUT_AUTO, $object->getLayout()); + $this->assertEquals(TblWidth::AUTO, $object->getUnit()); + } + /** * Test setting style with normal value */ @@ -77,6 +87,7 @@ class TableTest extends \PHPUnit\Framework\TestCase 'alignment' => JcTable::CENTER, 'width' => 100, 'unit' => 'pct', + 'layout' => Table::LAYOUT_FIXED, ); foreach ($attributes as $key => $value) { $set = "set{$key}"; @@ -174,13 +185,14 @@ class TableTest extends \PHPUnit\Framework\TestCase } /** - * Tests table layout + * Tests table cell spacing */ - public function testTableLayout() + public function testTableCellSpacing() { $object = new Table(); - $this->assertEquals(Table::LAYOUT_AUTO, $object->getLayout()); - $object->setLayout(Table::LAYOUT_FIXED); - $this->assertEquals(Table::LAYOUT_FIXED, $object->getLayout()); + $this->assertNull($object->getCellSpacing()); + + $object = new Table(array('cellSpacing' => 20)); + $this->assertEquals(20, $object->getCellSpacing()); } } diff --git a/tests/PhpWord/Writer/Word2007/Style/TableTest.php b/tests/PhpWord/Writer/Word2007/Style/TableTest.php index a89dd610..c0a0b3ad 100644 --- a/tests/PhpWord/Writer/Word2007/Style/TableTest.php +++ b/tests/PhpWord/Writer/Word2007/Style/TableTest.php @@ -55,4 +55,25 @@ class TableTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists($path)); $this->assertEquals(Table::LAYOUT_FIXED, $doc->getElementAttribute($path, 'w:type')); } + + /** + * Test write styles + */ + public function testCellSpacing() + { + $tableStyle = new Table(); + $tableStyle->setCellSpacing(10.3); + + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $table = $section->addTable($tableStyle); + $table->addRow(); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + + $path = '/w:document/w:body/w:tbl/w:tblPr/w:tblCellSpacing'; + $this->assertTrue($doc->elementExists($path)); + $this->assertEquals(10.3, $doc->getElementAttribute($path, 'w:w')); + $this->assertEquals(\PhpOffice\PhpWord\SimpleType\TblWidth::TWIP, $doc->getElementAttribute($path, 'w:type')); + } } From bded91af9f9a28927263484ac98e9190c20f9c94 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 18 Feb 2018 00:39:00 +0100 Subject: [PATCH 233/370] Footnote in listitem (#1289) * Allow footnote to be added in ListItems --- CHANGELOG.md | 1 + samples/Sample_14_ListItem.php | 2 ++ src/PhpWord/Element/AbstractContainer.php | 2 +- src/PhpWord/Shared/Html.php | 10 +++++++--- src/PhpWord/Style/Cell.php | 6 ++++-- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dca8348..406122b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ v0.15.0 (?? ??? 2018) - Save PNG alpha information when using remote images. @samsullivan #779 - Fix parsing of `` tag. @troosan #1274 - Bookmark are not writton as internal link in html writer @troosan #1263 +- It should be possible to add a Footnote in a ListItemRun @troosan #1287 #1287 diff --git a/samples/Sample_14_ListItem.php b/samples/Sample_14_ListItem.php index 689ac3d3..774fd284 100644 --- a/samples/Sample_14_ListItem.php +++ b/samples/Sample_14_ListItem.php @@ -67,6 +67,8 @@ $listItemRun->addText(' in bold', array('bold' => true)); $listItemRun = $section->addListItemRun(); $listItemRun->addText('List item 2'); $listItemRun->addText(' in italic', array('italic' => true)); +$footnote = $listItemRun->addFootnote(); +$footnote->addText('this is a footnote on a list item'); $listItemRun = $section->addListItemRun(); $listItemRun->addText('List item 3'); $listItemRun->addText(' underlined', array('underline' => 'dash')); diff --git a/src/PhpWord/Element/AbstractContainer.php b/src/PhpWord/Element/AbstractContainer.php index 4a5f83f5..507ff143 100644 --- a/src/PhpWord/Element/AbstractContainer.php +++ b/src/PhpWord/Element/AbstractContainer.php @@ -207,7 +207,7 @@ abstract class AbstractContainer extends AbstractElement 'Table' => array('Section', 'Header', 'Footer', 'Cell', 'TextBox'), 'CheckBox' => array('Section', 'Header', 'Footer', 'Cell', 'TextRun'), 'TextBox' => array('Section', 'Header', 'Footer', 'Cell'), - 'Footnote' => array('Section', 'TextRun', 'Cell'), + 'Footnote' => array('Section', 'TextRun', 'Cell', 'ListItemRun'), 'Endnote' => array('Section', 'TextRun', 'Cell'), 'PreserveText' => array('Section', 'Header', 'Footer', 'Cell'), 'Title' => array('Section', 'Cell'), diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 971776ff..1841616e 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -415,6 +415,10 @@ class Html } } + /** + * @param bool $isOrderedList + * @return array + */ private static function getListStyle($isOrderedList) { if ($isOrderedList) { @@ -547,13 +551,13 @@ class Html case 'width': if (preg_match('/([0-9]+[a-z]+)/', $cValue, $matches)) { $styles['width'] = Converter::cssToTwip($matches[1]); - $styles['unit'] = \PhpOffice\PhpWord\Style\Table::WIDTH_TWIP; + $styles['unit'] = \PhpOffice\PhpWord\SimpleType\TblWidth::TWIP; } elseif (preg_match('/([0-9]+)%/', $cValue, $matches)) { $styles['width'] = $matches[1] * 50; - $styles['unit'] = \PhpOffice\PhpWord\Style\Table::WIDTH_PERCENT; + $styles['unit'] = \PhpOffice\PhpWord\SimpleType\TblWidth::PERCENT; } elseif (preg_match('/([0-9]+)/', $cValue, $matches)) { $styles['width'] = $matches[1]; - $styles['unit'] = \PhpOffice\PhpWord\Style\Table::WIDTH_AUTO; + $styles['unit'] = \PhpOffice\PhpWord\SimpleType\TblWidth::AUTO; } break; case 'border': diff --git a/src/PhpWord/Style/Cell.php b/src/PhpWord/Style/Cell.php index c281f998..8675ed7b 100644 --- a/src/PhpWord/Style/Cell.php +++ b/src/PhpWord/Style/Cell.php @@ -17,6 +17,8 @@ namespace PhpOffice\PhpWord\Style; +use PhpOffice\PhpWord\SimpleType\TblWidth; + /** * Table cell style */ @@ -123,7 +125,7 @@ class Cell extends Border * * @var string */ - private $unit = Table::WIDTH_TWIP; + private $unit = TblWidth::TWIP; /** * Get vertical align. @@ -308,7 +310,7 @@ class Cell extends Border */ public function setUnit($value) { - $this->unit = $this->setEnumVal($value, array(Table::WIDTH_AUTO, Table::WIDTH_PERCENT, Table::WIDTH_TWIP), Table::WIDTH_TWIP); + $this->unit = $this->setEnumVal($value, array(TblWidth::AUTO, TblWidth::PERCENT, TblWidth::TWIP), TblWidth::TWIP); return $this; } From 59de019881750f9cb2bbae7f005e56c65d545b6d Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 18 Feb 2018 01:41:32 +0100 Subject: [PATCH 234/370] Fix listitem parsing (#1290) * Word 2007 Reader: Added support for ListItemRun * Add tests + changelog --- CHANGELOG.md | 3 ++ samples/resources/Sample_11_ReadWord2007.docx | Bin 63320 -> 63388 bytes src/PhpWord/Reader/Word2007/AbstractPart.php | 9 ++-- tests/PhpWord/Reader/Word2007/ElementTest.php | 40 ++++++++++++++++++ 4 files changed, 48 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 406122b6..f6f87158 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ v0.15.0 (?? ??? 2018) - Add support for Track changes @Cip @troosan #354 #1262 - Add support for fixed Table Layout @aoloe @ekopach @troosan #841 #1276 - Add support for Cell Spacing @dox07 @troosan #1040 +- Add parsing of formatting inside lists @atomicalnet @troosan #594 ### Fixed - Fix reading of docx default style - @troosan #1238 @@ -22,6 +23,8 @@ v0.15.0 (?? ??? 2018) - Bookmark are not writton as internal link in html writer @troosan #1263 - It should be possible to add a Footnote in a ListItemRun @troosan #1287 #1287 +### Changed +- Remove zend-stdlib dependency @Trainmaster #1284 v0.14.0 (29 Dec 2017) diff --git a/samples/resources/Sample_11_ReadWord2007.docx b/samples/resources/Sample_11_ReadWord2007.docx index 3faf6f1213f13e82466ef29200862498d2ef7014..406cf1e1ebf296f563f7a05ef4c7c6aaaffd148b 100644 GIT binary patch delta 11671 zcmbWdbyOYAvNwzbcZZF;1_|yO+}+(Bg4@R3HzByY26qo0B)Gc<-?)D~=id9B_n!6s z_0C%Lo1W_Gs;*f*wR)<0=^Q%i0{W*2BJg*)y{kV81O&VQ1Ox^I1caxPt2v9glbO4N zg`*p@mxKMB&bZ?)7xp^dkubVpQ!iD${jf)DR1B3OA0(d|rHo1=ziz>2u4KBz6wdRC zo%+aYax^%2+Zy9SPA%|A#M@wJ7vTKU z@#CBQ5{2ySba6NQvWDHD`bo#tqEVNEWR3GqU|0r(M46<_o_>=+bzzbP{jeFN#v!C< zk+Nyc6fuUjsn8*6117maXy zc0dS!ufM%9+&ym+LnO~+xJKL^4H*7cZ=?ctjvo21uk@8qdLlTCOJr zAc;^%D$OI=qA(?wpA17T3)gD<3B_QvbA%j7S@9VAtX~V!us&r%hh`LS{HbFBUUX3q z-^3WE-y&dfLgkkRW9l~DDzJGYVNUA!?bN7S{Jap@Zjp=wSJ+0Kj@FEx4+MKPPF`+l zbEMt4Chjv+rv~NL%2D`Exh-qv(3I122R=_vosvG#U#~}c_@X6{{qh+W!XEqbjRsO; zTk=w+gdTr!qakn)A{!vGx$PV77N4YxbrX~gLo|pQ(l%l;$FNl7gZWu8CiS8?vJeFz zjB;iIdPd0UhcmWN(fa+#9SBILO^{T^gtEH%2_II(PKqyzi~$dADi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;FPQ5@pc=rlRx`=!)FD7YGC&JCp0PC_-nOA=KmhRzy4{0>$f@ z$mD!;g0RK=Y2H(&$IXWU3Fn|g<>XG(o)P1>$@H>s8FPQQH+ZnxyJTJB%1Z~Drmm9o zJp^;<;q+mcJA%;DLRZ*B0$*hrBb{LQ6sgnyCp6FppjN6i69PsU-8xgMmC?@z?-%W3 z{>bU4w#S+VjoRio63T6_0DFGuKN4VB}YdDZ}x+Pw$J8%7`WaN^ogd4Gu~jVjde$~1CEV{jMBko|HDv0lGB|9O0lw1 zDCoVR`%o1Ug0-W4j=urtf)W&9v&xL_M|38H-N{wI%1HBF8Ha}Kr#nK-s$k`f8!4r% zgoKTV~*FSK*nmTE^ipd@6hMw#{;kCGT~@=Wi5C{IwmEoO$USk{Z`77ilP8K zG6S2boGgpww607jeG#vPy8tV(Ec^G)pcDyk|BLb^j_^TCP`AQns0W6(a*5(=4hp{{ z%mEkmA>5^Y@ZEOFR9}SHY*kc*7hBt7Ex~6oY4&5^UIr{e-Ju)$QED9Uqr(zq700-B zGY=K5UAcYWYl<@}2sI8MMX7B7wy!eTe-PRFXhyd@p&Nr@TG%?JhQWc8pmU>;t{Y>l z4zy}#1eBuln=2@PcgRK8t<>uB}fN@*QEZ*?{9Ap>2J zX88JRH4i=B%1z?F9Vjk?N3y@6!) ze#(DT*aD01$npMD$pZmF`p@DQhXvfb;|Fa3lH3b{k^+tHg~2tqKtO=aTZD8 zK+r)TL7=|`NkIO0LjP|q`oN2OanLLv`vc{_lONFV0RuD{==LB88Uk#5;Quy%47~Xo k`~b2%QsMvWaD6#E`_%zL{%<`Xz2`vJM^Z?R>wjkd4_96YkN^Mx diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index 511e9081..1d610516 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -138,14 +138,15 @@ abstract class AbstractPart $parent->addPreserveText($textContent, $fontStyle, $paragraphStyle); } elseif ($xmlReader->elementExists('w:pPr/w:numPr', $domNode)) { // List item - $textContent = ''; $numId = $xmlReader->getAttribute('w:val', $domNode, 'w:pPr/w:numPr/w:numId'); $levelId = $xmlReader->getAttribute('w:val', $domNode, 'w:pPr/w:numPr/w:ilvl'); - $nodes = $xmlReader->getElements('w:r', $domNode); + $nodes = $xmlReader->getElements('*', $domNode); + + $listItemRun = $parent->addListItemRun($levelId, "PHPWordList{$numId}", $paragraphStyle); + foreach ($nodes as $node) { - $textContent .= $xmlReader->getValue('w:t', $node); + $this->readRun($xmlReader, $node, $listItemRun, $docPart, $paragraphStyle); } - $parent->addListItem($textContent, $levelId, null, "PHPWordList{$numId}", $paragraphStyle); } elseif (!empty($headingMatches)) { // Heading $textContent = ''; diff --git a/tests/PhpWord/Reader/Word2007/ElementTest.php b/tests/PhpWord/Reader/Word2007/ElementTest.php index 67c2eb13..c2648b68 100644 --- a/tests/PhpWord/Reader/Word2007/ElementTest.php +++ b/tests/PhpWord/Reader/Word2007/ElementTest.php @@ -43,4 +43,44 @@ class ElementTest extends AbstractTestReader $this->assertInstanceOf('PhpOffice\PhpWord\Element\Text', $elements[1]); $this->assertEquals('test string', $elements[1]->getText()); } + + /** + * Test reading of textbreak + */ + public function testReadListItemRunWithFormatting() + { + $documentXml = ' + + + + + + + + Two + + + with + + + + + + bold + + '; + + $phpWord = $this->getDocumentFromString($documentXml); + + $elements = $this->get($phpWord->getSections(), 0)->getElements(); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\ListItemRun', $elements[0]); + $this->assertEquals(0, $elements[0]->getDepth()); + + $listElements = $this->get($elements, 0)->getElements(); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\Text', $listElements[0]); + $this->assertEquals('Two', $listElements[0]->getText()); + $this->assertEquals(' with ', $listElements[1]->getText()); + $this->assertEquals('bold', $listElements[2]->getText()); + $this->assertTrue($listElements[2]->getFontStyle()->getBold()); + } } From 557af99a6df894d5216dae3c58f0089779dafa05 Mon Sep 17 00:00:00 2001 From: Matt Bolt Date: Mon, 19 Feb 2018 12:43:01 +0800 Subject: [PATCH 235/370] Fix colspan and rowspan for tables in HTML Writer --- src/PhpWord/Writer/HTML/Element/Table.php | 57 +++++++++++++++++++---- 1 file changed, 49 insertions(+), 8 deletions(-) diff --git a/src/PhpWord/Writer/HTML/Element/Table.php b/src/PhpWord/Writer/HTML/Element/Table.php index c7d8670b..17ba04b5 100644 --- a/src/PhpWord/Writer/HTML/Element/Table.php +++ b/src/PhpWord/Writer/HTML/Element/Table.php @@ -40,18 +40,59 @@ class Table extends AbstractElement $rowCount = count($rows); if ($rowCount > 0) { $content .= '' . PHP_EOL; - foreach ($rows as $row) { + for ($i = 0; $i < count($rows); $i++) { /** @var $row \PhpOffice\PhpWord\Element\Row Type hint */ - $rowStyle = $row->getStyle(); + $rowStyle = $rows[$i]->getStyle(); // $height = $row->getHeight(); $tblHeader = $rowStyle->isTblHeader(); $content .= '' . PHP_EOL; - foreach ($row->getCells() as $cell) { - $writer = new Container($this->parentWriter, $cell); - $cellTag = $tblHeader ? 'th' : 'td'; - $content .= "<{$cellTag}>" . PHP_EOL; - $content .= $writer->write(); - $content .= "" . PHP_EOL; + $rowCells = $rows[$i]->getCells(); + for ($j = 0; $j < count($rowCells); $j++) { + $cellStyle = $rowCells[$j]->getStyle(); + $cellColSpan = $cellStyle->getGridSpan(); + $cellRowSpan = 1; + $cellVMerge = $cellStyle->getVMerge(); + // If this is the first cell of the vertical merge, find out how man rows it spans + if ($cellVMerge === 'restart') { + for ($k = $i + 1; $k < count($rows); $k++) { + $kRowCells = $rows[$k]->getCells(); + if (isset($kRowCells[$j])) { + if ($kRowCells[$j]->getStyle()->getVMerge() === 'continue') { + $cellRowSpan++; + } else { + break; + } + } else { + break; + } + } + } + // Ignore cells that are merged vertically with previous rows + if ($cellVMerge !== 'continue') { + $cellTag = $tblHeader ? 'th' : 'td'; + $cellColSpanAttr = (is_numeric($cellColSpan) && ($cellColSpan > 1) ? " colspan=\"{$cellColSpan}\"" : ""); + $cellRowSpanAttr = ($cellRowSpan > 1 ? " rowspan=\"{$cellRowSpan}\"" : ""); + $content .= "<{$cellTag}{$cellColSpanAttr}{$cellRowSpanAttr}>" . PHP_EOL; + $writer = new Container($this->parentWriter, $rowCells[$j]); + $content .= $writer->write(); + if ($cellRowSpan > 1) { + // There shouldn't be any content in the subsequent merged cells, but lets check anyway + for ($k = $i + 1; $k < count($rows); $k++) { + $kRowCells = $rows[$k]->getCells(); + if (isset($kRowCells[$j])) { + if ($kRowCells[$j]->getStyle()->getVMerge() === 'continue') { + $writer = new Container($this->parentWriter, $kRowCells[$j]); + $content .= $writer->write(); + } else { + break; + } + } else { + break; + } + } + } + $content .= "" . PHP_EOL; + } } $content .= '' . PHP_EOL; } From a95c3f83bcc0bf99fe7c8b91e3d63f1161391794 Mon Sep 17 00:00:00 2001 From: Matt Bolt Date: Mon, 19 Feb 2018 18:02:55 +0800 Subject: [PATCH 236/370] Fix colspan and rowspan for tables in HTML Writer. Syntax improved. --- src/PhpWord/Writer/HTML/Element/Table.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/PhpWord/Writer/HTML/Element/Table.php b/src/PhpWord/Writer/HTML/Element/Table.php index 17ba04b5..30de2397 100644 --- a/src/PhpWord/Writer/HTML/Element/Table.php +++ b/src/PhpWord/Writer/HTML/Element/Table.php @@ -40,21 +40,22 @@ class Table extends AbstractElement $rowCount = count($rows); if ($rowCount > 0) { $content .= '
                ' . PHP_EOL; - for ($i = 0; $i < count($rows); $i++) { + for ($i = 0; $i < $rowCount; $i++) { /** @var $row \PhpOffice\PhpWord\Element\Row Type hint */ $rowStyle = $rows[$i]->getStyle(); // $height = $row->getHeight(); $tblHeader = $rowStyle->isTblHeader(); $content .= '' . PHP_EOL; $rowCells = $rows[$i]->getCells(); - for ($j = 0; $j < count($rowCells); $j++) { + $rowCellCount = count($rowCells); + for ($j = 0; $j < $rowCellCount; $j++) { $cellStyle = $rowCells[$j]->getStyle(); $cellColSpan = $cellStyle->getGridSpan(); $cellRowSpan = 1; $cellVMerge = $cellStyle->getVMerge(); // If this is the first cell of the vertical merge, find out how man rows it spans if ($cellVMerge === 'restart') { - for ($k = $i + 1; $k < count($rows); $k++) { + for ($k = $i + 1; $k < $rowCount; $k++) { $kRowCells = $rows[$k]->getCells(); if (isset($kRowCells[$j])) { if ($kRowCells[$j]->getStyle()->getVMerge() === 'continue') { @@ -70,14 +71,14 @@ class Table extends AbstractElement // Ignore cells that are merged vertically with previous rows if ($cellVMerge !== 'continue') { $cellTag = $tblHeader ? 'th' : 'td'; - $cellColSpanAttr = (is_numeric($cellColSpan) && ($cellColSpan > 1) ? " colspan=\"{$cellColSpan}\"" : ""); - $cellRowSpanAttr = ($cellRowSpan > 1 ? " rowspan=\"{$cellRowSpan}\"" : ""); + $cellColSpanAttr = (is_numeric($cellColSpan) && ($cellColSpan > 1) ? " colspan=\"{$cellColSpan}\"" : ''); + $cellRowSpanAttr = ($cellRowSpan > 1 ? " rowspan=\"{$cellRowSpan}\"" : ''); $content .= "<{$cellTag}{$cellColSpanAttr}{$cellRowSpanAttr}>" . PHP_EOL; $writer = new Container($this->parentWriter, $rowCells[$j]); $content .= $writer->write(); if ($cellRowSpan > 1) { // There shouldn't be any content in the subsequent merged cells, but lets check anyway - for ($k = $i + 1; $k < count($rows); $k++) { + for ($k = $i + 1; $k < $rowCount; $k++) { $kRowCells = $rows[$k]->getCells(); if (isset($kRowCells[$j])) { if ($kRowCells[$j]->getStyle()->getVMerge() === 'continue') { From f3c73f333adbbbc4c625dd599b2889889d1d29eb Mon Sep 17 00:00:00 2001 From: Samuel Laulhau Date: Tue, 27 Feb 2018 23:24:01 +0100 Subject: [PATCH 237/370] Fix HTML parsing when style attribute is empty (#1295) --- src/PhpWord/Shared/Html.php | 3 ++- tests/PhpWord/Shared/HtmlTest.php | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 1841616e..73635807 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -486,8 +486,9 @@ class Html private static function parseStyle($attribute, $styles) { $properties = explode(';', trim($attribute->value, " \t\n\r\0\x0B;")); + foreach ($properties as $property) { - list($cKey, $cValue) = explode(':', $property, 2); + list($cKey, $cValue) = array_pad(explode(':', $property, 2), 2, null); $cValue = trim($cValue); switch (trim($cKey)) { case 'text-decoration': diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index ac68b887..8be1cc19 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -418,4 +418,14 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:hyperlink')); $this->assertEquals('link text', $doc->getElement('/w:document/w:body/w:p/w:hyperlink/w:r/w:t')->nodeValue); } + + public function testParseMalformedStyleIsIgnored() + { + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $html = '

                text

                '; + Html::addHtml($section, $html); + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + $this->assertFalse($doc->elementExists('/w:document/w:body/w:p[1]/w:pPr/w:jc')); + } } From 7fe32e6ac1b23ea039015f207184fd36e3f1a6bb Mon Sep 17 00:00:00 2001 From: Lenz Weber Date: Tue, 27 Feb 2018 23:27:18 +0100 Subject: [PATCH 238/370] Add support for MACROBUTTON Field (#1021) * add functionality to use MACROBUTTON as Field, use Styles for Field, add noProof to Font Style * code review * refactoring + fixes + unit tests --- CHANGELOG.md | 1 + samples/Sample_27_Field.php | 14 +++++ src/PhpWord/Element/Field.php | 52 ++++++++++++++++ src/PhpWord/Style/Font.php | 31 ++++++++++ src/PhpWord/Writer/Word2007/Element/Field.php | 60 ++++++++++++++++++- src/PhpWord/Writer/Word2007/Style/Font.php | 3 + tests/PhpWord/Writer/Word2007/ElementTest.php | 31 ++++++++++ 7 files changed, 191 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6f87158..c684a37d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ v0.15.0 (?? ??? 2018) - Add support for fixed Table Layout @aoloe @ekopach @troosan #841 #1276 - Add support for Cell Spacing @dox07 @troosan #1040 - Add parsing of formatting inside lists @atomicalnet @troosan #594 +- Add support for MACROBUTTON field @phryneas @troosan #1021 ### Fixed - Fix reading of docx default style - @troosan #1238 diff --git a/samples/Sample_27_Field.php b/samples/Sample_27_Field.php index ec9dbe25..9c37dffe 100644 --- a/samples/Sample_27_Field.php +++ b/samples/Sample_27_Field.php @@ -20,6 +20,7 @@ $section->addField('PAGE', array('format' => 'Arabic')); $section->addText('Number of pages field:'); $section->addField('NUMPAGES', array('numformat' => '0,00', 'format' => 'Arabic'), array('PreserveFormat')); +$section->addTextBreak(); $textrun = $section->addTextRun(); $textrun->addText('An index field is '); @@ -43,6 +44,19 @@ $textrun = $section->addTextRun(array('alignment' => \PhpOffice\PhpWord\SimpleTy $textrun->addText('This is the date of lunar calendar '); $textrun->addField('DATE', array('dateformat' => 'd-M-yyyy H:mm:ss'), array('PreserveFormat', 'LunarCalendar')); $textrun->addText(' written in a textrun.'); +$section->addTextBreak(); + +$macroText = new TextRun(); +$macroText->addText('Double click', array('bold' => true)); +$macroText->addText(' to '); +$macroText->addText('zoom to 100%', array('italic' => true)); + +$section->addText('A macro button with styled text:'); +$section->addField('MACROBUTTON', array('macroname' => 'Zoom100'), array(), $macroText); +$section->addTextBreak(); + +$section->addText('A macro button with simple text:'); +$section->addField('MACROBUTTON', array('macroname' => 'Zoom100'), array(), 'double click to zoom'); // Save file echo write($phpWord, basename(__FILE__, '.php'), $writers); diff --git a/src/PhpWord/Element/Field.php b/src/PhpWord/Element/Field.php index 7b33a479..5aeffbc1 100644 --- a/src/PhpWord/Element/Field.php +++ b/src/PhpWord/Element/Field.php @@ -17,6 +17,8 @@ namespace PhpOffice\PhpWord\Element; +use PhpOffice\PhpWord\Style\Font; + /** * Field element * @@ -54,6 +56,9 @@ class Field extends AbstractElement ), 'options' => array('PreserveFormat', 'LunarCalendar', 'SakaEraCalendar', 'LastUsedFormat'), ), + 'MACROBUTTON' => array( + 'properties' => array('macroname' => ''), + ), 'XE' => array( 'properties' => array(), 'options' => array('Bold', 'Italic'), @@ -92,6 +97,13 @@ class Field extends AbstractElement */ protected $options = array(); + /** + * Font style + * + * @var \PhpOffice\PhpWord\Style\Font + */ + protected $fontStyle; + /** * Create a new Field Element * @@ -203,6 +215,46 @@ class Field extends AbstractElement return $this->options; } + /** + * Set Text style + * + * @param \PhpOffice\PhpWord\Style\Font $style + * @return \PhpOffice\PhpWord\Style\Font + */ + public function setFontStyle($style = null) + { + if (!$style instanceof Font) { + throw new \InvalidArgumentException('font style must be of type Font'); + } + + if ($style->isNoProof()) { + $this->fontStyle = $style; + } else { + // make a copy of the font so the original is not altered + $this->fontStyle = clone $style; + $this->fontStyle->setNoProof(true); + } + + return $this->fontStyle; + } + + /** + * Get Text style + * + * @return \PhpOffice\PhpWord\Style\Font + */ + public function getFontStyle() + { + if ($this->fontStyle == null) { + $font = new Font(); + $font->setNoProof(true); + + return $font; + } + + return $this->fontStyle; + } + /** * Set Field text * diff --git a/src/PhpWord/Style/Font.php b/src/PhpWord/Style/Font.php index 8bfb3ac5..03fb692c 100644 --- a/src/PhpWord/Style/Font.php +++ b/src/PhpWord/Style/Font.php @@ -236,6 +236,14 @@ class Font extends AbstractStyle */ private $rtl = false; + /** + * noProof (disables AutoCorrect) + * + * @var bool + * http://www.datypic.com/sc/ooxml/e-w_noProof-1.html + */ + private $noProof = false; + /** * Languages * @var \PhpOffice\PhpWord\Style\Language @@ -706,6 +714,29 @@ class Font extends AbstractStyle return $this; } + /** + * Get noProof (disables autocorrect) + * + * @return bool + */ + public function isNoProof() + { + return $this->noProof; + } + + /** + * Set noProof (disables autocorrect) + * + * @param bool $value + * @return $this + */ + public function setNoProof($value = false) + { + $this->noProof = $value; + + return $this; + } + /** * Get line height * diff --git a/src/PhpWord/Writer/Word2007/Element/Field.php b/src/PhpWord/Writer/Word2007/Element/Field.php index 75d4983f..336a4325 100644 --- a/src/PhpWord/Writer/Word2007/Element/Field.php +++ b/src/PhpWord/Writer/Word2007/Element/Field.php @@ -29,12 +29,22 @@ class Field extends Text */ public function write() { - $xmlWriter = $this->getXmlWriter(); $element = $this->getElement(); if (!$element instanceof \PhpOffice\PhpWord\Element\Field) { return; } + $methodName = 'write' . ucfirst(strtolower($element->getType())); + if (method_exists($this, $methodName)) { + $this->$methodName($element); + } else { + $this->writeDefault($element); + } + } + + private function writeDefault(\PhpOffice\PhpWord\Element\Field $element) + { + $xmlWriter = $this->getXmlWriter(); $this->startElementP(); $xmlWriter->startElement('w:r'); @@ -104,6 +114,51 @@ class Field extends Text $this->endElementP(); // w:p } + /** + * Writes a macrobutton field + * + * //TODO A lot of code duplication with general method, should maybe be refactored + * @param \PhpOffice\PhpWord\Element\Field $element + */ + protected function writeMacrobutton(\PhpOffice\PhpWord\Element\Field $element) + { + $xmlWriter = $this->getXmlWriter(); + $this->startElementP(); + + $xmlWriter->startElement('w:r'); + $xmlWriter->startElement('w:fldChar'); + $xmlWriter->writeAttribute('w:fldCharType', 'begin'); + $xmlWriter->endElement(); // w:fldChar + $xmlWriter->endElement(); // w:r + + $instruction = ' ' . $element->getType() . ' ' . $this->buildPropertiesAndOptions($element); + if (is_string($element->getText())) { + $instruction .= $element->getText() . ' '; + } + + $xmlWriter->startElement('w:r'); + $xmlWriter->startElement('w:instrText'); + $xmlWriter->writeAttribute('xml:space', 'preserve'); + $xmlWriter->text($instruction); + $xmlWriter->endElement(); // w:instrText + $xmlWriter->endElement(); // w:r + + if ($element->getText() != null) { + if ($element->getText() instanceof \PhpOffice\PhpWord\Element\TextRun) { + $containerWriter = new Container($xmlWriter, $element->getText(), true); + $containerWriter->write(); + } + } + + $xmlWriter->startElement('w:r'); + $xmlWriter->startElement('w:fldChar'); + $xmlWriter->writeAttribute('w:fldCharType', 'end'); + $xmlWriter->endElement(); // w:fldChar + $xmlWriter->endElement(); // w:r + + $this->endElementP(); // w:p + } + private function buildPropertiesAndOptions(\PhpOffice\PhpWord\Element\Field $element) { $propertiesAndOptions = ''; @@ -119,6 +174,9 @@ class Field extends Text case 'dateformat': $propertiesAndOptions .= '\@ "' . $propval . '" '; break; + case 'macroname': + $propertiesAndOptions .= $propval . ' '; + break; } } diff --git a/src/PhpWord/Writer/Word2007/Style/Font.php b/src/PhpWord/Writer/Word2007/Style/Font.php index ecaad416..a13db155 100644 --- a/src/PhpWord/Writer/Word2007/Style/Font.php +++ b/src/PhpWord/Writer/Word2007/Style/Font.php @@ -135,6 +135,9 @@ class Font extends AbstractStyle $xmlWriter->writeElementIf($style->getSpacing() !== null, 'w:spacing', 'w:val', $style->getSpacing()); $xmlWriter->writeElementIf($style->getKerning() !== null, 'w:kern', 'w:val', $style->getKerning() * 2); + // noProof + $xmlWriter->writeElementIf($style->isNoProof() !== false, 'w:noProof'); + // Background-Color $shading = $style->getShading(); if (!is_null($shading)) { diff --git a/tests/PhpWord/Writer/Word2007/ElementTest.php b/tests/PhpWord/Writer/Word2007/ElementTest.php index f91a8479..887e8e58 100644 --- a/tests/PhpWord/Writer/Word2007/ElementTest.php +++ b/tests/PhpWord/Writer/Word2007/ElementTest.php @@ -322,6 +322,37 @@ class ElementTest extends \PHPUnit\Framework\TestCase $this->assertEquals('"\\b \\i ', $doc->getElement($element)->textContent); } + /** + * Test writing the macrobutton field + */ + public function testMacroButtonField() + { + $phpWord = new PhpWord(); + $section = $phpWord->addSection(); + + $macroText = new TextRun(); + $macroText->addText('Double click', array('bold' => true)); + $macroText->addText(' to '); + $macroText->addText('zoom to 100%', array('italic' => true)); + + $section->addField('MACROBUTTON', array('macroname' => 'Zoom100'), array(), $macroText); + $section->addField('MACROBUTTON', array('macroname' => 'Zoom100'), array(), 'double click to zoom'); + $doc = TestHelperDOCX::getDocument($phpWord); + + $element = '/w:document/w:body/w:p[1]/w:r[2]/w:instrText'; + $this->assertTrue($doc->elementExists($element)); + $this->assertEquals(' MACROBUTTON Zoom100 ', $doc->getElement($element)->textContent); + + $element = '/w:document/w:body/w:p[1]/w:r[3]/'; + $this->assertTrue($doc->elementExists($element . 'w:t')); + $this->assertEquals('Double click', $doc->getElement($element . 'w:t')->textContent); + $this->assertTrue($doc->elementExists($element . 'w:rPr/w:b')); + + $element = '/w:document/w:body/w:p[2]/w:r[2]/w:instrText'; + $this->assertTrue($doc->elementExists($element)); + $this->assertEquals(' MACROBUTTON Zoom100 double click to zoom ', $doc->getElement($element)->textContent); + } + /** * Test form fields */ From 0869bdc8f78d584b6091a1dcdc5caf507e637cca Mon Sep 17 00:00:00 2001 From: Damjan Cvetko Date: Thu, 1 Mar 2018 01:24:59 +0100 Subject: [PATCH 239/370] Add support for reading element in runs. Internaly encoding it as "\t". --- src/PhpWord/Reader/Word2007/AbstractPart.php | 6 ++++-- tests/PhpWord/Reader/Word2007/ElementTest.php | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index 1d610516..70d3d960 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -241,9 +241,11 @@ abstract class AbstractPart if ($xmlReader->elementExists('w:br', $domNode)) { $parent->addTextBreak(); } - if ($xmlReader->elementExists('w:t', $domNode)) { + if ($xmlReader->elementExists('w:t', $domNode) || $xmlReader->elementExists('w:tab', $domNode)) { // TextRun - if ($domNode->parentNode->nodeName == 'w:del') { + if ($xmlReader->elementExists('w:tab', $domNode)) { + $textContent = "\t"; + } elseif ($domNode->parentNode->nodeName == 'w:del') { $textContent = $xmlReader->getValue('w:delText', $domNode); } else { $textContent = $xmlReader->getValue('w:t', $domNode); diff --git a/tests/PhpWord/Reader/Word2007/ElementTest.php b/tests/PhpWord/Reader/Word2007/ElementTest.php index c2648b68..6804b172 100644 --- a/tests/PhpWord/Reader/Word2007/ElementTest.php +++ b/tests/PhpWord/Reader/Word2007/ElementTest.php @@ -83,4 +83,22 @@ class ElementTest extends AbstractTestReader $this->assertEquals('bold', $listElements[2]->getText()); $this->assertTrue($listElements[2]->getFontStyle()->getBold()); } + + /** + * Test reading of tab + */ + public function testReadTab() + { + $documentXml = ' + + + + '; + + $phpWord = $this->getDocumentFromString($documentXml); + + $elements = $this->get($phpWord->getSections(), 0)->getElements(); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\Text', $elements[0]); + $this->assertEquals("\t", $elements[0]->getText()); + } } From 740e66acf58394c47a991181184efc6d010f3a38 Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 2 Mar 2018 07:17:26 +0100 Subject: [PATCH 240/370] randomize the tempDir more to make sure directory is unique [ci skip] --- src/PhpWord/Writer/AbstractWriter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Writer/AbstractWriter.php b/src/PhpWord/Writer/AbstractWriter.php index 538d9c03..bb943d7e 100644 --- a/src/PhpWord/Writer/AbstractWriter.php +++ b/src/PhpWord/Writer/AbstractWriter.php @@ -216,7 +216,7 @@ abstract class AbstractWriter implements WriterInterface protected function getTempFile($filename) { // Temporary directory - $this->setTempDir(Settings::getTempDir() . uniqid('/PHPWordWriter_') . '/'); + $this->setTempDir(Settings::getTempDir() . uniqid('/PHPWordWriter_', true) . '/'); // Temporary file $this->originalFilename = $filename; From 8a2cba22926242b6ec9433781b8878d301ae1e0e Mon Sep 17 00:00:00 2001 From: Damjan Cvetko Date: Sun, 4 Mar 2018 17:13:06 +0100 Subject: [PATCH 241/370] Support multiple elements (w:t, w:delText, w:tab) in w:r. --- src/PhpWord/Reader/Word2007/AbstractPart.php | 18 +++++++++++------- tests/PhpWord/Reader/Word2007/ElementTest.php | 4 +++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index 70d3d960..c69f636a 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -241,14 +241,18 @@ abstract class AbstractPart if ($xmlReader->elementExists('w:br', $domNode)) { $parent->addTextBreak(); } - if ($xmlReader->elementExists('w:t', $domNode) || $xmlReader->elementExists('w:tab', $domNode)) { + if ($xmlReader->elementExists('w:t', $domNode) || $xmlReader->elementExists('w:tab', $domNode) || $xmlReader->elementExists('w:delText', $domNode)) { // TextRun - if ($xmlReader->elementExists('w:tab', $domNode)) { - $textContent = "\t"; - } elseif ($domNode->parentNode->nodeName == 'w:del') { - $textContent = $xmlReader->getValue('w:delText', $domNode); - } else { - $textContent = $xmlReader->getValue('w:t', $domNode); + $textContent = ''; + $nodes = $xmlReader->getElements('w:t|w:delText|w:tab', $domNode); + foreach ($nodes as $node) { + if ($node->nodeName == 'w:t') { + $textContent .= $node->nodeValue; + } elseif ($node->nodeName == 'w:delText') { + $textContent .= $node->nodeValue; + } elseif ($node->nodeName == 'w:tab') { + $textContent .= "\t"; + } } /** @var AbstractElement $element */ $element = $parent->addText($textContent, $fontStyle, $paragraphStyle); diff --git a/tests/PhpWord/Reader/Word2007/ElementTest.php b/tests/PhpWord/Reader/Word2007/ElementTest.php index 6804b172..aad4a543 100644 --- a/tests/PhpWord/Reader/Word2007/ElementTest.php +++ b/tests/PhpWord/Reader/Word2007/ElementTest.php @@ -91,7 +91,9 @@ class ElementTest extends AbstractTestReader { $documentXml = ' + One + Two '; @@ -99,6 +101,6 @@ class ElementTest extends AbstractTestReader $elements = $this->get($phpWord->getSections(), 0)->getElements(); $this->assertInstanceOf('PhpOffice\PhpWord\Element\Text', $elements[0]); - $this->assertEquals("\t", $elements[0]->getText()); + $this->assertEquals("One\tTwo", $elements[0]->getText()); } } From 30b224b3d099f417507c422c1244e6174dbee4d0 Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 6 Mar 2018 06:34:55 +0100 Subject: [PATCH 242/370] Word2007 parsing title formatting (#1297) * Improve Title parsing - Title should be able to contain TextRun - Style 'Title' should be treated the same with as Heading - Add tests for Heading/Title reader * update the documentation and the changelog * PHP 7.2 build should not fail anymore * reduce dependencies versions * fix parsing of footnotes and endnotes * add method to remove an element from a section --- .scrutinizer.yml | 5 + .travis.yml | 5 +- CHANGELOG.md | 1 + docs/elements.rst | 3 +- samples/Sample_17_TitleTOC.php | 3 +- src/PhpWord/Collection/AbstractCollection.php | 10 +- src/PhpWord/Element/AbstractContainer.php | 37 +++- src/PhpWord/Element/Bookmark.php | 2 +- src/PhpWord/Element/ListItem.php | 2 +- src/PhpWord/Element/Title.php | 20 ++- src/PhpWord/PhpWord.php | 15 ++ src/PhpWord/Reader/Word2007/AbstractPart.php | 61 +++++-- src/PhpWord/Reader/Word2007/Footnotes.php | 43 +++-- src/PhpWord/Style.php | 8 +- src/PhpWord/Writer/Word2007/Element/Title.php | 45 +++-- src/PhpWord/Writer/Word2007/Part/Styles.php | 12 +- tests/PhpWord/Element/SectionTest.php | 31 ++++ tests/PhpWord/Element/TitleTest.php | 21 +++ tests/PhpWord/Reader/Word2007/ElementTest.php | 70 +++++++- tests/PhpWord/Reader/Word2007/PartTest.php | 163 ++++++++++++++++++ tests/PhpWord/Reader/Word2007/StyleTest.php | 8 +- tests/PhpWord/Writer/Word2007/ElementTest.php | 29 ++++ .../Writer/Word2007/Part/DocumentTest.php | 1 - .../PhpWord/_includes/AbstractTestReader.php | 43 +++-- 24 files changed, 539 insertions(+), 99 deletions(-) create mode 100644 tests/PhpWord/Reader/Word2007/PartTest.php diff --git a/.scrutinizer.yml b/.scrutinizer.yml index c8fe57cf..291a6d60 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,3 +1,8 @@ +build: + nodes: + analysis: + tests: + override: [php-scrutinizer-run] filter: excluded_paths: [ 'vendor/*', 'tests/*', 'samples/*', 'src/PhpWord/Shared/PCLZip/*' ] diff --git a/.travis.yml b/.travis.yml index d63b7bb2..281c2630 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,12 +15,9 @@ matrix: include: - php: 5.6 env: COVERAGE=1 - allow_failures: - - php: 7.2 cache: directories: - - vendor - $HOME/.composer/cache - .php-cs.cache @@ -38,7 +35,7 @@ before_script: - if [ -z "$COVERAGE" ]; then phpenv config-rm xdebug.ini ; fi ## Composer - composer self-update - - composer install --prefer-source + - travis_wait composer install --prefer-source ## PHPDocumentor - mkdir -p build/docs - mkdir -p build/coverage diff --git a/CHANGELOG.md b/CHANGELOG.md index c684a37d..7f527746 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ v0.15.0 (?? ??? 2018) - Fix parsing of `` tag. @troosan #1274 - Bookmark are not writton as internal link in html writer @troosan #1263 - It should be possible to add a Footnote in a ListItemRun @troosan #1287 #1287 +- Fix parsing of Heading and Title formating @troosan @gthomas2 #465 ### Changed - Remove zend-stdlib dependency @Trainmaster #1284 diff --git a/docs/elements.rst b/docs/elements.rst index d13abc56..4d1b9383 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -89,6 +89,7 @@ Titles If you want to structure your document or build table of contents, you need titles or headings. To add a title to the document, use the ``addTitleStyle`` and ``addTitle`` method. +If `depth` is 0, a Title will be inserted, otherwise a Heading1, Heading2, ... .. code-block:: php @@ -98,7 +99,7 @@ To add a title to the document, use the ``addTitleStyle`` and ``addTitle`` metho - ``depth``. - ``$fontStyle``. See :ref:`font-style`. - ``$paragraphStyle``. See :ref:`paragraph-style`. -- ``$text``. Text to be displayed in the document. +- ``$text``. Text to be displayed in the document. This can be `string` or a `\PhpOffice\PhpWord\Element\TextRun` It's necessary to add a title style to your document because otherwise the title won't be detected as a real title. diff --git a/samples/Sample_17_TitleTOC.php b/samples/Sample_17_TitleTOC.php index f99b73ea..86e8e28c 100644 --- a/samples/Sample_17_TitleTOC.php +++ b/samples/Sample_17_TitleTOC.php @@ -12,13 +12,14 @@ $section = $phpWord->addSection(); // Define styles $fontStyle12 = array('spaceAfter' => 60, 'size' => 12); $fontStyle10 = array('size' => 10); +$phpWord->addTitleStyle(null, array('size' => 22, 'bold' => true)); $phpWord->addTitleStyle(1, array('size' => 20, 'color' => '333333', 'bold' => true)); $phpWord->addTitleStyle(2, array('size' => 16, 'color' => '666666')); $phpWord->addTitleStyle(3, array('size' => 14, 'italic' => true)); $phpWord->addTitleStyle(4, array('size' => 12)); // Add text elements -$section->addText('Table of contents 1'); +$section->addTitle('Table of contents 1', 0); $section->addTextBreak(2); // Add TOC #1 diff --git a/src/PhpWord/Collection/AbstractCollection.php b/src/PhpWord/Collection/AbstractCollection.php index 61709a50..d49967ca 100644 --- a/src/PhpWord/Collection/AbstractCollection.php +++ b/src/PhpWord/Collection/AbstractCollection.php @@ -27,14 +27,14 @@ abstract class AbstractCollection /** * Items * - * @var array + * @var \PhpOffice\PhpWord\Element\AbstractContainer[] */ private $items = array(); /** * Get items * - * @return array + * @return \PhpOffice\PhpWord\Element\AbstractContainer[] */ public function getItems() { @@ -45,7 +45,7 @@ abstract class AbstractCollection * Get item by index * * @param int $index - * @return mixed + * @return \PhpOffice\PhpWord\Element\AbstractContainer */ public function getItem($index) { @@ -60,7 +60,7 @@ abstract class AbstractCollection * Set item. * * @param int $index - * @param mixed $item + * @param \PhpOffice\PhpWord\Element\AbstractContainer $item */ public function setItem($index, $item) { @@ -72,7 +72,7 @@ abstract class AbstractCollection /** * Add new item * - * @param mixed $item + * @param \PhpOffice\PhpWord\Element\AbstractContainer $item * @return int */ public function addItem($item) diff --git a/src/PhpWord/Element/AbstractContainer.php b/src/PhpWord/Element/AbstractContainer.php index 507ff143..1cedbef0 100644 --- a/src/PhpWord/Element/AbstractContainer.php +++ b/src/PhpWord/Element/AbstractContainer.php @@ -54,7 +54,7 @@ abstract class AbstractContainer extends AbstractElement /** * Elements collection * - * @var array + * @var \PhpOffice\PhpWord\Element\AbstractElement[] */ protected $elements = array(); @@ -164,6 +164,41 @@ abstract class AbstractContainer extends AbstractElement return $this->elements; } + /** + * Returns the element at the requested position + * + * @param int $index + * @return \PhpOffice\PhpWord\Element\AbstractElement|null + */ + public function getElement($index) + { + if (array_key_exists($index, $this->elements)) { + return $this->elements[$index]; + } + + return null; + } + + /** + * Removes the element at requested index + * + * @param int|\PhpOffice\PhpWord\Element\AbstractElement $toRemove + */ + public function removeElement($toRemove) + { + if (is_int($toRemove) && array_key_exists($toRemove, $this->elements)) { + unset($this->elements[$toRemove]); + } elseif ($toRemove instanceof \PhpOffice\PhpWord\Element\AbstractElement) { + foreach ($this->elements as $key => $element) { + if ($element->getElementId() === $toRemove->getElementId()) { + unset($this->elements[$key]); + + return; + } + } + } + } + /** * Count elements * diff --git a/src/PhpWord/Element/Bookmark.php b/src/PhpWord/Element/Bookmark.php index 2eceb5ed..8d4e0af5 100644 --- a/src/PhpWord/Element/Bookmark.php +++ b/src/PhpWord/Element/Bookmark.php @@ -43,7 +43,7 @@ class Bookmark extends AbstractElement * * @param string $name */ - public function __construct($name) + public function __construct($name = '') { $this->name = CommonText::toUTF8($name); } diff --git a/src/PhpWord/Element/ListItem.php b/src/PhpWord/Element/ListItem.php index 7f665b1b..cb55c5ae 100644 --- a/src/PhpWord/Element/ListItem.php +++ b/src/PhpWord/Element/ListItem.php @@ -62,7 +62,7 @@ class ListItem extends AbstractElement // Version >= 0.10.0 will pass numbering style name. Older version will use old method if (!is_null($listStyle) && is_string($listStyle)) { - $this->style = new ListItemStyle($listStyle); + $this->style = new ListItemStyle($listStyle); // @codeCoverageIgnore } else { $this->style = $this->setNewStyle(new ListItemStyle(), $listStyle, true); } diff --git a/src/PhpWord/Element/Title.php b/src/PhpWord/Element/Title.php index 808af55e..ed06fa13 100644 --- a/src/PhpWord/Element/Title.php +++ b/src/PhpWord/Element/Title.php @@ -28,7 +28,7 @@ class Title extends AbstractElement /** * Title Text content * - * @var string + * @var string|TextRun */ private $text; @@ -56,15 +56,25 @@ class Title extends AbstractElement /** * Create a new Title Element * - * @param string $text + * @param string|TextRun $text * @param int $depth */ public function __construct($text, $depth = 1) { - $this->text = CommonText::toUTF8($text); + if (isset($text)) { + if (is_string($text)) { + $this->text = CommonText::toUTF8($text); + } elseif ($text instanceof TextRun) { + $this->text = $text; + } else { + throw new \InvalidArgumentException('Invalid text, should be a string or a TextRun'); + } + } + $this->depth = $depth; - if (array_key_exists("Heading_{$this->depth}", Style::getStyles())) { - $this->style = "Heading{$this->depth}"; + $styleName = $depth === 0 ? 'Title' : "Heading_{$this->depth}"; + if (array_key_exists($styleName, Style::getStyles())) { + $this->style = str_replace('_', '', $styleName); } return $this; diff --git a/src/PhpWord/PhpWord.php b/src/PhpWord/PhpWord.php index d7c2348a..54ef65ac 100644 --- a/src/PhpWord/PhpWord.php +++ b/src/PhpWord/PhpWord.php @@ -212,6 +212,21 @@ class PhpWord return $this->sections; } + /** + * Returns the section at the requested position + * + * @param int $index + * @return \PhpOffice\PhpWord\Element\Section|null + */ + public function getSection($index) + { + if (array_key_exists($index, $this->sections)) { + return $this->sections[$index]; + } + + return null; + } + /** * Create new section * diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index 1d610516..f8a26ddb 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -18,6 +18,7 @@ namespace PhpOffice\PhpWord\Reader\Word2007; use PhpOffice\Common\XMLReader; +use PhpOffice\PhpWord\Element\TextRun; use PhpOffice\PhpWord\Element\TrackChange; use PhpOffice\PhpWord\PhpWord; @@ -103,12 +104,10 @@ abstract class AbstractPart { // Paragraph style $paragraphStyle = null; - $headingMatches = array(); + $headingDepth = null; if ($xmlReader->elementExists('w:pPr', $domNode)) { $paragraphStyle = $this->readParagraphStyle($xmlReader, $domNode); - if (is_array($paragraphStyle) && isset($paragraphStyle['styleName'])) { - preg_match('/Heading(\d)/', $paragraphStyle['styleName'], $headingMatches); - } + $headingDepth = $this->getHeadingDepth($paragraphStyle); } // PreserveText @@ -147,14 +146,19 @@ abstract class AbstractPart foreach ($nodes as $node) { $this->readRun($xmlReader, $node, $listItemRun, $docPart, $paragraphStyle); } - } elseif (!empty($headingMatches)) { - // Heading - $textContent = ''; + } elseif ($headingDepth !== null) { + // Heading or Title + $textContent = null; $nodes = $xmlReader->getElements('w:r', $domNode); - foreach ($nodes as $node) { - $textContent .= $xmlReader->getValue('w:t', $node); + if ($nodes->length === 1) { + $textContent = $xmlReader->getValue('w:t', $nodes->item(0)); + } else { + $textContent = new TextRun($paragraphStyle); + foreach ($nodes as $node) { + $this->readRun($xmlReader, $node, $textContent, $docPart, $paragraphStyle); + } } - $parent->addTitle($textContent, $headingMatches[1]); + $parent->addTitle($textContent, $headingDepth); } else { // Text and TextRun $runCount = $xmlReader->countElements('w:r', $domNode); @@ -176,6 +180,29 @@ abstract class AbstractPart } } + /** + * Returns the depth of the Heading, returns 0 for a Title + * + * @param array $paragraphStyle + * @return number|null + */ + private function getHeadingDepth(array $paragraphStyle = null) + { + if (is_array($paragraphStyle) && isset($paragraphStyle['styleName'])) { + if ('Title' === $paragraphStyle['styleName']) { + return 0; + } + + $headingMatches = array(); + preg_match('/Heading(\d)/', $paragraphStyle['styleName'], $headingMatches); + if (!empty($headingMatches)) { + return $headingMatches[1]; + } + } + + return null; + } + /** * Read w:r. * @@ -212,10 +239,14 @@ abstract class AbstractPart } else { if ($xmlReader->elementExists('w:footnoteReference', $domNode)) { // Footnote - $parent->addFootnote(); + $wId = $xmlReader->getAttribute('w:id', $domNode, 'w:footnoteReference'); + $footnote = $parent->addFootnote(); + $footnote->setRelationId($wId); } elseif ($xmlReader->elementExists('w:endnoteReference', $domNode)) { // Endnote - $parent->addEndnote(); + $wId = $xmlReader->getAttribute('w:id', $domNode, 'w:endnoteReference'); + $endnote = $parent->addEndnote(); + $endnote->setRelationId($wId); } elseif ($xmlReader->elementExists('w:pict', $domNode)) { // Image $rId = $xmlReader->getAttribute('r:id', $domNode, 'w:pict/v:shape/v:imagedata'); @@ -496,11 +527,9 @@ abstract class AbstractPart return $possibleAttribute; } } - } else { - return $attributes; } - return null; + return $attributes; } /** @@ -578,7 +607,7 @@ abstract class AbstractPart */ private function isOn($value = null) { - return $value == null || $value == '1' || $value == 'true' || $value == 'on'; + return $value === null || $value === '1' || $value === 'true' || $value === 'on'; } /** diff --git a/src/PhpWord/Reader/Word2007/Footnotes.php b/src/PhpWord/Reader/Word2007/Footnotes.php index 61988723..b69b2606 100644 --- a/src/PhpWord/Reader/Word2007/Footnotes.php +++ b/src/PhpWord/Reader/Word2007/Footnotes.php @@ -48,9 +48,6 @@ class Footnotes extends AbstractPart */ public function read(PhpWord $phpWord) { - $getMethod = "get{$this->collection}"; - $collection = $phpWord->$getMethod()->getItems(); - $xmlReader = new XMLReader(); $xmlReader->getDomFromZip($this->docFile, $this->xmlFile); $nodes = $xmlReader->getElements('*'); @@ -60,17 +57,41 @@ class Footnotes extends AbstractPart $type = $xmlReader->getAttribute('w:type', $node); // Avoid w:type "separator" and "continuationSeparator" - // Only look for or without w:type attribute - if (is_null($type) && isset($collection[$id])) { - $element = $collection[$id]; - $pNodes = $xmlReader->getElements('w:p/*', $node); - foreach ($pNodes as $pNode) { - $this->readRun($xmlReader, $pNode, $element, $this->collection); + // Only look for or without w:type attribute, or with w:type = normal + if ((is_null($type) || $type === 'normal')) { + $element = $this->getElement($phpWord, $id); + if ($element !== null) { + $pNodes = $xmlReader->getElements('w:p/*', $node); + foreach ($pNodes as $pNode) { + $this->readRun($xmlReader, $pNode, $element, $this->collection); + } + $addMethod = "add{$this->element}"; + $phpWord->$addMethod($element); } - $addMethod = "add{$this->element}"; - $phpWord->$addMethod($element); } } } } + + /** + * Searches for the element with the given relationId + * + * @param PhpWord $phpWord + * @param int $relationId + * @return \PhpOffice\PhpWord\Element\AbstractContainer|null + */ + private function getElement(PhpWord $phpWord, $relationId) + { + $getMethod = "get{$this->collection}"; + $collection = $phpWord->$getMethod()->getItems(); + + //not found by key, looping to search by relationId + foreach ($collection as $collectionElement) { + if ($collectionElement->getRelationId() == $relationId) { + return $collectionElement; + } + } + + return null; + } } diff --git a/src/PhpWord/Style.php b/src/PhpWord/Style.php index 1939aaba..017b3290 100644 --- a/src/PhpWord/Style.php +++ b/src/PhpWord/Style.php @@ -95,7 +95,13 @@ class Style */ public static function addTitleStyle($depth, $fontStyle, $paragraphStyle = null) { - return self::setStyleValues("Heading_{$depth}", new Font('title', $paragraphStyle), $fontStyle); + if ($depth == null) { + $styleName = 'Title'; + } else { + $styleName = "Heading_{$depth}"; + } + + return self::setStyleValues($styleName, new Font('title', $paragraphStyle), $fontStyle); } /** diff --git a/src/PhpWord/Writer/Word2007/Element/Title.php b/src/PhpWord/Writer/Word2007/Element/Title.php index f204ab16..80c0904d 100644 --- a/src/PhpWord/Writer/Word2007/Element/Title.php +++ b/src/PhpWord/Writer/Word2007/Element/Title.php @@ -47,27 +47,36 @@ class Title extends AbstractElement $xmlWriter->endElement(); } - $rId = $element->getRelationId(); - $bookmarkRId = $element->getPhpWord()->addBookmark(); + if ($element->getDepth() !== 0) { + $rId = $element->getRelationId(); + $bookmarkRId = $element->getPhpWord()->addBookmark(); - // Bookmark start for TOC - $xmlWriter->startElement('w:bookmarkStart'); - $xmlWriter->writeAttribute('w:id', $bookmarkRId); - $xmlWriter->writeAttribute('w:name', "_Toc{$rId}"); - $xmlWriter->endElement(); + // Bookmark start for TOC + $xmlWriter->startElement('w:bookmarkStart'); + $xmlWriter->writeAttribute('w:id', $bookmarkRId); + $xmlWriter->writeAttribute('w:name', "_Toc{$rId}"); + $xmlWriter->endElement(); //w:bookmarkStart + } // Actual text - $xmlWriter->startElement('w:r'); - $xmlWriter->startElement('w:t'); - $this->writeText($this->getText($element->getText())); - $xmlWriter->endElement(); // w:t - $xmlWriter->endElement(); // w:r + $text = $element->getText(); + if (is_string($text)) { + $xmlWriter->startElement('w:r'); + $xmlWriter->startElement('w:t'); + $this->writeText($text); + $xmlWriter->endElement(); // w:t + $xmlWriter->endElement(); // w:r + } elseif ($text instanceof \PhpOffice\PhpWord\Element\AbstractContainer) { + $containerWriter = new Container($xmlWriter, $text); + $containerWriter->write(); + } - // Bookmark end - $xmlWriter->startElement('w:bookmarkEnd'); - $xmlWriter->writeAttribute('w:id', $bookmarkRId); - $xmlWriter->endElement(); - - $xmlWriter->endElement(); + if ($element->getDepth() !== 0) { + // Bookmark end + $xmlWriter->startElement('w:bookmarkEnd'); + $xmlWriter->writeAttribute('w:id', $bookmarkRId); + $xmlWriter->endElement(); //w:bookmarkEnd + } + $xmlWriter->endElement(); //w:p } } diff --git a/src/PhpWord/Writer/Word2007/Part/Styles.php b/src/PhpWord/Writer/Word2007/Part/Styles.php index 1cc94806..03855f03 100644 --- a/src/PhpWord/Writer/Word2007/Part/Styles.php +++ b/src/PhpWord/Writer/Word2007/Part/Styles.php @@ -180,9 +180,15 @@ class Styles extends AbstractPart // Heading style if ($styleType == 'title') { $arrStyle = explode('_', $styleName); - $styleId = 'Heading' . $arrStyle[1]; - $styleName = 'heading ' . $arrStyle[1]; - $styleLink = 'Heading' . $arrStyle[1] . 'Char'; + if (count($arrStyle) > 1) { + $styleId = 'Heading' . $arrStyle[1]; + $styleName = 'heading ' . $arrStyle[1]; + $styleLink = 'Heading' . $arrStyle[1] . 'Char'; + } else { + $styleId = $styleName; + $styleName = strtolower($styleName); + $styleLink = $styleName . 'Char'; + } $xmlWriter->writeAttribute('w:styleId', $styleId); $xmlWriter->startElement('w:link'); diff --git a/tests/PhpWord/Element/SectionTest.php b/tests/PhpWord/Element/SectionTest.php index 20f0f0f7..867f680a 100644 --- a/tests/PhpWord/Element/SectionTest.php +++ b/tests/PhpWord/Element/SectionTest.php @@ -162,4 +162,35 @@ class SectionTest extends \PHPUnit\Framework\TestCase $object = new Section(1); $object->addHeader('ODD'); } + + /** + * @covers \PhpOffice\PhpWord\Element\AbstractContainer::removeElement + */ + public function testRemoveElementByIndex() + { + $section = new Section(1); + $section->addText('firstText'); + $section->addText('secondText'); + + $this->assertEquals(2, $section->countElements()); + $section->removeElement(1); + + $this->assertEquals(1, $section->countElements()); + } + + /** + * @covers \PhpOffice\PhpWord\Element\AbstractContainer::removeElement + */ + public function testRemoveElementByElement() + { + $section = new Section(1); + $fistText = $section->addText('firstText'); + $secondText = $section->addText('secondText'); + + $this->assertEquals(2, $section->countElements()); + $section->removeElement($fistText); + + $this->assertEquals(1, $section->countElements()); + $this->assertEquals($secondText->getElementId(), $section->getElement(1)->getElementId()); + } } diff --git a/tests/PhpWord/Element/TitleTest.php b/tests/PhpWord/Element/TitleTest.php index 3ea6242f..e99a80a6 100644 --- a/tests/PhpWord/Element/TitleTest.php +++ b/tests/PhpWord/Element/TitleTest.php @@ -45,4 +45,25 @@ class TitleTest extends \PHPUnit\Framework\TestCase $this->assertNull($oTitle->getStyle()); } + + /** + * Create new instance with TextRun + */ + public function testConstructWithTextRun() + { + $oTextRun = new TextRun(); + $oTextRun->addText('text'); + $oTitle = new Title($oTextRun); + + $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\TextRun', $oTitle->getText()); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testConstructWithInvalidArgument() + { + $oPageBreak = new PageBreak(); + new Title($oPageBreak); + } } diff --git a/tests/PhpWord/Reader/Word2007/ElementTest.php b/tests/PhpWord/Reader/Word2007/ElementTest.php index c2648b68..10c1ec9a 100644 --- a/tests/PhpWord/Reader/Word2007/ElementTest.php +++ b/tests/PhpWord/Reader/Word2007/ElementTest.php @@ -36,9 +36,9 @@ class ElementTest extends AbstractTestReader '; - $phpWord = $this->getDocumentFromString($documentXml); + $phpWord = $this->getDocumentFromString(array('document' => $documentXml)); - $elements = $this->get($phpWord->getSections(), 0)->getElements(); + $elements = $phpWord->getSection(0)->getElements(); $this->assertInstanceOf('PhpOffice\PhpWord\Element\TextBreak', $elements[0]); $this->assertInstanceOf('PhpOffice\PhpWord\Element\Text', $elements[1]); $this->assertEquals('test string', $elements[1]->getText()); @@ -70,17 +70,73 @@ class ElementTest extends AbstractTestReader '; - $phpWord = $this->getDocumentFromString($documentXml); + $phpWord = $this->getDocumentFromString(array('document' => $documentXml)); - $elements = $this->get($phpWord->getSections(), 0)->getElements(); - $this->assertInstanceOf('PhpOffice\PhpWord\Element\ListItemRun', $elements[0]); - $this->assertEquals(0, $elements[0]->getDepth()); + $sections = $phpWord->getSection(0); + $this->assertNull($sections->getElement(999)); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\ListItemRun', $sections->getElement(0)); + $this->assertEquals(0, $sections->getElement(0)->getDepth()); - $listElements = $this->get($elements, 0)->getElements(); + $listElements = $sections->getElement(0)->getElements(); $this->assertInstanceOf('PhpOffice\PhpWord\Element\Text', $listElements[0]); $this->assertEquals('Two', $listElements[0]->getText()); $this->assertEquals(' with ', $listElements[1]->getText()); $this->assertEquals('bold', $listElements[2]->getText()); $this->assertTrue($listElements[2]->getFontStyle()->getBold()); } + + /** + * Test reading Title style + */ + public function testReadTitleStyle() + { + $documentXml = ' + + + + + This is a non formatted title + + + + + + + + This is a + + + + + + bold + + + title + + '; + + $stylesXml = ' + + + + + + '; + + $phpWord = $this->getDocumentFromString(array('document' => $documentXml, 'styles' => $stylesXml)); + + $elements = $phpWord->getSection(0)->getElements(); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\Title', $elements[0]); + /** @var \PhpOffice\PhpWord\Element\Title $title */ + $title = $elements[0]; + $this->assertEquals('Title', $title->getStyle()); + $this->assertEquals('This is a non formatted title', $title->getText()); + + $this->assertInstanceOf('PhpOffice\PhpWord\Element\Title', $elements[1]); + /** @var \PhpOffice\PhpWord\Element\Title $formattedTitle */ + $formattedTitle = $elements[1]; + $this->assertEquals('Title', $formattedTitle->getStyle()); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\TextRun', $formattedTitle->getText()); + } } diff --git a/tests/PhpWord/Reader/Word2007/PartTest.php b/tests/PhpWord/Reader/Word2007/PartTest.php new file mode 100644 index 00000000..0f7ecc7c --- /dev/null +++ b/tests/PhpWord/Reader/Word2007/PartTest.php @@ -0,0 +1,163 @@ + + + This is a test + + + + + + + + + + + And another one + + + + + + + + '; + + $footnotesXml = ' + + + + + + + + + + + + + + + + + + + + + + footnote text + + + '; + + $endnotesXml = ' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This is an endnote + + + '; + + $phpWord = $this->getDocumentFromString(array('document' => $documentXml, 'footnotes' => $footnotesXml, 'endnotes' => $endnotesXml)); + + $elements = $phpWord->getSection(0)->getElements(); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\TextRun', $elements[0]); + /** @var \PhpOffice\PhpWord\Element\TextRun $textRun */ + $textRun = $elements[0]; + + //test the text in the first paragraph + /** @var \PhpOffice\PhpWord\Element\Text $text */ + $text = $elements[0]->getElement(0); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\Text', $text); + $this->assertEquals('This is a test', $text->getText()); + + //test the presence of the footnote in the document.xml + /** @var \PhpOffice\PhpWord\Element\Footnote $footnote */ + $documentFootnote = $textRun->getElement(1); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\Footnote', $documentFootnote); + $this->assertEquals(1, $documentFootnote->getRelationId()); + + //test the presence of the footnote in the footnote.xml + /** @var \PhpOffice\PhpWord\Element\Footnote $footnote */ + $footnote = $phpWord->getFootnotes()->getItem(1); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\Footnote', $footnote); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\Text', $footnote->getElement(0)); + $this->assertEquals('footnote text', $footnote->getElement(0)->getText()); + $this->assertEquals(1, $footnote->getRelationId()); + + //test the text in the second paragraph + /** @var \PhpOffice\PhpWord\Element\Text $text */ + $text = $elements[1]->getElement(0); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\Text', $text); + $this->assertEquals('And another one', $text->getText()); + + //test the presence of the endnote in the document.xml + /** @var \PhpOffice\PhpWord\Element\Endnote $endnote */ + $documentEndnote = $elements[1]->getElement(1); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\Endnote', $documentEndnote); + $this->assertEquals(2, $documentEndnote->getRelationId()); + + //test the presence of the endnote in the endnote.xml + /** @var \PhpOffice\PhpWord\Element\Endnote $endnote */ + $endnote = $phpWord->getEndnotes()->getItem(1); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\Endnote', $endnote); + $this->assertEquals(2, $endnote->getRelationId()); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\Text', $endnote->getElement(0)); + $this->assertEquals('This is an endnote', $endnote->getElement(0)->getText()); + } +} diff --git a/tests/PhpWord/Reader/Word2007/StyleTest.php b/tests/PhpWord/Reader/Word2007/StyleTest.php index 4375df47..c0d5d864 100644 --- a/tests/PhpWord/Reader/Word2007/StyleTest.php +++ b/tests/PhpWord/Reader/Word2007/StyleTest.php @@ -37,9 +37,9 @@ class StyleTest extends AbstractTestReader '; - $phpWord = $this->getDocumentFromString($documentXml); + $phpWord = $this->getDocumentFromString(array('document' => $documentXml)); - $elements = $this->get($phpWord->getSections(), 0)->getElements(); + $elements = $phpWord->getSection(0)->getElements(); $this->assertInstanceOf('PhpOffice\PhpWord\Element\Table', $elements[0]); $this->assertInstanceOf('PhpOffice\PhpWord\Style\Table', $elements[0]->getStyle()); $this->assertEquals(Table::LAYOUT_FIXED, $elements[0]->getStyle()->getLayout()); @@ -56,9 +56,9 @@ class StyleTest extends AbstractTestReader '; - $phpWord = $this->getDocumentFromString($documentXml); + $phpWord = $this->getDocumentFromString(array('document' => $documentXml)); - $elements = $this->get($phpWord->getSections(), 0)->getElements(); + $elements = $phpWord->getSection(0)->getElements(); $this->assertInstanceOf('PhpOffice\PhpWord\Element\Table', $elements[0]); $this->assertInstanceOf('PhpOffice\PhpWord\Style\Table', $elements[0]->getStyle()); $this->assertEquals(TblWidth::AUTO, $elements[0]->getStyle()->getUnit()); diff --git a/tests/PhpWord/Writer/Word2007/ElementTest.php b/tests/PhpWord/Writer/Word2007/ElementTest.php index 887e8e58..b59e369f 100644 --- a/tests/PhpWord/Writer/Word2007/ElementTest.php +++ b/tests/PhpWord/Writer/Word2007/ElementTest.php @@ -447,6 +447,9 @@ class ElementTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:commentReference')); } + /** + * Test Track changes + */ public function testTrackChange() { $phpWord = new PhpWord(); @@ -462,4 +465,30 @@ class ElementTest extends \PHPUnit\Framework\TestCase $this->assertEquals('author name', $doc->getElementAttribute('/w:document/w:body/w:p/w:ins', 'w:author')); $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:del/w:r/w:delText')); } + + /** + * Test Title and Headings + */ + public function testTitleAndHeading() + { + $phpWord = new PhpWord(); + $phpWord->addTitleStyle(0, array('size' => 14, 'italic' => true)); + $phpWord->addTitleStyle(1, array('size' => 20, 'color' => '333333', 'bold' => true)); + + $section = $phpWord->addSection(); + $section->addTitle('This is a title', 0); + $section->addTitle('Heading 1', 1); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p[1]/w:r/w:t')); + $this->assertEquals('This is a title', $doc->getElement('/w:document/w:body/w:p[1]/w:r/w:t')->textContent); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p[1]/w:pPr/w:pStyle')); + $this->assertEquals('Title', $doc->getElementAttribute('/w:document/w:body/w:p[1]/w:pPr/w:pStyle', 'w:val')); + + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p[2]/w:r/w:t')); + $this->assertEquals('Heading 1', $doc->getElement('/w:document/w:body/w:p[2]/w:r/w:t')->textContent); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p[2]/w:pPr/w:pStyle')); + $this->assertEquals('Heading1', $doc->getElementAttribute('/w:document/w:body/w:p[2]/w:pPr/w:pStyle', 'w:val')); + } } diff --git a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php index 6998e717..39db6028 100644 --- a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php @@ -24,7 +24,6 @@ use PhpOffice\PhpWord\SimpleType\Jc; use PhpOffice\PhpWord\SimpleType\NumberFormat; use PhpOffice\PhpWord\Style\Cell; use PhpOffice\PhpWord\Style\Font; -use PhpOffice\PhpWord\Style\Paragraph; use PhpOffice\PhpWord\TestHelperDOCX; /** diff --git a/tests/PhpWord/_includes/AbstractTestReader.php b/tests/PhpWord/_includes/AbstractTestReader.php index f138ac76..348cab98 100644 --- a/tests/PhpWord/_includes/AbstractTestReader.php +++ b/tests/PhpWord/_includes/AbstractTestReader.php @@ -17,43 +17,48 @@ namespace PhpOffice\PhpWord; -use PhpOffice\PhpWord\Reader\Word2007\Document; - /** * Base class for Word2007 reader tests */ abstract class AbstractTestReader extends \PHPUnit\Framework\TestCase { + private $parts = array( + 'styles' => array('class' => 'PhpOffice\PhpWord\Reader\Word2007\Styles', 'xml' => '{toReplace}'), + 'document' => array('class' => 'PhpOffice\PhpWord\Reader\Word2007\Document', 'xml' => '{toReplace}'), + 'footnotes' => array('class' => 'PhpOffice\PhpWord\Reader\Word2007\Footnotes', 'xml' => '{toReplace}'), + 'endnotes' => array('class' => 'PhpOffice\PhpWord\Reader\Word2007\Endnotes', 'xml' => '{toReplace}'), + 'settings' => array('class' => 'PhpOffice\PhpWord\Reader\Word2007\Settings', 'xml' => '{toReplace}'), + ); + /** * Builds a PhpWord instance based on the xml passed * * @param string $documentXml + * @param null|string $stylesXml * @return \PhpOffice\PhpWord\PhpWord */ - protected function getDocumentFromString($documentXml) + protected function getDocumentFromString(array $partXmls = array()) { - $phpWord = new PhpWord(); $file = __DIR__ . '/../_files/temp.docx'; $zip = new \ZipArchive(); $zip->open($file, \ZipArchive::CREATE); - $zip->addFromString('document.xml', '' . $documentXml . ''); + foreach ($this->parts as $partName => $part) { + if (array_key_exists($partName, $partXmls)) { + $zip->addFromString("{$partName}.xml", str_replace('{toReplace}', $partXmls[$partName], $this->parts[$partName]['xml'])); + } + } $zip->close(); - $documentReader = new Document($file, 'document.xml'); - $documentReader->read($phpWord); + + $phpWord = new PhpWord(); + foreach ($this->parts as $partName => $part) { + if (array_key_exists($partName, $partXmls)) { + $className = $this->parts[$partName]['class']; + $reader = new $className($file, "{$partName}.xml"); + $reader->read($phpWord); + } + } unlink($file); return $phpWord; } - - /** - * Returns the element at position $index in the array - * - * @param array $array - * @param number $index - * @return mixed - */ - protected function get(array $array, $index = 0) - { - return $array[$index]; - } } From 250fbd49b1fcaea5412a6860bdc1b38780e8327e Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 6 Mar 2018 06:35:43 +0100 Subject: [PATCH 243/370] Added support for Vertically Raised or Lowered Text (w:position) (#1294) * Added support for Vertically Raised or Lowered Text (w:position). Note that only docx writing is implemented for now. * Add tests + changelog * add reader + tests + doc --- CHANGELOG.md | 1 + docs/styles.rst | 1 + src/PhpWord/Reader/Word2007/AbstractPart.php | 1 + src/PhpWord/Style/Font.php | 34 +++++++++++++++++++ src/PhpWord/Style/Frame.php | 31 +++++++++++++++++ src/PhpWord/Writer/Word2007/Element/Image.php | 13 +++++++ src/PhpWord/Writer/Word2007/Style/Font.php | 3 ++ tests/PhpWord/Reader/Word2007/StyleTest.php | 24 +++++++++++++ .../Writer/Word2007/Style/FontTest.php | 15 ++++++++ 9 files changed, 123 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f527746..1c52179c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ v0.15.0 (?? ??? 2018) - Add support for fixed Table Layout @aoloe @ekopach @troosan #841 #1276 - Add support for Cell Spacing @dox07 @troosan #1040 - Add parsing of formatting inside lists @atomicalnet @troosan #594 +- Added support for Vertically Raised or Lowered Text (w:position) @anrikun @troosan #640 - Add support for MACROBUTTON field @phryneas @troosan #1021 ### Fixed diff --git a/docs/styles.rst b/docs/styles.rst index 0ec0ec38..b84f76f0 100644 --- a/docs/styles.rst +++ b/docs/styles.rst @@ -59,6 +59,7 @@ Available Font style options: See ``\PhpOffice\PhpWord\Style\Font::UNDERLINE_...`` constants for more values - ``lang``. Language, either a language code like *en-US*, *fr-BE*, etc. or an object (or as an array) if you need to set eastAsian or bidirectional languages See ``\PhpOffice\PhpWord\Style\Language`` class for some language codes. +- ``position``. The text position, raised or lowered, in half points .. _paragraph-style: diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index f8a26ddb..b4610d28 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -422,6 +422,7 @@ abstract class AbstractPart 'fgColor' => array(self::READ_VALUE, 'w:highlight'), 'rtl' => array(self::READ_TRUE, 'w:rtl'), 'lang' => array(self::READ_VALUE, 'w:lang'), + 'position' => array(self::READ_VALUE, 'w:position'), ); return $this->readStyleDefs($xmlReader, $styleNode, $styleDefs); diff --git a/src/PhpWord/Style/Font.php b/src/PhpWord/Style/Font.php index 03fb692c..3095b799 100644 --- a/src/PhpWord/Style/Font.php +++ b/src/PhpWord/Style/Font.php @@ -232,6 +232,7 @@ class Font extends AbstractStyle /** * Right to left languages + * * @var bool */ private $rtl = false; @@ -246,10 +247,19 @@ class Font extends AbstractStyle /** * Languages + * * @var \PhpOffice\PhpWord\Style\Language */ private $lang; + /** + * Vertically Raised or Lowered Text + * + * @var int Signed Half-Point Measurement + * @see http://www.datypic.com/sc/ooxml/e-w_position-1.html + */ + private $position; + /** * Create new font style * @@ -294,6 +304,7 @@ class Font extends AbstractStyle 'scale' => $this->getScale(), 'spacing' => $this->getSpacing(), 'kerning' => $this->getKerning(), + 'position' => $this->getPosition(), ), 'paragraph' => $this->getParagraph(), 'rtl' => $this->isRTL(), @@ -926,4 +937,27 @@ class Font extends AbstractStyle { return $this->getParagraph(); } + + /** + * Get position + * + * @return int + */ + public function getPosition() + { + return $this->position; + } + + /** + * Set position + * + * @param int $value + * @return self + */ + public function setPosition($value = null) + { + $this->position = $this->setIntVal($value, null); + + return $this; + } } diff --git a/src/PhpWord/Style/Frame.php b/src/PhpWord/Style/Frame.php index a8e1c69d..bb684409 100644 --- a/src/PhpWord/Style/Frame.php +++ b/src/PhpWord/Style/Frame.php @@ -171,6 +171,14 @@ class Frame extends AbstractStyle */ private $wrap; + /** + * Vertically raised or lowered text + * + * @var int + * @see http://www.datypic.com/sc/ooxml/e-w_position-1.html + */ + private $position; + /** * Create a new instance * @@ -538,4 +546,27 @@ class Frame extends AbstractStyle return $this; } + + /** + * Get position + * + * @return int + */ + public function getPosition() + { + return $this->position; + } + + /** + * Set position + * + * @param int $value + * @return self + */ + public function setPosition($value = null) + { + $this->position = $this->setIntVal($value, null); + + return $this; + } } diff --git a/src/PhpWord/Writer/Word2007/Element/Image.php b/src/PhpWord/Writer/Word2007/Element/Image.php index 7e33f75e..32a22a13 100644 --- a/src/PhpWord/Writer/Word2007/Element/Image.php +++ b/src/PhpWord/Writer/Word2007/Element/Image.php @@ -19,6 +19,9 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Element; use PhpOffice\Common\XMLWriter; use PhpOffice\PhpWord\Element\Image as ImageElement; +use PhpOffice\PhpWord\Style\Font as FontStyle; +use PhpOffice\PhpWord\Style\Frame as FrameStyle; +use PhpOffice\PhpWord\Writer\Word2007\Style\Font as FontStyleWriter; use PhpOffice\PhpWord\Writer\Word2007\Style\Image as ImageStyleWriter; /** @@ -62,6 +65,16 @@ class Image extends AbstractElement $this->writeCommentRangeStart(); $xmlWriter->startElement('w:r'); + + // Write position + $position = $style->getPosition(); + if ($position && $style->getWrap() == FrameStyle::WRAP_INLINE) { + $fontStyle = new FontStyle('text'); + $fontStyle->setPosition($position); + $fontStyleWriter = new FontStyleWriter($xmlWriter, $fontStyle); + $fontStyleWriter->write(); + } + $xmlWriter->startElement('w:pict'); $xmlWriter->startElement('v:shape'); $xmlWriter->writeAttribute('type', '#_x0000_t75'); diff --git a/src/PhpWord/Writer/Word2007/Style/Font.php b/src/PhpWord/Writer/Word2007/Style/Font.php index a13db155..5f2a84c0 100644 --- a/src/PhpWord/Writer/Word2007/Style/Font.php +++ b/src/PhpWord/Writer/Word2007/Style/Font.php @@ -151,6 +151,9 @@ class Font extends AbstractStyle $xmlWriter->writeElementIf($styleName === null && $style->isRTL(), 'w:rtl'); } + // Position + $xmlWriter->writeElementIf($style->getPosition() !== null, 'w:position', 'w:val', $style->getPosition()); + $xmlWriter->endElement(); } diff --git a/tests/PhpWord/Reader/Word2007/StyleTest.php b/tests/PhpWord/Reader/Word2007/StyleTest.php index c0d5d864..ad8f125a 100644 --- a/tests/PhpWord/Reader/Word2007/StyleTest.php +++ b/tests/PhpWord/Reader/Word2007/StyleTest.php @@ -66,4 +66,28 @@ class StyleTest extends AbstractTestReader $tableStyle = $elements[0]->getStyle(); $this->assertEquals(10.5, $tableStyle->getCellSpacing()); } + + /** + * Test reading of position + */ + public function testReadPosition() + { + $documentXml = ' + + + + + This text is lowered + + '; + + $phpWord = $this->getDocumentFromString($documentXml); + + $elements = $this->get($phpWord->getSections(), 0)->getElements(); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\Text', $elements[0]); + $this->assertInstanceOf('PhpOffice\PhpWord\Style\Font', $elements[0]->getFontStyle()); + /** @var \PhpOffice\PhpWord\Style\Font $fontStyle */ + $fontStyle = $elements[0]->getFontStyle(); + $this->assertEquals(15, $fontStyle->getPosition()); + } } diff --git a/tests/PhpWord/Writer/Word2007/Style/FontTest.php b/tests/PhpWord/Writer/Word2007/Style/FontTest.php index d36a3037..f66cf24f 100644 --- a/tests/PhpWord/Writer/Word2007/Style/FontTest.php +++ b/tests/PhpWord/Writer/Word2007/Style/FontTest.php @@ -65,4 +65,19 @@ class FontTest extends \PHPUnit\Framework\TestCase $path = '/w:document/w:body/w:p/w:r/w:rPr/w:lang'; $this->assertTrue($doc->elementExists($path, $file)); } + + /** + * Test writing position + */ + public function testPosition() + { + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $section->addText('This text is lowered', array('position' => -20)); + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + + $path = '/w:document/w:body/w:p/w:r/w:rPr/w:position'; + $this->assertTrue($doc->elementExists($path)); + $this->assertEquals(-20, $doc->getElementAttribute($path, 'w:val')); + } } From 6a6497956da91d3a9d4ab44d9df2c2ed31bfb8dd Mon Sep 17 00:00:00 2001 From: Frank Liepert Date: Tue, 6 Mar 2018 22:19:40 +0100 Subject: [PATCH 244/370] Allow to set "autoHyphenation" setting (#1282) * Allow to set "autoHyphenation" for document * Allow to set "consecutiveHyphenLimit" for document * Allow to set "hyphenationZone" for document * Allow to set "doNotHyphenateCaps" for document * Allow to set "suppressAutoHyphens" for paragraph * randomize the tempDir more * Word2007 parsing title formatting (#1297) * Improve Title parsing - Title should be able to contain TextRun - Style 'Title' should be treated the same with as Heading - Add tests for Heading/Title reader * update the documentation and the changelog * PHP 7.2 build should not fail anymore * fix parsing of footnotes and endnotes * add method to remove an element from a section * add method to allow sorting of sections --- CHANGELOG.md | 3 +- docs/general.rst | 46 +++++++++- docs/styles.rst | 1 + src/PhpWord/Element/Field.php | 42 --------- src/PhpWord/Metadata/Settings.php | 90 +++++++++++++++++++ src/PhpWord/PhpWord.php | 11 +++ src/PhpWord/Reader/Word2007/AbstractPart.php | 31 +++---- src/PhpWord/Reader/Word2007/Settings.php | 41 ++++++++- src/PhpWord/Shared/Html.php | 2 +- src/PhpWord/Style/Paragraph.php | 62 +++++++++---- src/PhpWord/Writer/ODText/Part/Content.php | 10 +-- src/PhpWord/Writer/Word2007/Part/Settings.php | 48 ++++++++-- .../Writer/Word2007/Style/Paragraph.php | 3 + tests/PhpWord/Element/SectionTest.php | 4 +- tests/PhpWord/Metadata/SettingsTest.php | 54 +++++++++++ tests/PhpWord/PhpWordTest.php | 54 +++++++++++ tests/PhpWord/Reader/Word2007/StyleTest.php | 4 +- tests/PhpWord/Style/ParagraphTest.php | 35 ++++---- .../Writer/Word2007/Part/SettingsTest.php | 64 +++++++++++++ .../Writer/Word2007/Style/ParagraphTest.php | 15 ++++ 20 files changed, 506 insertions(+), 114 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c52179c..cdc4d67c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ v0.15.0 (?? ??? 2018) - Add parsing of formatting inside lists @atomicalnet @troosan #594 - Added support for Vertically Raised or Lowered Text (w:position) @anrikun @troosan #640 - Add support for MACROBUTTON field @phryneas @troosan #1021 +- Add support for Hyphenation @Trainmaster #1282 (Document: `autoHyphenation`, `consecutiveHyphenLimit`, `hyphenationZone`, `doNotHyphenateCaps`, Paragraph: `suppressAutoHyphens`) ### Fixed - Fix reading of docx default style - @troosan #1238 @@ -477,4 +478,4 @@ This is the first release after a long development hiatus in [CodePlex](https:// - Basic CI with Travis - @Progi1984 - Added PHPWord_Exception and exception when could not copy the template - @Progi1984 - IMPROVED: Moved examples out of Classes directory - @Progi1984 -- IMPROVED: Advanced string replace in setValue for Template - @Esmeraldo [#49](http://phpword.codeplex.com/workitem/49) \ No newline at end of file +- IMPROVED: Advanced string replace in setValue for Template - @Esmeraldo [#49](http://phpword.codeplex.com/workitem/49) diff --git a/docs/general.rst b/docs/general.rst index 99d8b3ba..f40a08c3 100644 --- a/docs/general.rst +++ b/docs/general.rst @@ -217,10 +217,10 @@ The default language of the document can be change with the following. $phpWord->getSettings()->setThemeFontLang(new Language(Language::FR_BE)); -``Languge`` has 3 parameters, one for Latin languages, one for East Asian languages and one for Complex (Bi-Directional) languages. +``Language`` has 3 parameters, one for Latin languages, one for East Asian languages and one for Complex (Bi-Directional) languages. A couple of language codes are provided in the ``PhpOffice\PhpWord\ComplexType\Language`` class but any valid code/ID can be used. -In case you are generating an RTF document the Language need to be set differently. +In case you are generating an RTF document the language need to be set differently. .. code-block:: php @@ -290,3 +290,45 @@ To force an update of the fields present in the document, set updateFields to tr .. code-block:: php $phpWord->getSettings()->setUpdateFields(true); + +Hyphenation +----------- +Hyphenation describes the process of breaking words with hyphens. There are several options to control hyphenation. + +Auto hyphenation +~~~~~~~~~~~~~~~~ + +To automatically hyphenate text set ``autoHyphenation`` to ``true``. + +.. code-block:: php + + $phpWord->getSettings()->setAutoHyphenation(true); + +Consecutive Hyphen Limit +~~~~~~~~~~~~~~~~~~~~~~~~ + +The maximum number of consecutive lines of text ending with a hyphen can be controlled by the ``consecutiveHyphenLimit`` option. +There is no limit if the option is not set or the provided value is ``0``. + +.. code-block:: php + + $phpWord->getSettings()->setConsecutiveHyphenLimit(2); + +Hyphenation Zone +~~~~~~~~~~~~~~~~ + +The hyphenation zone (in *twip*) is the allowed amount of whitespace before hyphenation is applied. +The smaller the hyphenation zone the more words are hyphenated. Or in other words, the wider the hyphenation zone the less words are hyphenated. + +.. code-block:: php + + $phpWord->getSettings()->setHyphenationZone(\PhpOffice\PhpWord\Shared\Converter::cmToTwip(1)); + +Hyphenate Caps +~~~~~~~~~~~~~~ + +To control whether or not words in all capital letters shall be hyphenated use the `doNotHyphenateCaps` option. + +.. code-block:: php + + $phpWord->getSettings()->setDoNotHyphenateCaps(true); diff --git a/docs/styles.rst b/docs/styles.rst index b84f76f0..b4ed328d 100644 --- a/docs/styles.rst +++ b/docs/styles.rst @@ -82,6 +82,7 @@ Available Paragraph style options: - ``spaceAfter``. Space after paragraph in *twip*. - ``spacing``. Space between lines. - ``spacingLineRule``. Line Spacing Rule. *auto*, *exact*, *atLeast* +- ``suppressAutoHyphens``. Hyphenation for paragraph, *true* or *false*. - ``tabs``. Set of custom tab stops. - ``widowControl``. Allow first/last line to display on a separate page, *true* or *false*. - ``contextualSpacing``. Ignore Spacing Above and Below When Using Identical Styles, *true* or *false*. diff --git a/src/PhpWord/Element/Field.php b/src/PhpWord/Element/Field.php index 5aeffbc1..de504965 100644 --- a/src/PhpWord/Element/Field.php +++ b/src/PhpWord/Element/Field.php @@ -17,8 +17,6 @@ namespace PhpOffice\PhpWord\Element; -use PhpOffice\PhpWord\Style\Font; - /** * Field element * @@ -215,46 +213,6 @@ class Field extends AbstractElement return $this->options; } - /** - * Set Text style - * - * @param \PhpOffice\PhpWord\Style\Font $style - * @return \PhpOffice\PhpWord\Style\Font - */ - public function setFontStyle($style = null) - { - if (!$style instanceof Font) { - throw new \InvalidArgumentException('font style must be of type Font'); - } - - if ($style->isNoProof()) { - $this->fontStyle = $style; - } else { - // make a copy of the font so the original is not altered - $this->fontStyle = clone $style; - $this->fontStyle->setNoProof(true); - } - - return $this->fontStyle; - } - - /** - * Get Text style - * - * @return \PhpOffice\PhpWord\Style\Font - */ - public function getFontStyle() - { - if ($this->fontStyle == null) { - $font = new Font(); - $font->setNoProof(true); - - return $font; - } - - return $this->fontStyle; - } - /** * Set Field text * diff --git a/src/PhpWord/Metadata/Settings.php b/src/PhpWord/Metadata/Settings.php index 728cc823..8ab58609 100644 --- a/src/PhpWord/Metadata/Settings.php +++ b/src/PhpWord/Metadata/Settings.php @@ -130,6 +130,32 @@ class Settings */ private $decimalSymbol = '.'; + /** + * Automatically hyphenate document contents when displayed + * + * @var bool|null + */ + private $autoHyphenation; + + /** + * Maximum number of consecutively hyphenated lines + * + * @var int|null + */ + private $consecutiveHyphenLimit; + + /** + * The allowed amount of whitespace before hyphenation is applied + * @var float|null + */ + private $hyphenationZone; + + /** + * Do not hyphenate words in all capital letters + * @var bool|null + */ + private $doNotHyphenateCaps; + /** * @return Protection */ @@ -387,4 +413,68 @@ class Settings { $this->decimalSymbol = $decimalSymbol; } + + /** + * @return bool|null + */ + public function hasAutoHyphenation() + { + return $this->autoHyphenation; + } + + /** + * @param bool $autoHyphenation + */ + public function setAutoHyphenation($autoHyphenation) + { + $this->autoHyphenation = (bool) $autoHyphenation; + } + + /** + * @return int|null + */ + public function getConsecutiveHyphenLimit() + { + return $this->consecutiveHyphenLimit; + } + + /** + * @param int $consecutiveHyphenLimit + */ + public function setConsecutiveHyphenLimit($consecutiveHyphenLimit) + { + $this->consecutiveHyphenLimit = (int) $consecutiveHyphenLimit; + } + + /** + * @return float|null + */ + public function getHyphenationZone() + { + return $this->hyphenationZone; + } + + /** + * @param float $hyphenationZone Measurement unit is twip + */ + public function setHyphenationZone($hyphenationZone) + { + $this->hyphenationZone = $hyphenationZone; + } + + /** + * @return null|bool + */ + public function hasDoNotHyphenateCaps() + { + return $this->doNotHyphenateCaps; + } + + /** + * @param bool $doNotHyphenateCaps + */ + public function setDoNotHyphenateCaps($doNotHyphenateCaps) + { + $this->doNotHyphenateCaps = (bool) $doNotHyphenateCaps; + } } diff --git a/src/PhpWord/PhpWord.php b/src/PhpWord/PhpWord.php index 54ef65ac..ff23f6ef 100644 --- a/src/PhpWord/PhpWord.php +++ b/src/PhpWord/PhpWord.php @@ -242,6 +242,17 @@ class PhpWord return $section; } + /** + * Sorts the sections using the callable passed + * + * @see http://php.net/manual/en/function.usort.php for usage + * @param callable $sorter + */ + public function sortSections($sorter) + { + usort($this->sections, $sorter); + } + /** * Get default font name * diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index b4610d28..2cbfba37 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -364,20 +364,21 @@ abstract class AbstractPart $styleNode = $xmlReader->getElement('w:pPr', $domNode); $styleDefs = array( - 'styleName' => array(self::READ_VALUE, array('w:pStyle', 'w:name')), - 'alignment' => array(self::READ_VALUE, 'w:jc'), - 'basedOn' => array(self::READ_VALUE, 'w:basedOn'), - 'next' => array(self::READ_VALUE, 'w:next'), - 'indent' => array(self::READ_VALUE, 'w:ind', 'w:left'), - 'hanging' => array(self::READ_VALUE, 'w:ind', 'w:hanging'), - 'spaceAfter' => array(self::READ_VALUE, 'w:spacing', 'w:after'), - 'spaceBefore' => array(self::READ_VALUE, 'w:spacing', 'w:before'), - 'widowControl' => array(self::READ_FALSE, 'w:widowControl'), - 'keepNext' => array(self::READ_TRUE, 'w:keepNext'), - 'keepLines' => array(self::READ_TRUE, 'w:keepLines'), - 'pageBreakBefore' => array(self::READ_TRUE, 'w:pageBreakBefore'), - 'contextualSpacing' => array(self::READ_TRUE, 'w:contextualSpacing'), - 'bidi' => array(self::READ_TRUE, 'w:bidi'), + 'styleName' => array(self::READ_VALUE, array('w:pStyle', 'w:name')), + 'alignment' => array(self::READ_VALUE, 'w:jc'), + 'basedOn' => array(self::READ_VALUE, 'w:basedOn'), + 'next' => array(self::READ_VALUE, 'w:next'), + 'indent' => array(self::READ_VALUE, 'w:ind', 'w:left'), + 'hanging' => array(self::READ_VALUE, 'w:ind', 'w:hanging'), + 'spaceAfter' => array(self::READ_VALUE, 'w:spacing', 'w:after'), + 'spaceBefore' => array(self::READ_VALUE, 'w:spacing', 'w:before'), + 'widowControl' => array(self::READ_FALSE, 'w:widowControl'), + 'keepNext' => array(self::READ_TRUE, 'w:keepNext'), + 'keepLines' => array(self::READ_TRUE, 'w:keepLines'), + 'pageBreakBefore' => array(self::READ_TRUE, 'w:pageBreakBefore'), + 'contextualSpacing' => array(self::READ_TRUE, 'w:contextualSpacing'), + 'bidi' => array(self::READ_TRUE, 'w:bidi'), + 'suppressAutoHyphens' => array(self::READ_TRUE, 'w:suppressAutoHyphens'), ); return $this->readStyleDefs($xmlReader, $styleNode, $styleDefs); @@ -578,7 +579,7 @@ abstract class AbstractPart * * @param string $method * @ignoreScrutinizerPatch - * @param mixed $attributeValue + * @param string|null $attributeValue * @param mixed $expected * @return mixed */ diff --git a/src/PhpWord/Reader/Word2007/Settings.php b/src/PhpWord/Reader/Word2007/Settings.php index 581a546d..ee057fe6 100644 --- a/src/PhpWord/Reader/Word2007/Settings.php +++ b/src/PhpWord/Reader/Word2007/Settings.php @@ -29,7 +29,18 @@ use PhpOffice\PhpWord\Style\Language; */ class Settings extends AbstractPart { - private static $booleanProperties = array('hideSpellingErrors', 'hideGrammaticalErrors', 'trackRevisions', 'doNotTrackMoves', 'doNotTrackFormatting', 'evenAndOddHeaders'); + private static $booleanProperties = array( + 'mirrorMargins', + 'hideSpellingErrors', + 'hideGrammaticalErrors', + 'trackRevisions', + 'doNotTrackMoves', + 'doNotTrackFormatting', + 'evenAndOddHeaders', + 'updateFields', + 'autoHyphenation', + 'doNotHyphenateCaps', + ); /** * Read settings.xml. @@ -157,4 +168,32 @@ class Settings extends AbstractPart $revisionView->setInkAnnotations(filter_var($xmlReader->getAttribute('w:inkAnnotations', $node), FILTER_VALIDATE_BOOLEAN)); $phpWord->getSettings()->setRevisionView($revisionView); } + + /** + * @param XMLReader $xmlReader + * @param PhpWord $phpWord + * @param \DOMElement $node + */ + protected function setConsecutiveHyphenLimit(XMLReader $xmlReader, PhpWord $phpWord, \DOMElement $node) + { + $value = $xmlReader->getAttribute('w:val', $node); + + if ($value !== null) { + $phpWord->getSettings()->setConsecutiveHyphenLimit($value); + } + } + + /** + * @param XMLReader $xmlReader + * @param PhpWord $phpWord + * @param \DOMElement $node + */ + protected function setHyphenationZone(XMLReader $xmlReader, PhpWord $phpWord, \DOMElement $node) + { + $value = $xmlReader->getAttribute('w:val', $node); + + if ($value !== null) { + $phpWord->getSettings()->setHyphenationZone($value); + } + } } diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 73635807..2c7cf1b5 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -252,7 +252,7 @@ class Html $styles['font'] = self::recursiveParseStylesInHierarchy($node, $styles['font']); //alignment applies on paragraph, not on font. Let's copy it there - if (isset($styles['font']['alignment'])) { + if (isset($styles['font']['alignment']) && is_array($styles['paragraph'])) { $styles['paragraph']['alignment'] = $styles['font']['alignment']; } diff --git a/src/PhpWord/Style/Paragraph.php b/src/PhpWord/Style/Paragraph.php index 7e40d9e4..53a9b958 100644 --- a/src/PhpWord/Style/Paragraph.php +++ b/src/PhpWord/Style/Paragraph.php @@ -180,6 +180,13 @@ class Paragraph extends Border */ private $textAlignment; + /** + * Suppress hyphenation for paragraph + * + * @var bool + */ + private $suppressAutoHyphens = false; + /** * Set Style value * @@ -212,27 +219,28 @@ class Paragraph extends Border public function getStyleValues() { $styles = array( - 'name' => $this->getStyleName(), - 'basedOn' => $this->getBasedOn(), - 'next' => $this->getNext(), - 'alignment' => $this->getAlignment(), - 'indentation' => $this->getIndentation(), - 'spacing' => $this->getSpace(), - 'pagination' => array( - 'widowControl' => $this->hasWidowControl(), - 'keepNext' => $this->isKeepNext(), - 'keepLines' => $this->isKeepLines(), - 'pageBreak' => $this->hasPageBreakBefore(), + 'name' => $this->getStyleName(), + 'basedOn' => $this->getBasedOn(), + 'next' => $this->getNext(), + 'alignment' => $this->getAlignment(), + 'indentation' => $this->getIndentation(), + 'spacing' => $this->getSpace(), + 'pagination' => array( + 'widowControl' => $this->hasWidowControl(), + 'keepNext' => $this->isKeepNext(), + 'keepLines' => $this->isKeepLines(), + 'pageBreak' => $this->hasPageBreakBefore(), ), - 'numbering' => array( - 'style' => $this->getNumStyle(), - 'level' => $this->getNumLevel(), + 'numbering' => array( + 'style' => $this->getNumStyle(), + 'level' => $this->getNumLevel(), ), - 'tabs' => $this->getTabs(), - 'shading' => $this->getShading(), - 'contextualSpacing' => $this->hasContextualSpacing(), - 'bidi' => $this->isBidi(), - 'textAlignment' => $this->getTextAlignment(), + 'tabs' => $this->getTabs(), + 'shading' => $this->getShading(), + 'contextualSpacing' => $this->hasContextualSpacing(), + 'bidi' => $this->isBidi(), + 'textAlignment' => $this->getTextAlignment(), + 'suppressAutoHyphens' => $this->hasSuppressAutoHyphens(), ); return $styles; @@ -848,4 +856,20 @@ class Paragraph extends Border return $this; } + + /** + * @return bool + */ + public function hasSuppressAutoHyphens() + { + return $this->suppressAutoHyphens; + } + + /** + * @param bool $suppressAutoHyphens + */ + public function setSuppressAutoHyphens($suppressAutoHyphens) + { + $this->suppressAutoHyphens = (bool) $suppressAutoHyphens; + } } diff --git a/src/PhpWord/Writer/ODText/Part/Content.php b/src/PhpWord/Writer/ODText/Part/Content.php index 19d3e54a..f91ad544 100644 --- a/src/PhpWord/Writer/ODText/Part/Content.php +++ b/src/PhpWord/Writer/ODText/Part/Content.php @@ -222,8 +222,8 @@ class Content extends AbstractPart * Table style can be null or string of the style name * * @param \PhpOffice\PhpWord\Element\AbstractContainer $container - * @param int &$paragraphStyleCount - * @param int &$fontStyleCount + * @param int $paragraphStyleCount + * @param int $fontStyleCount * @todo Simplify the logic */ private function getContainerStyle($container, &$paragraphStyleCount, &$fontStyleCount) @@ -254,9 +254,9 @@ class Content extends AbstractPart /** * Get style of individual element * - * @param \PhpOffice\PhpWord\Element\Text &$element - * @param int &$paragraphStyleCount - * @param int &$fontStyleCount + * @param \PhpOffice\PhpWord\Element\Text $element + * @param int $paragraphStyleCount + * @param int $fontStyleCount */ private function getElementStyle(&$element, &$paragraphStyleCount, &$fontStyleCount) { diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index e56e2612..463ce082 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -149,12 +149,16 @@ class Settings extends AbstractPart $this->setOnOffValue('w:doNotTrackFormatting', $documentSettings->hasDoNotTrackFormatting()); $this->setOnOffValue('w:evenAndOddHeaders', $documentSettings->hasEvenAndOddHeaders()); $this->setOnOffValue('w:updateFields', $documentSettings->hasUpdateFields()); + $this->setOnOffValue('w:autoHyphenation', $documentSettings->hasAutoHyphenation()); + $this->setOnOffValue('w:doNotHyphenateCaps', $documentSettings->hasDoNotHyphenateCaps()); $this->setThemeFontLang($documentSettings->getThemeFontLang()); $this->setRevisionView($documentSettings->getRevisionView()); $this->setDocumentProtection($documentSettings->getDocumentProtection()); $this->setProofState($documentSettings->getProofState()); $this->setZoom($documentSettings->getZoom()); + $this->setConsecutiveHyphenLimit($documentSettings->getConsecutiveHyphenLimit()); + $this->setHyphenationZone($documentSettings->getHyphenationZone()); $this->setCompatibility(); } @@ -162,16 +166,18 @@ class Settings extends AbstractPart * Adds a boolean attribute to the settings array * * @param string $settingName - * @param bool $booleanValue + * @param bool|null $booleanValue */ private function setOnOffValue($settingName, $booleanValue) { - if ($booleanValue !== null && is_bool($booleanValue)) { - if ($booleanValue) { - $this->settings[$settingName] = array('@attributes' => array()); - } else { - $this->settings[$settingName] = array('@attributes' => array('w:val' => 'false')); - } + if (!is_bool($booleanValue)) { + return; + } + + if ($booleanValue) { + $this->settings[$settingName] = array('@attributes' => array()); + } else { + $this->settings[$settingName] = array('@attributes' => array('w:val' => 'false')); } } @@ -278,6 +284,34 @@ class Settings extends AbstractPart } } + /** + * @param int|null $consecutiveHyphenLimit + */ + private function setConsecutiveHyphenLimit($consecutiveHyphenLimit) + { + if ($consecutiveHyphenLimit === null) { + return; + } + + $this->settings['w:consecutiveHyphenLimit'] = array( + '@attributes' => array('w:val' => $consecutiveHyphenLimit), + ); + } + + /** + * @param float|null $hyphenationZone + */ + private function setHyphenationZone($hyphenationZone) + { + if ($hyphenationZone === null) { + return; + } + + $this->settings['w:hyphenationZone'] = array( + '@attributes' => array('w:val' => $hyphenationZone), + ); + } + /** * Get compatibility setting. */ diff --git a/src/PhpWord/Writer/Word2007/Style/Paragraph.php b/src/PhpWord/Writer/Word2007/Style/Paragraph.php index 8915fb4c..eeccc5c8 100644 --- a/src/PhpWord/Writer/Word2007/Style/Paragraph.php +++ b/src/PhpWord/Writer/Word2007/Style/Paragraph.php @@ -112,6 +112,9 @@ class Paragraph extends AbstractStyle //Paragraph textAlignment $xmlWriter->writeElementIf($styles['textAlignment'] !== null, 'w:textAlignment', 'w:val', $styles['textAlignment']); + // Hyphenation + $xmlWriter->writeElementIf($styles['suppressAutoHyphens'] === true, 'w:suppressAutoHyphens'); + // Child style: alignment, indentation, spacing, and shading $this->writeChildStyle($xmlWriter, 'Indentation', $styles['indentation']); $this->writeChildStyle($xmlWriter, 'Spacing', $styles['spacing']); diff --git a/tests/PhpWord/Element/SectionTest.php b/tests/PhpWord/Element/SectionTest.php index 867f680a..37096e2d 100644 --- a/tests/PhpWord/Element/SectionTest.php +++ b/tests/PhpWord/Element/SectionTest.php @@ -184,11 +184,11 @@ class SectionTest extends \PHPUnit\Framework\TestCase public function testRemoveElementByElement() { $section = new Section(1); - $fistText = $section->addText('firstText'); + $firstText = $section->addText('firstText'); $secondText = $section->addText('secondText'); $this->assertEquals(2, $section->countElements()); - $section->removeElement($fistText); + $section->removeElement($firstText); $this->assertEquals(1, $section->countElements()); $this->assertEquals($secondText->getElementId(), $section->getElement(1)->getElementId()); diff --git a/tests/PhpWord/Metadata/SettingsTest.php b/tests/PhpWord/Metadata/SettingsTest.php index 50863561..07dc8962 100644 --- a/tests/PhpWord/Metadata/SettingsTest.php +++ b/tests/PhpWord/Metadata/SettingsTest.php @@ -172,4 +172,58 @@ class SettingsTest extends \PHPUnit\Framework\TestCase $oSettings->setUpdateFields(true); $this->assertTrue($oSettings->hasUpdateFields()); } + + public function testAutoHyphenation() + { + $oSettings = new Settings(); + $oSettings->setAutoHyphenation(true); + $this->assertTrue($oSettings->hasAutoHyphenation()); + } + + public function testDefaultAutoHyphenation() + { + $oSettings = new Settings(); + $this->assertNull($oSettings->hasAutoHyphenation()); + } + + public function testConsecutiveHyphenLimit() + { + $consecutiveHypenLimit = 2; + $oSettings = new Settings(); + $oSettings->setConsecutiveHyphenLimit($consecutiveHypenLimit); + $this->assertSame($consecutiveHypenLimit, $oSettings->getConsecutiveHyphenLimit()); + } + + public function testDefaultConsecutiveHyphenLimit() + { + $oSettings = new Settings(); + $this->assertNull($oSettings->getConsecutiveHyphenLimit()); + } + + public function testHyphenationZone() + { + $hyphenationZoneInTwip = 100; + $oSettings = new Settings(); + $oSettings->setHyphenationZone($hyphenationZoneInTwip); + $this->assertSame($hyphenationZoneInTwip, $oSettings->getHyphenationZone()); + } + + public function testDefaultHyphenationZone() + { + $oSettings = new Settings(); + $this->assertNull($oSettings->getHyphenationZone()); + } + + public function testDoNotHyphenateCaps() + { + $oSettings = new Settings(); + $oSettings->setDoNotHyphenateCaps(true); + $this->assertTrue($oSettings->hasDoNotHyphenateCaps()); + } + + public function testDefaultDoNotHyphenateCaps() + { + $oSettings = new Settings(); + $this->assertNull($oSettings->hasDoNotHyphenateCaps()); + } } diff --git a/tests/PhpWord/PhpWordTest.php b/tests/PhpWord/PhpWordTest.php index f8a22459..3b1b5a36 100644 --- a/tests/PhpWord/PhpWordTest.php +++ b/tests/PhpWord/PhpWordTest.php @@ -171,4 +171,58 @@ class PhpWordTest extends \PHPUnit\Framework\TestCase $phpWord = new PhpWord(); $phpWord->undefinedMethod(); } + + /** + * @covers \PhpOffice\PhpWord\PhpWord::getSection + */ + public function testGetNotExistingSection() + { + $phpWord = new PhpWord(); + $section = $phpWord->getSection(0); + + $this->assertNull($section); + } + + /** + * @covers \PhpOffice\PhpWord\PhpWord::getSection + */ + public function testGetSection() + { + $phpWord = new PhpWord(); + $phpWord->addSection(); + $section = $phpWord->getSection(0); + + $this->assertNotNull($section); + } + + /** + * @covers \PhpOffice\PhpWord\PhpWord::sortSections + */ + public function testSortSections() + { + $phpWord = new PhpWord(); + $section1 = $phpWord->addSection(); + $section1->addText('test1'); + $section2 = $phpWord->addSection(); + $section2->addText('test2'); + $section2->addText('test3'); + + $this->assertEquals(1, $phpWord->getSection(0)->countElements()); + $this->assertEquals(2, $phpWord->getSection(1)->countElements()); + + $phpWord->sortSections(function ($a, $b) { + $numElementsInA = $a->countElements(); + $numElementsInB = $b->countElements(); + if ($numElementsInA === $numElementsInB) { + return 0; + } elseif ($numElementsInA > $numElementsInB) { + return -1; + } + + return 1; + }); + + $this->assertEquals(2, $phpWord->getSection(0)->countElements()); + $this->assertEquals(1, $phpWord->getSection(1)->countElements()); + } } diff --git a/tests/PhpWord/Reader/Word2007/StyleTest.php b/tests/PhpWord/Reader/Word2007/StyleTest.php index ad8f125a..93e4a1f0 100644 --- a/tests/PhpWord/Reader/Word2007/StyleTest.php +++ b/tests/PhpWord/Reader/Word2007/StyleTest.php @@ -81,9 +81,9 @@ class StyleTest extends AbstractTestReader '; - $phpWord = $this->getDocumentFromString($documentXml); + $phpWord = $this->getDocumentFromString(array('document' => $documentXml)); - $elements = $this->get($phpWord->getSections(), 0)->getElements(); + $elements = $phpWord->getSection(0)->getElements(); $this->assertInstanceOf('PhpOffice\PhpWord\Element\Text', $elements[0]); $this->assertInstanceOf('PhpOffice\PhpWord\Style\Font', $elements[0]->getFontStyle()); /** @var \PhpOffice\PhpWord\Style\Font $fontStyle */ diff --git a/tests/PhpWord/Style/ParagraphTest.php b/tests/PhpWord/Style/ParagraphTest.php index e961f36a..adf0ed4d 100644 --- a/tests/PhpWord/Style/ParagraphTest.php +++ b/tests/PhpWord/Style/ParagraphTest.php @@ -67,23 +67,24 @@ class ParagraphTest extends \PHPUnit\Framework\TestCase $object = new Paragraph(); $attributes = array( - 'spaceAfter' => 240, - 'spaceBefore' => 240, - 'indent' => 1, - 'hanging' => 1, - 'spacing' => 120, - 'spacingLineRule' => LineSpacingRule::AT_LEAST, - 'basedOn' => 'Normal', - 'next' => 'Normal', - 'numStyle' => 'numStyle', - 'numLevel' => 1, - 'widowControl' => false, - 'keepNext' => true, - 'keepLines' => true, - 'pageBreakBefore' => true, - 'contextualSpacing' => true, - 'textAlignment' => 'auto', - 'bidi' => true, + 'spaceAfter' => 240, + 'spaceBefore' => 240, + 'indent' => 1, + 'hanging' => 1, + 'spacing' => 120, + 'spacingLineRule' => LineSpacingRule::AT_LEAST, + 'basedOn' => 'Normal', + 'next' => 'Normal', + 'numStyle' => 'numStyle', + 'numLevel' => 1, + 'widowControl' => false, + 'keepNext' => true, + 'keepLines' => true, + 'pageBreakBefore' => true, + 'contextualSpacing' => true, + 'textAlignment' => 'auto', + 'bidi' => true, + 'suppressAutoHyphens' => true, ); foreach ($attributes as $key => $value) { $get = $this->findGetter($key, $value, $object); diff --git a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php index 50b444b8..a45253a2 100644 --- a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php @@ -330,4 +330,68 @@ class SettingsTest extends \PHPUnit\Framework\TestCase $element = $doc->getElement($path, $file); $this->assertNotEquals('false', $element->getAttribute('w:val')); } + + public function testAutoHyphenation() + { + $phpWord = new PhpWord(); + $phpWord->getSettings()->setAutoHyphenation(true); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:autoHyphenation'; + $this->assertTrue($doc->elementExists($path, $file)); + + $element = $doc->getElement($path, $file); + $this->assertNotEquals('false', $element->getAttribute('w:val')); + } + + public function testConsecutiveHyphenLimit() + { + $phpWord = new PhpWord(); + $phpWord->getSettings()->setConsecutiveHyphenLimit(2); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:consecutiveHyphenLimit'; + $this->assertTrue($doc->elementExists($path, $file)); + + $element = $doc->getElement($path, $file); + $this->assertSame('2', $element->getAttribute('w:val')); + } + + public function testHyphenationZone() + { + $phpWord = new PhpWord(); + $phpWord->getSettings()->setHyphenationZone(100); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:hyphenationZone'; + $this->assertTrue($doc->elementExists($path, $file)); + + $element = $doc->getElement($path, $file); + $this->assertSame('100', $element->getAttribute('w:val')); + } + + public function testDoNotHyphenateCaps() + { + $phpWord = new PhpWord(); + $phpWord->getSettings()->setDoNotHyphenateCaps(true); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:doNotHyphenateCaps'; + $this->assertTrue($doc->elementExists($path, $file)); + + $element = $doc->getElement($path, $file); + $this->assertNotEquals('false', $element->getAttribute('w:val')); + } } diff --git a/tests/PhpWord/Writer/Word2007/Style/ParagraphTest.php b/tests/PhpWord/Writer/Word2007/Style/ParagraphTest.php index 9bc2756b..1e5e1d13 100644 --- a/tests/PhpWord/Writer/Word2007/Style/ParagraphTest.php +++ b/tests/PhpWord/Writer/Word2007/Style/ParagraphTest.php @@ -17,6 +17,7 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Style; +use PhpOffice\PhpWord\Style\Paragraph as ParagraphStyle; use PhpOffice\PhpWord\TestHelperDOCX; /** @@ -49,4 +50,18 @@ class ParagraphTest extends \PHPUnit\Framework\TestCase $path = '/w:document/w:body/w:p/w:pPr/w:numPr/w:ilvl'; $this->assertTrue($doc->elementExists($path)); } + + public function testSuppressAutoHyphens() + { + $paragraphStyle = new ParagraphStyle(); + $paragraphStyle->setSuppressAutoHyphens(true); + + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $section->addText('test', null, $paragraphStyle); + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + + $path = '/w:document/w:body/w:p/w:pPr/w:suppressAutoHyphens'; + $this->assertTrue($doc->elementExists($path)); + } } From f41c542ba07e02718718a2958b9cfcb427dfb8a0 Mon Sep 17 00:00:00 2001 From: Frank Liepert Date: Thu, 15 Feb 2018 20:08:48 +0100 Subject: [PATCH 245/370] Enforce valid value for on/off type --- src/PhpWord/Writer/Word2007/Part/Settings.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index 463ce082..118c0da0 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -174,11 +174,8 @@ class Settings extends AbstractPart return; } - if ($booleanValue) { - $this->settings[$settingName] = array('@attributes' => array()); - } else { - $this->settings[$settingName] = array('@attributes' => array('w:val' => 'false')); - } + $value = $booleanValue ? 'true' : 'false'; + $this->settings[$settingName] = array('@attributes' => array('w:val' => $value)); } /** From edc3aa3cce59172b138e08475e1732624a2812cd Mon Sep 17 00:00:00 2001 From: Frank Liepert Date: Thu, 15 Feb 2018 20:08:59 +0100 Subject: [PATCH 246/370] Improve assertions --- .../Writer/Word2007/Part/SettingsTest.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php index a45253a2..41583e37 100644 --- a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php @@ -174,7 +174,7 @@ class SettingsTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists($path, $file)); $element = $doc->getElement($path, $file); - $this->assertNotEquals('false', $element->getAttribute('w:val')); + $this->assertSame('true', $element->getAttribute('w:val')); } /** @@ -193,7 +193,7 @@ class SettingsTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists($path, $file)); $element = $doc->getElement($path, $file); - $this->assertNotEquals('false', $element->getAttribute('w:val')); + $this->assertSame('true', $element->getAttribute('w:val')); } /** @@ -247,7 +247,7 @@ class SettingsTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists($path, $file)); $element = $doc->getElement($path, $file); - $this->assertNotEquals('false', $element->getAttribute('w:val')); + $this->assertSame('true', $element->getAttribute('w:val')); } /** @@ -290,7 +290,7 @@ class SettingsTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists($path, $file)); $element = $doc->getElement($path, $file); - $this->assertNotEquals('false', $element->getAttribute('w:val')); + $this->assertSame('true', $element->getAttribute('w:val')); } /** @@ -309,7 +309,7 @@ class SettingsTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists($path, $file)); $element = $doc->getElement($path, $file); - $this->assertNotEquals('false', $element->getAttribute('w:val')); + $this->assertSame('true', $element->getAttribute('w:val')); } /** @@ -328,7 +328,7 @@ class SettingsTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists($path, $file)); $element = $doc->getElement($path, $file); - $this->assertNotEquals('false', $element->getAttribute('w:val')); + $this->assertSame('true', $element->getAttribute('w:val')); } public function testAutoHyphenation() @@ -344,7 +344,7 @@ class SettingsTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists($path, $file)); $element = $doc->getElement($path, $file); - $this->assertNotEquals('false', $element->getAttribute('w:val')); + $this->assertSame('true', $element->getAttribute('w:val')); } public function testConsecutiveHyphenLimit() @@ -392,6 +392,6 @@ class SettingsTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists($path, $file)); $element = $doc->getElement($path, $file); - $this->assertNotEquals('false', $element->getAttribute('w:val')); + $this->assertSame('true', $element->getAttribute('w:val')); } } From 9ffbd98cc66d87d28cd3b80cbf9915461b5b81d4 Mon Sep 17 00:00:00 2001 From: Frank Liepert Date: Thu, 15 Feb 2018 20:12:56 +0100 Subject: [PATCH 247/370] Add missing tests --- .../Writer/Word2007/Part/SettingsTest.php | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php index 41583e37..a8c01da0 100644 --- a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php @@ -196,6 +196,22 @@ class SettingsTest extends \PHPUnit\Framework\TestCase $this->assertSame('true', $element->getAttribute('w:val')); } + public function testUpdateFields() + { + $phpWord = new PhpWord(); + $phpWord->getSettings()->setUpdateFields(true); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:updateFields'; + $this->assertTrue($doc->elementExists($path, $file)); + + $element = $doc->getElement($path, $file); + $this->assertSame('true', $element->getAttribute('w:val')); + } + /** * Test zoom percentage */ @@ -274,6 +290,38 @@ class SettingsTest extends \PHPUnit\Framework\TestCase $this->assertEquals('true', $element->getAttribute('w:comments')); } + public function testHideSpellingErrors() + { + $phpWord = new PhpWord(); + $phpWord->getSettings()->setHideSpellingErrors(true); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:hideSpellingErrors'; + $this->assertTrue($doc->elementExists($path, $file)); + + $element = $doc->getElement($path, $file); + $this->assertSame('true', $element->getAttribute('w:val')); + } + + public function testHideGrammaticalErrors() + { + $phpWord = new PhpWord(); + $phpWord->getSettings()->setHideGrammaticalErrors(true); + + $doc = TestHelperDOCX::getDocument($phpWord); + + $file = 'word/settings.xml'; + + $path = '/w:settings/w:hideGrammaticalErrors'; + $this->assertTrue($doc->elementExists($path, $file)); + + $element = $doc->getElement($path, $file); + $this->assertSame('true', $element->getAttribute('w:val')); + } + /** * Test track Revisions */ From d8f4a28b94ade126a66bed836050246af2cb7ee8 Mon Sep 17 00:00:00 2001 From: Frank Liepert Date: Wed, 7 Mar 2018 20:04:19 +0100 Subject: [PATCH 248/370] Make Composer scripts compatible with Windows Windows does not like the "./" syntax --- composer.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index d1c35b40..742e4bc8 100644 --- a/composer.json +++ b/composer.json @@ -36,19 +36,19 @@ ], "scripts": { "test": [ - "./vendor/bin/phpunit --color=always" + "phpunit --color=always" ], "test-no-coverage": [ - "./vendor/bin/phpunit --color=always --no-coverage" + "phpunit --color=always --no-coverage" ], "check": [ - "./vendor/bin/php-cs-fixer fix --ansi --dry-run --diff", - "./vendor/bin/phpcs --report-width=200 --report-summary --report-full samples/ src/ tests/ --ignore=src/PhpWord/Shared/PCLZip --standard=PSR2 -n", - "./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php", + "php-cs-fixer fix --ansi --dry-run --diff", + "phpcs --report-width=200 --report-summary --report-full samples/ src/ tests/ --ignore=src/PhpWord/Shared/PCLZip --standard=PSR2 -n", + "phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php", "@test" ], "fix": [ - "./vendor/bin/php-cs-fixer fix --ansi" + "php-cs-fixer fix --ansi" ] }, "scripts-descriptions": { From eb6900969ffbce2838c1b35d1e25c9d31fc29752 Mon Sep 17 00:00:00 2001 From: Francisco Lucas Sens Date: Thu, 8 Mar 2018 16:15:31 -0300 Subject: [PATCH 249/370] Added new constant to Brazilian portuguese language --- src/PhpWord/Style/Language.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/PhpWord/Style/Language.php b/src/PhpWord/Style/Language.php index e09421e0..c8152f50 100644 --- a/src/PhpWord/Style/Language.php +++ b/src/PhpWord/Style/Language.php @@ -59,6 +59,9 @@ final class Language extends AbstractStyle const HI_IN = 'hi-IN'; const HI_IN_ID = 1081; + const PT_BR = 'pt-BR'; + const PT_BR_ID = 1046; + /** * Language ID, used for RTF document generation * From f9a05547f717e9c95fa2054f12d9f3fa6a56c4dd Mon Sep 17 00:00:00 2001 From: Henri MEDOT Date: Thu, 8 Mar 2018 23:46:22 +0100 Subject: [PATCH 250/370] Added support for Floating Table Positioning (tblpPr) (#639) Added support for Floating Table Positioning (tblpPr) --- CHANGELOG.md | 1 + docs/elements.rst | 1 + docs/styles.rst | 14 + samples/Sample_09_Tables.php | 12 + samples/Sample_26_Html.php | 3 + src/PhpWord/Reader/Word2007/AbstractPart.php | 30 ++ src/PhpWord/Style/Table.php | 30 ++ src/PhpWord/Style/TablePosition.php | 410 ++++++++++++++++++ src/PhpWord/Writer/Word2007/Style/Table.php | 5 + .../Writer/Word2007/Style/TablePosition.php | 65 +++ tests/PhpWord/Reader/Word2007/StyleTest.php | 35 +- tests/PhpWord/Style/TablePositionTest.php | 65 +++ tests/PhpWord/Style/TableTest.php | 13 + .../Writer/Word2007/Style/TableTest.php | 42 ++ 14 files changed, 725 insertions(+), 1 deletion(-) create mode 100644 src/PhpWord/Style/TablePosition.php create mode 100644 src/PhpWord/Writer/Word2007/Style/TablePosition.php create mode 100644 tests/PhpWord/Style/TablePositionTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index cdc4d67c..0c83ac35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ v0.15.0 (?? ??? 2018) - Added support for Vertically Raised or Lowered Text (w:position) @anrikun @troosan #640 - Add support for MACROBUTTON field @phryneas @troosan #1021 - Add support for Hyphenation @Trainmaster #1282 (Document: `autoHyphenation`, `consecutiveHyphenLimit`, `hyphenationZone`, `doNotHyphenateCaps`, Paragraph: `suppressAutoHyphens`) +- Added support for Floating Table Positioning (tblpPr) @anrikun #639 ### Fixed - Fix reading of docx default style - @troosan #1238 diff --git a/docs/elements.rst b/docs/elements.rst index 4d1b9383..4c5ad03b 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -482,6 +482,7 @@ Track changes can be set on text elements. There are 2 ways to set the change in Either by calling the `setChangeInfo()`, or by setting the `TrackChange` instance on the element with `setTrackChange()`. .. code-block:: php + $phpWord = new \PhpOffice\PhpWord\PhpWord(); // New portrait section diff --git a/docs/styles.rst b/docs/styles.rst index b4ed328d..98088e78 100644 --- a/docs/styles.rst +++ b/docs/styles.rst @@ -108,6 +108,20 @@ Available Table style options: - ``unit``. The unit to use for the width. One of ``\PhpOffice\PhpWord\SimpleType\TblWidth``. Defaults to *auto*. - ``layout``. Table layout, either *fixed* or *autofit* See ``\PhpOffice\PhpWord\Style\Table`` for constants. - ``cellSpacing`` Cell spacing in *twip* +- ``position`` Floating Table Positioning, see below for options + +Floating Table Positioning options: + +- ``leftFromText`` Distance From Left of Table to Text in *twip* +- ``rightFromText`` Distance From Right of Table to Text in *twip* +- ``topFromText`` Distance From Top of Table to Text in *twip* +- ``bottomFromText`` Distance From Top of Table to Text in *twip* +- ``vertAnchor`` Table Vertical Anchor, one of ``\PhpOffice\PhpWord\Style\TablePosition::VANCHOR_*`` +- ``horzAnchor`` Table Horizontal Anchor, one of ``\PhpOffice\PhpWord\Style\TablePosition::HANCHOR_*`` +- ``tblpXSpec`` Relative Horizontal Alignment From Anchor, one of ``\PhpOffice\PhpWord\Style\TablePosition::XALIGN_*`` +- ``tblpX`` Absolute Horizontal Distance From Anchorin *twip* +- ``tblpYSpec`` Relative Vertical Alignment From Anchor, one of ``\PhpOffice\PhpWord\Style\TablePosition::YALIGN_*`` +- ``tblpY`` Absolute Vertical Distance From Anchorin *twip* Available Row style options: diff --git a/samples/Sample_09_Tables.php b/samples/Sample_09_Tables.php index ba41aa54..e458a5ee 100644 --- a/samples/Sample_09_Tables.php +++ b/samples/Sample_09_Tables.php @@ -1,4 +1,7 @@ addText('This cell contains nested table.'); $innerCell = $cell->addTable(array('alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER))->addRow()->addCell(); $innerCell->addText('Inside nested table'); +// 6. Table with floating position + +$section->addTextBreak(2); +$section->addText('Table with floating positioning.', $header); + +$table = $section->addTable(array('borderSize' => 6, 'borderColor' => '999999', 'position' => array('vertAnchor' => TablePosition::VANCHOR_TEXT, 'bottomFromText' => Converter::cmToTwip(1)))); +$cell = $table->addRow()->addCell(); +$cell->addText('This is a single cell.'); + // Save file echo write($phpWord, basename(__FILE__, '.php'), $writers); if (!CLI) { diff --git a/samples/Sample_26_Html.php b/samples/Sample_26_Html.php index f6086357..31e5984f 100644 --- a/samples/Sample_26_Html.php +++ b/samples/Sample_26_Html.php @@ -4,6 +4,7 @@ include_once 'Sample_Header.php'; // New Word Document echo date('H:i:s') , ' Create new PhpWord object' , EOL; $phpWord = new \PhpOffice\PhpWord\PhpWord(); +$phpWord->addParagraphStyle('Heading2', array('alignment' => 'center')); $section = $phpWord->addSection(); $html = '

                Adding element via HTML

                '; @@ -17,6 +18,8 @@ $html .= '

                היי, זה $html .= '

                Unordered (bulleted) list:

                '; $html .= '
                • Item 1
                • Item 2
                  • Item 2.1
                  • Item 2.1
                '; +$html .= '

                centered title

                '; + $html .= '

                Ordered (numbered) list:

                '; $html .= '
                1. List 1 item 1

                2. diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index 2cbfba37..7ba53ad1 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -462,12 +462,42 @@ abstract class AbstractPart $styleDefs['layout'] = array(self::READ_VALUE, 'w:tblLayout', 'w:type'); $styleDefs['cellSpacing'] = array(self::READ_VALUE, 'w:tblCellSpacing', 'w:w'); $style = $this->readStyleDefs($xmlReader, $styleNode, $styleDefs); + + $tablePositionNode = $xmlReader->getElement('w:tblpPr', $styleNode); + if ($tablePositionNode !== null) { + $style['position'] = $this->readTablePosition($xmlReader, $tablePositionNode); + } } } return $style; } + /** + * Read w:tblpPr + * + * @param \PhpOffice\Common\XMLReader $xmlReader + * @param \DOMElement $domNode + * @return array + */ + private function readTablePosition(XMLReader $xmlReader, \DOMElement $domNode) + { + $styleDefs = array( + 'leftFromText' => array(self::READ_VALUE, '.', 'w:leftFromText'), + 'rightFromText' => array(self::READ_VALUE, '.', 'w:rightFromText'), + 'topFromText' => array(self::READ_VALUE, '.', 'w:topFromText'), + 'bottomFromText' => array(self::READ_VALUE, '.', 'w:bottomFromText'), + 'vertAnchor' => array(self::READ_VALUE, '.', 'w:vertAnchor'), + 'horzAnchor' => array(self::READ_VALUE, '.', 'w:horzAnchor'), + 'tblpXSpec' => array(self::READ_VALUE, '.', 'w:tblpXSpec'), + 'tblpX' => array(self::READ_VALUE, '.', 'w:tblpX'), + 'tblpYSpec' => array(self::READ_VALUE, '.', 'w:tblpYSpec'), + 'tblpY' => array(self::READ_VALUE, '.', 'w:tblpY'), + ); + + return $this->readStyleDefs($xmlReader, $domNode, $styleDefs); + } + /** * Read w:tcPr * diff --git a/src/PhpWord/Style/Table.php b/src/PhpWord/Style/Table.php index 8aba172a..92a24dde 100644 --- a/src/PhpWord/Style/Table.php +++ b/src/PhpWord/Style/Table.php @@ -152,6 +152,13 @@ class Table extends Border */ private $layout = self::LAYOUT_AUTO; + /** + * Position + * + * @var \PhpOffice\PhpWord\Style\TablePosition + */ + private $position; + /** * Create new table style * @@ -694,4 +701,27 @@ class Table extends Border return $this; } + + /** + * Get position + * + * @return \PhpOffice\PhpWord\Style\TablePosition + */ + public function getPosition() + { + return $this->position; + } + + /** + * Set position + * + * @param mixed $value + * @return self + */ + public function setPosition($value = null) + { + $this->setObjectVal($value, 'TablePosition', $this->position); + + return $this; + } } diff --git a/src/PhpWord/Style/TablePosition.php b/src/PhpWord/Style/TablePosition.php new file mode 100644 index 00000000..7cb0a0be --- /dev/null +++ b/src/PhpWord/Style/TablePosition.php @@ -0,0 +1,410 @@ +setStyleByArray($style); + } + + /** + * Get distance from left of table to text + * + * @return int + */ + public function getLeftFromText() + { + return $this->leftFromText; + } + + /** + * Set distance from left of table to text + * + * @param int $value + * @return self + */ + public function setLeftFromText($value = null) + { + $this->leftFromText = $this->setNumericVal($value, $this->leftFromText); + + return $this; + } + + /** + * Get distance from right of table to text + * + * @return int + */ + public function getRightFromText() + { + return $this->rightFromText; + } + + /** + * Set distance from right of table to text + * + * @param int $value + * @return self + */ + public function setRightFromText($value = null) + { + $this->rightFromText = $this->setNumericVal($value, $this->rightFromText); + + return $this; + } + + /** + * Get distance from top of table to text + * + * @return int + */ + public function getTopFromText() + { + return $this->topFromText; + } + + /** + * Set distance from top of table to text + * + * @param int $value + * @return self + */ + public function setTopFromText($value = null) + { + $this->topFromText = $this->setNumericVal($value, $this->topFromText); + + return $this; + } + + /** + * Get distance from bottom of table to text + * + * @return int + */ + public function getBottomFromText() + { + return $this->bottomFromText; + } + + /** + * Set distance from bottom of table to text + * + * @param int $value + * @return self + */ + public function setBottomFromText($value = null) + { + $this->bottomFromText = $this->setNumericVal($value, $this->bottomFromText); + + return $this; + } + + /** + * Get table vertical anchor + * + * @return string + */ + public function getVertAnchor() + { + return $this->vertAnchor; + } + + /** + * Set table vertical anchor + * + * @param string $value + * @return self + */ + public function setVertAnchor($value = null) + { + $enum = array( + self::VANCHOR_TEXT, + self::VANCHOR_MARGIN, + self::VANCHOR_PAGE, + ); + $this->vertAnchor = $this->setEnumVal($value, $enum, $this->vertAnchor); + + return $this; + } + + /** + * Get table horizontal anchor + * + * @return string + */ + public function getHorzAnchor() + { + return $this->horzAnchor; + } + + /** + * Set table horizontal anchor + * + * @param string $value + * @return self + */ + public function setHorzAnchor($value = null) + { + $enum = array( + self::HANCHOR_TEXT, + self::HANCHOR_MARGIN, + self::HANCHOR_PAGE, + ); + $this->horzAnchor = $this->setEnumVal($value, $enum, $this->horzAnchor); + + return $this; + } + + /** + * Get relative horizontal alignment from anchor + * + * @return string + */ + public function getTblpXSpec() + { + return $this->tblpXSpec; + } + + /** + * Set relative horizontal alignment from anchor + * + * @param string $value + * @return self + */ + public function setTblpXSpec($value = null) + { + $enum = array( + self::XALIGN_LEFT, + self::XALIGN_CENTER, + self::XALIGN_RIGHT, + self::XALIGN_INSIDE, + self::XALIGN_OUTSIDE, + ); + $this->tblpXSpec = $this->setEnumVal($value, $enum, $this->tblpXSpec); + + return $this; + } + + /** + * Get absolute horizontal distance from anchor + * + * @return int + */ + public function getTblpX() + { + return $this->tblpX; + } + + /** + * Set absolute horizontal distance from anchor + * + * @param int $value + * @return self + */ + public function setTblpX($value = null) + { + $this->tblpX = $this->setNumericVal($value, $this->tblpX); + + return $this; + } + + /** + * Get relative vertical alignment from anchor + * + * @return string + */ + public function getTblpYSpec() + { + return $this->tblpYSpec; + } + + /** + * Set relative vertical alignment from anchor + * + * @param string $value + * @return self + */ + public function setTblpYSpec($value = null) + { + $enum = array( + self::YALIGN_INLINE, + self::YALIGN_TOP, + self::YALIGN_CENTER, + self::YALIGN_BOTTOM, + self::YALIGN_INSIDE, + self::YALIGN_OUTSIDE, + ); + $this->tblpYSpec = $this->setEnumVal($value, $enum, $this->tblpYSpec); + + return $this; + } + + /** + * Get absolute vertical distance from anchor + * + * @return int + */ + public function getTblpY() + { + return $this->tblpY; + } + + /** + * Set absolute vertical distance from anchor + * + * @param int $value + * @return self + */ + public function setTblpY($value = null) + { + $this->tblpY = $this->setNumericVal($value, $this->tblpY); + + return $this; + } +} diff --git a/src/PhpWord/Writer/Word2007/Style/Table.php b/src/PhpWord/Writer/Word2007/Style/Table.php index 14226212..058e60e2 100644 --- a/src/PhpWord/Writer/Word2007/Style/Table.php +++ b/src/PhpWord/Writer/Word2007/Style/Table.php @@ -80,6 +80,11 @@ class Table extends AbstractStyle $this->writeTblWidth($xmlWriter, 'w:tblW', $style->getUnit(), $style->getWidth()); $this->writeTblWidth($xmlWriter, 'w:tblCellSpacing', TblWidth::TWIP, $style->getCellSpacing()); $this->writeLayout($xmlWriter, $style->getLayout()); + + // Position + $styleWriter = new TablePosition($xmlWriter, $style->getPosition()); + $styleWriter->write(); + $this->writeMargin($xmlWriter, $style); $this->writeBorder($xmlWriter, $style); diff --git a/src/PhpWord/Writer/Word2007/Style/TablePosition.php b/src/PhpWord/Writer/Word2007/Style/TablePosition.php new file mode 100644 index 00000000..14fa6a0d --- /dev/null +++ b/src/PhpWord/Writer/Word2007/Style/TablePosition.php @@ -0,0 +1,65 @@ +getStyle(); + if (!$style instanceof \PhpOffice\PhpWord\Style\TablePosition) { + return; + } + + $values = array(); + $properties = array( + 'leftFromText', + 'rightFromText', + 'topFromText', + 'bottomFromText', + 'vertAnchor', + 'horzAnchor', + 'tblpXSpec', + 'tblpX', + 'tblpYSpec', + 'tblpY', + ); + foreach ($properties as $property) { + $method = 'get' . $property; + if (method_exists($style, $method)) { + $values[$property] = $style->$method(); + } + } + $values = array_filter($values); + + if ($values) { + $xmlWriter = $this->getXmlWriter(); + $xmlWriter->startElement('w:tblpPr'); + foreach ($values as $property => $value) { + $xmlWriter->writeAttribute('w:' . $property, $value); + } + $xmlWriter->endElement(); + } + } +} diff --git a/tests/PhpWord/Reader/Word2007/StyleTest.php b/tests/PhpWord/Reader/Word2007/StyleTest.php index 93e4a1f0..3b04b677 100644 --- a/tests/PhpWord/Reader/Word2007/StyleTest.php +++ b/tests/PhpWord/Reader/Word2007/StyleTest.php @@ -20,6 +20,7 @@ namespace PhpOffice\PhpWord\Reader\Word2007; use PhpOffice\PhpWord\AbstractTestReader; use PhpOffice\PhpWord\SimpleType\TblWidth; use PhpOffice\PhpWord\Style\Table; +use PhpOffice\PhpWord\Style\TablePosition; /** * Test class for PhpOffice\PhpWord\Reader\Word2007\Styles @@ -61,12 +62,44 @@ class StyleTest extends AbstractTestReader $elements = $phpWord->getSection(0)->getElements(); $this->assertInstanceOf('PhpOffice\PhpWord\Element\Table', $elements[0]); $this->assertInstanceOf('PhpOffice\PhpWord\Style\Table', $elements[0]->getStyle()); - $this->assertEquals(TblWidth::AUTO, $elements[0]->getStyle()->getUnit()); /** @var \PhpOffice\PhpWord\Style\Table $tableStyle */ $tableStyle = $elements[0]->getStyle(); + $this->assertEquals(TblWidth::AUTO, $tableStyle->getUnit()); $this->assertEquals(10.5, $tableStyle->getCellSpacing()); } + /** + * Test reading of table position + */ + public function testReadTablePosition() + { + $documentXml = ' + + + + '; + + $phpWord = $this->getDocumentFromString(array('document' => $documentXml)); + + $elements = $phpWord->getSection(0)->getElements(); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\Table', $elements[0]); + $this->assertInstanceOf('PhpOffice\PhpWord\Style\Table', $elements[0]->getStyle()); + $this->assertNotNull($elements[0]->getStyle()->getPosition()); + $this->assertInstanceOf('PhpOffice\PhpWord\Style\TablePosition', $elements[0]->getStyle()->getPosition()); + /** @var \PhpOffice\PhpWord\Style\TablePosition $tableStyle */ + $tableStyle = $elements[0]->getStyle()->getPosition(); + $this->assertEquals(10, $tableStyle->getLeftFromText()); + $this->assertEquals(20, $tableStyle->getRightFromText()); + $this->assertEquals(30, $tableStyle->getTopFromText()); + $this->assertEquals(40, $tableStyle->getBottomFromText()); + $this->assertEquals(TablePosition::VANCHOR_PAGE, $tableStyle->getVertAnchor()); + $this->assertEquals(TablePosition::HANCHOR_MARGIN, $tableStyle->getHorzAnchor()); + $this->assertEquals(TablePosition::XALIGN_CENTER, $tableStyle->getTblpXSpec()); + $this->assertEquals(50, $tableStyle->getTblpX()); + $this->assertEquals(TablePosition::YALIGN_TOP, $tableStyle->getTblpYSpec()); + $this->assertEquals(60, $tableStyle->getTblpY()); + } + /** * Test reading of position */ diff --git a/tests/PhpWord/Style/TablePositionTest.php b/tests/PhpWord/Style/TablePositionTest.php new file mode 100644 index 00000000..77b22e4e --- /dev/null +++ b/tests/PhpWord/Style/TablePositionTest.php @@ -0,0 +1,65 @@ + TablePosition::VANCHOR_PAGE, 'bottomFromText' => 20); + + $object = new TablePosition($styleTable); + $this->assertEquals(TablePosition::VANCHOR_PAGE, $object->getVertAnchor()); + $this->assertEquals(20, $object->getBottomFromText()); + } + + /** + * Test setting style with normal value + */ + public function testSetGetNormal() + { + $object = new TablePosition(); + + $attributes = array( + 'leftFromText' => 4, + 'rightFromText' => 4, + 'topFromText' => 4, + 'bottomFromText' => 4, + 'vertAnchor' => TablePosition::VANCHOR_PAGE, + 'horzAnchor' => TablePosition::HANCHOR_TEXT, + 'tblpXSpec' => TablePosition::XALIGN_CENTER, + 'tblpX' => 5, + 'tblpYSpec' => TablePosition::YALIGN_OUTSIDE, + 'tblpY' => 6, + ); + foreach ($attributes as $key => $value) { + $set = "set{$key}"; + $get = "get{$key}"; + $object->$set($value); + $this->assertEquals($value, $object->$get()); + } + } +} diff --git a/tests/PhpWord/Style/TableTest.php b/tests/PhpWord/Style/TableTest.php index 9dec422e..1ee718df 100644 --- a/tests/PhpWord/Style/TableTest.php +++ b/tests/PhpWord/Style/TableTest.php @@ -195,4 +195,17 @@ class TableTest extends \PHPUnit\Framework\TestCase $object = new Table(array('cellSpacing' => 20)); $this->assertEquals(20, $object->getCellSpacing()); } + + /** + * Tests table floating position + */ + public function testTablePosition() + { + $object = new Table(); + $this->assertNull($object->getPosition()); + + $object->setPosition(array('vertAnchor' => TablePosition::VANCHOR_PAGE)); + $this->assertNotNull($object->getPosition()); + $this->assertEquals(TablePosition::VANCHOR_PAGE, $object->getPosition()->getVertAnchor()); + } } diff --git a/tests/PhpWord/Writer/Word2007/Style/TableTest.php b/tests/PhpWord/Writer/Word2007/Style/TableTest.php index c0a0b3ad..2b67507a 100644 --- a/tests/PhpWord/Writer/Word2007/Style/TableTest.php +++ b/tests/PhpWord/Writer/Word2007/Style/TableTest.php @@ -18,6 +18,7 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Style; use PhpOffice\PhpWord\Style\Table; +use PhpOffice\PhpWord\Style\TablePosition; use PhpOffice\PhpWord\TestHelperDOCX; /** @@ -76,4 +77,45 @@ class TableTest extends \PHPUnit\Framework\TestCase $this->assertEquals(10.3, $doc->getElementAttribute($path, 'w:w')); $this->assertEquals(\PhpOffice\PhpWord\SimpleType\TblWidth::TWIP, $doc->getElementAttribute($path, 'w:type')); } + + /** + * Test write table position + */ + public function testTablePosition() + { + $tablePosition = array( + 'leftFromText' => 10, + 'rightFromText' => 20, + 'topFromText' => 30, + 'bottomFromText' => 40, + 'vertAnchor' => TablePosition::VANCHOR_PAGE, + 'horzAnchor' => TablePosition::HANCHOR_MARGIN, + 'tblpXSpec' => TablePosition::XALIGN_CENTER, + 'tblpX' => 50, + 'tblpYSpec' => TablePosition::YALIGN_TOP, + 'tblpY' => 60, + ); + $tableStyle = new Table(); + $tableStyle->setPosition($tablePosition); + + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $table = $section->addTable($tableStyle); + $table->addRow(); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + + $path = '/w:document/w:body/w:tbl/w:tblPr/w:tblpPr'; + $this->assertTrue($doc->elementExists($path)); + $this->assertEquals(10, $doc->getElementAttribute($path, 'w:leftFromText')); + $this->assertEquals(20, $doc->getElementAttribute($path, 'w:rightFromText')); + $this->assertEquals(30, $doc->getElementAttribute($path, 'w:topFromText')); + $this->assertEquals(40, $doc->getElementAttribute($path, 'w:bottomFromText')); + $this->assertEquals(TablePosition::VANCHOR_PAGE, $doc->getElementAttribute($path, 'w:vertAnchor')); + $this->assertEquals(TablePosition::HANCHOR_MARGIN, $doc->getElementAttribute($path, 'w:horzAnchor')); + $this->assertEquals(TablePosition::XALIGN_CENTER, $doc->getElementAttribute($path, 'w:tblpXSpec')); + $this->assertEquals(50, $doc->getElementAttribute($path, 'w:tblpX')); + $this->assertEquals(TablePosition::YALIGN_TOP, $doc->getElementAttribute($path, 'w:tblpYSpec')); + $this->assertEquals(60, $doc->getElementAttribute($path, 'w:tblpY')); + } } From 77f2b16bc1b7ddfed894b8f6129be3456fa78326 Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 8 Mar 2018 23:52:25 +0100 Subject: [PATCH 251/370] update copyright to 2018 --- bootstrap.php | 2 +- src/PhpWord/Collection/AbstractCollection.php | 2 +- src/PhpWord/Collection/Bookmarks.php | 2 +- src/PhpWord/Collection/Charts.php | 2 +- src/PhpWord/Collection/Comments.php | 2 +- src/PhpWord/Collection/Endnotes.php | 2 +- src/PhpWord/Collection/Footnotes.php | 2 +- src/PhpWord/Collection/Titles.php | 2 +- src/PhpWord/ComplexType/FootnoteProperties.php | 2 +- src/PhpWord/ComplexType/ProofState.php | 2 +- src/PhpWord/ComplexType/TrackChangesView.php | 2 +- src/PhpWord/Element/AbstractContainer.php | 2 +- src/PhpWord/Element/AbstractElement.php | 2 +- src/PhpWord/Element/Bookmark.php | 2 +- src/PhpWord/Element/Cell.php | 2 +- src/PhpWord/Element/Chart.php | 2 +- src/PhpWord/Element/CheckBox.php | 2 +- src/PhpWord/Element/Comment.php | 2 +- src/PhpWord/Element/Endnote.php | 2 +- src/PhpWord/Element/Field.php | 2 +- src/PhpWord/Element/Footer.php | 2 +- src/PhpWord/Element/Footnote.php | 2 +- src/PhpWord/Element/FormField.php | 2 +- src/PhpWord/Element/Header.php | 2 +- src/PhpWord/Element/Image.php | 2 +- src/PhpWord/Element/Line.php | 2 +- src/PhpWord/Element/Link.php | 2 +- src/PhpWord/Element/ListItem.php | 2 +- src/PhpWord/Element/ListItemRun.php | 2 +- src/PhpWord/Element/OLEObject.php | 2 +- src/PhpWord/Element/PageBreak.php | 2 +- src/PhpWord/Element/PreserveText.php | 2 +- src/PhpWord/Element/Row.php | 2 +- src/PhpWord/Element/SDT.php | 2 +- src/PhpWord/Element/Section.php | 2 +- src/PhpWord/Element/Shape.php | 2 +- src/PhpWord/Element/TOC.php | 2 +- src/PhpWord/Element/Table.php | 2 +- src/PhpWord/Element/Text.php | 2 +- src/PhpWord/Element/TextBox.php | 2 +- src/PhpWord/Element/TextBreak.php | 2 +- src/PhpWord/Element/TextRun.php | 2 +- src/PhpWord/Element/Title.php | 2 +- src/PhpWord/Element/TrackChange.php | 2 +- src/PhpWord/Escaper/AbstractEscaper.php | 2 +- src/PhpWord/Escaper/EscaperInterface.php | 2 +- src/PhpWord/Escaper/RegExp.php | 2 +- src/PhpWord/Escaper/Rtf.php | 2 +- src/PhpWord/Escaper/Xml.php | 2 +- src/PhpWord/Exception/CopyFileException.php | 2 +- src/PhpWord/Exception/CreateTemporaryFileException.php | 2 +- src/PhpWord/Exception/Exception.php | 2 +- src/PhpWord/Exception/InvalidImageException.php | 2 +- src/PhpWord/Exception/InvalidObjectException.php | 2 +- src/PhpWord/Exception/InvalidStyleException.php | 2 +- src/PhpWord/Exception/UnsupportedImageTypeException.php | 2 +- src/PhpWord/IOFactory.php | 2 +- src/PhpWord/Media.php | 2 +- src/PhpWord/Metadata/Compatibility.php | 2 +- src/PhpWord/Metadata/DocInfo.php | 2 +- src/PhpWord/Metadata/Protection.php | 2 +- src/PhpWord/Metadata/Settings.php | 2 +- src/PhpWord/PhpWord.php | 2 +- src/PhpWord/Reader/AbstractReader.php | 2 +- src/PhpWord/Reader/HTML.php | 2 +- src/PhpWord/Reader/MsDoc.php | 2 +- src/PhpWord/Reader/ODText.php | 2 +- src/PhpWord/Reader/ODText/AbstractPart.php | 2 +- src/PhpWord/Reader/ODText/Content.php | 2 +- src/PhpWord/Reader/ODText/Meta.php | 2 +- src/PhpWord/Reader/RTF.php | 2 +- src/PhpWord/Reader/RTF/Document.php | 2 +- src/PhpWord/Reader/ReaderInterface.php | 2 +- src/PhpWord/Reader/Word2007.php | 2 +- src/PhpWord/Reader/Word2007/AbstractPart.php | 2 +- src/PhpWord/Reader/Word2007/DocPropsApp.php | 2 +- src/PhpWord/Reader/Word2007/DocPropsCore.php | 2 +- src/PhpWord/Reader/Word2007/DocPropsCustom.php | 2 +- src/PhpWord/Reader/Word2007/Document.php | 2 +- src/PhpWord/Reader/Word2007/Endnotes.php | 2 +- src/PhpWord/Reader/Word2007/Footnotes.php | 2 +- src/PhpWord/Reader/Word2007/Numbering.php | 2 +- src/PhpWord/Reader/Word2007/Settings.php | 2 +- src/PhpWord/Reader/Word2007/Styles.php | 2 +- src/PhpWord/Settings.php | 2 +- src/PhpWord/Shared/AbstractEnum.php | 2 +- src/PhpWord/Shared/Converter.php | 2 +- src/PhpWord/Shared/Html.php | 2 +- src/PhpWord/Shared/Microsoft/PasswordEncoder.php | 2 +- src/PhpWord/Shared/OLERead.php | 2 +- src/PhpWord/Shared/ZipArchive.php | 2 +- src/PhpWord/SimpleType/DocProtect.php | 2 +- src/PhpWord/SimpleType/Jc.php | 2 +- src/PhpWord/SimpleType/JcTable.php | 2 +- src/PhpWord/SimpleType/LineSpacingRule.php | 2 +- src/PhpWord/SimpleType/NumberFormat.php | 2 +- src/PhpWord/SimpleType/TblWidth.php | 2 +- src/PhpWord/SimpleType/TextAlignment.php | 2 +- src/PhpWord/SimpleType/Zoom.php | 2 +- src/PhpWord/Style.php | 2 +- src/PhpWord/Style/AbstractStyle.php | 2 +- src/PhpWord/Style/Border.php | 2 +- src/PhpWord/Style/Cell.php | 2 +- src/PhpWord/Style/Chart.php | 2 +- src/PhpWord/Style/Extrusion.php | 2 +- src/PhpWord/Style/Fill.php | 2 +- src/PhpWord/Style/Font.php | 2 +- src/PhpWord/Style/Frame.php | 2 +- src/PhpWord/Style/Image.php | 2 +- src/PhpWord/Style/Indentation.php | 2 +- src/PhpWord/Style/Language.php | 2 +- src/PhpWord/Style/Line.php | 2 +- src/PhpWord/Style/LineNumbering.php | 2 +- src/PhpWord/Style/ListItem.php | 2 +- src/PhpWord/Style/Numbering.php | 2 +- src/PhpWord/Style/NumberingLevel.php | 2 +- src/PhpWord/Style/Outline.php | 2 +- src/PhpWord/Style/Paper.php | 2 +- src/PhpWord/Style/Paragraph.php | 2 +- src/PhpWord/Style/Row.php | 2 +- src/PhpWord/Style/Section.php | 2 +- src/PhpWord/Style/Shading.php | 2 +- src/PhpWord/Style/Shadow.php | 2 +- src/PhpWord/Style/Shape.php | 2 +- src/PhpWord/Style/Spacing.php | 2 +- src/PhpWord/Style/TOC.php | 2 +- src/PhpWord/Style/Tab.php | 2 +- src/PhpWord/Style/Table.php | 2 +- src/PhpWord/Style/TablePosition.php | 2 +- src/PhpWord/Style/TextBox.php | 2 +- src/PhpWord/Template.php | 2 +- src/PhpWord/TemplateProcessor.php | 2 +- src/PhpWord/Writer/AbstractWriter.php | 2 +- src/PhpWord/Writer/HTML.php | 2 +- src/PhpWord/Writer/HTML/Element/AbstractElement.php | 2 +- src/PhpWord/Writer/HTML/Element/Bookmark.php | 2 +- src/PhpWord/Writer/HTML/Element/Container.php | 2 +- src/PhpWord/Writer/HTML/Element/Endnote.php | 2 +- src/PhpWord/Writer/HTML/Element/Footnote.php | 2 +- src/PhpWord/Writer/HTML/Element/Image.php | 2 +- src/PhpWord/Writer/HTML/Element/Link.php | 2 +- src/PhpWord/Writer/HTML/Element/ListItem.php | 2 +- src/PhpWord/Writer/HTML/Element/PageBreak.php | 2 +- src/PhpWord/Writer/HTML/Element/Table.php | 2 +- src/PhpWord/Writer/HTML/Element/Text.php | 2 +- src/PhpWord/Writer/HTML/Element/TextBreak.php | 2 +- src/PhpWord/Writer/HTML/Element/TextRun.php | 2 +- src/PhpWord/Writer/HTML/Element/Title.php | 2 +- src/PhpWord/Writer/HTML/Part/AbstractPart.php | 2 +- src/PhpWord/Writer/HTML/Part/Body.php | 2 +- src/PhpWord/Writer/HTML/Part/Head.php | 2 +- src/PhpWord/Writer/HTML/Style/AbstractStyle.php | 2 +- src/PhpWord/Writer/HTML/Style/Font.php | 2 +- src/PhpWord/Writer/HTML/Style/Generic.php | 2 +- src/PhpWord/Writer/HTML/Style/Image.php | 2 +- src/PhpWord/Writer/HTML/Style/Paragraph.php | 2 +- src/PhpWord/Writer/ODText.php | 2 +- src/PhpWord/Writer/ODText/Element/AbstractElement.php | 2 +- src/PhpWord/Writer/ODText/Element/Container.php | 2 +- src/PhpWord/Writer/ODText/Element/Image.php | 2 +- src/PhpWord/Writer/ODText/Element/Link.php | 2 +- src/PhpWord/Writer/ODText/Element/PageBreak.php | 2 +- src/PhpWord/Writer/ODText/Element/Table.php | 2 +- src/PhpWord/Writer/ODText/Element/Text.php | 2 +- src/PhpWord/Writer/ODText/Element/TextBreak.php | 2 +- src/PhpWord/Writer/ODText/Element/TextRun.php | 2 +- src/PhpWord/Writer/ODText/Element/Title.php | 2 +- src/PhpWord/Writer/ODText/Part/AbstractPart.php | 2 +- src/PhpWord/Writer/ODText/Part/Content.php | 2 +- src/PhpWord/Writer/ODText/Part/Manifest.php | 2 +- src/PhpWord/Writer/ODText/Part/Meta.php | 2 +- src/PhpWord/Writer/ODText/Part/Mimetype.php | 2 +- src/PhpWord/Writer/ODText/Part/Styles.php | 2 +- src/PhpWord/Writer/ODText/Style/AbstractStyle.php | 2 +- src/PhpWord/Writer/ODText/Style/Font.php | 2 +- src/PhpWord/Writer/ODText/Style/Image.php | 2 +- src/PhpWord/Writer/ODText/Style/Paragraph.php | 2 +- src/PhpWord/Writer/ODText/Style/Section.php | 2 +- src/PhpWord/Writer/ODText/Style/Table.php | 2 +- src/PhpWord/Writer/PDF.php | 2 +- src/PhpWord/Writer/PDF/AbstractRenderer.php | 2 +- src/PhpWord/Writer/PDF/DomPDF.php | 2 +- src/PhpWord/Writer/PDF/MPDF.php | 2 +- src/PhpWord/Writer/PDF/TCPDF.php | 2 +- src/PhpWord/Writer/RTF.php | 2 +- src/PhpWord/Writer/RTF/Element/AbstractElement.php | 2 +- src/PhpWord/Writer/RTF/Element/Container.php | 2 +- src/PhpWord/Writer/RTF/Element/Image.php | 2 +- src/PhpWord/Writer/RTF/Element/Link.php | 2 +- src/PhpWord/Writer/RTF/Element/ListItem.php | 2 +- src/PhpWord/Writer/RTF/Element/PageBreak.php | 2 +- src/PhpWord/Writer/RTF/Element/Table.php | 2 +- src/PhpWord/Writer/RTF/Element/Text.php | 2 +- src/PhpWord/Writer/RTF/Element/TextBreak.php | 2 +- src/PhpWord/Writer/RTF/Element/TextRun.php | 2 +- src/PhpWord/Writer/RTF/Element/Title.php | 2 +- src/PhpWord/Writer/RTF/Part/AbstractPart.php | 2 +- src/PhpWord/Writer/RTF/Part/Document.php | 2 +- src/PhpWord/Writer/RTF/Part/Header.php | 2 +- src/PhpWord/Writer/RTF/Style/AbstractStyle.php | 2 +- src/PhpWord/Writer/RTF/Style/Border.php | 2 +- src/PhpWord/Writer/RTF/Style/Font.php | 2 +- src/PhpWord/Writer/RTF/Style/Paragraph.php | 2 +- src/PhpWord/Writer/RTF/Style/Section.php | 2 +- src/PhpWord/Writer/Word2007.php | 2 +- src/PhpWord/Writer/Word2007/Element/AbstractElement.php | 2 +- src/PhpWord/Writer/Word2007/Element/Bookmark.php | 2 +- src/PhpWord/Writer/Word2007/Element/Chart.php | 2 +- src/PhpWord/Writer/Word2007/Element/CheckBox.php | 2 +- src/PhpWord/Writer/Word2007/Element/Container.php | 2 +- src/PhpWord/Writer/Word2007/Element/Endnote.php | 2 +- src/PhpWord/Writer/Word2007/Element/Field.php | 2 +- src/PhpWord/Writer/Word2007/Element/Footnote.php | 2 +- src/PhpWord/Writer/Word2007/Element/FormField.php | 2 +- src/PhpWord/Writer/Word2007/Element/Image.php | 2 +- src/PhpWord/Writer/Word2007/Element/Line.php | 2 +- src/PhpWord/Writer/Word2007/Element/Link.php | 2 +- src/PhpWord/Writer/Word2007/Element/ListItem.php | 2 +- src/PhpWord/Writer/Word2007/Element/ListItemRun.php | 2 +- src/PhpWord/Writer/Word2007/Element/OLEObject.php | 2 +- src/PhpWord/Writer/Word2007/Element/PageBreak.php | 2 +- src/PhpWord/Writer/Word2007/Element/ParagraphAlignment.php | 2 +- src/PhpWord/Writer/Word2007/Element/PreserveText.php | 2 +- src/PhpWord/Writer/Word2007/Element/SDT.php | 2 +- src/PhpWord/Writer/Word2007/Element/Shape.php | 2 +- src/PhpWord/Writer/Word2007/Element/TOC.php | 2 +- src/PhpWord/Writer/Word2007/Element/Table.php | 2 +- src/PhpWord/Writer/Word2007/Element/TableAlignment.php | 2 +- src/PhpWord/Writer/Word2007/Element/Text.php | 2 +- src/PhpWord/Writer/Word2007/Element/TextBox.php | 2 +- src/PhpWord/Writer/Word2007/Element/TextBreak.php | 2 +- src/PhpWord/Writer/Word2007/Element/TextRun.php | 2 +- src/PhpWord/Writer/Word2007/Element/Title.php | 2 +- src/PhpWord/Writer/Word2007/Part/AbstractPart.php | 2 +- src/PhpWord/Writer/Word2007/Part/Chart.php | 2 +- src/PhpWord/Writer/Word2007/Part/Comments.php | 2 +- src/PhpWord/Writer/Word2007/Part/ContentTypes.php | 2 +- src/PhpWord/Writer/Word2007/Part/DocPropsApp.php | 2 +- src/PhpWord/Writer/Word2007/Part/DocPropsCore.php | 2 +- src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php | 2 +- src/PhpWord/Writer/Word2007/Part/Document.php | 2 +- src/PhpWord/Writer/Word2007/Part/Endnotes.php | 2 +- src/PhpWord/Writer/Word2007/Part/FontTable.php | 2 +- src/PhpWord/Writer/Word2007/Part/Footer.php | 2 +- src/PhpWord/Writer/Word2007/Part/Footnotes.php | 2 +- src/PhpWord/Writer/Word2007/Part/Header.php | 2 +- src/PhpWord/Writer/Word2007/Part/Numbering.php | 2 +- src/PhpWord/Writer/Word2007/Part/Rels.php | 2 +- src/PhpWord/Writer/Word2007/Part/RelsDocument.php | 2 +- src/PhpWord/Writer/Word2007/Part/RelsPart.php | 2 +- src/PhpWord/Writer/Word2007/Part/Settings.php | 2 +- src/PhpWord/Writer/Word2007/Part/Styles.php | 2 +- src/PhpWord/Writer/Word2007/Part/Theme.php | 2 +- src/PhpWord/Writer/Word2007/Part/WebSettings.php | 2 +- src/PhpWord/Writer/Word2007/Style/AbstractStyle.php | 2 +- src/PhpWord/Writer/Word2007/Style/Cell.php | 2 +- src/PhpWord/Writer/Word2007/Style/Extrusion.php | 2 +- src/PhpWord/Writer/Word2007/Style/Fill.php | 2 +- src/PhpWord/Writer/Word2007/Style/Font.php | 2 +- src/PhpWord/Writer/Word2007/Style/Frame.php | 2 +- src/PhpWord/Writer/Word2007/Style/Image.php | 2 +- src/PhpWord/Writer/Word2007/Style/Indentation.php | 2 +- src/PhpWord/Writer/Word2007/Style/Line.php | 2 +- src/PhpWord/Writer/Word2007/Style/LineNumbering.php | 2 +- src/PhpWord/Writer/Word2007/Style/MarginBorder.php | 2 +- src/PhpWord/Writer/Word2007/Style/Outline.php | 2 +- src/PhpWord/Writer/Word2007/Style/Paragraph.php | 2 +- src/PhpWord/Writer/Word2007/Style/Row.php | 2 +- src/PhpWord/Writer/Word2007/Style/Section.php | 2 +- src/PhpWord/Writer/Word2007/Style/Shading.php | 2 +- src/PhpWord/Writer/Word2007/Style/Shadow.php | 2 +- src/PhpWord/Writer/Word2007/Style/Shape.php | 2 +- src/PhpWord/Writer/Word2007/Style/Spacing.php | 2 +- src/PhpWord/Writer/Word2007/Style/Tab.php | 2 +- src/PhpWord/Writer/Word2007/Style/Table.php | 2 +- src/PhpWord/Writer/Word2007/Style/TablePosition.php | 2 +- src/PhpWord/Writer/Word2007/Style/TextBox.php | 2 +- src/PhpWord/Writer/WriterInterface.php | 2 +- tests/PhpWord/Collection/CollectionTest.php | 2 +- tests/PhpWord/ComplexType/FootnotePropertiesTest.php | 2 +- tests/PhpWord/ComplexType/ProofStateTest.php | 2 +- tests/PhpWord/Element/AbstractElementTest.php | 2 +- tests/PhpWord/Element/BookmarkTest.php | 2 +- tests/PhpWord/Element/CellTest.php | 2 +- tests/PhpWord/Element/CheckBoxTest.php | 2 +- tests/PhpWord/Element/CommentTest.php | 2 +- tests/PhpWord/Element/FieldTest.php | 2 +- tests/PhpWord/Element/FooterTest.php | 2 +- tests/PhpWord/Element/FootnoteTest.php | 2 +- tests/PhpWord/Element/HeaderTest.php | 2 +- tests/PhpWord/Element/ImageTest.php | 2 +- tests/PhpWord/Element/LineTest.php | 2 +- tests/PhpWord/Element/LinkTest.php | 2 +- tests/PhpWord/Element/ListItemRunTest.php | 2 +- tests/PhpWord/Element/ListItemTest.php | 2 +- tests/PhpWord/Element/ObjectTest.php | 2 +- tests/PhpWord/Element/PageBreakTest.php | 2 +- tests/PhpWord/Element/PreserveTextTest.php | 2 +- tests/PhpWord/Element/RowTest.php | 2 +- tests/PhpWord/Element/SDTTest.php | 2 +- tests/PhpWord/Element/SectionTest.php | 2 +- tests/PhpWord/Element/TOCTest.php | 2 +- tests/PhpWord/Element/TableTest.php | 2 +- tests/PhpWord/Element/TextBoxTest.php | 2 +- tests/PhpWord/Element/TextBreakTest.php | 2 +- tests/PhpWord/Element/TextRunTest.php | 2 +- tests/PhpWord/Element/TextTest.php | 2 +- tests/PhpWord/Element/TitleTest.php | 2 +- tests/PhpWord/Element/TrackChangeTest.php | 2 +- tests/PhpWord/Exception/CopyFileExceptionTest.php | 2 +- tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php | 2 +- tests/PhpWord/Exception/ExceptionTest.php | 2 +- tests/PhpWord/Exception/InvalidImageExceptionTest.php | 2 +- tests/PhpWord/Exception/InvalidStyleExceptionTest.php | 2 +- tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php | 2 +- tests/PhpWord/IOFactoryTest.php | 2 +- tests/PhpWord/MediaTest.php | 2 +- tests/PhpWord/Metadata/DocInfoTest.php | 2 +- tests/PhpWord/Metadata/SettingsTest.php | 2 +- tests/PhpWord/PhpWordTest.php | 2 +- tests/PhpWord/Reader/HTMLTest.php | 2 +- tests/PhpWord/Reader/MsDocTest.php | 2 +- tests/PhpWord/Reader/ODTextTest.php | 2 +- tests/PhpWord/Reader/RTFTest.php | 2 +- tests/PhpWord/Reader/Word2007/ElementTest.php | 2 +- tests/PhpWord/Reader/Word2007/PartTest.php | 2 +- tests/PhpWord/Reader/Word2007/StyleTest.php | 2 +- tests/PhpWord/Reader/Word2007Test.php | 2 +- tests/PhpWord/SettingsTest.php | 2 +- tests/PhpWord/Shared/ConverterTest.php | 2 +- tests/PhpWord/Shared/HtmlTest.php | 2 +- tests/PhpWord/Shared/Microsoft/PasswordEncoderTest.php | 2 +- tests/PhpWord/Shared/ZipArchiveTest.php | 2 +- tests/PhpWord/Style/AbstractStyleTest.php | 2 +- tests/PhpWord/Style/CellTest.php | 2 +- tests/PhpWord/Style/FontTest.php | 2 +- tests/PhpWord/Style/ImageTest.php | 2 +- tests/PhpWord/Style/IndentationTest.php | 2 +- tests/PhpWord/Style/LanguageTest.php | 2 +- tests/PhpWord/Style/LineNumberingTest.php | 2 +- tests/PhpWord/Style/LineTest.php | 2 +- tests/PhpWord/Style/ListItemTest.php | 2 +- tests/PhpWord/Style/NumberingLevelTest.php | 2 +- tests/PhpWord/Style/NumberingTest.php | 2 +- tests/PhpWord/Style/PaperTest.php | 2 +- tests/PhpWord/Style/ParagraphTest.php | 2 +- tests/PhpWord/Style/RowTest.php | 2 +- tests/PhpWord/Style/SectionTest.php | 2 +- tests/PhpWord/Style/ShadingTest.php | 2 +- tests/PhpWord/Style/SpacingTest.php | 2 +- tests/PhpWord/Style/TOCTest.php | 2 +- tests/PhpWord/Style/TabTest.php | 2 +- tests/PhpWord/Style/TableTest.php | 2 +- tests/PhpWord/Style/TextBoxTest.php | 2 +- tests/PhpWord/StyleTest.php | 2 +- tests/PhpWord/TemplateProcessorTest.php | 2 +- tests/PhpWord/Writer/HTML/ElementTest.php | 2 +- tests/PhpWord/Writer/HTML/PartTest.php | 2 +- tests/PhpWord/Writer/HTML/StyleTest.php | 2 +- tests/PhpWord/Writer/HTMLTest.php | 2 +- tests/PhpWord/Writer/ODText/ElementTest.php | 2 +- tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php | 2 +- tests/PhpWord/Writer/ODText/Part/ContentTest.php | 2 +- tests/PhpWord/Writer/ODText/StyleTest.php | 2 +- tests/PhpWord/Writer/ODTextTest.php | 2 +- tests/PhpWord/Writer/PDF/DomPDFTest.php | 2 +- tests/PhpWord/Writer/PDF/MPDFTest.php | 2 +- tests/PhpWord/Writer/PDF/TCPDFTest.php | 2 +- tests/PhpWord/Writer/PDFTest.php | 2 +- tests/PhpWord/Writer/RTF/ElementTest.php | 2 +- tests/PhpWord/Writer/RTF/StyleTest.php | 2 +- tests/PhpWord/Writer/RTFTest.php | 2 +- tests/PhpWord/Writer/Word2007/ElementTest.php | 2 +- tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php | 2 +- tests/PhpWord/Writer/Word2007/Part/CommentsTest.php | 2 +- tests/PhpWord/Writer/Word2007/Part/DocumentTest.php | 2 +- tests/PhpWord/Writer/Word2007/Part/FooterTest.php | 2 +- tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php | 2 +- tests/PhpWord/Writer/Word2007/Part/HeaderTest.php | 2 +- tests/PhpWord/Writer/Word2007/Part/NumberingTest.php | 2 +- tests/PhpWord/Writer/Word2007/Part/SettingsTest.php | 2 +- tests/PhpWord/Writer/Word2007/Part/StylesTest.php | 2 +- tests/PhpWord/Writer/Word2007/PartTest.php | 2 +- tests/PhpWord/Writer/Word2007/Style/FontTest.php | 2 +- tests/PhpWord/Writer/Word2007/Style/ParagraphTest.php | 2 +- tests/PhpWord/Writer/Word2007/Style/TableTest.php | 2 +- tests/PhpWord/Writer/Word2007/StyleTest.php | 2 +- tests/PhpWord/Writer/Word2007Test.php | 2 +- tests/PhpWord/_includes/AbstractTestReader.php | 2 +- tests/PhpWord/_includes/TestHelperDOCX.php | 2 +- tests/PhpWord/_includes/XmlDocument.php | 2 +- tests/bootstrap.php | 2 +- 392 files changed, 392 insertions(+), 392 deletions(-) diff --git a/bootstrap.php b/bootstrap.php index 362e8b74..740e3d04 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. test bootstrap * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Collection/AbstractCollection.php b/src/PhpWord/Collection/AbstractCollection.php index d49967ca..899ec287 100644 --- a/src/PhpWord/Collection/AbstractCollection.php +++ b/src/PhpWord/Collection/AbstractCollection.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Collection/Bookmarks.php b/src/PhpWord/Collection/Bookmarks.php index 7210fb03..b5ffd5f4 100644 --- a/src/PhpWord/Collection/Bookmarks.php +++ b/src/PhpWord/Collection/Bookmarks.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Collection/Charts.php b/src/PhpWord/Collection/Charts.php index 56d92c94..aa807d1e 100644 --- a/src/PhpWord/Collection/Charts.php +++ b/src/PhpWord/Collection/Charts.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Collection/Comments.php b/src/PhpWord/Collection/Comments.php index f2fe82d9..b6c02d39 100644 --- a/src/PhpWord/Collection/Comments.php +++ b/src/PhpWord/Collection/Comments.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Collection/Endnotes.php b/src/PhpWord/Collection/Endnotes.php index 52a56d31..db01b408 100644 --- a/src/PhpWord/Collection/Endnotes.php +++ b/src/PhpWord/Collection/Endnotes.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Collection/Footnotes.php b/src/PhpWord/Collection/Footnotes.php index 63989f53..a0a31ca4 100644 --- a/src/PhpWord/Collection/Footnotes.php +++ b/src/PhpWord/Collection/Footnotes.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Collection/Titles.php b/src/PhpWord/Collection/Titles.php index 9e4f12cd..1ea58ec0 100644 --- a/src/PhpWord/Collection/Titles.php +++ b/src/PhpWord/Collection/Titles.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/ComplexType/FootnoteProperties.php b/src/PhpWord/ComplexType/FootnoteProperties.php index 8cb3a869..e42c9f9d 100644 --- a/src/PhpWord/ComplexType/FootnoteProperties.php +++ b/src/PhpWord/ComplexType/FootnoteProperties.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/ComplexType/ProofState.php b/src/PhpWord/ComplexType/ProofState.php index 6a915da1..4f8dafe3 100644 --- a/src/PhpWord/ComplexType/ProofState.php +++ b/src/PhpWord/ComplexType/ProofState.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/ComplexType/TrackChangesView.php b/src/PhpWord/ComplexType/TrackChangesView.php index 3fc16298..92ea05ea 100644 --- a/src/PhpWord/ComplexType/TrackChangesView.php +++ b/src/PhpWord/ComplexType/TrackChangesView.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/AbstractContainer.php b/src/PhpWord/Element/AbstractContainer.php index 1cedbef0..ec990720 100644 --- a/src/PhpWord/Element/AbstractContainer.php +++ b/src/PhpWord/Element/AbstractContainer.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/AbstractElement.php b/src/PhpWord/Element/AbstractElement.php index e1b705e0..5ff85b8f 100644 --- a/src/PhpWord/Element/AbstractElement.php +++ b/src/PhpWord/Element/AbstractElement.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Bookmark.php b/src/PhpWord/Element/Bookmark.php index 8d4e0af5..16b020d7 100644 --- a/src/PhpWord/Element/Bookmark.php +++ b/src/PhpWord/Element/Bookmark.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Cell.php b/src/PhpWord/Element/Cell.php index b5250cd6..68f5df62 100644 --- a/src/PhpWord/Element/Cell.php +++ b/src/PhpWord/Element/Cell.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Chart.php b/src/PhpWord/Element/Chart.php index c340da40..755f45e1 100644 --- a/src/PhpWord/Element/Chart.php +++ b/src/PhpWord/Element/Chart.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/CheckBox.php b/src/PhpWord/Element/CheckBox.php index e0a94fdf..f3e87176 100644 --- a/src/PhpWord/Element/CheckBox.php +++ b/src/PhpWord/Element/CheckBox.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Comment.php b/src/PhpWord/Element/Comment.php index 205ff598..96ad15ef 100644 --- a/src/PhpWord/Element/Comment.php +++ b/src/PhpWord/Element/Comment.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Endnote.php b/src/PhpWord/Element/Endnote.php index b6e94fba..b9627195 100644 --- a/src/PhpWord/Element/Endnote.php +++ b/src/PhpWord/Element/Endnote.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Field.php b/src/PhpWord/Element/Field.php index de504965..5171e9a6 100644 --- a/src/PhpWord/Element/Field.php +++ b/src/PhpWord/Element/Field.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Footer.php b/src/PhpWord/Element/Footer.php index 08ff525a..0290d7c1 100644 --- a/src/PhpWord/Element/Footer.php +++ b/src/PhpWord/Element/Footer.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Footnote.php b/src/PhpWord/Element/Footnote.php index e9a1bfc2..90aabccc 100644 --- a/src/PhpWord/Element/Footnote.php +++ b/src/PhpWord/Element/Footnote.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/FormField.php b/src/PhpWord/Element/FormField.php index 598d61dc..f937df59 100644 --- a/src/PhpWord/Element/FormField.php +++ b/src/PhpWord/Element/FormField.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Header.php b/src/PhpWord/Element/Header.php index ee820877..8a01946e 100644 --- a/src/PhpWord/Element/Header.php +++ b/src/PhpWord/Element/Header.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Image.php b/src/PhpWord/Element/Image.php index 5e73d4e4..03637067 100644 --- a/src/PhpWord/Element/Image.php +++ b/src/PhpWord/Element/Image.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Line.php b/src/PhpWord/Element/Line.php index eba66473..7e40b940 100644 --- a/src/PhpWord/Element/Line.php +++ b/src/PhpWord/Element/Line.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Link.php b/src/PhpWord/Element/Link.php index 4637120a..2bec32dd 100644 --- a/src/PhpWord/Element/Link.php +++ b/src/PhpWord/Element/Link.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/ListItem.php b/src/PhpWord/Element/ListItem.php index cb55c5ae..8b064c47 100644 --- a/src/PhpWord/Element/ListItem.php +++ b/src/PhpWord/Element/ListItem.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/ListItemRun.php b/src/PhpWord/Element/ListItemRun.php index e311dc24..6e48a690 100644 --- a/src/PhpWord/Element/ListItemRun.php +++ b/src/PhpWord/Element/ListItemRun.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord -* @copyright 2010-2017 PHPWord contributors +* @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/OLEObject.php b/src/PhpWord/Element/OLEObject.php index 5da94c3a..c0c7f217 100644 --- a/src/PhpWord/Element/OLEObject.php +++ b/src/PhpWord/Element/OLEObject.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/PageBreak.php b/src/PhpWord/Element/PageBreak.php index e41e807b..1e2ada80 100644 --- a/src/PhpWord/Element/PageBreak.php +++ b/src/PhpWord/Element/PageBreak.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/PreserveText.php b/src/PhpWord/Element/PreserveText.php index ad20d7a3..1ce2dcdd 100644 --- a/src/PhpWord/Element/PreserveText.php +++ b/src/PhpWord/Element/PreserveText.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Row.php b/src/PhpWord/Element/Row.php index 2e89b354..da4dfe5d 100644 --- a/src/PhpWord/Element/Row.php +++ b/src/PhpWord/Element/Row.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/SDT.php b/src/PhpWord/Element/SDT.php index 86f445cc..a866d1bd 100644 --- a/src/PhpWord/Element/SDT.php +++ b/src/PhpWord/Element/SDT.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Section.php b/src/PhpWord/Element/Section.php index 06acf1f9..d612fc01 100644 --- a/src/PhpWord/Element/Section.php +++ b/src/PhpWord/Element/Section.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Shape.php b/src/PhpWord/Element/Shape.php index b553a4ac..d143c9b6 100644 --- a/src/PhpWord/Element/Shape.php +++ b/src/PhpWord/Element/Shape.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/TOC.php b/src/PhpWord/Element/TOC.php index e3ca0a08..c51d0e6b 100644 --- a/src/PhpWord/Element/TOC.php +++ b/src/PhpWord/Element/TOC.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Table.php b/src/PhpWord/Element/Table.php index 3a045031..10c4db69 100644 --- a/src/PhpWord/Element/Table.php +++ b/src/PhpWord/Element/Table.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Text.php b/src/PhpWord/Element/Text.php index 4de12176..f4d7f081 100644 --- a/src/PhpWord/Element/Text.php +++ b/src/PhpWord/Element/Text.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/TextBox.php b/src/PhpWord/Element/TextBox.php index 8058d0c9..b9f274d6 100644 --- a/src/PhpWord/Element/TextBox.php +++ b/src/PhpWord/Element/TextBox.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/TextBreak.php b/src/PhpWord/Element/TextBreak.php index 4cf65f35..385fec5a 100644 --- a/src/PhpWord/Element/TextBreak.php +++ b/src/PhpWord/Element/TextBreak.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/TextRun.php b/src/PhpWord/Element/TextRun.php index 6d9ae9f4..9af55d46 100644 --- a/src/PhpWord/Element/TextRun.php +++ b/src/PhpWord/Element/TextRun.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/Title.php b/src/PhpWord/Element/Title.php index ed06fa13..569cea92 100644 --- a/src/PhpWord/Element/Title.php +++ b/src/PhpWord/Element/Title.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Element/TrackChange.php b/src/PhpWord/Element/TrackChange.php index dde616cc..410ffb7c 100644 --- a/src/PhpWord/Element/TrackChange.php +++ b/src/PhpWord/Element/TrackChange.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Escaper/AbstractEscaper.php b/src/PhpWord/Escaper/AbstractEscaper.php index 8207e2c6..1575c069 100644 --- a/src/PhpWord/Escaper/AbstractEscaper.php +++ b/src/PhpWord/Escaper/AbstractEscaper.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Escaper/EscaperInterface.php b/src/PhpWord/Escaper/EscaperInterface.php index 1ef35c1b..deb2cfbc 100644 --- a/src/PhpWord/Escaper/EscaperInterface.php +++ b/src/PhpWord/Escaper/EscaperInterface.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Escaper/RegExp.php b/src/PhpWord/Escaper/RegExp.php index 2f4e12ec..f69aad82 100644 --- a/src/PhpWord/Escaper/RegExp.php +++ b/src/PhpWord/Escaper/RegExp.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Escaper/Rtf.php b/src/PhpWord/Escaper/Rtf.php index 35f91ada..b8e0b216 100644 --- a/src/PhpWord/Escaper/Rtf.php +++ b/src/PhpWord/Escaper/Rtf.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Escaper/Xml.php b/src/PhpWord/Escaper/Xml.php index 81cedaa9..a769c5e1 100644 --- a/src/PhpWord/Escaper/Xml.php +++ b/src/PhpWord/Escaper/Xml.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Exception/CopyFileException.php b/src/PhpWord/Exception/CopyFileException.php index a5c1da6a..d1c3bd01 100644 --- a/src/PhpWord/Exception/CopyFileException.php +++ b/src/PhpWord/Exception/CopyFileException.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Exception/CreateTemporaryFileException.php b/src/PhpWord/Exception/CreateTemporaryFileException.php index fafc8dac..c8a06429 100644 --- a/src/PhpWord/Exception/CreateTemporaryFileException.php +++ b/src/PhpWord/Exception/CreateTemporaryFileException.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Exception/Exception.php b/src/PhpWord/Exception/Exception.php index b94ed1be..d874625c 100644 --- a/src/PhpWord/Exception/Exception.php +++ b/src/PhpWord/Exception/Exception.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Exception/InvalidImageException.php b/src/PhpWord/Exception/InvalidImageException.php index 0a7b8fed..07c96681 100644 --- a/src/PhpWord/Exception/InvalidImageException.php +++ b/src/PhpWord/Exception/InvalidImageException.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Exception/InvalidObjectException.php b/src/PhpWord/Exception/InvalidObjectException.php index 54015506..d8fef961 100644 --- a/src/PhpWord/Exception/InvalidObjectException.php +++ b/src/PhpWord/Exception/InvalidObjectException.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Exception/InvalidStyleException.php b/src/PhpWord/Exception/InvalidStyleException.php index e697f6cf..58c1961d 100644 --- a/src/PhpWord/Exception/InvalidStyleException.php +++ b/src/PhpWord/Exception/InvalidStyleException.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Exception/UnsupportedImageTypeException.php b/src/PhpWord/Exception/UnsupportedImageTypeException.php index 73b41d04..ee270653 100644 --- a/src/PhpWord/Exception/UnsupportedImageTypeException.php +++ b/src/PhpWord/Exception/UnsupportedImageTypeException.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/IOFactory.php b/src/PhpWord/IOFactory.php index eed1f163..3929f485 100644 --- a/src/PhpWord/IOFactory.php +++ b/src/PhpWord/IOFactory.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Media.php b/src/PhpWord/Media.php index d9879010..cc1b2903 100644 --- a/src/PhpWord/Media.php +++ b/src/PhpWord/Media.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Metadata/Compatibility.php b/src/PhpWord/Metadata/Compatibility.php index 69f6f98a..bf0363aa 100644 --- a/src/PhpWord/Metadata/Compatibility.php +++ b/src/PhpWord/Metadata/Compatibility.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Metadata/DocInfo.php b/src/PhpWord/Metadata/DocInfo.php index 09714f9e..27ef89ae 100644 --- a/src/PhpWord/Metadata/DocInfo.php +++ b/src/PhpWord/Metadata/DocInfo.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Metadata/Protection.php b/src/PhpWord/Metadata/Protection.php index 39ebc3de..584ed83e 100644 --- a/src/PhpWord/Metadata/Protection.php +++ b/src/PhpWord/Metadata/Protection.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Metadata/Settings.php b/src/PhpWord/Metadata/Settings.php index 8ab58609..b1552e02 100644 --- a/src/PhpWord/Metadata/Settings.php +++ b/src/PhpWord/Metadata/Settings.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/PhpWord.php b/src/PhpWord/PhpWord.php index ff23f6ef..6b6fd9ff 100644 --- a/src/PhpWord/PhpWord.php +++ b/src/PhpWord/PhpWord.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/AbstractReader.php b/src/PhpWord/Reader/AbstractReader.php index f59a9556..7db285f7 100644 --- a/src/PhpWord/Reader/AbstractReader.php +++ b/src/PhpWord/Reader/AbstractReader.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/HTML.php b/src/PhpWord/Reader/HTML.php index 4e8b5e82..db9f2089 100644 --- a/src/PhpWord/Reader/HTML.php +++ b/src/PhpWord/Reader/HTML.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/MsDoc.php b/src/PhpWord/Reader/MsDoc.php index c134377a..d4945229 100644 --- a/src/PhpWord/Reader/MsDoc.php +++ b/src/PhpWord/Reader/MsDoc.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/ODText.php b/src/PhpWord/Reader/ODText.php index 5a22b4ba..0b58dc50 100644 --- a/src/PhpWord/Reader/ODText.php +++ b/src/PhpWord/Reader/ODText.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/ODText/AbstractPart.php b/src/PhpWord/Reader/ODText/AbstractPart.php index bdac3b6f..ff664e01 100644 --- a/src/PhpWord/Reader/ODText/AbstractPart.php +++ b/src/PhpWord/Reader/ODText/AbstractPart.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/ODText/Content.php b/src/PhpWord/Reader/ODText/Content.php index 7a7a0468..9dfd6453 100644 --- a/src/PhpWord/Reader/ODText/Content.php +++ b/src/PhpWord/Reader/ODText/Content.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/ODText/Meta.php b/src/PhpWord/Reader/ODText/Meta.php index 98832d17..8801a543 100644 --- a/src/PhpWord/Reader/ODText/Meta.php +++ b/src/PhpWord/Reader/ODText/Meta.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/RTF.php b/src/PhpWord/Reader/RTF.php index 2d09a04d..620252ff 100644 --- a/src/PhpWord/Reader/RTF.php +++ b/src/PhpWord/Reader/RTF.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/RTF/Document.php b/src/PhpWord/Reader/RTF/Document.php index be16d707..b9509d71 100644 --- a/src/PhpWord/Reader/RTF/Document.php +++ b/src/PhpWord/Reader/RTF/Document.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/ReaderInterface.php b/src/PhpWord/Reader/ReaderInterface.php index 3b2e357b..4024cdb3 100644 --- a/src/PhpWord/Reader/ReaderInterface.php +++ b/src/PhpWord/Reader/ReaderInterface.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/Word2007.php b/src/PhpWord/Reader/Word2007.php index 6c2178ad..deed3ce3 100644 --- a/src/PhpWord/Reader/Word2007.php +++ b/src/PhpWord/Reader/Word2007.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index 7ba53ad1..342d9d11 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/Word2007/DocPropsApp.php b/src/PhpWord/Reader/Word2007/DocPropsApp.php index df34c9c3..decc5103 100644 --- a/src/PhpWord/Reader/Word2007/DocPropsApp.php +++ b/src/PhpWord/Reader/Word2007/DocPropsApp.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/Word2007/DocPropsCore.php b/src/PhpWord/Reader/Word2007/DocPropsCore.php index f82c6b4b..36eecebe 100644 --- a/src/PhpWord/Reader/Word2007/DocPropsCore.php +++ b/src/PhpWord/Reader/Word2007/DocPropsCore.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/Word2007/DocPropsCustom.php b/src/PhpWord/Reader/Word2007/DocPropsCustom.php index a3d6b90b..a6835aac 100644 --- a/src/PhpWord/Reader/Word2007/DocPropsCustom.php +++ b/src/PhpWord/Reader/Word2007/DocPropsCustom.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/Word2007/Document.php b/src/PhpWord/Reader/Word2007/Document.php index ff094bcc..4e37541b 100644 --- a/src/PhpWord/Reader/Word2007/Document.php +++ b/src/PhpWord/Reader/Word2007/Document.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/Word2007/Endnotes.php b/src/PhpWord/Reader/Word2007/Endnotes.php index 0f46cb2f..aa8b65d7 100644 --- a/src/PhpWord/Reader/Word2007/Endnotes.php +++ b/src/PhpWord/Reader/Word2007/Endnotes.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/Word2007/Footnotes.php b/src/PhpWord/Reader/Word2007/Footnotes.php index b69b2606..634f4739 100644 --- a/src/PhpWord/Reader/Word2007/Footnotes.php +++ b/src/PhpWord/Reader/Word2007/Footnotes.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/Word2007/Numbering.php b/src/PhpWord/Reader/Word2007/Numbering.php index c2a81dd5..3f57cbf8 100644 --- a/src/PhpWord/Reader/Word2007/Numbering.php +++ b/src/PhpWord/Reader/Word2007/Numbering.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/Word2007/Settings.php b/src/PhpWord/Reader/Word2007/Settings.php index ee057fe6..5cfe5453 100644 --- a/src/PhpWord/Reader/Word2007/Settings.php +++ b/src/PhpWord/Reader/Word2007/Settings.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Reader/Word2007/Styles.php b/src/PhpWord/Reader/Word2007/Styles.php index 8719641e..f343ad92 100644 --- a/src/PhpWord/Reader/Word2007/Styles.php +++ b/src/PhpWord/Reader/Word2007/Styles.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Settings.php b/src/PhpWord/Settings.php index 22b8ba1f..8de1a8df 100644 --- a/src/PhpWord/Settings.php +++ b/src/PhpWord/Settings.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Shared/AbstractEnum.php b/src/PhpWord/Shared/AbstractEnum.php index 442d8251..f2375d87 100644 --- a/src/PhpWord/Shared/AbstractEnum.php +++ b/src/PhpWord/Shared/AbstractEnum.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Shared/Converter.php b/src/PhpWord/Shared/Converter.php index 56687c98..c53f0030 100644 --- a/src/PhpWord/Shared/Converter.php +++ b/src/PhpWord/Shared/Converter.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 2c7cf1b5..15f3b605 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Shared/Microsoft/PasswordEncoder.php b/src/PhpWord/Shared/Microsoft/PasswordEncoder.php index 1c7b4c6c..fc0c7ecd 100644 --- a/src/PhpWord/Shared/Microsoft/PasswordEncoder.php +++ b/src/PhpWord/Shared/Microsoft/PasswordEncoder.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Shared/OLERead.php b/src/PhpWord/Shared/OLERead.php index bcdda0c3..2e6a899e 100644 --- a/src/PhpWord/Shared/OLERead.php +++ b/src/PhpWord/Shared/OLERead.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ namespace PhpOffice\PhpWord\Shared; diff --git a/src/PhpWord/Shared/ZipArchive.php b/src/PhpWord/Shared/ZipArchive.php index 3d8d0a41..2783e17e 100644 --- a/src/PhpWord/Shared/ZipArchive.php +++ b/src/PhpWord/Shared/ZipArchive.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/SimpleType/DocProtect.php b/src/PhpWord/SimpleType/DocProtect.php index cffa0003..e386913d 100644 --- a/src/PhpWord/SimpleType/DocProtect.php +++ b/src/PhpWord/SimpleType/DocProtect.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/SimpleType/Jc.php b/src/PhpWord/SimpleType/Jc.php index 5d0ee33b..e55f824d 100644 --- a/src/PhpWord/SimpleType/Jc.php +++ b/src/PhpWord/SimpleType/Jc.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/SimpleType/JcTable.php b/src/PhpWord/SimpleType/JcTable.php index 71e07397..924a4f20 100644 --- a/src/PhpWord/SimpleType/JcTable.php +++ b/src/PhpWord/SimpleType/JcTable.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/SimpleType/LineSpacingRule.php b/src/PhpWord/SimpleType/LineSpacingRule.php index f2cc5e63..8fd8340c 100644 --- a/src/PhpWord/SimpleType/LineSpacingRule.php +++ b/src/PhpWord/SimpleType/LineSpacingRule.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/SimpleType/NumberFormat.php b/src/PhpWord/SimpleType/NumberFormat.php index 480d8539..83da66fa 100644 --- a/src/PhpWord/SimpleType/NumberFormat.php +++ b/src/PhpWord/SimpleType/NumberFormat.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/SimpleType/TblWidth.php b/src/PhpWord/SimpleType/TblWidth.php index 3d947bce..7fd753de 100644 --- a/src/PhpWord/SimpleType/TblWidth.php +++ b/src/PhpWord/SimpleType/TblWidth.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/SimpleType/TextAlignment.php b/src/PhpWord/SimpleType/TextAlignment.php index de36b108..838b0c5e 100644 --- a/src/PhpWord/SimpleType/TextAlignment.php +++ b/src/PhpWord/SimpleType/TextAlignment.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/SimpleType/Zoom.php b/src/PhpWord/SimpleType/Zoom.php index 111e4ea1..02c38fdb 100644 --- a/src/PhpWord/SimpleType/Zoom.php +++ b/src/PhpWord/SimpleType/Zoom.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style.php b/src/PhpWord/Style.php index 017b3290..47242621 100644 --- a/src/PhpWord/Style.php +++ b/src/PhpWord/Style.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/AbstractStyle.php b/src/PhpWord/Style/AbstractStyle.php index 76ebd591..8edbe80b 100644 --- a/src/PhpWord/Style/AbstractStyle.php +++ b/src/PhpWord/Style/AbstractStyle.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Border.php b/src/PhpWord/Style/Border.php index ab6aef18..d032d07f 100644 --- a/src/PhpWord/Style/Border.php +++ b/src/PhpWord/Style/Border.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Cell.php b/src/PhpWord/Style/Cell.php index 8675ed7b..e609e190 100644 --- a/src/PhpWord/Style/Cell.php +++ b/src/PhpWord/Style/Cell.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Chart.php b/src/PhpWord/Style/Chart.php index 694fcddc..58271fef 100644 --- a/src/PhpWord/Style/Chart.php +++ b/src/PhpWord/Style/Chart.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Extrusion.php b/src/PhpWord/Style/Extrusion.php index 11c03eda..4c860bcd 100644 --- a/src/PhpWord/Style/Extrusion.php +++ b/src/PhpWord/Style/Extrusion.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Fill.php b/src/PhpWord/Style/Fill.php index 9b473009..360bcf3f 100644 --- a/src/PhpWord/Style/Fill.php +++ b/src/PhpWord/Style/Fill.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Font.php b/src/PhpWord/Style/Font.php index 3095b799..c58cee49 100644 --- a/src/PhpWord/Style/Font.php +++ b/src/PhpWord/Style/Font.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Frame.php b/src/PhpWord/Style/Frame.php index bb684409..b9263049 100644 --- a/src/PhpWord/Style/Frame.php +++ b/src/PhpWord/Style/Frame.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Image.php b/src/PhpWord/Style/Image.php index e0b97215..70aafe12 100644 --- a/src/PhpWord/Style/Image.php +++ b/src/PhpWord/Style/Image.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Indentation.php b/src/PhpWord/Style/Indentation.php index 9621714c..e422395c 100644 --- a/src/PhpWord/Style/Indentation.php +++ b/src/PhpWord/Style/Indentation.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Language.php b/src/PhpWord/Style/Language.php index e09421e0..91f948f5 100644 --- a/src/PhpWord/Style/Language.php +++ b/src/PhpWord/Style/Language.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Line.php b/src/PhpWord/Style/Line.php index 16d15950..a9952eec 100644 --- a/src/PhpWord/Style/Line.php +++ b/src/PhpWord/Style/Line.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/LineNumbering.php b/src/PhpWord/Style/LineNumbering.php index b5f3c263..451252d8 100644 --- a/src/PhpWord/Style/LineNumbering.php +++ b/src/PhpWord/Style/LineNumbering.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/ListItem.php b/src/PhpWord/Style/ListItem.php index 444341dc..306ecff3 100644 --- a/src/PhpWord/Style/ListItem.php +++ b/src/PhpWord/Style/ListItem.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Numbering.php b/src/PhpWord/Style/Numbering.php index 80ed5dca..f7855cfa 100644 --- a/src/PhpWord/Style/Numbering.php +++ b/src/PhpWord/Style/Numbering.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/NumberingLevel.php b/src/PhpWord/Style/NumberingLevel.php index 33c151e4..e9b32f01 100644 --- a/src/PhpWord/Style/NumberingLevel.php +++ b/src/PhpWord/Style/NumberingLevel.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Outline.php b/src/PhpWord/Style/Outline.php index fb7e028a..a04ad974 100644 --- a/src/PhpWord/Style/Outline.php +++ b/src/PhpWord/Style/Outline.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Paper.php b/src/PhpWord/Style/Paper.php index 09e4769e..3c93ed8f 100644 --- a/src/PhpWord/Style/Paper.php +++ b/src/PhpWord/Style/Paper.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Paragraph.php b/src/PhpWord/Style/Paragraph.php index 53a9b958..ac587686 100644 --- a/src/PhpWord/Style/Paragraph.php +++ b/src/PhpWord/Style/Paragraph.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Row.php b/src/PhpWord/Style/Row.php index b56c6f5f..ad801af6 100644 --- a/src/PhpWord/Style/Row.php +++ b/src/PhpWord/Style/Row.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Section.php b/src/PhpWord/Style/Section.php index 476846f5..162e08e0 100644 --- a/src/PhpWord/Style/Section.php +++ b/src/PhpWord/Style/Section.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Shading.php b/src/PhpWord/Style/Shading.php index eeb055b2..154df26c 100644 --- a/src/PhpWord/Style/Shading.php +++ b/src/PhpWord/Style/Shading.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Shadow.php b/src/PhpWord/Style/Shadow.php index 71d1e3e0..1379a320 100644 --- a/src/PhpWord/Style/Shadow.php +++ b/src/PhpWord/Style/Shadow.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Shape.php b/src/PhpWord/Style/Shape.php index fc84241d..0c3f8179 100644 --- a/src/PhpWord/Style/Shape.php +++ b/src/PhpWord/Style/Shape.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Spacing.php b/src/PhpWord/Style/Spacing.php index 489eb5d7..9bfb2282 100644 --- a/src/PhpWord/Style/Spacing.php +++ b/src/PhpWord/Style/Spacing.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/TOC.php b/src/PhpWord/Style/TOC.php index 938e6de1..2efd54a4 100644 --- a/src/PhpWord/Style/TOC.php +++ b/src/PhpWord/Style/TOC.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Tab.php b/src/PhpWord/Style/Tab.php index 09e49e02..d3cf5bd7 100644 --- a/src/PhpWord/Style/Tab.php +++ b/src/PhpWord/Style/Tab.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/Table.php b/src/PhpWord/Style/Table.php index 92a24dde..feb028da 100644 --- a/src/PhpWord/Style/Table.php +++ b/src/PhpWord/Style/Table.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/TablePosition.php b/src/PhpWord/Style/TablePosition.php index 7cb0a0be..d4b70831 100644 --- a/src/PhpWord/Style/TablePosition.php +++ b/src/PhpWord/Style/TablePosition.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Style/TextBox.php b/src/PhpWord/Style/TextBox.php index 91adc0af..e9c0f0c0 100644 --- a/src/PhpWord/Style/TextBox.php +++ b/src/PhpWord/Style/TextBox.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Template.php b/src/PhpWord/Template.php index a4769927..c42696f0 100644 --- a/src/PhpWord/Template.php +++ b/src/PhpWord/Template.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php index 269b25e9..72446ae7 100644 --- a/src/PhpWord/TemplateProcessor.php +++ b/src/PhpWord/TemplateProcessor.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/AbstractWriter.php b/src/PhpWord/Writer/AbstractWriter.php index bb943d7e..7e0d511a 100644 --- a/src/PhpWord/Writer/AbstractWriter.php +++ b/src/PhpWord/Writer/AbstractWriter.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML.php b/src/PhpWord/Writer/HTML.php index 9b098dd8..7f55b9d3 100644 --- a/src/PhpWord/Writer/HTML.php +++ b/src/PhpWord/Writer/HTML.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/AbstractElement.php b/src/PhpWord/Writer/HTML/Element/AbstractElement.php index 47f0f93c..dc5ccfaa 100644 --- a/src/PhpWord/Writer/HTML/Element/AbstractElement.php +++ b/src/PhpWord/Writer/HTML/Element/AbstractElement.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/Bookmark.php b/src/PhpWord/Writer/HTML/Element/Bookmark.php index 649cc7b8..082bd760 100644 --- a/src/PhpWord/Writer/HTML/Element/Bookmark.php +++ b/src/PhpWord/Writer/HTML/Element/Bookmark.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/Container.php b/src/PhpWord/Writer/HTML/Element/Container.php index 677b6173..006b5889 100644 --- a/src/PhpWord/Writer/HTML/Element/Container.php +++ b/src/PhpWord/Writer/HTML/Element/Container.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/Endnote.php b/src/PhpWord/Writer/HTML/Element/Endnote.php index c4a3e436..2252dc3a 100644 --- a/src/PhpWord/Writer/HTML/Element/Endnote.php +++ b/src/PhpWord/Writer/HTML/Element/Endnote.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/Footnote.php b/src/PhpWord/Writer/HTML/Element/Footnote.php index 60b246f8..ed14db1e 100644 --- a/src/PhpWord/Writer/HTML/Element/Footnote.php +++ b/src/PhpWord/Writer/HTML/Element/Footnote.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/Image.php b/src/PhpWord/Writer/HTML/Element/Image.php index 3e516b53..7c22a166 100644 --- a/src/PhpWord/Writer/HTML/Element/Image.php +++ b/src/PhpWord/Writer/HTML/Element/Image.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/Link.php b/src/PhpWord/Writer/HTML/Element/Link.php index f29880d4..f6dae5cd 100644 --- a/src/PhpWord/Writer/HTML/Element/Link.php +++ b/src/PhpWord/Writer/HTML/Element/Link.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/ListItem.php b/src/PhpWord/Writer/HTML/Element/ListItem.php index 02b25eb9..384b3ef1 100644 --- a/src/PhpWord/Writer/HTML/Element/ListItem.php +++ b/src/PhpWord/Writer/HTML/Element/ListItem.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/PageBreak.php b/src/PhpWord/Writer/HTML/Element/PageBreak.php index 5cab2724..f9998e37 100644 --- a/src/PhpWord/Writer/HTML/Element/PageBreak.php +++ b/src/PhpWord/Writer/HTML/Element/PageBreak.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/Table.php b/src/PhpWord/Writer/HTML/Element/Table.php index c7d8670b..95f7c1fa 100644 --- a/src/PhpWord/Writer/HTML/Element/Table.php +++ b/src/PhpWord/Writer/HTML/Element/Table.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/Text.php b/src/PhpWord/Writer/HTML/Element/Text.php index 9f8f7773..04d76a83 100644 --- a/src/PhpWord/Writer/HTML/Element/Text.php +++ b/src/PhpWord/Writer/HTML/Element/Text.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/TextBreak.php b/src/PhpWord/Writer/HTML/Element/TextBreak.php index 93ab924a..6ff092db 100644 --- a/src/PhpWord/Writer/HTML/Element/TextBreak.php +++ b/src/PhpWord/Writer/HTML/Element/TextBreak.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/TextRun.php b/src/PhpWord/Writer/HTML/Element/TextRun.php index d7461539..b2deaf25 100644 --- a/src/PhpWord/Writer/HTML/Element/TextRun.php +++ b/src/PhpWord/Writer/HTML/Element/TextRun.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Element/Title.php b/src/PhpWord/Writer/HTML/Element/Title.php index ee8f271b..3a802018 100644 --- a/src/PhpWord/Writer/HTML/Element/Title.php +++ b/src/PhpWord/Writer/HTML/Element/Title.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Part/AbstractPart.php b/src/PhpWord/Writer/HTML/Part/AbstractPart.php index 7b6e0c3e..2d86f399 100644 --- a/src/PhpWord/Writer/HTML/Part/AbstractPart.php +++ b/src/PhpWord/Writer/HTML/Part/AbstractPart.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Part/Body.php b/src/PhpWord/Writer/HTML/Part/Body.php index eea17350..a029f965 100644 --- a/src/PhpWord/Writer/HTML/Part/Body.php +++ b/src/PhpWord/Writer/HTML/Part/Body.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Part/Head.php b/src/PhpWord/Writer/HTML/Part/Head.php index f4d63014..1107becf 100644 --- a/src/PhpWord/Writer/HTML/Part/Head.php +++ b/src/PhpWord/Writer/HTML/Part/Head.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Style/AbstractStyle.php b/src/PhpWord/Writer/HTML/Style/AbstractStyle.php index fa27c085..cfb54cb8 100644 --- a/src/PhpWord/Writer/HTML/Style/AbstractStyle.php +++ b/src/PhpWord/Writer/HTML/Style/AbstractStyle.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Style/Font.php b/src/PhpWord/Writer/HTML/Style/Font.php index 8daa8823..1aeaa347 100644 --- a/src/PhpWord/Writer/HTML/Style/Font.php +++ b/src/PhpWord/Writer/HTML/Style/Font.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Style/Generic.php b/src/PhpWord/Writer/HTML/Style/Generic.php index 73830707..ee5d0896 100644 --- a/src/PhpWord/Writer/HTML/Style/Generic.php +++ b/src/PhpWord/Writer/HTML/Style/Generic.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Style/Image.php b/src/PhpWord/Writer/HTML/Style/Image.php index 178b1434..93747b46 100644 --- a/src/PhpWord/Writer/HTML/Style/Image.php +++ b/src/PhpWord/Writer/HTML/Style/Image.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/HTML/Style/Paragraph.php b/src/PhpWord/Writer/HTML/Style/Paragraph.php index 57e44e85..863ef93b 100644 --- a/src/PhpWord/Writer/HTML/Style/Paragraph.php +++ b/src/PhpWord/Writer/HTML/Style/Paragraph.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText.php b/src/PhpWord/Writer/ODText.php index 7158874c..efd0d6a9 100644 --- a/src/PhpWord/Writer/ODText.php +++ b/src/PhpWord/Writer/ODText.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/AbstractElement.php b/src/PhpWord/Writer/ODText/Element/AbstractElement.php index 481995ff..9c9fc1c4 100644 --- a/src/PhpWord/Writer/ODText/Element/AbstractElement.php +++ b/src/PhpWord/Writer/ODText/Element/AbstractElement.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/Container.php b/src/PhpWord/Writer/ODText/Element/Container.php index 112e71e8..6ba8124f 100644 --- a/src/PhpWord/Writer/ODText/Element/Container.php +++ b/src/PhpWord/Writer/ODText/Element/Container.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/Image.php b/src/PhpWord/Writer/ODText/Element/Image.php index 2c0b4727..add45e10 100644 --- a/src/PhpWord/Writer/ODText/Element/Image.php +++ b/src/PhpWord/Writer/ODText/Element/Image.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/Link.php b/src/PhpWord/Writer/ODText/Element/Link.php index 34d72c1a..d6fec507 100644 --- a/src/PhpWord/Writer/ODText/Element/Link.php +++ b/src/PhpWord/Writer/ODText/Element/Link.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/PageBreak.php b/src/PhpWord/Writer/ODText/Element/PageBreak.php index 6eee6cfc..ecf47607 100644 --- a/src/PhpWord/Writer/ODText/Element/PageBreak.php +++ b/src/PhpWord/Writer/ODText/Element/PageBreak.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/Table.php b/src/PhpWord/Writer/ODText/Element/Table.php index cdc2a0e3..8a21ee1b 100644 --- a/src/PhpWord/Writer/ODText/Element/Table.php +++ b/src/PhpWord/Writer/ODText/Element/Table.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/Text.php b/src/PhpWord/Writer/ODText/Element/Text.php index f9259fc5..7dcd28a0 100644 --- a/src/PhpWord/Writer/ODText/Element/Text.php +++ b/src/PhpWord/Writer/ODText/Element/Text.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/TextBreak.php b/src/PhpWord/Writer/ODText/Element/TextBreak.php index f7642e3b..80cd1387 100644 --- a/src/PhpWord/Writer/ODText/Element/TextBreak.php +++ b/src/PhpWord/Writer/ODText/Element/TextBreak.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/TextRun.php b/src/PhpWord/Writer/ODText/Element/TextRun.php index f5c855fe..78e5a8ad 100644 --- a/src/PhpWord/Writer/ODText/Element/TextRun.php +++ b/src/PhpWord/Writer/ODText/Element/TextRun.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Element/Title.php b/src/PhpWord/Writer/ODText/Element/Title.php index 769d293f..343949a2 100644 --- a/src/PhpWord/Writer/ODText/Element/Title.php +++ b/src/PhpWord/Writer/ODText/Element/Title.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Part/AbstractPart.php b/src/PhpWord/Writer/ODText/Part/AbstractPart.php index 74412fd4..f2844de6 100644 --- a/src/PhpWord/Writer/ODText/Part/AbstractPart.php +++ b/src/PhpWord/Writer/ODText/Part/AbstractPart.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Part/Content.php b/src/PhpWord/Writer/ODText/Part/Content.php index f91ad544..a50eea7b 100644 --- a/src/PhpWord/Writer/ODText/Part/Content.php +++ b/src/PhpWord/Writer/ODText/Part/Content.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Part/Manifest.php b/src/PhpWord/Writer/ODText/Part/Manifest.php index d916ccdf..f952b4c0 100644 --- a/src/PhpWord/Writer/ODText/Part/Manifest.php +++ b/src/PhpWord/Writer/ODText/Part/Manifest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Part/Meta.php b/src/PhpWord/Writer/ODText/Part/Meta.php index f592c5f0..f38ad01d 100644 --- a/src/PhpWord/Writer/ODText/Part/Meta.php +++ b/src/PhpWord/Writer/ODText/Part/Meta.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Part/Mimetype.php b/src/PhpWord/Writer/ODText/Part/Mimetype.php index 6e45b848..552f5440 100644 --- a/src/PhpWord/Writer/ODText/Part/Mimetype.php +++ b/src/PhpWord/Writer/ODText/Part/Mimetype.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Part/Styles.php b/src/PhpWord/Writer/ODText/Part/Styles.php index e49fa25e..e7635e98 100644 --- a/src/PhpWord/Writer/ODText/Part/Styles.php +++ b/src/PhpWord/Writer/ODText/Part/Styles.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Style/AbstractStyle.php b/src/PhpWord/Writer/ODText/Style/AbstractStyle.php index 26b9905b..f7679ab2 100644 --- a/src/PhpWord/Writer/ODText/Style/AbstractStyle.php +++ b/src/PhpWord/Writer/ODText/Style/AbstractStyle.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Style/Font.php b/src/PhpWord/Writer/ODText/Style/Font.php index 50de32ad..7c7d20dd 100644 --- a/src/PhpWord/Writer/ODText/Style/Font.php +++ b/src/PhpWord/Writer/ODText/Style/Font.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Style/Image.php b/src/PhpWord/Writer/ODText/Style/Image.php index b85d4d70..13005a7f 100644 --- a/src/PhpWord/Writer/ODText/Style/Image.php +++ b/src/PhpWord/Writer/ODText/Style/Image.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Style/Paragraph.php b/src/PhpWord/Writer/ODText/Style/Paragraph.php index 14a811a5..223d02f0 100644 --- a/src/PhpWord/Writer/ODText/Style/Paragraph.php +++ b/src/PhpWord/Writer/ODText/Style/Paragraph.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Style/Section.php b/src/PhpWord/Writer/ODText/Style/Section.php index bef023e9..92d88911 100644 --- a/src/PhpWord/Writer/ODText/Style/Section.php +++ b/src/PhpWord/Writer/ODText/Style/Section.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/ODText/Style/Table.php b/src/PhpWord/Writer/ODText/Style/Table.php index 7d66899a..249321cf 100644 --- a/src/PhpWord/Writer/ODText/Style/Table.php +++ b/src/PhpWord/Writer/ODText/Style/Table.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/PDF.php b/src/PhpWord/Writer/PDF.php index 45fe8f35..64dcc789 100644 --- a/src/PhpWord/Writer/PDF.php +++ b/src/PhpWord/Writer/PDF.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PhpWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/PDF/AbstractRenderer.php b/src/PhpWord/Writer/PDF/AbstractRenderer.php index 7b668e0b..5f9e3b3a 100644 --- a/src/PhpWord/Writer/PDF/AbstractRenderer.php +++ b/src/PhpWord/Writer/PDF/AbstractRenderer.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PhpWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/PDF/DomPDF.php b/src/PhpWord/Writer/PDF/DomPDF.php index be282d20..5fa8f75d 100644 --- a/src/PhpWord/Writer/PDF/DomPDF.php +++ b/src/PhpWord/Writer/PDF/DomPDF.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PhpWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/PDF/MPDF.php b/src/PhpWord/Writer/PDF/MPDF.php index b6980a9d..e63f5dfd 100644 --- a/src/PhpWord/Writer/PDF/MPDF.php +++ b/src/PhpWord/Writer/PDF/MPDF.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PhpWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/PDF/TCPDF.php b/src/PhpWord/Writer/PDF/TCPDF.php index 85e3614c..badab046 100644 --- a/src/PhpWord/Writer/PDF/TCPDF.php +++ b/src/PhpWord/Writer/PDF/TCPDF.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PhpWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF.php b/src/PhpWord/Writer/RTF.php index 7756253a..0604e8b5 100644 --- a/src/PhpWord/Writer/RTF.php +++ b/src/PhpWord/Writer/RTF.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/AbstractElement.php b/src/PhpWord/Writer/RTF/Element/AbstractElement.php index 1013ee36..cf1aa391 100644 --- a/src/PhpWord/Writer/RTF/Element/AbstractElement.php +++ b/src/PhpWord/Writer/RTF/Element/AbstractElement.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/Container.php b/src/PhpWord/Writer/RTF/Element/Container.php index 4850c8bf..58c19256 100644 --- a/src/PhpWord/Writer/RTF/Element/Container.php +++ b/src/PhpWord/Writer/RTF/Element/Container.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/Image.php b/src/PhpWord/Writer/RTF/Element/Image.php index fb96baff..f1e72700 100644 --- a/src/PhpWord/Writer/RTF/Element/Image.php +++ b/src/PhpWord/Writer/RTF/Element/Image.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/Link.php b/src/PhpWord/Writer/RTF/Element/Link.php index 91a75720..25954ed8 100644 --- a/src/PhpWord/Writer/RTF/Element/Link.php +++ b/src/PhpWord/Writer/RTF/Element/Link.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/ListItem.php b/src/PhpWord/Writer/RTF/Element/ListItem.php index e628bffd..29e7f660 100644 --- a/src/PhpWord/Writer/RTF/Element/ListItem.php +++ b/src/PhpWord/Writer/RTF/Element/ListItem.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/PageBreak.php b/src/PhpWord/Writer/RTF/Element/PageBreak.php index 0adbe06e..6b08c9cc 100644 --- a/src/PhpWord/Writer/RTF/Element/PageBreak.php +++ b/src/PhpWord/Writer/RTF/Element/PageBreak.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/Table.php b/src/PhpWord/Writer/RTF/Element/Table.php index d0bc0845..8154aa7c 100644 --- a/src/PhpWord/Writer/RTF/Element/Table.php +++ b/src/PhpWord/Writer/RTF/Element/Table.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/Text.php b/src/PhpWord/Writer/RTF/Element/Text.php index 2fac0520..f80e7935 100644 --- a/src/PhpWord/Writer/RTF/Element/Text.php +++ b/src/PhpWord/Writer/RTF/Element/Text.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/TextBreak.php b/src/PhpWord/Writer/RTF/Element/TextBreak.php index 2009fcff..4aab2767 100644 --- a/src/PhpWord/Writer/RTF/Element/TextBreak.php +++ b/src/PhpWord/Writer/RTF/Element/TextBreak.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/TextRun.php b/src/PhpWord/Writer/RTF/Element/TextRun.php index d4e56765..bfd161f0 100644 --- a/src/PhpWord/Writer/RTF/Element/TextRun.php +++ b/src/PhpWord/Writer/RTF/Element/TextRun.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Element/Title.php b/src/PhpWord/Writer/RTF/Element/Title.php index 18bad9fd..a9940ca9 100644 --- a/src/PhpWord/Writer/RTF/Element/Title.php +++ b/src/PhpWord/Writer/RTF/Element/Title.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Part/AbstractPart.php b/src/PhpWord/Writer/RTF/Part/AbstractPart.php index 7569a105..8171b0d2 100644 --- a/src/PhpWord/Writer/RTF/Part/AbstractPart.php +++ b/src/PhpWord/Writer/RTF/Part/AbstractPart.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Part/Document.php b/src/PhpWord/Writer/RTF/Part/Document.php index 465872ea..d4bfadb4 100644 --- a/src/PhpWord/Writer/RTF/Part/Document.php +++ b/src/PhpWord/Writer/RTF/Part/Document.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Part/Header.php b/src/PhpWord/Writer/RTF/Part/Header.php index 73f1351f..01439bc6 100644 --- a/src/PhpWord/Writer/RTF/Part/Header.php +++ b/src/PhpWord/Writer/RTF/Part/Header.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Style/AbstractStyle.php b/src/PhpWord/Writer/RTF/Style/AbstractStyle.php index 80523610..57aa6bb9 100644 --- a/src/PhpWord/Writer/RTF/Style/AbstractStyle.php +++ b/src/PhpWord/Writer/RTF/Style/AbstractStyle.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Style/Border.php b/src/PhpWord/Writer/RTF/Style/Border.php index 0ba9f602..08dcf018 100644 --- a/src/PhpWord/Writer/RTF/Style/Border.php +++ b/src/PhpWord/Writer/RTF/Style/Border.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Style/Font.php b/src/PhpWord/Writer/RTF/Style/Font.php index 3338368a..8c729425 100644 --- a/src/PhpWord/Writer/RTF/Style/Font.php +++ b/src/PhpWord/Writer/RTF/Style/Font.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Style/Paragraph.php b/src/PhpWord/Writer/RTF/Style/Paragraph.php index 61b61fd7..3b8690cd 100644 --- a/src/PhpWord/Writer/RTF/Style/Paragraph.php +++ b/src/PhpWord/Writer/RTF/Style/Paragraph.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/RTF/Style/Section.php b/src/PhpWord/Writer/RTF/Style/Section.php index 8f073716..5c34fa86 100644 --- a/src/PhpWord/Writer/RTF/Style/Section.php +++ b/src/PhpWord/Writer/RTF/Style/Section.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007.php b/src/PhpWord/Writer/Word2007.php index fcef982f..eee215be 100644 --- a/src/PhpWord/Writer/Word2007.php +++ b/src/PhpWord/Writer/Word2007.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php index 8c9f0bb7..63f45a76 100644 --- a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php +++ b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Bookmark.php b/src/PhpWord/Writer/Word2007/Element/Bookmark.php index 4b0b78a7..04eaacf3 100644 --- a/src/PhpWord/Writer/Word2007/Element/Bookmark.php +++ b/src/PhpWord/Writer/Word2007/Element/Bookmark.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Chart.php b/src/PhpWord/Writer/Word2007/Element/Chart.php index 591799ab..f88ca2d2 100644 --- a/src/PhpWord/Writer/Word2007/Element/Chart.php +++ b/src/PhpWord/Writer/Word2007/Element/Chart.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/CheckBox.php b/src/PhpWord/Writer/Word2007/Element/CheckBox.php index ab888f67..05692a07 100644 --- a/src/PhpWord/Writer/Word2007/Element/CheckBox.php +++ b/src/PhpWord/Writer/Word2007/Element/CheckBox.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Container.php b/src/PhpWord/Writer/Word2007/Element/Container.php index b6d1145c..892da051 100644 --- a/src/PhpWord/Writer/Word2007/Element/Container.php +++ b/src/PhpWord/Writer/Word2007/Element/Container.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Endnote.php b/src/PhpWord/Writer/Word2007/Element/Endnote.php index ebfe35c1..9a2eb3ff 100644 --- a/src/PhpWord/Writer/Word2007/Element/Endnote.php +++ b/src/PhpWord/Writer/Word2007/Element/Endnote.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Field.php b/src/PhpWord/Writer/Word2007/Element/Field.php index 336a4325..cf3fbd66 100644 --- a/src/PhpWord/Writer/Word2007/Element/Field.php +++ b/src/PhpWord/Writer/Word2007/Element/Field.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Footnote.php b/src/PhpWord/Writer/Word2007/Element/Footnote.php index 65ef40c7..56a5332f 100644 --- a/src/PhpWord/Writer/Word2007/Element/Footnote.php +++ b/src/PhpWord/Writer/Word2007/Element/Footnote.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/FormField.php b/src/PhpWord/Writer/Word2007/Element/FormField.php index c77ca378..b59cf58f 100644 --- a/src/PhpWord/Writer/Word2007/Element/FormField.php +++ b/src/PhpWord/Writer/Word2007/Element/FormField.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Image.php b/src/PhpWord/Writer/Word2007/Element/Image.php index 32a22a13..3614ec18 100644 --- a/src/PhpWord/Writer/Word2007/Element/Image.php +++ b/src/PhpWord/Writer/Word2007/Element/Image.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Line.php b/src/PhpWord/Writer/Word2007/Element/Line.php index 9b1a160d..a114be60 100644 --- a/src/PhpWord/Writer/Word2007/Element/Line.php +++ b/src/PhpWord/Writer/Word2007/Element/Line.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Link.php b/src/PhpWord/Writer/Word2007/Element/Link.php index dc708a61..f0adf851 100644 --- a/src/PhpWord/Writer/Word2007/Element/Link.php +++ b/src/PhpWord/Writer/Word2007/Element/Link.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/ListItem.php b/src/PhpWord/Writer/Word2007/Element/ListItem.php index c1aa0ce3..ef738e10 100644 --- a/src/PhpWord/Writer/Word2007/Element/ListItem.php +++ b/src/PhpWord/Writer/Word2007/Element/ListItem.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/ListItemRun.php b/src/PhpWord/Writer/Word2007/Element/ListItemRun.php index e6ed2b46..765d2ee0 100644 --- a/src/PhpWord/Writer/Word2007/Element/ListItemRun.php +++ b/src/PhpWord/Writer/Word2007/Element/ListItemRun.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/OLEObject.php b/src/PhpWord/Writer/Word2007/Element/OLEObject.php index 50891d97..c55ff6cd 100644 --- a/src/PhpWord/Writer/Word2007/Element/OLEObject.php +++ b/src/PhpWord/Writer/Word2007/Element/OLEObject.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/PageBreak.php b/src/PhpWord/Writer/Word2007/Element/PageBreak.php index 04ff29d4..0801e4d3 100644 --- a/src/PhpWord/Writer/Word2007/Element/PageBreak.php +++ b/src/PhpWord/Writer/Word2007/Element/PageBreak.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/ParagraphAlignment.php b/src/PhpWord/Writer/Word2007/Element/ParagraphAlignment.php index 0dafa4a0..5563f607 100644 --- a/src/PhpWord/Writer/Word2007/Element/ParagraphAlignment.php +++ b/src/PhpWord/Writer/Word2007/Element/ParagraphAlignment.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/PreserveText.php b/src/PhpWord/Writer/Word2007/Element/PreserveText.php index 13887866..94ce6ede 100644 --- a/src/PhpWord/Writer/Word2007/Element/PreserveText.php +++ b/src/PhpWord/Writer/Word2007/Element/PreserveText.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/SDT.php b/src/PhpWord/Writer/Word2007/Element/SDT.php index 6a202564..21020a0f 100644 --- a/src/PhpWord/Writer/Word2007/Element/SDT.php +++ b/src/PhpWord/Writer/Word2007/Element/SDT.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Shape.php b/src/PhpWord/Writer/Word2007/Element/Shape.php index 9f111293..250d5c1d 100644 --- a/src/PhpWord/Writer/Word2007/Element/Shape.php +++ b/src/PhpWord/Writer/Word2007/Element/Shape.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/TOC.php b/src/PhpWord/Writer/Word2007/Element/TOC.php index 36ed7f88..94437cbf 100644 --- a/src/PhpWord/Writer/Word2007/Element/TOC.php +++ b/src/PhpWord/Writer/Word2007/Element/TOC.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Table.php b/src/PhpWord/Writer/Word2007/Element/Table.php index c0590772..25a48ab2 100644 --- a/src/PhpWord/Writer/Word2007/Element/Table.php +++ b/src/PhpWord/Writer/Word2007/Element/Table.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/TableAlignment.php b/src/PhpWord/Writer/Word2007/Element/TableAlignment.php index 44450fd6..f44e9ebe 100644 --- a/src/PhpWord/Writer/Word2007/Element/TableAlignment.php +++ b/src/PhpWord/Writer/Word2007/Element/TableAlignment.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Text.php b/src/PhpWord/Writer/Word2007/Element/Text.php index 130b912b..f421c1af 100644 --- a/src/PhpWord/Writer/Word2007/Element/Text.php +++ b/src/PhpWord/Writer/Word2007/Element/Text.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/TextBox.php b/src/PhpWord/Writer/Word2007/Element/TextBox.php index 3780c698..9dd4bc3e 100644 --- a/src/PhpWord/Writer/Word2007/Element/TextBox.php +++ b/src/PhpWord/Writer/Word2007/Element/TextBox.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/TextBreak.php b/src/PhpWord/Writer/Word2007/Element/TextBreak.php index 161a528e..7b3d9997 100644 --- a/src/PhpWord/Writer/Word2007/Element/TextBreak.php +++ b/src/PhpWord/Writer/Word2007/Element/TextBreak.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/TextRun.php b/src/PhpWord/Writer/Word2007/Element/TextRun.php index 9fd70b13..e46ad3f5 100644 --- a/src/PhpWord/Writer/Word2007/Element/TextRun.php +++ b/src/PhpWord/Writer/Word2007/Element/TextRun.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Element/Title.php b/src/PhpWord/Writer/Word2007/Element/Title.php index 80c0904d..858ecfef 100644 --- a/src/PhpWord/Writer/Word2007/Element/Title.php +++ b/src/PhpWord/Writer/Word2007/Element/Title.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/AbstractPart.php b/src/PhpWord/Writer/Word2007/Part/AbstractPart.php index 038eb21d..ce4e41cb 100644 --- a/src/PhpWord/Writer/Word2007/Part/AbstractPart.php +++ b/src/PhpWord/Writer/Word2007/Part/AbstractPart.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Chart.php b/src/PhpWord/Writer/Word2007/Part/Chart.php index c3703f9f..3db542c5 100644 --- a/src/PhpWord/Writer/Word2007/Part/Chart.php +++ b/src/PhpWord/Writer/Word2007/Part/Chart.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Comments.php b/src/PhpWord/Writer/Word2007/Part/Comments.php index 2b8f9267..33c9f59e 100644 --- a/src/PhpWord/Writer/Word2007/Part/Comments.php +++ b/src/PhpWord/Writer/Word2007/Part/Comments.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/ContentTypes.php b/src/PhpWord/Writer/Word2007/Part/ContentTypes.php index 9be988d3..28a2d294 100644 --- a/src/PhpWord/Writer/Word2007/Part/ContentTypes.php +++ b/src/PhpWord/Writer/Word2007/Part/ContentTypes.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/DocPropsApp.php b/src/PhpWord/Writer/Word2007/Part/DocPropsApp.php index dbd55187..3452d864 100644 --- a/src/PhpWord/Writer/Word2007/Part/DocPropsApp.php +++ b/src/PhpWord/Writer/Word2007/Part/DocPropsApp.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/DocPropsCore.php b/src/PhpWord/Writer/Word2007/Part/DocPropsCore.php index fdabee36..caefbd86 100644 --- a/src/PhpWord/Writer/Word2007/Part/DocPropsCore.php +++ b/src/PhpWord/Writer/Word2007/Part/DocPropsCore.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php b/src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php index 8ee2f028..478075d3 100644 --- a/src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php +++ b/src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Document.php b/src/PhpWord/Writer/Word2007/Part/Document.php index 72e4fcd8..986b4985 100644 --- a/src/PhpWord/Writer/Word2007/Part/Document.php +++ b/src/PhpWord/Writer/Word2007/Part/Document.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Endnotes.php b/src/PhpWord/Writer/Word2007/Part/Endnotes.php index 289119db..ce3a46bf 100644 --- a/src/PhpWord/Writer/Word2007/Part/Endnotes.php +++ b/src/PhpWord/Writer/Word2007/Part/Endnotes.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/FontTable.php b/src/PhpWord/Writer/Word2007/Part/FontTable.php index 065a318e..1161a951 100644 --- a/src/PhpWord/Writer/Word2007/Part/FontTable.php +++ b/src/PhpWord/Writer/Word2007/Part/FontTable.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Footer.php b/src/PhpWord/Writer/Word2007/Part/Footer.php index cfc9dd40..97b47790 100644 --- a/src/PhpWord/Writer/Word2007/Part/Footer.php +++ b/src/PhpWord/Writer/Word2007/Part/Footer.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Footnotes.php b/src/PhpWord/Writer/Word2007/Part/Footnotes.php index c9e3bcac..59bf1830 100644 --- a/src/PhpWord/Writer/Word2007/Part/Footnotes.php +++ b/src/PhpWord/Writer/Word2007/Part/Footnotes.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Header.php b/src/PhpWord/Writer/Word2007/Part/Header.php index 5853d92f..b58df1f9 100644 --- a/src/PhpWord/Writer/Word2007/Part/Header.php +++ b/src/PhpWord/Writer/Word2007/Part/Header.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Numbering.php b/src/PhpWord/Writer/Word2007/Part/Numbering.php index 6233a6b7..61e5cc23 100644 --- a/src/PhpWord/Writer/Word2007/Part/Numbering.php +++ b/src/PhpWord/Writer/Word2007/Part/Numbering.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Rels.php b/src/PhpWord/Writer/Word2007/Part/Rels.php index 154c7e89..661a4fa8 100644 --- a/src/PhpWord/Writer/Word2007/Part/Rels.php +++ b/src/PhpWord/Writer/Word2007/Part/Rels.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/RelsDocument.php b/src/PhpWord/Writer/Word2007/Part/RelsDocument.php index 505aa223..2a0c5e11 100644 --- a/src/PhpWord/Writer/Word2007/Part/RelsDocument.php +++ b/src/PhpWord/Writer/Word2007/Part/RelsDocument.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/RelsPart.php b/src/PhpWord/Writer/Word2007/Part/RelsPart.php index e639c041..ac61a0c2 100644 --- a/src/PhpWord/Writer/Word2007/Part/RelsPart.php +++ b/src/PhpWord/Writer/Word2007/Part/RelsPart.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index 118c0da0..42d3a5d5 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Styles.php b/src/PhpWord/Writer/Word2007/Part/Styles.php index 03855f03..d05338c7 100644 --- a/src/PhpWord/Writer/Word2007/Part/Styles.php +++ b/src/PhpWord/Writer/Word2007/Part/Styles.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/Theme.php b/src/PhpWord/Writer/Word2007/Part/Theme.php index c264140e..f4ef478e 100644 --- a/src/PhpWord/Writer/Word2007/Part/Theme.php +++ b/src/PhpWord/Writer/Word2007/Part/Theme.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Part/WebSettings.php b/src/PhpWord/Writer/Word2007/Part/WebSettings.php index 9f18e356..46252e87 100644 --- a/src/PhpWord/Writer/Word2007/Part/WebSettings.php +++ b/src/PhpWord/Writer/Word2007/Part/WebSettings.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/AbstractStyle.php b/src/PhpWord/Writer/Word2007/Style/AbstractStyle.php index d7756933..3236cead 100644 --- a/src/PhpWord/Writer/Word2007/Style/AbstractStyle.php +++ b/src/PhpWord/Writer/Word2007/Style/AbstractStyle.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Cell.php b/src/PhpWord/Writer/Word2007/Style/Cell.php index b889aa55..733b7b43 100644 --- a/src/PhpWord/Writer/Word2007/Style/Cell.php +++ b/src/PhpWord/Writer/Word2007/Style/Cell.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Extrusion.php b/src/PhpWord/Writer/Word2007/Style/Extrusion.php index e3a86a58..19399348 100644 --- a/src/PhpWord/Writer/Word2007/Style/Extrusion.php +++ b/src/PhpWord/Writer/Word2007/Style/Extrusion.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Fill.php b/src/PhpWord/Writer/Word2007/Style/Fill.php index de64313b..53d03974 100644 --- a/src/PhpWord/Writer/Word2007/Style/Fill.php +++ b/src/PhpWord/Writer/Word2007/Style/Fill.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Font.php b/src/PhpWord/Writer/Word2007/Style/Font.php index 5f2a84c0..58282d15 100644 --- a/src/PhpWord/Writer/Word2007/Style/Font.php +++ b/src/PhpWord/Writer/Word2007/Style/Font.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Frame.php b/src/PhpWord/Writer/Word2007/Style/Frame.php index 9bd5db66..47f9ef75 100644 --- a/src/PhpWord/Writer/Word2007/Style/Frame.php +++ b/src/PhpWord/Writer/Word2007/Style/Frame.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Image.php b/src/PhpWord/Writer/Word2007/Style/Image.php index 271b99df..ef23ed10 100644 --- a/src/PhpWord/Writer/Word2007/Style/Image.php +++ b/src/PhpWord/Writer/Word2007/Style/Image.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Indentation.php b/src/PhpWord/Writer/Word2007/Style/Indentation.php index c5a598ff..961e770f 100644 --- a/src/PhpWord/Writer/Word2007/Style/Indentation.php +++ b/src/PhpWord/Writer/Word2007/Style/Indentation.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Line.php b/src/PhpWord/Writer/Word2007/Style/Line.php index f065e521..154a42c1 100644 --- a/src/PhpWord/Writer/Word2007/Style/Line.php +++ b/src/PhpWord/Writer/Word2007/Style/Line.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/LineNumbering.php b/src/PhpWord/Writer/Word2007/Style/LineNumbering.php index 3ed577c6..4bf08b65 100644 --- a/src/PhpWord/Writer/Word2007/Style/LineNumbering.php +++ b/src/PhpWord/Writer/Word2007/Style/LineNumbering.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/MarginBorder.php b/src/PhpWord/Writer/Word2007/Style/MarginBorder.php index 5c3ecde2..f5c4b015 100644 --- a/src/PhpWord/Writer/Word2007/Style/MarginBorder.php +++ b/src/PhpWord/Writer/Word2007/Style/MarginBorder.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Outline.php b/src/PhpWord/Writer/Word2007/Style/Outline.php index 9ae61f39..ae4c1da3 100644 --- a/src/PhpWord/Writer/Word2007/Style/Outline.php +++ b/src/PhpWord/Writer/Word2007/Style/Outline.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Paragraph.php b/src/PhpWord/Writer/Word2007/Style/Paragraph.php index eeccc5c8..67616086 100644 --- a/src/PhpWord/Writer/Word2007/Style/Paragraph.php +++ b/src/PhpWord/Writer/Word2007/Style/Paragraph.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Row.php b/src/PhpWord/Writer/Word2007/Style/Row.php index f57094db..82028d24 100644 --- a/src/PhpWord/Writer/Word2007/Style/Row.php +++ b/src/PhpWord/Writer/Word2007/Style/Row.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Section.php b/src/PhpWord/Writer/Word2007/Style/Section.php index ef50c111..af77396d 100644 --- a/src/PhpWord/Writer/Word2007/Style/Section.php +++ b/src/PhpWord/Writer/Word2007/Style/Section.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Shading.php b/src/PhpWord/Writer/Word2007/Style/Shading.php index 00680687..0f9d6ccc 100644 --- a/src/PhpWord/Writer/Word2007/Style/Shading.php +++ b/src/PhpWord/Writer/Word2007/Style/Shading.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Shadow.php b/src/PhpWord/Writer/Word2007/Style/Shadow.php index 5efc38c4..7fcb12a9 100644 --- a/src/PhpWord/Writer/Word2007/Style/Shadow.php +++ b/src/PhpWord/Writer/Word2007/Style/Shadow.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Shape.php b/src/PhpWord/Writer/Word2007/Style/Shape.php index aad42ae7..2def6842 100644 --- a/src/PhpWord/Writer/Word2007/Style/Shape.php +++ b/src/PhpWord/Writer/Word2007/Style/Shape.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Spacing.php b/src/PhpWord/Writer/Word2007/Style/Spacing.php index c18339bd..0185cbcc 100644 --- a/src/PhpWord/Writer/Word2007/Style/Spacing.php +++ b/src/PhpWord/Writer/Word2007/Style/Spacing.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Tab.php b/src/PhpWord/Writer/Word2007/Style/Tab.php index 7b0a0ab5..b41653f6 100644 --- a/src/PhpWord/Writer/Word2007/Style/Tab.php +++ b/src/PhpWord/Writer/Word2007/Style/Tab.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/Table.php b/src/PhpWord/Writer/Word2007/Style/Table.php index 058e60e2..eb5af86d 100644 --- a/src/PhpWord/Writer/Word2007/Style/Table.php +++ b/src/PhpWord/Writer/Word2007/Style/Table.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/TablePosition.php b/src/PhpWord/Writer/Word2007/Style/TablePosition.php index 14fa6a0d..fa57b93c 100644 --- a/src/PhpWord/Writer/Word2007/Style/TablePosition.php +++ b/src/PhpWord/Writer/Word2007/Style/TablePosition.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/Word2007/Style/TextBox.php b/src/PhpWord/Writer/Word2007/Style/TextBox.php index cd92f845..627d0c86 100644 --- a/src/PhpWord/Writer/Word2007/Style/TextBox.php +++ b/src/PhpWord/Writer/Word2007/Style/TextBox.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpWord/Writer/WriterInterface.php b/src/PhpWord/Writer/WriterInterface.php index b5f08199..499cde3b 100644 --- a/src/PhpWord/Writer/WriterInterface.php +++ b/src/PhpWord/Writer/WriterInterface.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Collection/CollectionTest.php b/tests/PhpWord/Collection/CollectionTest.php index a8757171..aba63212 100644 --- a/tests/PhpWord/Collection/CollectionTest.php +++ b/tests/PhpWord/Collection/CollectionTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/ComplexType/FootnotePropertiesTest.php b/tests/PhpWord/ComplexType/FootnotePropertiesTest.php index b8df9bbe..4448daf8 100644 --- a/tests/PhpWord/ComplexType/FootnotePropertiesTest.php +++ b/tests/PhpWord/ComplexType/FootnotePropertiesTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/ComplexType/ProofStateTest.php b/tests/PhpWord/ComplexType/ProofStateTest.php index baf2009e..cd1e77f7 100644 --- a/tests/PhpWord/ComplexType/ProofStateTest.php +++ b/tests/PhpWord/ComplexType/ProofStateTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/AbstractElementTest.php b/tests/PhpWord/Element/AbstractElementTest.php index 87bb5e18..f0531b34 100644 --- a/tests/PhpWord/Element/AbstractElementTest.php +++ b/tests/PhpWord/Element/AbstractElementTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/BookmarkTest.php b/tests/PhpWord/Element/BookmarkTest.php index bd5d27ae..04e3f6d5 100644 --- a/tests/PhpWord/Element/BookmarkTest.php +++ b/tests/PhpWord/Element/BookmarkTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/CellTest.php b/tests/PhpWord/Element/CellTest.php index a1132cfa..d4aaa488 100644 --- a/tests/PhpWord/Element/CellTest.php +++ b/tests/PhpWord/Element/CellTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/CheckBoxTest.php b/tests/PhpWord/Element/CheckBoxTest.php index d5bda9bd..f732407b 100644 --- a/tests/PhpWord/Element/CheckBoxTest.php +++ b/tests/PhpWord/Element/CheckBoxTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/CommentTest.php b/tests/PhpWord/Element/CommentTest.php index d33a54f6..b9c3dfce 100644 --- a/tests/PhpWord/Element/CommentTest.php +++ b/tests/PhpWord/Element/CommentTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/FieldTest.php b/tests/PhpWord/Element/FieldTest.php index 8baa68e4..1c1c0ca1 100644 --- a/tests/PhpWord/Element/FieldTest.php +++ b/tests/PhpWord/Element/FieldTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/FooterTest.php b/tests/PhpWord/Element/FooterTest.php index b68e80cd..9de2487a 100644 --- a/tests/PhpWord/Element/FooterTest.php +++ b/tests/PhpWord/Element/FooterTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/FootnoteTest.php b/tests/PhpWord/Element/FootnoteTest.php index fd4c8d03..4ea330f5 100644 --- a/tests/PhpWord/Element/FootnoteTest.php +++ b/tests/PhpWord/Element/FootnoteTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/HeaderTest.php b/tests/PhpWord/Element/HeaderTest.php index 29b2fef5..e61175f1 100644 --- a/tests/PhpWord/Element/HeaderTest.php +++ b/tests/PhpWord/Element/HeaderTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/ImageTest.php b/tests/PhpWord/Element/ImageTest.php index 8bebce91..747a77ac 100644 --- a/tests/PhpWord/Element/ImageTest.php +++ b/tests/PhpWord/Element/ImageTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/LineTest.php b/tests/PhpWord/Element/LineTest.php index 4d414944..20eee74f 100644 --- a/tests/PhpWord/Element/LineTest.php +++ b/tests/PhpWord/Element/LineTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/LinkTest.php b/tests/PhpWord/Element/LinkTest.php index 63e8f1de..e1be7521 100644 --- a/tests/PhpWord/Element/LinkTest.php +++ b/tests/PhpWord/Element/LinkTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/ListItemRunTest.php b/tests/PhpWord/Element/ListItemRunTest.php index 84beec02..95eb17eb 100644 --- a/tests/PhpWord/Element/ListItemRunTest.php +++ b/tests/PhpWord/Element/ListItemRunTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/ListItemTest.php b/tests/PhpWord/Element/ListItemTest.php index 5fae34d4..e5c815ec 100644 --- a/tests/PhpWord/Element/ListItemTest.php +++ b/tests/PhpWord/Element/ListItemTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/ObjectTest.php b/tests/PhpWord/Element/ObjectTest.php index ba761b70..9fbe1bb5 100644 --- a/tests/PhpWord/Element/ObjectTest.php +++ b/tests/PhpWord/Element/ObjectTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/PageBreakTest.php b/tests/PhpWord/Element/PageBreakTest.php index 3b081848..d4491fe1 100644 --- a/tests/PhpWord/Element/PageBreakTest.php +++ b/tests/PhpWord/Element/PageBreakTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/PreserveTextTest.php b/tests/PhpWord/Element/PreserveTextTest.php index c2767a4f..97e49b93 100644 --- a/tests/PhpWord/Element/PreserveTextTest.php +++ b/tests/PhpWord/Element/PreserveTextTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/RowTest.php b/tests/PhpWord/Element/RowTest.php index 9abf3776..3c534502 100644 --- a/tests/PhpWord/Element/RowTest.php +++ b/tests/PhpWord/Element/RowTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/SDTTest.php b/tests/PhpWord/Element/SDTTest.php index 41eae213..6e40bae0 100644 --- a/tests/PhpWord/Element/SDTTest.php +++ b/tests/PhpWord/Element/SDTTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/SectionTest.php b/tests/PhpWord/Element/SectionTest.php index 37096e2d..265307d7 100644 --- a/tests/PhpWord/Element/SectionTest.php +++ b/tests/PhpWord/Element/SectionTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/TOCTest.php b/tests/PhpWord/Element/TOCTest.php index d826a1a1..5f5f518f 100644 --- a/tests/PhpWord/Element/TOCTest.php +++ b/tests/PhpWord/Element/TOCTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/TableTest.php b/tests/PhpWord/Element/TableTest.php index 0bbefb24..8ae5306c 100644 --- a/tests/PhpWord/Element/TableTest.php +++ b/tests/PhpWord/Element/TableTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/TextBoxTest.php b/tests/PhpWord/Element/TextBoxTest.php index 63b093c9..cd50acd4 100644 --- a/tests/PhpWord/Element/TextBoxTest.php +++ b/tests/PhpWord/Element/TextBoxTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/TextBreakTest.php b/tests/PhpWord/Element/TextBreakTest.php index 9b25bac3..13084c67 100644 --- a/tests/PhpWord/Element/TextBreakTest.php +++ b/tests/PhpWord/Element/TextBreakTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/TextRunTest.php b/tests/PhpWord/Element/TextRunTest.php index 59b8b89f..2168bcc4 100644 --- a/tests/PhpWord/Element/TextRunTest.php +++ b/tests/PhpWord/Element/TextRunTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/TextTest.php b/tests/PhpWord/Element/TextTest.php index 09027ad6..97be7ae5 100644 --- a/tests/PhpWord/Element/TextTest.php +++ b/tests/PhpWord/Element/TextTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/TitleTest.php b/tests/PhpWord/Element/TitleTest.php index e99a80a6..6ef87c3e 100644 --- a/tests/PhpWord/Element/TitleTest.php +++ b/tests/PhpWord/Element/TitleTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Element/TrackChangeTest.php b/tests/PhpWord/Element/TrackChangeTest.php index 3249f10b..df86feb2 100644 --- a/tests/PhpWord/Element/TrackChangeTest.php +++ b/tests/PhpWord/Element/TrackChangeTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Exception/CopyFileExceptionTest.php b/tests/PhpWord/Exception/CopyFileExceptionTest.php index fa9949ed..5fed9c9f 100644 --- a/tests/PhpWord/Exception/CopyFileExceptionTest.php +++ b/tests/PhpWord/Exception/CopyFileExceptionTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php b/tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php index 6b4d14bf..f879285e 100644 --- a/tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php +++ b/tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Exception/ExceptionTest.php b/tests/PhpWord/Exception/ExceptionTest.php index 255477f9..8c7bce57 100644 --- a/tests/PhpWord/Exception/ExceptionTest.php +++ b/tests/PhpWord/Exception/ExceptionTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Exception/InvalidImageExceptionTest.php b/tests/PhpWord/Exception/InvalidImageExceptionTest.php index c0285dc1..71da1aa9 100644 --- a/tests/PhpWord/Exception/InvalidImageExceptionTest.php +++ b/tests/PhpWord/Exception/InvalidImageExceptionTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Exception/InvalidStyleExceptionTest.php b/tests/PhpWord/Exception/InvalidStyleExceptionTest.php index d516019f..1d981449 100644 --- a/tests/PhpWord/Exception/InvalidStyleExceptionTest.php +++ b/tests/PhpWord/Exception/InvalidStyleExceptionTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php b/tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php index 559d6341..5b03f5e3 100644 --- a/tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php +++ b/tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/IOFactoryTest.php b/tests/PhpWord/IOFactoryTest.php index 581b7d49..4a59e702 100644 --- a/tests/PhpWord/IOFactoryTest.php +++ b/tests/PhpWord/IOFactoryTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/MediaTest.php b/tests/PhpWord/MediaTest.php index ed56376b..02492016 100644 --- a/tests/PhpWord/MediaTest.php +++ b/tests/PhpWord/MediaTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Metadata/DocInfoTest.php b/tests/PhpWord/Metadata/DocInfoTest.php index d9b44dc6..25a323d2 100644 --- a/tests/PhpWord/Metadata/DocInfoTest.php +++ b/tests/PhpWord/Metadata/DocInfoTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Metadata/SettingsTest.php b/tests/PhpWord/Metadata/SettingsTest.php index 07dc8962..9670f1d9 100644 --- a/tests/PhpWord/Metadata/SettingsTest.php +++ b/tests/PhpWord/Metadata/SettingsTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/PhpWordTest.php b/tests/PhpWord/PhpWordTest.php index 3b1b5a36..d818e0f8 100644 --- a/tests/PhpWord/PhpWordTest.php +++ b/tests/PhpWord/PhpWordTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Reader/HTMLTest.php b/tests/PhpWord/Reader/HTMLTest.php index c56fc1fc..38588afc 100644 --- a/tests/PhpWord/Reader/HTMLTest.php +++ b/tests/PhpWord/Reader/HTMLTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Reader/MsDocTest.php b/tests/PhpWord/Reader/MsDocTest.php index e407547d..3ce39939 100644 --- a/tests/PhpWord/Reader/MsDocTest.php +++ b/tests/PhpWord/Reader/MsDocTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Reader/ODTextTest.php b/tests/PhpWord/Reader/ODTextTest.php index 7041e13e..ad270864 100644 --- a/tests/PhpWord/Reader/ODTextTest.php +++ b/tests/PhpWord/Reader/ODTextTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Reader/RTFTest.php b/tests/PhpWord/Reader/RTFTest.php index ca1f6ed4..fed00ceb 100644 --- a/tests/PhpWord/Reader/RTFTest.php +++ b/tests/PhpWord/Reader/RTFTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Reader/Word2007/ElementTest.php b/tests/PhpWord/Reader/Word2007/ElementTest.php index 10c1ec9a..941e6f82 100644 --- a/tests/PhpWord/Reader/Word2007/ElementTest.php +++ b/tests/PhpWord/Reader/Word2007/ElementTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Reader/Word2007/PartTest.php b/tests/PhpWord/Reader/Word2007/PartTest.php index 0f7ecc7c..31a492b8 100644 --- a/tests/PhpWord/Reader/Word2007/PartTest.php +++ b/tests/PhpWord/Reader/Word2007/PartTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Reader/Word2007/StyleTest.php b/tests/PhpWord/Reader/Word2007/StyleTest.php index 3b04b677..46421d97 100644 --- a/tests/PhpWord/Reader/Word2007/StyleTest.php +++ b/tests/PhpWord/Reader/Word2007/StyleTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Reader/Word2007Test.php b/tests/PhpWord/Reader/Word2007Test.php index 9a555672..62d23a68 100644 --- a/tests/PhpWord/Reader/Word2007Test.php +++ b/tests/PhpWord/Reader/Word2007Test.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/SettingsTest.php b/tests/PhpWord/SettingsTest.php index d8752b2b..afe59549 100644 --- a/tests/PhpWord/SettingsTest.php +++ b/tests/PhpWord/SettingsTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Shared/ConverterTest.php b/tests/PhpWord/Shared/ConverterTest.php index 752b9a8a..3798a07b 100644 --- a/tests/PhpWord/Shared/ConverterTest.php +++ b/tests/PhpWord/Shared/ConverterTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index 8be1cc19..7541c9c4 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Shared/Microsoft/PasswordEncoderTest.php b/tests/PhpWord/Shared/Microsoft/PasswordEncoderTest.php index c42a6eb4..5a050c54 100644 --- a/tests/PhpWord/Shared/Microsoft/PasswordEncoderTest.php +++ b/tests/PhpWord/Shared/Microsoft/PasswordEncoderTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Shared/ZipArchiveTest.php b/tests/PhpWord/Shared/ZipArchiveTest.php index cb095127..ecd0961e 100644 --- a/tests/PhpWord/Shared/ZipArchiveTest.php +++ b/tests/PhpWord/Shared/ZipArchiveTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/AbstractStyleTest.php b/tests/PhpWord/Style/AbstractStyleTest.php index c0263b1b..7ec272bb 100644 --- a/tests/PhpWord/Style/AbstractStyleTest.php +++ b/tests/PhpWord/Style/AbstractStyleTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/CellTest.php b/tests/PhpWord/Style/CellTest.php index 79b22ee1..db789fdc 100644 --- a/tests/PhpWord/Style/CellTest.php +++ b/tests/PhpWord/Style/CellTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/FontTest.php b/tests/PhpWord/Style/FontTest.php index 91bba97f..4ddbd397 100644 --- a/tests/PhpWord/Style/FontTest.php +++ b/tests/PhpWord/Style/FontTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/ImageTest.php b/tests/PhpWord/Style/ImageTest.php index 5d9e5568..09287bb9 100644 --- a/tests/PhpWord/Style/ImageTest.php +++ b/tests/PhpWord/Style/ImageTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/IndentationTest.php b/tests/PhpWord/Style/IndentationTest.php index 63a96628..b39a4d77 100644 --- a/tests/PhpWord/Style/IndentationTest.php +++ b/tests/PhpWord/Style/IndentationTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/LanguageTest.php b/tests/PhpWord/Style/LanguageTest.php index 74b2067a..99741cea 100644 --- a/tests/PhpWord/Style/LanguageTest.php +++ b/tests/PhpWord/Style/LanguageTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/LineNumberingTest.php b/tests/PhpWord/Style/LineNumberingTest.php index 9ec1e3b7..0d3f4e05 100644 --- a/tests/PhpWord/Style/LineNumberingTest.php +++ b/tests/PhpWord/Style/LineNumberingTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/LineTest.php b/tests/PhpWord/Style/LineTest.php index ab77b328..fba09f70 100644 --- a/tests/PhpWord/Style/LineTest.php +++ b/tests/PhpWord/Style/LineTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/ListItemTest.php b/tests/PhpWord/Style/ListItemTest.php index a8155fa3..71598e80 100644 --- a/tests/PhpWord/Style/ListItemTest.php +++ b/tests/PhpWord/Style/ListItemTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/NumberingLevelTest.php b/tests/PhpWord/Style/NumberingLevelTest.php index 9b512eb0..008a1fc5 100644 --- a/tests/PhpWord/Style/NumberingLevelTest.php +++ b/tests/PhpWord/Style/NumberingLevelTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/NumberingTest.php b/tests/PhpWord/Style/NumberingTest.php index 4ec12366..2090f9f6 100644 --- a/tests/PhpWord/Style/NumberingTest.php +++ b/tests/PhpWord/Style/NumberingTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/PaperTest.php b/tests/PhpWord/Style/PaperTest.php index 687e23c6..688f31af 100644 --- a/tests/PhpWord/Style/PaperTest.php +++ b/tests/PhpWord/Style/PaperTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/ParagraphTest.php b/tests/PhpWord/Style/ParagraphTest.php index adf0ed4d..62460738 100644 --- a/tests/PhpWord/Style/ParagraphTest.php +++ b/tests/PhpWord/Style/ParagraphTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/RowTest.php b/tests/PhpWord/Style/RowTest.php index 2daad7ea..534815b1 100644 --- a/tests/PhpWord/Style/RowTest.php +++ b/tests/PhpWord/Style/RowTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/SectionTest.php b/tests/PhpWord/Style/SectionTest.php index c9b7003f..b26d1d94 100644 --- a/tests/PhpWord/Style/SectionTest.php +++ b/tests/PhpWord/Style/SectionTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/ShadingTest.php b/tests/PhpWord/Style/ShadingTest.php index ab991a57..7aba03a1 100644 --- a/tests/PhpWord/Style/ShadingTest.php +++ b/tests/PhpWord/Style/ShadingTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/SpacingTest.php b/tests/PhpWord/Style/SpacingTest.php index 65be8092..f7402edd 100644 --- a/tests/PhpWord/Style/SpacingTest.php +++ b/tests/PhpWord/Style/SpacingTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/TOCTest.php b/tests/PhpWord/Style/TOCTest.php index 5981b00c..445c5e43 100644 --- a/tests/PhpWord/Style/TOCTest.php +++ b/tests/PhpWord/Style/TOCTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/TabTest.php b/tests/PhpWord/Style/TabTest.php index c11f0558..8d8d3f6c 100644 --- a/tests/PhpWord/Style/TabTest.php +++ b/tests/PhpWord/Style/TabTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/TableTest.php b/tests/PhpWord/Style/TableTest.php index 1ee718df..332d31aa 100644 --- a/tests/PhpWord/Style/TableTest.php +++ b/tests/PhpWord/Style/TableTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Style/TextBoxTest.php b/tests/PhpWord/Style/TextBoxTest.php index 5a6bc76f..803189cd 100644 --- a/tests/PhpWord/Style/TextBoxTest.php +++ b/tests/PhpWord/Style/TextBoxTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/StyleTest.php b/tests/PhpWord/StyleTest.php index 6f2f0980..cbc39c87 100644 --- a/tests/PhpWord/StyleTest.php +++ b/tests/PhpWord/StyleTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/TemplateProcessorTest.php b/tests/PhpWord/TemplateProcessorTest.php index 7b064ef7..c762a609 100644 --- a/tests/PhpWord/TemplateProcessorTest.php +++ b/tests/PhpWord/TemplateProcessorTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/HTML/ElementTest.php b/tests/PhpWord/Writer/HTML/ElementTest.php index fc092ba3..ff79953c 100644 --- a/tests/PhpWord/Writer/HTML/ElementTest.php +++ b/tests/PhpWord/Writer/HTML/ElementTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/HTML/PartTest.php b/tests/PhpWord/Writer/HTML/PartTest.php index 3d56f983..f8303414 100644 --- a/tests/PhpWord/Writer/HTML/PartTest.php +++ b/tests/PhpWord/Writer/HTML/PartTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/HTML/StyleTest.php b/tests/PhpWord/Writer/HTML/StyleTest.php index e9117de9..5b60226c 100644 --- a/tests/PhpWord/Writer/HTML/StyleTest.php +++ b/tests/PhpWord/Writer/HTML/StyleTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/HTMLTest.php b/tests/PhpWord/Writer/HTMLTest.php index f2bc7175..8868db5a 100644 --- a/tests/PhpWord/Writer/HTMLTest.php +++ b/tests/PhpWord/Writer/HTMLTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/ODText/ElementTest.php b/tests/PhpWord/Writer/ODText/ElementTest.php index f56114ea..37f0d1ef 100644 --- a/tests/PhpWord/Writer/ODText/ElementTest.php +++ b/tests/PhpWord/Writer/ODText/ElementTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php b/tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php index f91e6dd2..51d893d2 100644 --- a/tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php +++ b/tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/ODText/Part/ContentTest.php b/tests/PhpWord/Writer/ODText/Part/ContentTest.php index d5681143..2e501c60 100644 --- a/tests/PhpWord/Writer/ODText/Part/ContentTest.php +++ b/tests/PhpWord/Writer/ODText/Part/ContentTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/ODText/StyleTest.php b/tests/PhpWord/Writer/ODText/StyleTest.php index 5bd862f9..b1bf417d 100644 --- a/tests/PhpWord/Writer/ODText/StyleTest.php +++ b/tests/PhpWord/Writer/ODText/StyleTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/ODTextTest.php b/tests/PhpWord/Writer/ODTextTest.php index 1984de0f..a576a68d 100644 --- a/tests/PhpWord/Writer/ODTextTest.php +++ b/tests/PhpWord/Writer/ODTextTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/PDF/DomPDFTest.php b/tests/PhpWord/Writer/PDF/DomPDFTest.php index 61c3d296..bc229d51 100644 --- a/tests/PhpWord/Writer/PDF/DomPDFTest.php +++ b/tests/PhpWord/Writer/PDF/DomPDFTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/PDF/MPDFTest.php b/tests/PhpWord/Writer/PDF/MPDFTest.php index 330125fb..34a5f8d8 100644 --- a/tests/PhpWord/Writer/PDF/MPDFTest.php +++ b/tests/PhpWord/Writer/PDF/MPDFTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/PDF/TCPDFTest.php b/tests/PhpWord/Writer/PDF/TCPDFTest.php index e697eee1..6dc8f24c 100644 --- a/tests/PhpWord/Writer/PDF/TCPDFTest.php +++ b/tests/PhpWord/Writer/PDF/TCPDFTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/PDFTest.php b/tests/PhpWord/Writer/PDFTest.php index a7ca9f68..f699385c 100644 --- a/tests/PhpWord/Writer/PDFTest.php +++ b/tests/PhpWord/Writer/PDFTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/RTF/ElementTest.php b/tests/PhpWord/Writer/RTF/ElementTest.php index e85d2091..47630335 100644 --- a/tests/PhpWord/Writer/RTF/ElementTest.php +++ b/tests/PhpWord/Writer/RTF/ElementTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/RTF/StyleTest.php b/tests/PhpWord/Writer/RTF/StyleTest.php index 42f76430..5f04f1a8 100644 --- a/tests/PhpWord/Writer/RTF/StyleTest.php +++ b/tests/PhpWord/Writer/RTF/StyleTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/RTFTest.php b/tests/PhpWord/Writer/RTFTest.php index 803087e5..010720bd 100644 --- a/tests/PhpWord/Writer/RTFTest.php +++ b/tests/PhpWord/Writer/RTFTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/ElementTest.php b/tests/PhpWord/Writer/Word2007/ElementTest.php index b59e369f..979a4337 100644 --- a/tests/PhpWord/Writer/Word2007/ElementTest.php +++ b/tests/PhpWord/Writer/Word2007/ElementTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php b/tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php index 7796c02c..fac94882 100644 --- a/tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php b/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php index 83af284f..0233abdf 100644 --- a/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php index 39db6028..b35f9327 100644 --- a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/Part/FooterTest.php b/tests/PhpWord/Writer/Word2007/Part/FooterTest.php index 82bb7b7d..1f9bba0d 100644 --- a/tests/PhpWord/Writer/Word2007/Part/FooterTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/FooterTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php b/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php index 3d11174a..4b0e94df 100644 --- a/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/Part/HeaderTest.php b/tests/PhpWord/Writer/Word2007/Part/HeaderTest.php index afa81cf9..9edd0063 100644 --- a/tests/PhpWord/Writer/Word2007/Part/HeaderTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/HeaderTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php b/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php index 62127e29..fb5a220e 100644 --- a/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php index a8c01da0..8201d746 100644 --- a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/Part/StylesTest.php b/tests/PhpWord/Writer/Word2007/Part/StylesTest.php index 0cdb444e..91f37184 100644 --- a/tests/PhpWord/Writer/Word2007/Part/StylesTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/StylesTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/PartTest.php b/tests/PhpWord/Writer/Word2007/PartTest.php index 160bf553..277f61e1 100644 --- a/tests/PhpWord/Writer/Word2007/PartTest.php +++ b/tests/PhpWord/Writer/Word2007/PartTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/Style/FontTest.php b/tests/PhpWord/Writer/Word2007/Style/FontTest.php index f66cf24f..c57f50ab 100644 --- a/tests/PhpWord/Writer/Word2007/Style/FontTest.php +++ b/tests/PhpWord/Writer/Word2007/Style/FontTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/Style/ParagraphTest.php b/tests/PhpWord/Writer/Word2007/Style/ParagraphTest.php index 1e5e1d13..8443bbca 100644 --- a/tests/PhpWord/Writer/Word2007/Style/ParagraphTest.php +++ b/tests/PhpWord/Writer/Word2007/Style/ParagraphTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/Style/TableTest.php b/tests/PhpWord/Writer/Word2007/Style/TableTest.php index 2b67507a..364a34d6 100644 --- a/tests/PhpWord/Writer/Word2007/Style/TableTest.php +++ b/tests/PhpWord/Writer/Word2007/Style/TableTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007/StyleTest.php b/tests/PhpWord/Writer/Word2007/StyleTest.php index f48597d2..48cff871 100644 --- a/tests/PhpWord/Writer/Word2007/StyleTest.php +++ b/tests/PhpWord/Writer/Word2007/StyleTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/Writer/Word2007Test.php b/tests/PhpWord/Writer/Word2007Test.php index 3e1edb39..22a0e6df 100644 --- a/tests/PhpWord/Writer/Word2007Test.php +++ b/tests/PhpWord/Writer/Word2007Test.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/_includes/AbstractTestReader.php b/tests/PhpWord/_includes/AbstractTestReader.php index 348cab98..d9097d71 100644 --- a/tests/PhpWord/_includes/AbstractTestReader.php +++ b/tests/PhpWord/_includes/AbstractTestReader.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/_includes/TestHelperDOCX.php b/tests/PhpWord/_includes/TestHelperDOCX.php index bef060ee..02fa7d78 100644 --- a/tests/PhpWord/_includes/TestHelperDOCX.php +++ b/tests/PhpWord/_includes/TestHelperDOCX.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpWord/_includes/XmlDocument.php b/tests/PhpWord/_includes/XmlDocument.php index 21a12105..8c937bf5 100644 --- a/tests/PhpWord/_includes/XmlDocument.php +++ b/tests/PhpWord/_includes/XmlDocument.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 7126c204..c1681bcd 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. test bootstrap * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ require_once __DIR__ . '/../bootstrap.php'; From e29a3e7c103c29867d855b75a98134ae48fa4072 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 11 Mar 2018 13:27:35 +0100 Subject: [PATCH 252/370] add text wrapping distance --- samples/Sample_13_Images.php | 38 ++++-- src/PhpWord/Style/Frame.php | 120 ++++++++++++++++++ src/PhpWord/Writer/Word2007/Style/Frame.php | 13 +- tests/PhpWord/Style/FontTest.php | 1 + tests/PhpWord/Style/ImageTest.php | 41 +++--- tests/PhpWord/Writer/HTML/ElementTest.php | 23 ++++ .../Writer/Word2007/Style/ImageTest.php | 69 ++++++++++ 7 files changed, 272 insertions(+), 33 deletions(-) create mode 100644 tests/PhpWord/Writer/Word2007/Style/ImageTest.php diff --git a/samples/Sample_13_Images.php b/samples/Sample_13_Images.php index 6c7033b0..f7be3be9 100644 --- a/samples/Sample_13_Images.php +++ b/samples/Sample_13_Images.php @@ -1,4 +1,7 @@ addSection(); $section->addText('Local image without any styles:'); $section->addImage('resources/_mars.jpg'); -$section->addTextBreak(2); +printSeparator($section); $section->addText('Local image with styles:'); $section->addImage('resources/_earth.jpg', array('width' => 210, 'height' => 210, 'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER)); -$section->addTextBreak(2); // Remote image +printSeparator($section); $source = 'http://php.net/images/logos/php-med-trans-light.gif'; $section->addText("Remote image from: {$source}"); $section->addImage($source); // Image from string +printSeparator($section); $source = 'resources/_mars.jpg'; $fileContent = file_get_contents($source); $section->addText('Image from string'); $section->addImage($fileContent); //Wrapping style -$text = str_repeat('Hello World! ', 15); +printSeparator($section); +$text = str_repeat('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ', 2); $wrappingStyles = array('inline', 'behind', 'infront', 'square', 'tight'); foreach ($wrappingStyles as $wrappingStyle) { - $section->addTextBreak(5); $section->addText("Wrapping style {$wrappingStyle}"); $section->addImage( 'resources/_earth.jpg', array( - 'positioning' => 'relative', - 'marginTop' => -1, - 'marginLeft' => 1, - 'width' => 80, - 'height' => 80, - 'wrappingStyle' => $wrappingStyle, + 'positioning' => 'relative', + 'marginTop' => -1, + 'marginLeft' => 1, + 'width' => 80, + 'height' => 80, + 'wrappingStyle' => $wrappingStyle, + 'wrapDistanceRight' => Converter::cmToPoint(1), + 'wrapDistanceBottom' => Converter::cmToPoint(1), ) ); $section->addText($text); + printSeparator($section); } //Absolute positioning -$section->addTextBreak(3); $section->addText('Absolute positioning: see top right corner of page'); $section->addImage( 'resources/_mars.jpg', @@ -64,7 +70,7 @@ $section->addImage( ); //Relative positioning -$section->addTextBreak(3); +printSeparator($section); $section->addText('Relative positioning: Horizontal position center relative to column,'); $section->addText('Vertical position top relative to line'); $section->addImage( @@ -80,6 +86,14 @@ $section->addImage( ) ); +function printSeparator(Section $section) +{ + $section->addTextBreak(); + $lineStyle = array('weight' => 0.2, 'width' => 150, 'height' => 0, 'align' => 'center'); + $section->addLine($lineStyle); + $section->addTextBreak(2); +} + // Save file echo write($phpWord, basename(__FILE__, '.php'), $writers); if (!CLI) { diff --git a/src/PhpWord/Style/Frame.php b/src/PhpWord/Style/Frame.php index b9263049..e87b7a80 100644 --- a/src/PhpWord/Style/Frame.php +++ b/src/PhpWord/Style/Frame.php @@ -171,6 +171,34 @@ class Frame extends AbstractStyle */ private $wrap; + /** + * Top wrap distance + * + * @var float + */ + private $wrapDistanceTop; + + /** + * Bottom wrap distance + * + * @var float + */ + private $wrapDistanceBottom; + + /** + * Left wrap distance + * + * @var float + */ + private $wrapDistanceLeft; + + /** + * Right wrap distance + * + * @var float + */ + private $wrapDistanceRight; + /** * Vertically raised or lowered text * @@ -547,6 +575,98 @@ class Frame extends AbstractStyle return $this; } + /** + * Get top distance from text wrap + * + * @return float + */ + public function getWrapDistanceTop() + { + return $this->wrapDistanceTop; + } + + /** + * Set top distance from text wrap + * + * @param int $value + * @return self + */ + public function setWrapDistanceTop($value = null) + { + $this->wrapDistanceTop = $this->setFloatVal($value, null); + + return $this; + } + + /** + * Get bottom distance from text wrap + * + * @return float + */ + public function getWrapDistanceBottom() + { + return $this->wrapDistanceBottom; + } + + /** + * Set bottom distance from text wrap + * + * @param float $value + * @return self + */ + public function setWrapDistanceBottom($value = null) + { + $this->wrapDistanceBottom = $this->setFloatVal($value, null); + + return $this; + } + + /** + * Get left distance from text wrap + * + * @return float + */ + public function getWrapDistanceLeft() + { + return $this->wrapDistanceLeft; + } + + /** + * Set left distance from text wrap + * + * @param float $value + * @return self + */ + public function setWrapDistanceLeft($value = null) + { + $this->wrapDistanceLeft = $this->setFloatVal($value, null); + + return $this; + } + + /** + * Get right distance from text wrap + * + * @return float + */ + public function getWrapDistanceRight() + { + return $this->wrapDistanceRight; + } + + /** + * Set right distance from text wrap + * + * @param float $value + * @return self + */ + public function setWrapDistanceRight($value = null) + { + $this->wrapDistanceRight = $this->setFloatVal($value, null); + + return $this; + } + /** * Get position * diff --git a/src/PhpWord/Writer/Word2007/Style/Frame.php b/src/PhpWord/Writer/Word2007/Style/Frame.php index 47f9ef75..ea5abf78 100644 --- a/src/PhpWord/Writer/Word2007/Style/Frame.php +++ b/src/PhpWord/Writer/Word2007/Style/Frame.php @@ -45,10 +45,14 @@ class Frame extends AbstractStyle $zIndices = array(FrameStyle::WRAP_INFRONT => $maxZIndex, FrameStyle::WRAP_BEHIND => -$maxZIndex); $properties = array( - 'width' => 'width', - 'height' => 'height', - 'left' => 'margin-left', - 'top' => 'margin-top', + 'width' => 'width', + 'height' => 'height', + 'left' => 'margin-left', + 'top' => 'margin-top', + 'wrapDistanceTop' => 'mso-wrap-distance-top', + 'wrapDistanceBottom' => 'mso-wrap-distance-bottom', + 'wrapDistanceLeft' => 'mso-wrap-distance-left', + 'wrapDistanceRight' => 'mso-wrap-distance-right', ); $sizeStyles = $this->getStyles($style, $properties, $style->getUnit()); @@ -57,7 +61,6 @@ class Frame extends AbstractStyle 'hPos' => 'mso-position-horizontal', 'vPos' => 'mso-position-vertical', 'hPosRelTo' => 'mso-position-horizontal-relative', - 'vPosRelTo' => 'mso-position-vertical-relative', ); $posStyles = $this->getStyles($style, $properties); diff --git a/tests/PhpWord/Style/FontTest.php b/tests/PhpWord/Style/FontTest.php index 4ddbd397..6a934579 100644 --- a/tests/PhpWord/Style/FontTest.php +++ b/tests/PhpWord/Style/FontTest.php @@ -115,6 +115,7 @@ class FontTest extends \PHPUnit\Framework\TestCase 'spacing' => 240, 'kerning' => 10, 'rtl' => true, + 'noProof' => true, 'lang' => new Language(Language::EN_US), ); $object->setStyleByArray($attributes); diff --git a/tests/PhpWord/Style/ImageTest.php b/tests/PhpWord/Style/ImageTest.php index 09287bb9..1d43d921 100644 --- a/tests/PhpWord/Style/ImageTest.php +++ b/tests/PhpWord/Style/ImageTest.php @@ -35,12 +35,16 @@ class ImageTest extends \PHPUnit\Framework\TestCase $object = new Image(); $properties = array( - 'width' => 200, - 'height' => 200, - 'alignment' => Jc::START, - 'marginTop' => 240, - 'marginLeft' => 240, - 'wrappingStyle' => 'inline', + 'width' => 200, + 'height' => 200, + 'alignment' => Jc::START, + 'marginTop' => 240, + 'marginLeft' => 240, + 'wrappingStyle' => 'inline', + 'wrapDistanceLeft' => 10, + 'wrapDistanceRight' => 20, + 'wrapDistanceTop' => 30, + 'wrapDistanceBottom' => 40, ); foreach ($properties as $key => $value) { $set = "set{$key}"; @@ -58,16 +62,21 @@ class ImageTest extends \PHPUnit\Framework\TestCase $object = new Image(); $properties = array( - 'width' => 200, - 'height' => 200, - 'alignment' => Jc::START, - 'marginTop' => 240, - 'marginLeft' => 240, - 'positioning' => \PhpOffice\PhpWord\Style\Image::POSITION_ABSOLUTE, - 'posHorizontal' => \PhpOffice\PhpWord\Style\Image::POSITION_HORIZONTAL_CENTER, - 'posVertical' => \PhpOffice\PhpWord\Style\Image::POSITION_VERTICAL_TOP, - 'posHorizontalRel' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE_TO_COLUMN, - 'posVerticalRel' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE_TO_IMARGIN, + 'width' => 200, + 'height' => 200, + 'alignment' => Jc::START, + 'marginTop' => 240, + 'marginLeft' => 240, + 'position' => 10, + 'positioning' => \PhpOffice\PhpWord\Style\Image::POSITION_ABSOLUTE, + 'posHorizontal' => \PhpOffice\PhpWord\Style\Image::POSITION_HORIZONTAL_CENTER, + 'posVertical' => \PhpOffice\PhpWord\Style\Image::POSITION_VERTICAL_TOP, + 'posHorizontalRel' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE_TO_COLUMN, + 'posVerticalRel' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE_TO_IMARGIN, + 'wrapDistanceLeft' => 10, + 'wrapDistanceRight' => 20, + 'wrapDistanceTop' => 30, + 'wrapDistanceBottom' => 40, ); foreach ($properties as $key => $value) { $get = "get{$key}"; diff --git a/tests/PhpWord/Writer/HTML/ElementTest.php b/tests/PhpWord/Writer/HTML/ElementTest.php index ff79953c..ceb3abcb 100644 --- a/tests/PhpWord/Writer/HTML/ElementTest.php +++ b/tests/PhpWord/Writer/HTML/ElementTest.php @@ -17,7 +17,9 @@ namespace PhpOffice\PhpWord\Writer\HTML; +use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\Element\Text as TextElement; +use PhpOffice\PhpWord\Element\TrackChange; use PhpOffice\PhpWord\Writer\HTML; use PhpOffice\PhpWord\Writer\HTML\Element\Text; @@ -54,4 +56,25 @@ class ElementTest extends \PHPUnit\Framework\TestCase $this->assertEquals(htmlspecialchars('-A-', ENT_COMPAT, 'UTF-8'), $object->write()); } + + /** + * Test write TrackChange + */ + public function testWriteTrackChanges() + { + $phpWord = new PhpWord(); + $section = $phpWord->addSection(); + $text = $section->addText('my dummy text'); + $text->setChangeInfo(TrackChange::INSERTED, 'author name'); + $text2 = $section->addText('my other text'); + $text2->setTrackChange(new TrackChange(TrackChange::DELETED, 'another author', new \DateTime())); + + $htmlWriter = new HTML($phpWord); + $dom = new \DOMDocument(); + $dom->loadHTML($htmlWriter->getContent()); + $xpath = new \DOMXpath($dom); + + $this->assertTrue($xpath->query('/html/body/p[1]/ins')->length == 1); + $this->assertTrue($xpath->query('/html/body/p[2]/del')->length == 1); + } } diff --git a/tests/PhpWord/Writer/Word2007/Style/ImageTest.php b/tests/PhpWord/Writer/Word2007/Style/ImageTest.php new file mode 100644 index 00000000..efa0a105 --- /dev/null +++ b/tests/PhpWord/Writer/Word2007/Style/ImageTest.php @@ -0,0 +1,69 @@ + Image::WRAP_INLINE, + 'wrapDistanceLeft' => 10, + 'wrapDistanceRight' => 20, + 'wrapDistanceTop' => 30, + 'wrapDistanceBottom' => 40, + ); + + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $section->addImage(__DIR__ . '/../../../_files/images/earth.jpg', $styles); + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + + $path = '/w:document/w:body/w:p[1]/w:r/w:pict/v:shape'; + $this->assertTrue($doc->elementExists($path . '/w10:wrap')); + $this->assertEquals('inline', $doc->getElementAttribute($path . '/w10:wrap', 'type')); + + $this->assertTrue($doc->elementExists($path)); + $style = $doc->getElement($path)->getAttribute('style'); + $this->assertNotNull($style); + $this->assertContains('mso-wrap-distance-left:10pt;', $style); + $this->assertContains('mso-wrap-distance-right:20pt;', $style); + $this->assertContains('mso-wrap-distance-top:30pt;', $style); + $this->assertContains('mso-wrap-distance-bottom:40pt;', $style); + } +} From a0111be6ae1e5bc2018f171b34849975ce59d579 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 11 Mar 2018 15:02:24 +0100 Subject: [PATCH 253/370] update changelog and doc --- CHANGELOG.md | 1 + docs/styles.rst | 4 ++++ tests/PhpWord/Writer/HTML/ElementTest.php | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c83ac35..e4515131 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ v0.15.0 (?? ??? 2018) - Add support for MACROBUTTON field @phryneas @troosan #1021 - Add support for Hyphenation @Trainmaster #1282 (Document: `autoHyphenation`, `consecutiveHyphenLimit`, `hyphenationZone`, `doNotHyphenateCaps`, Paragraph: `suppressAutoHyphens`) - Added support for Floating Table Positioning (tblpPr) @anrikun #639 +- Added support for Image text wrapping distance @troosan #1310 ### Fixed - Fix reading of docx default style - @troosan #1238 diff --git a/docs/styles.rst b/docs/styles.rst index 98088e78..9b3ce758 100644 --- a/docs/styles.rst +++ b/docs/styles.rst @@ -154,6 +154,10 @@ Available Image style options: - ``marginTop``. Top margin in inches, can be negative. - ``width``. Width in pixels. - ``wrappingStyle``. Wrapping style, *inline*, *square*, *tight*, *behind*, or *infront*. +- ``wrapDistanceTop``. Top text wrapping in pixels. +- ``wrapDistanceBottom``. Bottom text wrapping in pixels. +- ``wrapDistanceLeft``. Left text wrapping in pixels. +- ``wrapDistanceRight``. Right text wrapping in pixels. .. _numbering-level-style: diff --git a/tests/PhpWord/Writer/HTML/ElementTest.php b/tests/PhpWord/Writer/HTML/ElementTest.php index ceb3abcb..b99a5c9a 100644 --- a/tests/PhpWord/Writer/HTML/ElementTest.php +++ b/tests/PhpWord/Writer/HTML/ElementTest.php @@ -17,9 +17,9 @@ namespace PhpOffice\PhpWord\Writer\HTML; -use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\Element\Text as TextElement; use PhpOffice\PhpWord\Element\TrackChange; +use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\Writer\HTML; use PhpOffice\PhpWord\Writer\HTML\Element\Text; From bb70eb0b4c37fa059d53c9714da88150f1ed3cfc Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 18 Mar 2018 12:37:39 +0100 Subject: [PATCH 254/370] fix docx parsing --- src/PhpWord/Reader/Word2007/AbstractPart.php | 143 +++++++++--------- src/PhpWord/Writer/HTML/Element/Title.php | 14 +- src/PhpWord/Writer/ODText/Element/Title.php | 8 +- src/PhpWord/Writer/RTF/Element/Text.php | 2 +- tests/PhpWord/Reader/Word2007/ElementTest.php | 91 ++++++++++- tests/PhpWord/Reader/Word2007/StyleTest.php | 9 +- tests/PhpWord/Writer/Word2007Test.php | 2 +- 7 files changed, 180 insertions(+), 89 deletions(-) diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index 9d002623..7509a382 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -18,6 +18,7 @@ namespace PhpOffice\PhpWord\Reader\Word2007; use PhpOffice\Common\XMLReader; +use PhpOffice\PhpWord\Element\AbstractContainer; use PhpOffice\PhpWord\Element\TextRun; use PhpOffice\PhpWord\Element\TrackChange; use PhpOffice\PhpWord\PhpWord; @@ -161,20 +162,14 @@ abstract class AbstractPart $parent->addTitle($textContent, $headingDepth); } else { // Text and TextRun - $runCount = $xmlReader->countElements('w:r', $domNode); - $insCount = $xmlReader->countElements('w:ins', $domNode); - $delCount = $xmlReader->countElements('w:del', $domNode); - $linkCount = $xmlReader->countElements('w:hyperlink', $domNode); - $runLinkCount = $runCount + $insCount + $delCount + $linkCount; - if (0 == $runLinkCount) { + $textRunContainers = $xmlReader->countElements('w:r|w:ins|w:del|w:hyperlink|w:smartTag', $domNode); + if (0 === $textRunContainers) { $parent->addTextBreak(null, $paragraphStyle); } else { $nodes = $xmlReader->getElements('*', $domNode); - if ($runLinkCount > 1) { - $parent = $parent->addTextRun($paragraphStyle); - } + $paragraph = $parent->addTextRun($paragraphStyle); foreach ($nodes as $node) { - $this->readRun($xmlReader, $node, $parent, $docPart, $paragraphStyle); + $this->readRun($xmlReader, $node, $paragraph, $docPart, $paragraphStyle); } } } @@ -216,81 +211,85 @@ abstract class AbstractPart */ protected function readRun(XMLReader $xmlReader, \DOMElement $domNode, $parent, $docPart, $paragraphStyle = null) { - if (in_array($domNode->nodeName, array('w:ins', 'w:del'))) { + if (in_array($domNode->nodeName, array('w:ins', 'w:del', 'w:smartTag', 'w:hyperlink'))) { $nodes = $xmlReader->getElements('*', $domNode); foreach ($nodes as $node) { - return $this->readRun($xmlReader, $node, $parent, $docPart, $paragraphStyle); + $this->readRun($xmlReader, $node, $parent, $docPart, $paragraphStyle); + } + } elseif ($domNode->nodeName == 'w:r') { + $fontStyle = $this->readFontStyle($xmlReader, $domNode); + $nodes = $xmlReader->getElements('*', $domNode); + foreach ($nodes as $node) { + $this->readRunChild($xmlReader, $node, $parent, $docPart, $paragraphStyle, $fontStyle); } } + } - if (!in_array($domNode->nodeName, array('w:r', 'w:hyperlink'))) { - return; - } - $fontStyle = $this->readFontStyle($xmlReader, $domNode); - - // Link - if ('w:hyperlink' == $domNode->nodeName) { - $rId = $xmlReader->getAttribute('r:id', $domNode); - $textContent = $xmlReader->getValue('w:r/w:t', $domNode); + /** + * Parses nodes under w:r + * + * @param XMLReader $xmlReader + * @param \DOMElement $node + * @param AbstractContainer $parent + * @param string $docPart + * @param mixed $paragraphStyle + * @param mixed $fontStyle + */ + protected function readRunChild(XMLReader $xmlReader, \DOMElement $node, AbstractContainer $parent, $docPart, $paragraphStyle = null, $fontStyle = null) + { + $runParent = $node->parentNode->parentNode; + if ($node->nodeName == 'w:footnoteReference') { + // Footnote + $wId = $xmlReader->getAttribute('w:id', $node); + $footnote = $parent->addFootnote(); + $footnote->setRelationId($wId); + } elseif ($node->nodeName == 'w:endnoteReference') { + // Endnote + $wId = $xmlReader->getAttribute('w:id', $node); + $endnote = $parent->addEndnote(); + $endnote->setRelationId($wId); + } elseif ($node->nodeName == 'w:pict') { + // Image + $rId = $xmlReader->getAttribute('r:id', $node, 'v:shape/v:imagedata'); $target = $this->getMediaTarget($docPart, $rId); if (!is_null($target)) { - $parent->addLink($target, $textContent, $fontStyle, $paragraphStyle); + if ('External' == $this->getTargetMode($docPart, $rId)) { + $imageSource = $target; + } else { + $imageSource = "zip://{$this->docFile}#{$target}"; + } + $parent->addImage($imageSource); } - } else { - if ($xmlReader->elementExists('w:footnoteReference', $domNode)) { - // Footnote - $wId = $xmlReader->getAttribute('w:id', $domNode, 'w:footnoteReference'); - $footnote = $parent->addFootnote(); - $footnote->setRelationId($wId); - } elseif ($xmlReader->elementExists('w:endnoteReference', $domNode)) { - // Endnote - $wId = $xmlReader->getAttribute('w:id', $domNode, 'w:endnoteReference'); - $endnote = $parent->addEndnote(); - $endnote->setRelationId($wId); - } elseif ($xmlReader->elementExists('w:pict', $domNode)) { - // Image - $rId = $xmlReader->getAttribute('r:id', $domNode, 'w:pict/v:shape/v:imagedata'); + } elseif ($node->nodeName == 'w:object') { + // Object + $rId = $xmlReader->getAttribute('r:id', $node, 'o:OLEObject'); + // $rIdIcon = $xmlReader->getAttribute('r:id', $domNode, 'w:object/v:shape/v:imagedata'); + $target = $this->getMediaTarget($docPart, $rId); + if (!is_null($target)) { + $textContent = "<Object: {$target}>"; + $parent->addText($textContent, $fontStyle, $paragraphStyle); + } + } elseif ($node->nodeName == 'w:br') { + $parent->addTextBreak(); + } elseif ($node->nodeName == 'w:tab') { + $parent->addText("\t"); + } elseif ($node->nodeName == 'w:t' || $node->nodeName == 'w:delText') { + // TextRun + $textContent = $xmlReader->getValue('.', $node); + + if ($runParent->nodeName == 'w:hyperlink') { + $rId = $xmlReader->getAttribute('r:id', $runParent); $target = $this->getMediaTarget($docPart, $rId); if (!is_null($target)) { - if ('External' == $this->getTargetMode($docPart, $rId)) { - $imageSource = $target; - } else { - $imageSource = "zip://{$this->docFile}#{$target}"; - } - $parent->addImage($imageSource); - } - } elseif ($xmlReader->elementExists('w:object', $domNode)) { - // Object - $rId = $xmlReader->getAttribute('r:id', $domNode, 'w:object/o:OLEObject'); - // $rIdIcon = $xmlReader->getAttribute('r:id', $domNode, 'w:object/v:shape/v:imagedata'); - $target = $this->getMediaTarget($docPart, $rId); - if (!is_null($target)) { - $textContent = "<Object: {$target}>"; - $parent->addText($textContent, $fontStyle, $paragraphStyle); - } - } - if ($xmlReader->elementExists('w:br', $domNode)) { - $parent->addTextBreak(); - } - if ($xmlReader->elementExists('w:t', $domNode) || $xmlReader->elementExists('w:tab', $domNode) || $xmlReader->elementExists('w:delText', $domNode)) { - // TextRun - $textContent = ''; - $nodes = $xmlReader->getElements('w:t|w:delText|w:tab', $domNode); - foreach ($nodes as $node) { - if ($node->nodeName == 'w:t') { - $textContent .= $node->nodeValue; - } elseif ($node->nodeName == 'w:delText') { - $textContent .= $node->nodeValue; - } elseif ($node->nodeName == 'w:tab') { - $textContent .= "\t"; - } + $parent->addLink($target, $textContent, $fontStyle, $paragraphStyle); } + } else { /** @var AbstractElement $element */ $element = $parent->addText($textContent, $fontStyle, $paragraphStyle); - if (in_array($domNode->parentNode->nodeName, array('w:ins', 'w:del'))) { - $type = ($domNode->parentNode->nodeName == 'w:del') ? TrackChange::DELETED : TrackChange::INSERTED; - $author = $domNode->parentNode->getAttribute('w:author'); - $date = \DateTime::createFromFormat('Y-m-d\TH:i:s\Z', $domNode->parentNode->getAttribute('w:date')); + if (in_array($runParent->nodeName, array('w:ins', 'w:del'))) { + $type = ($runParent->nodeName == 'w:del') ? TrackChange::DELETED : TrackChange::INSERTED; + $author = $runParent->getAttribute('w:author'); + $date = \DateTime::createFromFormat('Y-m-d\TH:i:s\Z', $runParent->getAttribute('w:date')); $element->setChangeInfo($type, $author, $date); } } diff --git a/src/PhpWord/Writer/HTML/Element/Title.php b/src/PhpWord/Writer/HTML/Element/Title.php index 3a802018..7307ce0c 100644 --- a/src/PhpWord/Writer/HTML/Element/Title.php +++ b/src/PhpWord/Writer/HTML/Element/Title.php @@ -38,11 +38,17 @@ class Title extends AbstractElement } $tag = 'h' . $this->element->getDepth(); - if (Settings::isOutputEscapingEnabled()) { - $text = $this->escaper->escapeHtml($this->element->getText()); - } else { - $text = $this->element->getText(); + + $text = $this->element->getText(); + if (is_string($text)) { + if (Settings::isOutputEscapingEnabled()) { + $text = $this->escaper->escapeHtml($text); + } + } elseif ($text instanceof \PhpOffice\PhpWord\Element\AbstractContainer) { + $writer = new Container($this->parentWriter, $this->element); + $text = $writer->write(); } + $content = "<{$tag}>{$text}" . PHP_EOL; return $content; diff --git a/src/PhpWord/Writer/ODText/Element/Title.php b/src/PhpWord/Writer/ODText/Element/Title.php index 343949a2..8b9440ab 100644 --- a/src/PhpWord/Writer/ODText/Element/Title.php +++ b/src/PhpWord/Writer/ODText/Element/Title.php @@ -37,7 +37,13 @@ class Title extends AbstractElement $xmlWriter->startElement('text:h'); $xmlWriter->writeAttribute('text:outline-level', $element->getDepth()); - $this->writeText($element->getText()); + $text = $element->getText(); + if (is_string($text)) { + $this->writeText($text); + } elseif ($text instanceof \PhpOffice\PhpWord\Element\AbstractContainer) { + $containerWriter = new Container($xmlWriter, $text); + $containerWriter->write(); + } $xmlWriter->endElement(); // text:h } } diff --git a/src/PhpWord/Writer/RTF/Element/Text.php b/src/PhpWord/Writer/RTF/Element/Text.php index f80e7935..b9e56e89 100644 --- a/src/PhpWord/Writer/RTF/Element/Text.php +++ b/src/PhpWord/Writer/RTF/Element/Text.php @@ -34,7 +34,7 @@ class Text extends AbstractElement /** @var \PhpOffice\PhpWord\Element\Text $element Type hint */ $element = $this->element; $elementClass = str_replace('\\Writer\\RTF', '', get_class($this)); - if (!$element instanceof $elementClass) { + if (!$element instanceof $elementClass || !is_string($element->getText())) { return ''; } diff --git a/tests/PhpWord/Reader/Word2007/ElementTest.php b/tests/PhpWord/Reader/Word2007/ElementTest.php index 46780278..75060625 100644 --- a/tests/PhpWord/Reader/Word2007/ElementTest.php +++ b/tests/PhpWord/Reader/Word2007/ElementTest.php @@ -18,6 +18,7 @@ namespace PhpOffice\PhpWord\Reader\Word2007; use PhpOffice\PhpWord\AbstractTestReader; +use PhpOffice\PhpWord\Element\TrackChange; /** * Test class for PhpOffice\PhpWord\Reader\Word2007\Element subnamespace @@ -39,9 +40,35 @@ class ElementTest extends AbstractTestReader $phpWord = $this->getDocumentFromString(array('document' => $documentXml)); $elements = $phpWord->getSection(0)->getElements(); - $this->assertInstanceOf('PhpOffice\PhpWord\Element\TextBreak', $elements[0]); - $this->assertInstanceOf('PhpOffice\PhpWord\Element\Text', $elements[1]); - $this->assertEquals('test string', $elements[1]->getText()); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\TextRun', $elements[0]); + /** @var \PhpOffice\PhpWord\Element\TextRun $textRun */ + $textRun = $elements[0]; + $this->assertInstanceOf('PhpOffice\PhpWord\Element\TextBreak', $textRun->getElement(0)); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\Text', $textRun->getElement(1)); + $this->assertEquals('test string', $textRun->getElement(1)->getText()); + } + + /** + * Test reading content inside w:smartTag + */ + public function testSmartTag() + { + $documentXml = ' + + + test string + + + '; + + $phpWord = $this->getDocumentFromString(array('document' => $documentXml)); + + $elements = $phpWord->getSection(0)->getElements(); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\TextRun', $elements[0]); + /** @var \PhpOffice\PhpWord\Element\TextRun $textRun */ + $textRun = $elements[0]; + $this->assertInstanceOf('PhpOffice\PhpWord\Element\Text', $textRun->getElement(0)); + $this->assertEquals('test string', $textRun->getElement(0)->getText()); } /** @@ -85,6 +112,49 @@ class ElementTest extends AbstractTestReader $this->assertTrue($listElements[2]->getFontStyle()->getBold()); } + /** + * Test reading track changes + */ + public function testReadTrackChange() + { + $documentXml = ' + + One + + + + two + + + + + three + + + '; + + $phpWord = $this->getDocumentFromString(array('document' => $documentXml)); + + $elements = $phpWord->getSection(0)->getElements(); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\TextRun', $elements[0]); + /** @var \PhpOffice\PhpWord\Element\TextRun $elements */ + $textRun = $elements[0]; + + $this->assertEquals('One ', $textRun->getElement(0)->getText()); + + $this->assertEquals('two', $textRun->getElement(1)->getText()); + $this->assertNotNull($textRun->getElement(1)->getTrackChange()); + /** @var \PhpOffice\PhpWord\Element\TrackChange $trackChange */ + $trackChange = $textRun->getElement(1)->getTrackChange(); + $this->assertEquals(TrackChange::DELETED, $trackChange->getChangeType()); + + $this->assertEquals('three', $textRun->getElement(2)->getText()); + $this->assertNotNull($textRun->getElement(2)->getTrackChange()); + /** @var \PhpOffice\PhpWord\Element\TrackChange $trackChange */ + $trackChange = $textRun->getElement(2)->getTrackChange(); + $this->assertEquals(TrackChange::INSERTED, $trackChange->getChangeType()); + } + /** * Test reading of tab */ @@ -98,11 +168,18 @@ class ElementTest extends AbstractTestReader '; - $phpWord = $this->getDocumentFromString($documentXml); + $phpWord = $this->getDocumentFromString(array('document' => $documentXml)); - $elements = $this->get($phpWord->getSections(), 0)->getElements(); - $this->assertInstanceOf('PhpOffice\PhpWord\Element\Text', $elements[0]); - $this->assertEquals("One\tTwo", $elements[0]->getText()); + $elements = $phpWord->getSection(0)->getElements(); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\TextRun', $elements[0]); + /** @var \PhpOffice\PhpWord\Element\TextRun $textRun */ + $textRun = $elements[0]; + $this->assertInstanceOf('PhpOffice\PhpWord\Element\Text', $textRun->getElement(0)); + $this->assertEquals('One', $textRun->getElement(0)->getText()); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\Text', $textRun->getElement(1)); + $this->assertEquals("\t", $textRun->getElement(1)->getText()); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\Text', $textRun->getElement(2)); + $this->assertEquals('Two', $textRun->getElement(2)->getText()); } /** diff --git a/tests/PhpWord/Reader/Word2007/StyleTest.php b/tests/PhpWord/Reader/Word2007/StyleTest.php index 46421d97..9bb6d3bd 100644 --- a/tests/PhpWord/Reader/Word2007/StyleTest.php +++ b/tests/PhpWord/Reader/Word2007/StyleTest.php @@ -117,10 +117,13 @@ class StyleTest extends AbstractTestReader $phpWord = $this->getDocumentFromString(array('document' => $documentXml)); $elements = $phpWord->getSection(0)->getElements(); - $this->assertInstanceOf('PhpOffice\PhpWord\Element\Text', $elements[0]); - $this->assertInstanceOf('PhpOffice\PhpWord\Style\Font', $elements[0]->getFontStyle()); + /** @var \PhpOffice\PhpWord\Element\TextRun $elements */ + $textRun = $elements[0]; + $this->assertInstanceOf('PhpOffice\PhpWord\Element\TextRun', $textRun); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\Text', $textRun->getElement(0)); + $this->assertInstanceOf('PhpOffice\PhpWord\Style\Font', $textRun->getElement(0)->getFontStyle()); /** @var \PhpOffice\PhpWord\Style\Font $fontStyle */ - $fontStyle = $elements[0]->getFontStyle(); + $fontStyle = $textRun->getElement(0)->getFontStyle(); $this->assertEquals(15, $fontStyle->getPosition()); } } diff --git a/tests/PhpWord/Writer/Word2007Test.php b/tests/PhpWord/Writer/Word2007Test.php index 22a0e6df..0db36fc1 100644 --- a/tests/PhpWord/Writer/Word2007Test.php +++ b/tests/PhpWord/Writer/Word2007Test.php @@ -75,7 +75,7 @@ class Word2007Test extends \PHPUnit\Framework\TestCase public function testSave() { $localImage = __DIR__ . '/../_files/images/earth.jpg'; - $remoteImage = 'http://php.net//images/logos/php-med-trans-light.gif'; + $remoteImage = 'http://php.net/images/logos/new-php-logo.png'; $phpWord = new PhpWord(); $phpWord->addFontStyle('Font', array('size' => 11)); $phpWord->addParagraphStyle('Paragraph', array('alignment' => Jc::CENTER)); From 4c846426ce68998d6846660338093a535a784f33 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 18 Mar 2018 20:53:05 +0100 Subject: [PATCH 255/370] format & changelog --- CHANGELOG.md | 1 + src/PhpWord/Element/Field.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4515131..b58ec404 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ v0.15.0 (?? ??? 2018) - Bookmark are not writton as internal link in html writer @troosan #1263 - It should be possible to add a Footnote in a ListItemRun @troosan #1287 #1287 - Fix parsing of Heading and Title formating @troosan @gthomas2 #465 +- Fix Dateformat typo, fix hours casing, add Month-Day-Year formats @ComputerTinker #591 ### Changed - Remove zend-stdlib dependency @Trainmaster #1284 diff --git a/src/PhpWord/Element/Field.php b/src/PhpWord/Element/Field.php index e5377cf4..0e5e28ed 100644 --- a/src/PhpWord/Element/Field.php +++ b/src/PhpWord/Element/Field.php @@ -46,8 +46,8 @@ class Field extends AbstractElement ), 'options' => array('PreserveFormat'), ), - 'DATE'=>array( - 'properties'=> array( + 'DATE' => array( + 'properties' => array( 'dateformat' => array( /* Generic formats */ 'yyyy-MM-dd', 'yyyy-MM', 'MMM-yy', 'MMM-yyyy', 'h:mm am/pm', 'h:mm:ss am/pm', 'HH:mm', 'HH:mm:ss', From 997e21433ccb397ac8a547863227e33f75089eb1 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 18 Mar 2018 22:26:45 +0100 Subject: [PATCH 256/370] add parsing of line-height and text-indent --- src/PhpWord/Shared/Html.php | 6 ++++++ tests/PhpWord/Shared/HtmlTest.php | 28 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 15f3b605..64c6b4a5 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -520,6 +520,12 @@ class Html case 'background-color': $styles['bgColor'] = trim($cValue, '#'); break; + case 'line-height': + $styles['lineHeight'] = $cValue; + break; + case 'text-indent': + $styles['indentation']['firstLine'] = Converter::cssToTwip($cValue); + break; case 'font-weight': $tValue = false; if (preg_match('#bold#', $cValue)) { diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index 7541c9c4..eda7abb8 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -114,6 +114,34 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $this->assertEquals('single', $doc->getElementAttribute('/w:document/w:body/w:p/w:r/w:rPr/w:u', 'w:val')); } + /** + * Test line-height style + */ + public function testParseLineHeight() + { + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + Html::addHtml($section, '

                  test

                  '); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:pPr/w:spacing')); + $this->assertEquals(240 * 1.5, $doc->getElementAttribute('/w:document/w:body/w:p/w:pPr/w:spacing', 'w:line')); + } + + /** + * Test text-indent style + */ + public function testParseTextIndent() + { + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + Html::addHtml($section, '

                  test

                  '); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:pPr/w:ind')); + $this->assertEquals(750, $doc->getElementAttribute('/w:document/w:body/w:p/w:pPr/w:ind', 'w:firstLine')); + } + /** * Test text-align style */ From de2e05bc112887332ea8800e5ddee255d1f83639 Mon Sep 17 00:00:00 2001 From: troosan Date: Mon, 19 Mar 2018 06:41:46 +0100 Subject: [PATCH 257/370] update changelog [ci skip] --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b58ec404..e2bf4eb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ v0.15.0 (?? ??? 2018) - Add support for Hyphenation @Trainmaster #1282 (Document: `autoHyphenation`, `consecutiveHyphenLimit`, `hyphenationZone`, `doNotHyphenateCaps`, Paragraph: `suppressAutoHyphens`) - Added support for Floating Table Positioning (tblpPr) @anrikun #639 - Added support for Image text wrapping distance @troosan #1310 +- Added parsing of CSS line-height and text-indent in HTML reader @troosan #1316 ### Fixed - Fix reading of docx default style - @troosan #1238 From 97d60dd985363681bfd376aacee776898032ea3d Mon Sep 17 00:00:00 2001 From: troosan Date: Mon, 19 Mar 2018 17:25:19 +0100 Subject: [PATCH 258/370] tranlate percentage to rate --- samples/Sample_26_Html.php | 3 +++ src/PhpWord/Shared/Html.php | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/samples/Sample_26_Html.php b/samples/Sample_26_Html.php index 31e5984f..d8763805 100644 --- a/samples/Sample_26_Html.php +++ b/samples/Sample_26_Html.php @@ -18,6 +18,9 @@ $html .= '

                  היי, זה $html .= '

                  Unordered (bulleted) list:

                  '; $html .= '
                  • Item 1
                  • Item 2
                    • Item 2.1
                    • Item 2.1
                  '; +$html .= '

                  1.5 line height with first line text indent:

                  '; +$html .= '

                  Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

                  '; + $html .= '

                  centered title

                  '; $html .= '

                  Ordered (numbered) list:

                  '; diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 64c6b4a5..dcf84778 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -521,7 +521,7 @@ class Html $styles['bgColor'] = trim($cValue, '#'); break; case 'line-height': - $styles['lineHeight'] = $cValue; + $styles['lineHeight'] = Html::toMultiplier($cValue); break; case 'text-indent': $styles['indentation']['firstLine'] = Converter::cssToTwip($cValue); @@ -681,6 +681,15 @@ class Html return null; } + private static function toMultiplier($cssValue) + { + if (preg_match('/([0-9]+)%/', $cssValue, $matches)) { + return ((int) $matches[1]) / 100; + } + + return $cssValue; + } + /** * Parse line break * From de01e86d41e397891fe5a8255b2b595ccd883b75 Mon Sep 17 00:00:00 2001 From: troosan Date: Mon, 19 Mar 2018 22:43:10 +0100 Subject: [PATCH 259/370] parse fixed line space --- src/PhpWord/Shared/Html.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index dcf84778..f8b25605 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -521,7 +521,18 @@ class Html $styles['bgColor'] = trim($cValue, '#'); break; case 'line-height': - $styles['lineHeight'] = Html::toMultiplier($cValue); + if (preg_match('/([0-9]+[a-z]+)/', $cValue, $matches)) { + $spacingLineRule = \PhpOffice\PhpWord\SimpleType\LineSpacingRule::EXACT; + $spacing = Converter::cssToTwip($matches[1]) / \PhpOffice\PhpWord\Style\Paragraph::LINE_HEIGHT; + } elseif (preg_match('/([0-9]+)%/', $cValue, $matches)) { + $spacingLineRule = \PhpOffice\PhpWord\SimpleType\LineSpacingRule::AUTO; + $spacing = ((int) $matches[1]) / 100; + } else { + $spacingLineRule = \PhpOffice\PhpWord\SimpleType\LineSpacingRule::AUTO; + $spacing = $cValue; + } + $styles['spacingLineRule'] = $spacingLineRule; + $styles['lineHeight'] = $spacing; break; case 'text-indent': $styles['indentation']['firstLine'] = Converter::cssToTwip($cValue); @@ -681,15 +692,6 @@ class Html return null; } - private static function toMultiplier($cssValue) - { - if (preg_match('/([0-9]+)%/', $cssValue, $matches)) { - return ((int) $matches[1]) / 100; - } - - return $cssValue; - } - /** * Parse line break * From 16a9ded2c97304c89d0a7f1c4f34aa72c12e3818 Mon Sep 17 00:00:00 2001 From: troosan Date: Mon, 19 Mar 2018 22:49:00 +0100 Subject: [PATCH 260/370] add exact line spacing test --- tests/PhpWord/Shared/HtmlTest.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index eda7abb8..386aaee1 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -20,6 +20,8 @@ namespace PhpOffice\PhpWord\Shared; use PhpOffice\PhpWord\Element\Section; use PhpOffice\PhpWord\SimpleType\Jc; use PhpOffice\PhpWord\TestHelperDOCX; +use PhpOffice\PhpWord\Style\Paragraph; +use PhpOffice\PhpWord\SimpleType\LineSpacingRule; /** * Test class for PhpOffice\PhpWord\Shared\Html @@ -122,10 +124,16 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $phpWord = new \PhpOffice\PhpWord\PhpWord(); $section = $phpWord->addSection(); Html::addHtml($section, '

                  test

                  '); + Html::addHtml($section, '

                  test

                  '); $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); - $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:pPr/w:spacing')); - $this->assertEquals(240 * 1.5, $doc->getElementAttribute('/w:document/w:body/w:p/w:pPr/w:spacing', 'w:line')); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p[1]/w:pPr/w:spacing')); + $this->assertEquals(Paragraph::LINE_HEIGHT * 1.5, $doc->getElementAttribute('/w:document/w:body/w:p[1]/w:pPr/w:spacing', 'w:line')); + $this->assertEquals(LineSpacingRule::AUTO, $doc->getElementAttribute('/w:document/w:body/w:p[1]/w:pPr/w:spacing', 'w:lineRule')); + + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p[2]/w:pPr/w:spacing')); + $this->assertEquals(300, $doc->getElementAttribute('/w:document/w:body/w:p[2]/w:pPr/w:spacing', 'w:line')); + $this->assertEquals(LineSpacingRule::EXACT, $doc->getElementAttribute('/w:document/w:body/w:p[2]/w:pPr/w:spacing', 'w:lineRule')); } /** From f73beaa26a90ece5eab8015b2127347fd35076f2 Mon Sep 17 00:00:00 2001 From: troosan Date: Mon, 19 Mar 2018 23:06:00 +0100 Subject: [PATCH 261/370] reset static collections at instantiation --- src/PhpWord/PhpWord.php | 13 +++++++++++++ tests/PhpWord/Shared/HtmlTest.php | 4 ++-- tests/PhpWord/Style/TablePositionTest.php | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/PhpWord/PhpWord.php b/src/PhpWord/PhpWord.php index 6b6fd9ff..d524adc7 100644 --- a/src/PhpWord/PhpWord.php +++ b/src/PhpWord/PhpWord.php @@ -52,8 +52,17 @@ class PhpWord * @const string|int */ const DEFAULT_FONT_NAME = Settings::DEFAULT_FONT_NAME; + /** + * @deprecated 0.11.0 Use Settings constants + */ const DEFAULT_FONT_SIZE = Settings::DEFAULT_FONT_SIZE; + /** + * @deprecated 0.11.0 Use Settings constants + */ const DEFAULT_FONT_COLOR = Settings::DEFAULT_FONT_COLOR; + /** + * @deprecated 0.11.0 Use Settings constants + */ const DEFAULT_FONT_CONTENT_TYPE = Settings::DEFAULT_FONT_CONTENT_TYPE; /** @@ -85,6 +94,10 @@ class PhpWord */ public function __construct() { + // Reset Media and styles + Media::resetStyles(); + Style::resetStyles(); + // Collection $collections = array('Bookmarks', 'Titles', 'Footnotes', 'Endnotes', 'Charts', 'Comments'); foreach ($collections as $collection) { diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index 386aaee1..1171489c 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -19,9 +19,9 @@ namespace PhpOffice\PhpWord\Shared; use PhpOffice\PhpWord\Element\Section; use PhpOffice\PhpWord\SimpleType\Jc; -use PhpOffice\PhpWord\TestHelperDOCX; -use PhpOffice\PhpWord\Style\Paragraph; use PhpOffice\PhpWord\SimpleType\LineSpacingRule; +use PhpOffice\PhpWord\Style\Paragraph; +use PhpOffice\PhpWord\TestHelperDOCX; /** * Test class for PhpOffice\PhpWord\Shared\Html diff --git a/tests/PhpWord/Style/TablePositionTest.php b/tests/PhpWord/Style/TablePositionTest.php index 77b22e4e..1243c3d5 100644 --- a/tests/PhpWord/Style/TablePositionTest.php +++ b/tests/PhpWord/Style/TablePositionTest.php @@ -11,7 +11,7 @@ * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * * @see https://github.com/PHPOffice/PHPWord - * @copyright 2010-2017 PHPWord contributors + * @copyright 2010-2018 PHPWord contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ From 992d8425521cb15f8b3a440a973a3b4394da1435 Mon Sep 17 00:00:00 2001 From: troosan Date: Mon, 19 Mar 2018 23:07:35 +0100 Subject: [PATCH 262/370] fix --- src/PhpWord/PhpWord.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/PhpWord.php b/src/PhpWord/PhpWord.php index d524adc7..b5cc0c51 100644 --- a/src/PhpWord/PhpWord.php +++ b/src/PhpWord/PhpWord.php @@ -95,7 +95,7 @@ class PhpWord public function __construct() { // Reset Media and styles - Media::resetStyles(); + Media::resetElements(); Style::resetStyles(); // Collection From 296706aa03ad9c24b35528acdb052feb0219ee96 Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 20 Mar 2018 21:35:06 +0100 Subject: [PATCH 263/370] add unit tests --- CHANGELOG.md | 1 + samples/Sample_09_Tables.php | 22 ++++---- tests/PhpWord/Writer/HTML/ElementTest.php | 68 +++++++++++++++++++++++ 3 files changed, 80 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6f87158..526b9c95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ v0.15.0 (?? ??? 2018) - Fix parsing of `` tag. @troosan #1274 - Bookmark are not writton as internal link in html writer @troosan #1263 - It should be possible to add a Footnote in a ListItemRun @troosan #1287 #1287 +- Fix colspan and rowspan for tables in HTML Writer @mattbolt #1292 ### Changed - Remove zend-stdlib dependency @Trainmaster #1284 diff --git a/samples/Sample_09_Tables.php b/samples/Sample_09_Tables.php index ba41aa54..b1231d55 100644 --- a/samples/Sample_09_Tables.php +++ b/samples/Sample_09_Tables.php @@ -113,20 +113,20 @@ $phpWord->addTableStyle('Colspan Rowspan', $styleTable); $table = $section->addTable('Colspan Rowspan'); $row = $table->addRow(); - -$row->addCell(null, array('vMerge' => 'restart'))->addText('A'); -$row->addCell(null, array('gridSpan' => 2, 'vMerge' => 'restart'))->addText('B'); -$row->addCell()->addText('1'); +$row->addCell(1000, array('vMerge' => 'restart'))->addText('A'); +$row->addCell(1000, array('gridSpan' => 2, 'vMerge' => 'restart'))->addText('B'); +$row->addCell(1000)->addText('1'); $row = $table->addRow(); -$row->addCell(null, array('vMerge' => 'continue')); -$row->addCell(null, array('vMerge' => 'continue', 'gridSpan' => 2)); -$row->addCell()->addText('2'); +$row->addCell(1000, array('vMerge' => 'continue')); +$row->addCell(1000, array('vMerge' => 'continue', 'gridSpan' => 2)); +$row->addCell(1000)->addText('2'); + $row = $table->addRow(); -$row->addCell(null, array('vMerge' => 'continue')); -$row->addCell()->addText('C'); -$row->addCell()->addText('D'); -$row->addCell()->addText('3'); +$row->addCell(1000, array('vMerge' => 'continue')); +$row->addCell(1000)->addText('C'); +$row->addCell(1000)->addText('D'); +$row->addCell(1000)->addText('3'); // 5. Nested table diff --git a/tests/PhpWord/Writer/HTML/ElementTest.php b/tests/PhpWord/Writer/HTML/ElementTest.php index fc092ba3..eb0d2571 100644 --- a/tests/PhpWord/Writer/HTML/ElementTest.php +++ b/tests/PhpWord/Writer/HTML/ElementTest.php @@ -18,6 +18,7 @@ namespace PhpOffice\PhpWord\Writer\HTML; use PhpOffice\PhpWord\Element\Text as TextElement; +use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\Writer\HTML; use PhpOffice\PhpWord\Writer\HTML\Element\Text; @@ -54,4 +55,71 @@ class ElementTest extends \PHPUnit\Framework\TestCase $this->assertEquals(htmlspecialchars('-A-', ENT_COMPAT, 'UTF-8'), $object->write()); } + + /** + * Tests writing table with col span + */ + public function testWriteColSpan() + { + $phpWord = new PhpWord(); + $section = $phpWord->addSection(); + $table = $section->addTable(); + $row1 = $table->addRow(); + $cell11 = $row1->addCell(1000, array('gridSpan' => 2)); + $cell11->addText('cell spanning 2 bellow'); + $row2 = $table->addRow(); + $cell21 = $row2->addCell(500); + $cell21->addText('first cell'); + $cell22 = $row2->addCell(500); + $cell22->addText('second cell'); + + $dom = $this->getAsHTML($phpWord); + echo $dom->saveHTML(); + + $xpath = new \DOMXpath($dom); + + $this->assertTrue($xpath->query('/html/body/table/tr[1]/td')->length == 1); + $this->assertEquals('2', $xpath->query('/html/body/table/tr/td[1]')->item(0)->attributes->getNamedItem('colspan')->textContent); + $this->assertTrue($xpath->query('/html/body/table/tr[2]/td')->length == 2); + } + + /** + * Tests writing table with row span + */ + public function testWriteRowSpan() + { + $phpWord = new PhpWord(); + $section = $phpWord->addSection(); + $table = $section->addTable(); + + $row1 = $table->addRow(); + $row1->addCell(1000, array('vMerge' => 'restart'))->addText('row spanning 3 bellow'); + $row1->addCell(500)->addText('first cell being spanned'); + + $row2 = $table->addRow(); + $row2->addCell(null, array('vMerge' => 'continue')); + $row2->addCell(500)->addText('second cell being spanned'); + + $row3 = $table->addRow(); + $row3->addCell(null, array('vMerge' => 'continue')); + $row3->addCell(500)->addText('third cell being spanned'); + + $dom = $this->getAsHTML($phpWord); + echo $dom->saveHTML(); + + $xpath = new \DOMXpath($dom); + + $this->assertTrue($xpath->query('/html/body/table/tr[1]/td')->length == 2); + $this->assertEquals('3', $xpath->query('/html/body/table/tr[1]/td[1]')->item(0)->attributes->getNamedItem('rowspan')->textContent); + $this->assertTrue($xpath->query('/html/body/table/tr[2]/td')->length == 1); + } + + private function getAsHTML(PhpWord $phpWord) + { + $htmlWriter = new HTML($phpWord); + $dom = new \DOMDocument(); + $dom->loadHTML($htmlWriter->getContent()); + + return $dom; + } } From d8387c1abad2e0e44af3f936cad0e6d5746ad271 Mon Sep 17 00:00:00 2001 From: Tim Jarrett Date: Tue, 2 Feb 2016 16:17:20 -0500 Subject: [PATCH 264/370] Escape incoming invalid XML characters using htmlspecialchars(). --- src/PhpWord/Reader/Word2007/AbstractPart.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index 7509a382..9623fb79 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -135,7 +135,7 @@ abstract class AbstractPart } } } - $parent->addPreserveText($textContent, $fontStyle, $paragraphStyle); + $parent->addPreserveText(htmlspecialchars($textContent, ENT_QUOTES | ENT_XML1), $fontStyle, $paragraphStyle); } elseif ($xmlReader->elementExists('w:pPr/w:numPr', $domNode)) { // List item $numId = $xmlReader->getAttribute('w:val', $domNode, 'w:pPr/w:numPr/w:numId'); @@ -152,7 +152,7 @@ abstract class AbstractPart $textContent = null; $nodes = $xmlReader->getElements('w:r', $domNode); if ($nodes->length === 1) { - $textContent = $xmlReader->getValue('w:t', $nodes->item(0)); + $textContent = htmlspecialchars($xmlReader->getValue('w:t', $nodes->item(0)), ENT_QUOTES | ENT_XML1); } else { $textContent = new TextRun($paragraphStyle); foreach ($nodes as $node) { @@ -275,7 +275,7 @@ abstract class AbstractPart $parent->addText("\t"); } elseif ($node->nodeName == 'w:t' || $node->nodeName == 'w:delText') { // TextRun - $textContent = $xmlReader->getValue('.', $node); + $textContent = htmlspecialchars($xmlReader->getValue('.', $node), ENT_QUOTES | ENT_XML1); if ($runParent->nodeName == 'w:hyperlink') { $rId = $xmlReader->getAttribute('r:id', $runParent); From 2c5970a38880d66ffb4db6870825f581755b44ee Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 20 Mar 2018 23:42:01 +0100 Subject: [PATCH 265/370] php 5.3 compatibility --- src/PhpWord/Reader/Word2007/AbstractPart.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index 9623fb79..f64886cf 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -135,7 +135,7 @@ abstract class AbstractPart } } } - $parent->addPreserveText(htmlspecialchars($textContent, ENT_QUOTES | ENT_XML1), $fontStyle, $paragraphStyle); + $parent->addPreserveText(htmlspecialchars($textContent, ENT_QUOTES, 'UTF-8'), $fontStyle, $paragraphStyle); } elseif ($xmlReader->elementExists('w:pPr/w:numPr', $domNode)) { // List item $numId = $xmlReader->getAttribute('w:val', $domNode, 'w:pPr/w:numPr/w:numId'); @@ -152,7 +152,7 @@ abstract class AbstractPart $textContent = null; $nodes = $xmlReader->getElements('w:r', $domNode); if ($nodes->length === 1) { - $textContent = htmlspecialchars($xmlReader->getValue('w:t', $nodes->item(0)), ENT_QUOTES | ENT_XML1); + $textContent = htmlspecialchars($xmlReader->getValue('w:t', $nodes->item(0)), ENT_QUOTES, 'UTF-8'); } else { $textContent = new TextRun($paragraphStyle); foreach ($nodes as $node) { @@ -275,7 +275,7 @@ abstract class AbstractPart $parent->addText("\t"); } elseif ($node->nodeName == 'w:t' || $node->nodeName == 'w:delText') { // TextRun - $textContent = htmlspecialchars($xmlReader->getValue('.', $node), ENT_QUOTES | ENT_XML1); + $textContent = htmlspecialchars($xmlReader->getValue('.', $node), ENT_QUOTES, 'UTF-8'); if ($runParent->nodeName == 'w:hyperlink') { $rId = $xmlReader->getAttribute('r:id', $runParent); From 45e2e92af7476d54b500271b9bb2d062b9407b2e Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 21 Mar 2018 21:50:41 +0100 Subject: [PATCH 266/370] fix graph data --- src/PhpWord/Writer/Word2007/Part/Chart.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Writer/Word2007/Part/Chart.php b/src/PhpWord/Writer/Word2007/Part/Chart.php index 011e3472..09ce8c55 100644 --- a/src/PhpWord/Writer/Word2007/Part/Chart.php +++ b/src/PhpWord/Writer/Word2007/Part/Chart.php @@ -236,7 +236,7 @@ class Chart extends AbstractPart $xmlWriter->startElement('c:pt'); $xmlWriter->writeAttribute('idx', $index); $xmlWriter->startElement('c:v'); - $this->writeText($value); + $xmlWriter->writeText($value); $xmlWriter->endElement(); // c:v $xmlWriter->endElement(); // c:pt $index++; From c08f2718af9c46ef1bcc56a0710487ca543e97d2 Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 21 Mar 2018 21:58:41 +0100 Subject: [PATCH 267/370] check style fixes --- samples/Sample_32_Chart.php | 10 ++++++++-- src/PhpWord/Writer/Word2007/Part/Chart.php | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/samples/Sample_32_Chart.php b/samples/Sample_32_Chart.php index e345afda..87d6f3e3 100644 --- a/samples/Sample_32_Chart.php +++ b/samples/Sample_32_Chart.php @@ -49,8 +49,14 @@ $section = $phpWord->addSection(array('colsNum' => 2, 'breakType' => 'continuous $chartTypes = array('pie', 'bar', 'column', 'line', 'area'); $multiSeries = array('bar', 'column', 'line', 'area'); -$style = array('width' => Converter::cmToEmu(5), 'height' => Converter::cmToEmu(4), '3d' => true, - 'showAxisLabels' => $showAxisLabels, 'showGridX' => $showGridLines, 'showGridY' => $showGridLines); +$style = array( + 'width' => Converter::cmToEmu(5), + 'height' => Converter::cmToEmu(4), + '3d' => true, + 'showAxisLabels' => $showAxisLabels, + 'showGridX' => $showGridLines, + 'showGridY' => $showGridLines, +); foreach ($chartTypes as $chartType) { $section->addTitle(ucfirst($chartType), 2); $chart = $section->addChart($chartType, $categories, $series1, $style); diff --git a/src/PhpWord/Writer/Word2007/Part/Chart.php b/src/PhpWord/Writer/Word2007/Part/Chart.php index 09ce8c55..59255a6b 100644 --- a/src/PhpWord/Writer/Word2007/Part/Chart.php +++ b/src/PhpWord/Writer/Word2007/Part/Chart.php @@ -280,7 +280,7 @@ class Chart extends AbstractPart } $xmlWriter->writeElementBlock('c:crosses', 'val', 'autoZero'); } - if (isset($this->options['radar']) || ($type == "cat" && $style->showGridX()) || ($type == "val" && $style->showGridY())) { + if (isset($this->options['radar']) || ($type == 'cat' && $style->showGridX()) || ($type == 'val' && $style->showGridY())) { $xmlWriter->writeElement('c:majorGridlines'); } From ade497d9d78962caccbf777256be1abfdee7d4f6 Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 21 Mar 2018 22:19:56 +0100 Subject: [PATCH 268/370] update changelog and doc --- CHANGELOG.md | 1 + docs/ISSUE_TEMPLATE.md | 2 +- docs/elements.rst | 4 +++- docs/styles.rst | 14 ++++++++++++++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c3b4dfd..d0b39ce1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ v0.15.0 (?? ??? 2018) - Added support for Floating Table Positioning (tblpPr) @anrikun #639 - Added support for Image text wrapping distance @troosan #1310 - Added parsing of CSS line-height and text-indent in HTML reader @troosan #1316 +- Added the ability to enable gridlines and axislabels on charts @FrankMeyer #576 ### Fixed - Fix reading of docx default style - @troosan #1238 diff --git a/docs/ISSUE_TEMPLATE.md b/docs/ISSUE_TEMPLATE.md index ee811b00..c7ed27d7 100644 --- a/docs/ISSUE_TEMPLATE.md +++ b/docs/ISSUE_TEMPLATE.md @@ -4,7 +4,7 @@ This is: - [ ] a feature request - [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpword) -# Expected Behavior +### Expected Behavior Please describe the behavior you are expecting. diff --git a/docs/elements.rst b/docs/elements.rst index 4c5ad03b..8f33b503 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -448,7 +448,9 @@ Charts can be added using $categories = array('A', 'B', 'C', 'D', 'E'); $series = array(1, 3, 2, 5, 4); - $chart = $section->addChart('line', $categories, $series); + $chart = $section->addChart('line', $categories, $series, $style); + +For available styling options see :ref:`chart-style`. check out the Sample_32_Chart.php for more options and styling. diff --git a/docs/styles.rst b/docs/styles.rst index 9b3ce758..0bda3faf 100644 --- a/docs/styles.rst +++ b/docs/styles.rst @@ -178,3 +178,17 @@ Available NumberingLevel style options: - ``suffix``. Content between numbering symbol and paragraph text tab\|space\|nothing. - ``tabPos``. See paragraph style. - ``text``. Numbering level text e.g. %1 for nonbullet or bullet character. + +.. _chart-style: + +Chart +----- + +Available Chart style options: + +- ``width``. Width (in EMU). +- ``height``. Height (in EMU). +- ``3d``. Is 3D; applies to pie, bar, line, area, *true* or *false*. +- ``showAxisLabels``. Show labels for axis, *true* or *false*. +- ``gridX``. Show Gridlines for X-Axis, *true* or *false*. +- ``gridY``. Show Gridlines for Y-Axis, *true* or *false*. From 400ee57bee82faaa3745f51a02ef6f1f6fa52b62 Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 22 Mar 2018 22:47:27 +0100 Subject: [PATCH 269/370] fix --- src/PhpWord/Writer/Word2007/Part/Chart.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Writer/Word2007/Part/Chart.php b/src/PhpWord/Writer/Word2007/Part/Chart.php index 59255a6b..2aeccca0 100644 --- a/src/PhpWord/Writer/Word2007/Part/Chart.php +++ b/src/PhpWord/Writer/Word2007/Part/Chart.php @@ -236,7 +236,7 @@ class Chart extends AbstractPart $xmlWriter->startElement('c:pt'); $xmlWriter->writeAttribute('idx', $index); $xmlWriter->startElement('c:v'); - $xmlWriter->writeText($value); + $xmlWriter->text($value); $xmlWriter->endElement(); // c:v $xmlWriter->endElement(); // c:pt $index++; From 34bda105365cc4c8d9e8fe9c33f3d8b204c4ee79 Mon Sep 17 00:00:00 2001 From: gthomas2 Date: Tue, 6 Jan 2015 17:20:27 +0000 Subject: [PATCH 270/370] Fix images added in word 2011 --- src/PhpWord/Element/Image.php | 20 +++++++++++++++++++- src/PhpWord/Reader/Word2007/AbstractPart.php | 9 +++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/PhpWord/Element/Image.php b/src/PhpWord/Element/Image.php index 03637067..0eb3d937 100644 --- a/src/PhpWord/Element/Image.php +++ b/src/PhpWord/Element/Image.php @@ -65,6 +65,13 @@ class Image extends AbstractElement */ private $watermark; + /** + * Name of image + * + * @var string + */ + private $name; + /** * Image type * @@ -131,11 +138,12 @@ class Image extends AbstractElement * @throws \PhpOffice\PhpWord\Exception\InvalidImageException * @throws \PhpOffice\PhpWord\Exception\UnsupportedImageTypeException */ - public function __construct($source, $style = null, $watermark = false) + public function __construct($source, $style = null, $watermark = false, $name = null) { $this->source = $source; $this->setIsWatermark($watermark); $this->style = $this->setNewStyle(new ImageStyle(), $style, true); + $this->name = $name; $this->checkImage(); } @@ -170,6 +178,16 @@ class Image extends AbstractElement return $this->sourceType; } + /** + * Get image name + * + * @return null|string + */ + public function getName() + { + return $this->name; + } + /** * Get image media ID * diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index f64886cf..d8155eb5 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -260,6 +260,15 @@ abstract class AbstractPart } $parent->addImage($imageSource); } + } elseif ($node->nodeName == 'w:drawing') { + // Office 2011 Images + $name = $xmlReader->getAttribute('name', $node, 'wp:inline/a:graphic/a:graphicData/pic:pic/pic:nvPicPr/pic:cNvPr'); + $embedId = $xmlReader->getAttribute('r:embed', $node, 'wp:inline/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip'); + $target = $this->getMediaTarget($docPart, $embedId); + if (!is_null($target)) { + $imageSource = "zip://{$this->docFile}#{$target}"; + $parent->addImage($imageSource, null, false, $name); + } } elseif ($node->nodeName == 'w:object') { // Object $rId = $xmlReader->getAttribute('r:id', $node, 'o:OLEObject'); From 9b722a5b0cc03e7e46390fba9c011c88e0dca46d Mon Sep 17 00:00:00 2001 From: gthomas2 Date: Tue, 6 Jan 2015 17:36:11 +0000 Subject: [PATCH 271/370] Added missing namespaces --- src/PhpWord/Shared/XMLReader.php | 195 +++++++++++++++++++++++++++++++ 1 file changed, 195 insertions(+) create mode 100644 src/PhpWord/Shared/XMLReader.php diff --git a/src/PhpWord/Shared/XMLReader.php b/src/PhpWord/Shared/XMLReader.php new file mode 100644 index 00000000..44ee07cd --- /dev/null +++ b/src/PhpWord/Shared/XMLReader.php @@ -0,0 +1,195 @@ +open($zipFile); + $content = $zip->getFromName($xmlFile); + $zip->close(); + + if ($content === false) { + return false; + } else { + return $this->getDomFromString($content); + } + } + + /** + * Get DOMDocument from content string + * + * @param string $content + * @return \DOMDocument + */ + public function getDomFromString($content) + { + $this->dom = new \DOMDocument(); + $this->dom->loadXML($content); + + return $this->dom; + } + + /** + * Get elements + * + * @param string $path + * @param \DOMElement $contextNode + * @return \DOMNodeList + */ + public function getElements($path, \DOMElement $contextNode = null) + { + if ($this->dom === null) { + return array(); + } + if ($this->xpath === null) { + $this->xpath = new \DOMXpath($this->dom); + // GT Mod - required for reading images + $this->xpath->registerNamespace('a', 'http://schemas.openxmlformats.org/drawingml/2006/main'); + $this->xpath->registerNamespace('pic', 'http://schemas.openxmlformats.org/drawingml/2006/picture'); + } + + if (is_null($contextNode)) { + return $this->xpath->query($path); + } else { + return $this->xpath->query($path, $contextNode); + } + } + + /** + * Get element + * + * @param string $path + * @param \DOMElement $contextNode + * @return \DOMElement|null + */ + public function getElement($path, \DOMElement $contextNode = null) + { + $elements = $this->getElements($path, $contextNode); + if ($elements->length > 0) { + return $elements->item(0); + } else { + return null; + } + } + + /** + * Get element attribute + * + * @param string $attribute + * @param \DOMElement $contextNode + * @param string $path + * @return string|null + */ + public function getAttribute($attribute, \DOMElement $contextNode = null, $path = null) + { + $return = null; + if ($path !== null) { + $elements = $this->getElements($path, $contextNode); + if ($elements->length > 0) { + /** @var \DOMElement $node Type hint */ + $node = $elements->item(0); + $return = $node->getAttribute($attribute); + } + } else { + if ($contextNode !== null) { + $return = $contextNode->getAttribute($attribute); + } + } + + return ($return == '') ? null : $return; + } + + /** + * Get element value + * + * @param string $path + * @param \DOMElement $contextNode + * @return string|null + */ + public function getValue($path, \DOMElement $contextNode = null) + { + $elements = $this->getElements($path, $contextNode); + if ($elements->length > 0) { + return $elements->item(0)->nodeValue; + } else { + return null; + } + } + + /** + * Count elements + * + * @param string $path + * @param \DOMElement $contextNode + * @return integer + */ + public function countElements($path, \DOMElement $contextNode = null) + { + $elements = $this->getElements($path, $contextNode); + + return $elements->length; + } + + /** + * Element exists + * + * @param string $path + * @param \DOMElement $contextNode + * @return boolean + */ + public function elementExists($path, \DOMElement $contextNode = null) + { + return $this->getElements($path, $contextNode)->length > 0; + } +} From 566e625b85b80f503db69d3e0e635a817dc0ef10 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 25 Mar 2018 22:46:50 +0200 Subject: [PATCH 272/370] merge/add test/cleanup --- composer.json | 2 +- src/PhpWord/Element/AbstractContainer.php | 2 +- src/PhpWord/Element/Image.php | 15 +- src/PhpWord/Reader/Word2007/AbstractPart.php | 9 +- src/PhpWord/Shared/XMLReader.php | 195 ------------------ tests/PhpWord/Reader/Word2007/ElementTest.php | 36 ++++ tests/PhpWord/Reader/Word2007Test.php | 14 ++ .../PhpWord/_files/documents/reader-2011.docx | Bin 0 -> 36938 bytes 8 files changed, 73 insertions(+), 200 deletions(-) delete mode 100644 src/PhpWord/Shared/XMLReader.php create mode 100644 tests/PhpWord/_files/documents/reader-2011.docx diff --git a/composer.json b/composer.json index 742e4bc8..6dc9be2c 100644 --- a/composer.json +++ b/composer.json @@ -61,7 +61,7 @@ "php": "^5.3.3 || ^7.0", "ext-xml": "*", "zendframework/zend-escaper": "^2.2", - "phpoffice/common": "^0.2" + "phpoffice/common": "dev-develop" }, "require-dev": { "phpunit/phpunit": "^4.8.36 || ^5.0", diff --git a/src/PhpWord/Element/AbstractContainer.php b/src/PhpWord/Element/AbstractContainer.php index ec990720..204d4a73 100644 --- a/src/PhpWord/Element/AbstractContainer.php +++ b/src/PhpWord/Element/AbstractContainer.php @@ -35,7 +35,7 @@ namespace PhpOffice\PhpWord\Element; * @method TOC addTOC(mixed $fontStyle = null, mixed $tocStyle = null, int $minDepth = 1, int $maxDepth = 9) * @method PageBreak addPageBreak() * @method Table addTable(mixed $style = null) - * @method Image addImage(string $source, mixed $style = null, bool $isWatermark = false) + * @method Image addImage(string $source, mixed $style = null, bool $isWatermark = false, $name = null) * @method OLEObject addOLEObject(string $source, mixed $style = null) * @method TextBox addTextBox(mixed $style = null) * @method Field addField(string $type = null, array $properties = array(), array $options = array(), mixed $text = null) diff --git a/src/PhpWord/Element/Image.php b/src/PhpWord/Element/Image.php index 0eb3d937..bae87ff5 100644 --- a/src/PhpWord/Element/Image.php +++ b/src/PhpWord/Element/Image.php @@ -134,6 +134,7 @@ class Image extends AbstractElement * @param string $source * @param mixed $style * @param bool $watermark + * @param string $name * * @throws \PhpOffice\PhpWord\Exception\InvalidImageException * @throws \PhpOffice\PhpWord\Exception\UnsupportedImageTypeException @@ -141,9 +142,9 @@ class Image extends AbstractElement public function __construct($source, $style = null, $watermark = false, $name = null) { $this->source = $source; - $this->setIsWatermark($watermark); $this->style = $this->setNewStyle(new ImageStyle(), $style, true); - $this->name = $name; + $this->setIsWatermark($watermark); + $this->setName($name); $this->checkImage(); } @@ -178,6 +179,16 @@ class Image extends AbstractElement return $this->sourceType; } + /** + * Sets the image name + * + * @param string $value + */ + public function setName($value) + { + $this->name = $value; + } + /** * Get image name * diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index d8155eb5..c7ec4ca7 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -261,7 +261,12 @@ abstract class AbstractPart $parent->addImage($imageSource); } } elseif ($node->nodeName == 'w:drawing') { - // Office 2011 Images + // Office 2011 Image + $xmlReader->registerNamespace('wp', 'http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing'); + $xmlReader->registerNamespace('r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'); + $xmlReader->registerNamespace('pic', 'http://schemas.openxmlformats.org/drawingml/2006/picture'); + $xmlReader->registerNamespace('a', 'http://schemas.openxmlformats.org/drawingml/2006/main'); + $name = $xmlReader->getAttribute('name', $node, 'wp:inline/a:graphic/a:graphicData/pic:pic/pic:nvPicPr/pic:cNvPr'); $embedId = $xmlReader->getAttribute('r:embed', $node, 'wp:inline/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip'); $target = $this->getMediaTarget($docPart, $embedId); @@ -573,6 +578,8 @@ abstract class AbstractPart return $possibleAttribute; } } + + return null; } return $attributes; diff --git a/src/PhpWord/Shared/XMLReader.php b/src/PhpWord/Shared/XMLReader.php deleted file mode 100644 index 44ee07cd..00000000 --- a/src/PhpWord/Shared/XMLReader.php +++ /dev/null @@ -1,195 +0,0 @@ -open($zipFile); - $content = $zip->getFromName($xmlFile); - $zip->close(); - - if ($content === false) { - return false; - } else { - return $this->getDomFromString($content); - } - } - - /** - * Get DOMDocument from content string - * - * @param string $content - * @return \DOMDocument - */ - public function getDomFromString($content) - { - $this->dom = new \DOMDocument(); - $this->dom->loadXML($content); - - return $this->dom; - } - - /** - * Get elements - * - * @param string $path - * @param \DOMElement $contextNode - * @return \DOMNodeList - */ - public function getElements($path, \DOMElement $contextNode = null) - { - if ($this->dom === null) { - return array(); - } - if ($this->xpath === null) { - $this->xpath = new \DOMXpath($this->dom); - // GT Mod - required for reading images - $this->xpath->registerNamespace('a', 'http://schemas.openxmlformats.org/drawingml/2006/main'); - $this->xpath->registerNamespace('pic', 'http://schemas.openxmlformats.org/drawingml/2006/picture'); - } - - if (is_null($contextNode)) { - return $this->xpath->query($path); - } else { - return $this->xpath->query($path, $contextNode); - } - } - - /** - * Get element - * - * @param string $path - * @param \DOMElement $contextNode - * @return \DOMElement|null - */ - public function getElement($path, \DOMElement $contextNode = null) - { - $elements = $this->getElements($path, $contextNode); - if ($elements->length > 0) { - return $elements->item(0); - } else { - return null; - } - } - - /** - * Get element attribute - * - * @param string $attribute - * @param \DOMElement $contextNode - * @param string $path - * @return string|null - */ - public function getAttribute($attribute, \DOMElement $contextNode = null, $path = null) - { - $return = null; - if ($path !== null) { - $elements = $this->getElements($path, $contextNode); - if ($elements->length > 0) { - /** @var \DOMElement $node Type hint */ - $node = $elements->item(0); - $return = $node->getAttribute($attribute); - } - } else { - if ($contextNode !== null) { - $return = $contextNode->getAttribute($attribute); - } - } - - return ($return == '') ? null : $return; - } - - /** - * Get element value - * - * @param string $path - * @param \DOMElement $contextNode - * @return string|null - */ - public function getValue($path, \DOMElement $contextNode = null) - { - $elements = $this->getElements($path, $contextNode); - if ($elements->length > 0) { - return $elements->item(0)->nodeValue; - } else { - return null; - } - } - - /** - * Count elements - * - * @param string $path - * @param \DOMElement $contextNode - * @return integer - */ - public function countElements($path, \DOMElement $contextNode = null) - { - $elements = $this->getElements($path, $contextNode); - - return $elements->length; - } - - /** - * Element exists - * - * @param string $path - * @param \DOMElement $contextNode - * @return boolean - */ - public function elementExists($path, \DOMElement $contextNode = null) - { - return $this->getElements($path, $contextNode)->length > 0; - } -} diff --git a/tests/PhpWord/Reader/Word2007/ElementTest.php b/tests/PhpWord/Reader/Word2007/ElementTest.php index 75060625..cb72ef9f 100644 --- a/tests/PhpWord/Reader/Word2007/ElementTest.php +++ b/tests/PhpWord/Reader/Word2007/ElementTest.php @@ -236,4 +236,40 @@ class ElementTest extends AbstractTestReader $this->assertEquals('Title', $formattedTitle->getStyle()); $this->assertInstanceOf('PhpOffice\PhpWord\Element\TextRun', $formattedTitle->getText()); } + + /** + * Test reading Drawing + */ + public function testReadDrawing() + { + $documentXml = ' + + + + + + + + + + + + + + + + + + + + + + + '; + + $phpWord = $this->getDocumentFromString(array('document' => $documentXml)); + + $elements = $phpWord->getSection(0)->getElements(); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\TextRun', $elements[0]); + } } diff --git a/tests/PhpWord/Reader/Word2007Test.php b/tests/PhpWord/Reader/Word2007Test.php index 62d23a68..e4ea62de 100644 --- a/tests/PhpWord/Reader/Word2007Test.php +++ b/tests/PhpWord/Reader/Word2007Test.php @@ -64,4 +64,18 @@ class Word2007Test extends \PHPUnit\Framework\TestCase $doc = TestHelperDOCX::getDocument($phpWord); $this->assertFalse($doc->elementExists('/w:document/w:body/w:p/w:r[w:t/node()="italics"]/w:rPr/w:b')); } + + /** + * Load a Word 2011 file + */ + public function testLoadWord2011() + { + $filename = __DIR__ . '/../_files/documents/reader-2011.docx'; + $phpWord = IOFactory::load($filename); + + $this->assertInstanceOf('PhpOffice\\PhpWord\\PhpWord', $phpWord); + + $doc = TestHelperDOCX::getDocument($phpWord); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p[3]/w:r/w:pict/v:shape/v:imagedata')); + } } diff --git a/tests/PhpWord/_files/documents/reader-2011.docx b/tests/PhpWord/_files/documents/reader-2011.docx new file mode 100644 index 0000000000000000000000000000000000000000..be94eca5242caeb7c9beda45741d5bcfd3b5838e GIT binary patch literal 36938 zcmeFYV|->!urK<=p4hf++nDG{Cbn%)>`ZLiwrz7_POOQIllR?w-?Q(z_rtxP&#Cp` zL$6i8?q2`us`^*AqAVCV8UPXi4FCX$0nx^@*v23LfC>ZvfC_*H)e^O{bvChe)>HMc zH*wNoaJR80$_EFf$_0Ra-T!~&f8!ZwR2{SJXF}>yKNS?~RtwJyEiZ@0Ysb?noJVAO zAWQX3uxal3n<}IV6ex1dv`V7ygR+p9ei4r`)^A0hUnGA{?>vYhgNwuN zOJrA!M*wHR+1i4qz=a|fZH6IF8#>OWLhy!65ANq-;wr0LrrWEkDKmP@SQ7f{)de+P z6|QeckN}DOO*hvN4!vQSUBEWpUD4lo27$>VDTup-%nbR+*^=!1j8)}q78VwYk#6;Qj;EETk{pKTbq2}+@)@)Cs*=6Jjp4de!1un~6iwyhDkv2x zn$u4Ao2L2F6Np{}o3E`Pl9t*n6RoES(>%r7L& zdOBrFxa=hAT;U`G5hA)^en0CDXuWp21CoL}i=WIF(tA5(v_=B6<({kD|S@`5Vo7w-UP8`Hm4uQRB6n$XJf%aZz@4#%2_kvucbuo4#Ms&nqtv!JJBC_I=BCJ!c@ z@zvW@8%6WuDB=)XkmE10Mx)-Y9d4$M@a>n2`hVI-W|-JG^jAyMm-XNQph4X19E}*&->oAPMx! zQ-l-$93>!l_L8GDrztOmV?5Gyy1X`2J7eUpMZ6Q%Ak7_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 deletions(-) diff --git a/docs/installing.rst b/docs/installing.rst index 4f407f54..34353be8 100644 --- a/docs/installing.rst +++ b/docs/installing.rst @@ -54,7 +54,5 @@ Example: Using samples ------------- -After installation, you can browse and use the samples that we've -provided, either by command line or using browser. If you can access -your PHPWord library folder using browser, point your browser to the -``samples`` folder, e.g. ``http://localhost/PhpWord/samples/``. +More examples are provided in the ``samples`` directory. +For an easy access to those samples launch ``php -S localhost:8000`` in the samples directory then browse to http://localhost:8000 to view the samples. From 67b18c32e7e4fa0bb0fa5cbe5c14efdf06437a91 Mon Sep 17 00:00:00 2001 From: troosan Date: Mon, 2 Apr 2018 14:50:31 +0200 Subject: [PATCH 274/370] fix [ci skip] --- samples/Sample_Header.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/Sample_Header.php b/samples/Sample_Header.php index ac51f983..faa39a35 100644 --- a/samples/Sample_Header.php +++ b/samples/Sample_Header.php @@ -83,7 +83,7 @@ function write($phpWord, $filename, $writers) $result .= EOL; } - $result .= getEndingNotes($writers); + $result .= getEndingNotes($writers, $filename); return $result; } @@ -95,7 +95,7 @@ function write($phpWord, $filename, $writers) * * @return string */ -function getEndingNotes($writers) +function getEndingNotes($writers, $filename) { $result = ''; From ca82e19bba2e81f32530292b53f95cf623268c58 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 7 Apr 2018 11:24:52 +0200 Subject: [PATCH 275/370] support internal link in addHtml method --- src/PhpWord/Shared/Html.php | 6 +++++- tests/PhpWord/Shared/HtmlTest.php | 12 ++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 0f5f446a..caa49034 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -664,6 +664,10 @@ class Html } self::parseInlineStyle($node, $styles['font']); - return $element->addLink($target, $node->textContent, $styles['font'], $styles['paragraph']); + if(strpos($target, '#') === 0) { + return $element->addLink(substr($target, 1), $node->textContent, $styles['font'], $styles['paragraph'], true); + } else { + return $element->addLink($target, $node->textContent, $styles['font'], $styles['paragraph']); + } } } diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index 6122924f..2c496081 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -353,5 +353,17 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:hyperlink')); $this->assertEquals('link text', $doc->getElement('/w:document/w:body/w:p/w:hyperlink/w:r/w:t')->nodeValue); + + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $section->addBookmark('bookmark'); + $html = '

                  internal link text

                  '; + Html::addHtml($section, $html); + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:hyperlink')); + $this->assertTrue($doc->getElement('/w:document/w:body/w:p/w:hyperlink')->hasAttribute('w:anchor')); + $this->assertEquals('bookmark', $doc->getElement('/w:document/w:body/w:p/w:hyperlink')->getAttribute('w:anchor')); + } } From a7981717b343dd09ece3962d36ebaf15e6852c4b Mon Sep 17 00:00:00 2001 From: pcworld <0188801@gmail.com> Date: Mon, 9 Apr 2018 02:45:50 +0200 Subject: [PATCH 276/370] addImage docs: Warn about user-generated strings --- docs/elements.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/elements.rst b/docs/elements.rst index c73ffa06..f2637ac9 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -234,7 +234,7 @@ To add an image, use the ``addImage`` method to sections, headers, footers, text $section->addImage($src, [$style]); -- ``$src``. String path to a local image, URL of a remote image or the image data, as a string. +- ``$src``. String path to a local image, URL of a remote image or the image data, as a string. Warning: Do not pass user-generated strings here, as that would allow an attacker to read arbitrary files or perform server-side request forgery by passing file paths or URLs instead of image data. - ``$style``. See :ref:`image-style`. Examples: From 6253adaba15a72f5310970d180e7f5b1c13a3242 Mon Sep 17 00:00:00 2001 From: pcworld <0188801@gmail.com> Date: Mon, 9 Apr 2018 02:47:16 +0200 Subject: [PATCH 277/370] Warn about parsing user-generated HTML --- src/PhpWord/Shared/Html.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index d8a10b57..3f34968d 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -34,6 +34,8 @@ class Html * Add HTML parts. * * Note: $stylesheet parameter is removed to avoid PHPMD error for unused parameter + * Warning: Do not pass user-generated HTML here, as that would allow an attacker to read arbitrary + * files or perform server-side request forgery by passing local file paths or URLs in . * * @param \PhpOffice\PhpWord\Element\AbstractContainer $element Where the parts need to be added * @param string $html The code to parse From e885b371bc4793fc43ed6d8c4586cd537f810b01 Mon Sep 17 00:00:00 2001 From: Frank Liepert Date: Tue, 10 Apr 2018 20:30:04 +0200 Subject: [PATCH 278/370] Add missing param annotation --- samples/Sample_Header.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/Sample_Header.php b/samples/Sample_Header.php index faa39a35..f0fc6266 100644 --- a/samples/Sample_Header.php +++ b/samples/Sample_Header.php @@ -92,7 +92,7 @@ function write($phpWord, $filename, $writers) * Get ending notes * * @param array $writers - * + * @param mixed $filename * @return string */ function getEndingNotes($writers, $filename) From 081c6722f62aa15a88af8fdff8dca3b58b136bb8 Mon Sep 17 00:00:00 2001 From: Frank Liepert Date: Wed, 11 Apr 2018 09:56:02 +0200 Subject: [PATCH 279/370] Add support for table indent --- CHANGELOG.md | 1 + docs/styles.rst | 1 + src/PhpWord/ComplexType/TblWidth.php | 59 +++++++++++++++++++ src/PhpWord/Reader/Word2007/AbstractPart.php | 24 ++++++++ src/PhpWord/Style/Table.php | 24 ++++++++ src/PhpWord/Writer/Word2007/Style/Table.php | 16 +++++ tests/PhpWord/Reader/Word2007/StyleTest.php | 19 ++++++ tests/PhpWord/Style/TableTest.php | 11 ++++ .../Writer/Word2007/Style/TableTest.php | 25 +++++++- 9 files changed, 179 insertions(+), 1 deletion(-) create mode 100644 src/PhpWord/ComplexType/TblWidth.php diff --git a/CHANGELOG.md b/CHANGELOG.md index d0b39ce1..e1d0937f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ v0.15.0 (?? ??? 2018) - Added support for Image text wrapping distance @troosan #1310 - Added parsing of CSS line-height and text-indent in HTML reader @troosan #1316 - Added the ability to enable gridlines and axislabels on charts @FrankMeyer #576 +- Add support for table indent (tblInd) @Trainmaster ### Fixed - Fix reading of docx default style - @troosan #1238 diff --git a/docs/styles.rst b/docs/styles.rst index 0bda3faf..88caeaeb 100644 --- a/docs/styles.rst +++ b/docs/styles.rst @@ -104,6 +104,7 @@ Available Table style options: - ``border(Top|Right|Bottom|Left)Color``. Border color, e.g. '9966CC'. - ``border(Top|Right|Bottom|Left)Size``. Border size in *twip*. - ``cellMargin(Top|Right|Bottom|Left)``. Cell margin in *twip*. +- ``indent``. Table indent from leading margin. Must be an instance of ``\PhpOffice\PhpWord\ComplexType\TblWidth``. - ``width``. Table width in percent. - ``unit``. The unit to use for the width. One of ``\PhpOffice\PhpWord\SimpleType\TblWidth``. Defaults to *auto*. - ``layout``. Table layout, either *fixed* or *autofit* See ``\PhpOffice\PhpWord\Style\Table`` for constants. diff --git a/src/PhpWord/ComplexType/TblWidth.php b/src/PhpWord/ComplexType/TblWidth.php new file mode 100644 index 00000000..91dedc3d --- /dev/null +++ b/src/PhpWord/ComplexType/TblWidth.php @@ -0,0 +1,59 @@ +value = $value; + TblWidthSimpleType::validate($type); + $this->type = $type; + } + + /** + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * @return int + */ + public function getValue() + { + return $this->value; + } +} diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index f64886cf..48a84ff2 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -18,6 +18,7 @@ namespace PhpOffice\PhpWord\Reader\Word2007; use PhpOffice\Common\XMLReader; +use PhpOffice\PhpWord\ComplexType\TblWidth as TblWidthComplexType; use PhpOffice\PhpWord\Element\AbstractContainer; use PhpOffice\PhpWord\Element\TextRun; use PhpOffice\PhpWord\Element\TrackChange; @@ -472,6 +473,11 @@ abstract class AbstractPart if ($tablePositionNode !== null) { $style['position'] = $this->readTablePosition($xmlReader, $tablePositionNode); } + + $indentNode = $xmlReader->getElement('w:tblInd', $styleNode); + if ($indentNode !== null) { + $style['indent'] = $this->readTableIndent($xmlReader, $indentNode); + } } } @@ -503,6 +509,24 @@ abstract class AbstractPart return $this->readStyleDefs($xmlReader, $domNode, $styleDefs); } + /** + * Read w:tblInd + * + * @param \PhpOffice\Common\XMLReader $xmlReader + * @param \DOMElement $domNode + * @return TblWidthComplexType + */ + private function readTableIndent(XMLReader $xmlReader, \DOMElement $domNode) + { + $styleDefs = array( + 'value' => array(self::READ_VALUE, '.', 'w:w'), + 'type' => array(self::READ_VALUE, '.', 'w:type'), + ); + $styleDefs = $this->readStyleDefs($xmlReader, $domNode, $styleDefs); + + return new TblWidthComplexType((int) $styleDefs['value'], $styleDefs['type']); + } + /** * Read w:tcPr * diff --git a/src/PhpWord/Style/Table.php b/src/PhpWord/Style/Table.php index feb028da..b622c78b 100644 --- a/src/PhpWord/Style/Table.php +++ b/src/PhpWord/Style/Table.php @@ -17,6 +17,7 @@ namespace PhpOffice\PhpWord\Style; +use PhpOffice\PhpWord\ComplexType\TblWidth as TblWidthComplexType; use PhpOffice\PhpWord\SimpleType\Jc; use PhpOffice\PhpWord\SimpleType\JcTable; use PhpOffice\PhpWord\SimpleType\TblWidth; @@ -159,6 +160,9 @@ class Table extends Border */ private $position; + /** @var TblWidthComplexType|null */ + private $indent; + /** * Create new table style * @@ -724,4 +728,24 @@ class Table extends Border return $this; } + + /** + * @return TblWidthComplexType + */ + public function getIndent() + { + return $this->indent; + } + + /** + * @param TblWidthComplexType $indent + * @return self + * @see http://www.datypic.com/sc/ooxml/e-w_tblInd-1.html + */ + public function setIndent(TblWidthComplexType $indent) + { + $this->indent = $indent; + + return $this; + } } diff --git a/src/PhpWord/Writer/Word2007/Style/Table.php b/src/PhpWord/Writer/Word2007/Style/Table.php index eb5af86d..7f49be7c 100644 --- a/src/PhpWord/Writer/Word2007/Style/Table.php +++ b/src/PhpWord/Writer/Word2007/Style/Table.php @@ -79,6 +79,7 @@ class Table extends AbstractStyle $this->writeTblWidth($xmlWriter, 'w:tblW', $style->getUnit(), $style->getWidth()); $this->writeTblWidth($xmlWriter, 'w:tblCellSpacing', TblWidth::TWIP, $style->getCellSpacing()); + $this->writeIndent($xmlWriter, $style); $this->writeLayout($xmlWriter, $style->getLayout()); // Position @@ -216,4 +217,19 @@ class Table extends AbstractStyle { $this->width = $value; } + + /** + * @param XMLWriter $xmlWriter + * @param TableStyle $style + */ + private function writeIndent(XMLWriter $xmlWriter, TableStyle $style) + { + $indent = $style->getIndent(); + + if ($indent === null) { + return; + } + + $this->writeTblWidth($xmlWriter, 'w:tblInd', $indent->getType(), $indent->getValue()); + } } diff --git a/tests/PhpWord/Reader/Word2007/StyleTest.php b/tests/PhpWord/Reader/Word2007/StyleTest.php index 9bb6d3bd..d64079fa 100644 --- a/tests/PhpWord/Reader/Word2007/StyleTest.php +++ b/tests/PhpWord/Reader/Word2007/StyleTest.php @@ -126,4 +126,23 @@ class StyleTest extends AbstractTestReader $fontStyle = $textRun->getElement(0)->getFontStyle(); $this->assertEquals(15, $fontStyle->getPosition()); } + + public function testReadIndent() + { + $documentXml = ' + + + + '; + + $phpWord = $this->getDocumentFromString(array('document' => $documentXml)); + + $elements = $phpWord->getSection(0)->getElements(); + $this->assertInstanceOf('PhpOffice\PhpWord\Element\Table', $elements[0]); + $this->assertInstanceOf('PhpOffice\PhpWord\Style\Table', $elements[0]->getStyle()); + /** @var \PhpOffice\PhpWord\Style\Table $tableStyle */ + $tableStyle = $elements[0]->getStyle(); + $this->assertSame(TblWidth::TWIP, $tableStyle->getIndent()->getType()); + $this->assertSame(2160, $tableStyle->getIndent()->getValue()); + } } diff --git a/tests/PhpWord/Style/TableTest.php b/tests/PhpWord/Style/TableTest.php index 332d31aa..91fc3550 100644 --- a/tests/PhpWord/Style/TableTest.php +++ b/tests/PhpWord/Style/TableTest.php @@ -17,6 +17,7 @@ namespace PhpOffice\PhpWord\Style; +use PhpOffice\PhpWord\ComplexType\TblWidth as TblWidthComplexType; use PhpOffice\PhpWord\SimpleType\JcTable; use PhpOffice\PhpWord\SimpleType\TblWidth; @@ -57,6 +58,7 @@ class TableTest extends \PHPUnit\Framework\TestCase $this->assertNull($object->getBgColor()); $this->assertEquals(Table::LAYOUT_AUTO, $object->getLayout()); $this->assertEquals(TblWidth::AUTO, $object->getUnit()); + $this->assertNull($object->getIndent()); } /** @@ -208,4 +210,13 @@ class TableTest extends \PHPUnit\Framework\TestCase $this->assertNotNull($object->getPosition()); $this->assertEquals(TablePosition::VANCHOR_PAGE, $object->getPosition()->getVertAnchor()); } + + public function testIndent() + { + $indent = new TblWidthComplexType(100, TblWidth::TWIP); + + $table = new Table(array('indent' => $indent)); + + $this->assertSame($indent, $table->getIndent()); + } } diff --git a/tests/PhpWord/Writer/Word2007/Style/TableTest.php b/tests/PhpWord/Writer/Word2007/Style/TableTest.php index 364a34d6..ec3b2483 100644 --- a/tests/PhpWord/Writer/Word2007/Style/TableTest.php +++ b/tests/PhpWord/Writer/Word2007/Style/TableTest.php @@ -17,6 +17,8 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Style; +use PhpOffice\PhpWord\ComplexType\TblWidth as TblWidthComplexType; +use PhpOffice\PhpWord\SimpleType\TblWidth; use PhpOffice\PhpWord\Style\Table; use PhpOffice\PhpWord\Style\TablePosition; use PhpOffice\PhpWord\TestHelperDOCX; @@ -75,7 +77,7 @@ class TableTest extends \PHPUnit\Framework\TestCase $path = '/w:document/w:body/w:tbl/w:tblPr/w:tblCellSpacing'; $this->assertTrue($doc->elementExists($path)); $this->assertEquals(10.3, $doc->getElementAttribute($path, 'w:w')); - $this->assertEquals(\PhpOffice\PhpWord\SimpleType\TblWidth::TWIP, $doc->getElementAttribute($path, 'w:type')); + $this->assertEquals(TblWidth::TWIP, $doc->getElementAttribute($path, 'w:type')); } /** @@ -118,4 +120,25 @@ class TableTest extends \PHPUnit\Framework\TestCase $this->assertEquals(TablePosition::YALIGN_TOP, $doc->getElementAttribute($path, 'w:tblpYSpec')); $this->assertEquals(60, $doc->getElementAttribute($path, 'w:tblpY')); } + + public function testIndent() + { + $value = 100; + $type = TblWidth::TWIP; + + $tableStyle = new Table(); + $tableStyle->setIndent(new TblWidthComplexType($value, $type)); + + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $table = $section->addTable($tableStyle); + $table->addRow(); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + + $path = '/w:document/w:body/w:tbl/w:tblPr/w:tblInd'; + $this->assertTrue($doc->elementExists($path)); + $this->assertSame($value, (int) $doc->getElementAttribute($path, 'w:w')); + $this->assertSame($type, $doc->getElementAttribute($path, 'w:type')); + } } From 853fcec1b6a20a7c5e75eeac1a33ad33a07ef527 Mon Sep 17 00:00:00 2001 From: Frank Liepert Date: Tue, 10 Apr 2018 11:18:37 +0200 Subject: [PATCH 280/370] Fix documented unit for image height/width --- CHANGELOG.md | 1 + docs/styles.rst | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0b39ce1..7dcefac2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ v0.15.0 (?? ??? 2018) ### Changed - Remove zend-stdlib dependency @Trainmaster #1284 +- The default unit for `\PhpOffice\PhpWord\Style\Image` changed from `px` to `pt`. v0.14.0 (29 Dec 2017) diff --git a/docs/styles.rst b/docs/styles.rst index 0bda3faf..8cb6fa23 100644 --- a/docs/styles.rst +++ b/docs/styles.rst @@ -149,10 +149,10 @@ Image Available Image style options: - ``alignment``. See ``\PhpOffice\PhpWord\SimpleType\Jc`` class for the details. -- ``height``. Height in pixels. +- ``height``. Height in *pt*. - ``marginLeft``. Left margin in inches, can be negative. - ``marginTop``. Top margin in inches, can be negative. -- ``width``. Width in pixels. +- ``width``. Width in *pt*. - ``wrappingStyle``. Wrapping style, *inline*, *square*, *tight*, *behind*, or *infront*. - ``wrapDistanceTop``. Top text wrapping in pixels. - ``wrapDistanceBottom``. Bottom text wrapping in pixels. From 833cf07c1acfe86b4bb5ca9786692a59991f2643 Mon Sep 17 00:00:00 2001 From: Frank Liepert Date: Tue, 10 Apr 2018 11:19:15 +0200 Subject: [PATCH 281/370] Consistently format "pt" unit --- docs/elements.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/elements.rst b/docs/elements.rst index 8f33b503..dd398e46 100644 --- a/docs/elements.rst +++ b/docs/elements.rst @@ -435,8 +435,8 @@ Available line style attributes: - ``dash``. Line types: dash, rounddot, squaredot, dashdot, longdash, longdashdot, longdashdotdot. - ``beginArrow``. Start type of arrow: block, open, classic, diamond, oval. - ``endArrow``. End type of arrow: block, open, classic, diamond, oval. -- ``width``. Line-object width in pt. -- ``height``. Line-object height in pt. +- ``width``. Line-object width in *pt*. +- ``height``. Line-object height in *pt*. - ``flip``. Flip the line element: true, false. Chart From 9bc85347ef074a2e4c3bf983e2b68c235adefc02 Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 14 Apr 2018 21:15:36 +0200 Subject: [PATCH 282/370] fix code formatting --- CHANGELOG.md | 1 + src/PhpWord/Shared/Html.php | 8 ++++---- tests/PhpWord/Shared/HtmlTest.php | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7dcefac2..fb07fcc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ v0.15.0 (?? ??? 2018) - Added support for Image text wrapping distance @troosan #1310 - Added parsing of CSS line-height and text-indent in HTML reader @troosan #1316 - Added the ability to enable gridlines and axislabels on charts @FrankMeyer #576 +- Added parsing of internal links in HTML reader @lalop #1336 ### Fixed - Fix reading of docx default style - @troosan #1238 diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index e27e706e..7d8ee51f 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -723,10 +723,10 @@ class Html } self::parseInlineStyle($node, $styles['font']); - if(strpos($target, '#') === 0) { - return $element->addLink(substr($target, 1), $node->textContent, $styles['font'], $styles['paragraph'], true); - } else { - return $element->addLink($target, $node->textContent, $styles['font'], $styles['paragraph']); + if (strpos($target, '#') === 0) { + return $element->addLink(substr($target, 1), $node->textContent, $styles['font'], $styles['paragraph'], true); } + + return $element->addLink($target, $node->textContent, $styles['font'], $styles['paragraph']); } } diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index c9e4b4b1..9ec2249d 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -453,7 +453,7 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:hyperlink')); $this->assertEquals('link text', $doc->getElement('/w:document/w:body/w:p/w:hyperlink/w:r/w:t')->nodeValue); - + $phpWord = new \PhpOffice\PhpWord\PhpWord(); $section = $phpWord->addSection(); $section->addBookmark('bookmark'); @@ -464,7 +464,6 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:hyperlink')); $this->assertTrue($doc->getElement('/w:document/w:body/w:p/w:hyperlink')->hasAttribute('w:anchor')); $this->assertEquals('bookmark', $doc->getElement('/w:document/w:body/w:p/w:hyperlink')->getAttribute('w:anchor')); - } public function testParseMalformedStyleIsIgnored() From dd27f668e0143198348d0882ee632e33a1baa111 Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 14 Apr 2018 22:42:58 +0200 Subject: [PATCH 283/370] add line height test [ci skip] --- tests/PhpWord/Shared/HtmlTest.php | 5 +++++ tests/PhpWord/Writer/Word2007/ElementTest.php | 2 +- tests/PhpWord/Writer/Word2007/Style/FontTest.php | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index 9ec2249d..f07b3f99 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -125,6 +125,7 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $section = $phpWord->addSection(); Html::addHtml($section, '

                  test

                  '); Html::addHtml($section, '

                  test

                  '); + Html::addHtml($section, '

                  test

                  '); $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); $this->assertTrue($doc->elementExists('/w:document/w:body/w:p[1]/w:pPr/w:spacing')); @@ -134,6 +135,10 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists('/w:document/w:body/w:p[2]/w:pPr/w:spacing')); $this->assertEquals(300, $doc->getElementAttribute('/w:document/w:body/w:p[2]/w:pPr/w:spacing', 'w:line')); $this->assertEquals(LineSpacingRule::EXACT, $doc->getElementAttribute('/w:document/w:body/w:p[2]/w:pPr/w:spacing', 'w:lineRule')); + + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p[3]/w:pPr/w:spacing')); + $this->assertEquals(Paragraph::LINE_HEIGHT * 1.2, $doc->getElementAttribute('/w:document/w:body/w:p[3]/w:pPr/w:spacing', 'w:line')); + $this->assertEquals(LineSpacingRule::AUTO, $doc->getElementAttribute('/w:document/w:body/w:p[3]/w:pPr/w:spacing', 'w:lineRule')); } /** diff --git a/tests/PhpWord/Writer/Word2007/ElementTest.php b/tests/PhpWord/Writer/Word2007/ElementTest.php index 979a4337..d365861a 100644 --- a/tests/PhpWord/Writer/Word2007/ElementTest.php +++ b/tests/PhpWord/Writer/Word2007/ElementTest.php @@ -256,7 +256,7 @@ class ElementTest extends \PHPUnit\Framework\TestCase { $phpWord = new PhpWord(); $section = $phpWord->addSection(); - $style = array('width' => 1000000, 'height' => 1000000); + $style = array('width' => 1000000, 'height' => 1000000, 'showAxisLabels' => true, 'showGridX' => true, 'showGridY' => true); $chartTypes = array('pie', 'doughnut', 'bar', 'line', 'area', 'scatter', 'radar'); $categories = array('A', 'B', 'C', 'D', 'E'); diff --git a/tests/PhpWord/Writer/Word2007/Style/FontTest.php b/tests/PhpWord/Writer/Word2007/Style/FontTest.php index c57f50ab..ccfffbfb 100644 --- a/tests/PhpWord/Writer/Word2007/Style/FontTest.php +++ b/tests/PhpWord/Writer/Word2007/Style/FontTest.php @@ -43,7 +43,7 @@ class FontTest extends \PHPUnit\Framework\TestCase $phpWord = new \PhpOffice\PhpWord\PhpWord(); $section = $phpWord->addSection(); $textrun = $section->addTextRun(); - $textrun->addText('سلام این یک پاراگراف راست به چپ است', array('rtl' => true)); + $textrun->addText('سلام این یک پاراگراف راست به چپ است', array('rtl' => true, 'lang' => 'ar-DZ')); $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); $file = 'word/document.xml'; From 85e1e5c280b89b45104ad7c270a9c07cada8d718 Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 14 Apr 2018 23:21:02 +0200 Subject: [PATCH 284/370] fix warning --- src/PhpWord/ComplexType/TblWidth.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/ComplexType/TblWidth.php b/src/PhpWord/ComplexType/TblWidth.php index 91dedc3d..0d1a2419 100644 --- a/src/PhpWord/ComplexType/TblWidth.php +++ b/src/PhpWord/ComplexType/TblWidth.php @@ -31,8 +31,8 @@ final class TblWidth private $value; /** - * @param int $value If omitted, then its value shall be assumed to be 0. - * @param string $type If omitted, then its value shall be assumed to be dxa. + * @param int $value If omitted, then its value shall be assumed to be 0 + * @param string $type If omitted, then its value shall be assumed to be dxa */ public function __construct($value = 0, $type = TblWidthSimpleType::TWIP) { From c52c96d6573363f764d7bfba42be3ce998d1dc0e Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 17 Apr 2018 07:34:57 +0200 Subject: [PATCH 285/370] add support for STYLEREF field --- samples/Sample_27_Field.php | 5 +++++ src/PhpWord/Element/Field.php | 4 ++++ src/PhpWord/Writer/Word2007/Element/Field.php | 3 +++ tests/PhpWord/Writer/Word2007/ElementTest.php | 1 + 4 files changed, 13 insertions(+) diff --git a/samples/Sample_27_Field.php b/samples/Sample_27_Field.php index 9c37dffe..4e7a5b22 100644 --- a/samples/Sample_27_Field.php +++ b/samples/Sample_27_Field.php @@ -6,15 +6,20 @@ include_once 'Sample_Header.php'; // New Word document echo date('H:i:s'), ' Create new PhpWord object', EOL; $phpWord = new \PhpOffice\PhpWord\PhpWord(); +PhpOffice\PhpWord\Style::addTitleStyle(1, array('size' => 14)); // New section $section = $phpWord->addSection(); +$section->addTitle('This page demos fields'); // Add Field elements // See Element/Field.php for all options $section->addText('Date field:'); $section->addField('DATE', array('dateformat' => 'dddd d MMMM yyyy H:mm:ss'), array('PreserveFormat')); +$section->addText('Style Ref field:'); +$section->addField('STYLEREF', array('StyleIdentifier' => 'Heading 1')); + $section->addText('Page field:'); $section->addField('PAGE', array('format' => 'Arabic')); diff --git a/src/PhpWord/Element/Field.php b/src/PhpWord/Element/Field.php index 0e5e28ed..2efc6b0b 100644 --- a/src/PhpWord/Element/Field.php +++ b/src/PhpWord/Element/Field.php @@ -78,6 +78,10 @@ class Field extends AbstractElement 'properties' => array(), 'options' => array('PreserveFormat'), ), + 'STYLEREF' => array( + 'properties' => array('StyleIdentifier' => ''), + 'options' => array('PreserveFormat'), + ), ); /** diff --git a/src/PhpWord/Writer/Word2007/Element/Field.php b/src/PhpWord/Writer/Word2007/Element/Field.php index cf3fbd66..e79dd24a 100644 --- a/src/PhpWord/Writer/Word2007/Element/Field.php +++ b/src/PhpWord/Writer/Word2007/Element/Field.php @@ -177,6 +177,9 @@ class Field extends Text case 'macroname': $propertiesAndOptions .= $propval . ' '; break; + default: + $propertiesAndOptions .= '"' . $propval . '" '; + break; } } diff --git a/tests/PhpWord/Writer/Word2007/ElementTest.php b/tests/PhpWord/Writer/Word2007/ElementTest.php index d365861a..25c62ecc 100644 --- a/tests/PhpWord/Writer/Word2007/ElementTest.php +++ b/tests/PhpWord/Writer/Word2007/ElementTest.php @@ -288,6 +288,7 @@ class ElementTest extends \PHPUnit\Framework\TestCase $section->addField('DATE', array(), array('LunarCalendar')); $section->addField('DATE', array(), array('SakaEraCalendar')); $section->addField('NUMPAGES', array('format' => 'roman', 'numformat' => '0,00'), array('SakaEraCalendar')); + $section->addField('STYLEREF', array('StyleIdentifier' => 'Heading 1')); $doc = TestHelperDOCX::getDocument($phpWord); $element = '/w:document/w:body/w:p/w:r/w:instrText'; From b147919a64d86dbdf878130c413c310e4c167200 Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 18 Apr 2018 22:34:53 +0200 Subject: [PATCH 286/370] write column width in ODT writer --- CHANGELOG.md | 1 + src/PhpWord/Element/Table.php | 24 +++++++ src/PhpWord/Style/Table.php | 27 ++++++++ src/PhpWord/Writer/ODText/Element/Table.php | 63 ++++++++++++++----- src/PhpWord/Writer/ODText/Part/Content.php | 1 + src/PhpWord/Writer/ODText/Style/Table.php | 13 ++++ src/PhpWord/Writer/Word2007/Element/Table.php | 16 +---- 7 files changed, 114 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb07fcc2..7a49f25e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ v0.15.0 (?? ??? 2018) - Fix colspan and rowspan for tables in HTML Writer @mattbolt #1292 - Fix parsing of Heading and Title formating @troosan @gthomas2 #465 - Fix Dateformat typo, fix hours casing, add Month-Day-Year formats @ComputerTinker #591 +- Fix missing column with in ODText writer @potofcoffee #413 ### Changed - Remove zend-stdlib dependency @Trainmaster #1284 diff --git a/src/PhpWord/Element/Table.php b/src/PhpWord/Element/Table.php index 10c4db69..16102119 100644 --- a/src/PhpWord/Element/Table.php +++ b/src/PhpWord/Element/Table.php @@ -149,4 +149,28 @@ class Table extends AbstractElement return $columnCount; } + + /** + * The first declared cell width for each column + * + * @return int[] + */ + public function findFirstDefinedCellWidths() + { + $cellWidths = array(); + if (is_array($this->rows)) { + foreach ($this->rows as $row) { + $cells = $row->getCells(); + if (count($cells) <= count($cellWidths)) { + continue; + } + $cellWidths = array(); + foreach ($cells as $cell) { + $cellWidths[] = $cell->getWidth(); + } + } + } + + return $cellWidths; + } } diff --git a/src/PhpWord/Style/Table.php b/src/PhpWord/Style/Table.php index feb028da..5d4a0150 100644 --- a/src/PhpWord/Style/Table.php +++ b/src/PhpWord/Style/Table.php @@ -159,6 +159,13 @@ class Table extends Border */ private $position; + /** + * The width of each column, computed based on the max cell width of each column + * + * @var int[] + */ + private $columnWidths; + /** * Create new table style * @@ -724,4 +731,24 @@ class Table extends Border return $this; } + + /** + * Get the columnWidths + * + * @return number[] + */ + public function getColumnWidths() + { + return $this->columnWidths; + } + + /** + * The column widths + * + * @param int[] $value + */ + public function setColumnWidths(array $value = null) + { + $this->columnWidths = $value; + } } diff --git a/src/PhpWord/Writer/ODText/Element/Table.php b/src/PhpWord/Writer/ODText/Element/Table.php index 8a21ee1b..088330ae 100644 --- a/src/PhpWord/Writer/ODText/Element/Table.php +++ b/src/PhpWord/Writer/ODText/Element/Table.php @@ -17,6 +17,10 @@ namespace PhpOffice\PhpWord\Writer\ODText\Element; +use PhpOffice\Common\XMLWriter; +use PhpOffice\PhpWord\Element\Row as RowElement; +use PhpOffice\PhpWord\Element\Table as TableElement; + /** * Table element writer * @@ -36,32 +40,59 @@ class Table extends AbstractElement } $rows = $element->getRows(); $rowCount = count($rows); - $colCount = $element->countColumns(); if ($rowCount > 0) { $xmlWriter->startElement('table:table'); $xmlWriter->writeAttribute('table:name', $element->getElementId()); $xmlWriter->writeAttribute('table:style', $element->getElementId()); - $xmlWriter->startElement('table:table-column'); - $xmlWriter->writeAttribute('table:number-columns-repeated', $colCount); - $xmlWriter->endElement(); // table:table-column + // Write columns + $this->writeColumns($xmlWriter, $element); + // Write rows foreach ($rows as $row) { - $xmlWriter->startElement('table:table-row'); - /** @var $row \PhpOffice\PhpWord\Element\Row Type hint */ - foreach ($row->getCells() as $cell) { - $xmlWriter->startElement('table:table-cell'); - $xmlWriter->writeAttribute('office:value-type', 'string'); - - $containerWriter = new Container($xmlWriter, $cell); - $containerWriter->write(); - - $xmlWriter->endElement(); // table:table-cell - } - $xmlWriter->endElement(); // table:table-row + $this->writeRow($xmlWriter, $row); } $xmlWriter->endElement(); // table:table } } + + /** + * Write column. + * + * @param \PhpOffice\Common\XMLWriter $xmlWriter + * @param \PhpOffice\PhpWord\Element\Table $element + */ + private function writeColumns(XMLWriter $xmlWriter, TableElement $element) + { + $colCount = $element->countColumns(); + + for ($i = 0; $i < $colCount; $i++) { + $xmlWriter->startElement('table:table-column'); + $xmlWriter->writeAttribute('table:style-name', $element->getElementId() . '.' . $i); + $xmlWriter->endElement(); + } + } + + /** + * Write row. + * + * @param \PhpOffice\Common\XMLWriter $xmlWriter + * @param \PhpOffice\PhpWord\Element\Row $row + */ + private function writeRow(XMLWriter $xmlWriter, RowElement $row) + { + $xmlWriter->startElement('table:table-row'); + /** @var $row \PhpOffice\PhpWord\Element\Row Type hint */ + foreach ($row->getCells() as $cell) { + $xmlWriter->startElement('table:table-cell'); + $xmlWriter->writeAttribute('office:value-type', 'string'); + + $containerWriter = new Container($xmlWriter, $cell); + $containerWriter->write(); + + $xmlWriter->endElement(); // table:table-cell + } + $xmlWriter->endElement(); // table:table-row + } } diff --git a/src/PhpWord/Writer/ODText/Part/Content.php b/src/PhpWord/Writer/ODText/Part/Content.php index a50eea7b..b705bb5e 100644 --- a/src/PhpWord/Writer/ODText/Part/Content.php +++ b/src/PhpWord/Writer/ODText/Part/Content.php @@ -246,6 +246,7 @@ class Content extends AbstractPart $style = Style::getStyle($style); } $style->setStyleName($element->getElementId()); + $style->setColumnWidths($element->findFirstDefinedCellWidths()); $this->autoStyles['Table'][] = $style; } } diff --git a/src/PhpWord/Writer/ODText/Style/Table.php b/src/PhpWord/Writer/ODText/Style/Table.php index 249321cf..f5a3c431 100644 --- a/src/PhpWord/Writer/ODText/Style/Table.php +++ b/src/PhpWord/Writer/ODText/Style/Table.php @@ -45,5 +45,18 @@ class Table extends AbstractStyle $xmlWriter->writeAttribute('table:align', 'center'); $xmlWriter->endElement(); // style:table-properties $xmlWriter->endElement(); // style:style + + $cellWidths = $style->getColumnWidths(); + + for ($i = 0; $i < count($cellWidths); $i++) { + $width = $cellWidths[$i]; + $xmlWriter->startElement('style:style'); + $xmlWriter->writeAttribute('style:name', $style->getStyleName() . '.' . $i); + $xmlWriter->writeAttribute('style:family', 'table-column'); + $xmlWriter->startElement('style:table-column-properties'); + $xmlWriter->writeAttribute('style:column-width', number_format($width * 0.0017638889, 2, '.', '') . 'cm'); + $xmlWriter->endElement(); // style:table-column-properties + $xmlWriter->endElement(); // style:style + } } } diff --git a/src/PhpWord/Writer/Word2007/Element/Table.php b/src/PhpWord/Writer/Word2007/Element/Table.php index 25a48ab2..c365b028 100644 --- a/src/PhpWord/Writer/Word2007/Element/Table.php +++ b/src/PhpWord/Writer/Word2007/Element/Table.php @@ -76,21 +76,7 @@ class Table extends AbstractElement */ private function writeColumns(XMLWriter $xmlWriter, TableElement $element) { - $rows = $element->getRows(); - $rowCount = count($rows); - - $cellWidths = array(); - for ($i = 0; $i < $rowCount; $i++) { - $row = $rows[$i]; - $cells = $row->getCells(); - if (count($cells) <= count($cellWidths)) { - continue; - } - $cellWidths = array(); - foreach ($cells as $cell) { - $cellWidths[] = $cell->getWidth(); - } - } + $cellWidths = $element->findFirstDefinedCellWidths(); $xmlWriter->startElement('w:tblGrid'); foreach ($cellWidths as $width) { From 5ec2c8560efbcc7c0daa888f9025f6e5164ffbd8 Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 25 Apr 2018 22:33:48 +0200 Subject: [PATCH 287/370] do not push code coverage after build of develop branch [ci skip] --- .travis_shell_after_success.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis_shell_after_success.sh b/.travis_shell_after_success.sh index 12728526..06feddaa 100644 --- a/.travis_shell_after_success.sh +++ b/.travis_shell_after_success.sh @@ -5,7 +5,7 @@ echo "TRAVIS_REPO_SLUG: $TRAVIS_REPO_SLUG" echo "TRAVIS_PHP_VERSION: $TRAVIS_PHP_VERSION" echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST" -if [ "$TRAVIS_REPO_SLUG" == "PHPOffice/PHPWord" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then +if [ "$TRAVIS_REPO_SLUG" == "PHPOffice/PHPWord" ] && [ "$TRAVIS_BRANCH" != "develop" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then echo -e "Publishing PHPDoc...\n" From 94be56b0ec6fcbb43d8a48bae9e74d3d93c5beb7 Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 25 Apr 2018 23:57:07 +0200 Subject: [PATCH 288/370] fix parsing of link style --- samples/Sample_26_Html.php | 2 +- src/PhpWord/Shared/Html.php | 2 +- tests/PhpWord/Shared/HtmlTest.php | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/samples/Sample_26_Html.php b/samples/Sample_26_Html.php index d8763805..e1823c43 100644 --- a/samples/Sample_26_Html.php +++ b/samples/Sample_26_Html.php @@ -11,7 +11,7 @@ $html = '

                  Adding element via HTML

                  '; $html .= '

                  Some well-formed HTML snippet needs to be used

                  '; $html .= '

                  With for example some1 inline formatting1

                  '; -$html .= '

                  A link to Read the docs

                  '; +$html .= '

                  A link to Read the docs

                  '; $html .= '

                  היי, זה פסקה מימין לשמאל

                  '; diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 7d8ee51f..cbdcecd5 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -721,7 +721,7 @@ class Html break; } } - self::parseInlineStyle($node, $styles['font']); + $styles['font'] = self::parseInlineStyle($node, $styles['font']); if (strpos($target, '#') === 0) { return $element->addLink(substr($target, 1), $node->textContent, $styles['font'], $styles['paragraph'], true); diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index f07b3f99..b61418e0 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -458,6 +458,8 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:hyperlink')); $this->assertEquals('link text', $doc->getElement('/w:document/w:body/w:p/w:hyperlink/w:r/w:t')->nodeValue); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:hyperlink/w:r/w:rPr/w:u')); + $this->assertEquals('single', $doc->getElementAttribute('/w:document/w:body/w:p/w:hyperlink/w:r/w:rPr/w:u', 'w:val')); $phpWord = new \PhpOffice\PhpWord\PhpWord(); $section = $phpWord->addSection(); From 96a47ec0ae5a88f752de16226cc950bae2ea760c Mon Sep 17 00:00:00 2001 From: Christian Zosel Date: Thu, 26 Apr 2018 08:41:00 +0200 Subject: [PATCH 289/370] Drop GitHub pages First step to fix #1355 --- .travis.yml | 2 -- .travis_shell_after_success.sh | 39 ---------------------------------- 2 files changed, 41 deletions(-) delete mode 100644 .travis_shell_after_success.sh diff --git a/.travis.yml b/.travis.yml index 281c2630..52fa9580 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,7 +55,5 @@ script: - if [ -z "$COVERAGE" ]; then ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig" ; fi after_script: - ## PHPDocumentor - - bash .travis_shell_after_success.sh ## Scrutinizer - if [ -n "$COVERAGE" ]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml ; fi diff --git a/.travis_shell_after_success.sh b/.travis_shell_after_success.sh deleted file mode 100644 index 06feddaa..00000000 --- a/.travis_shell_after_success.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -echo "--DEBUG--" -echo "TRAVIS_REPO_SLUG: $TRAVIS_REPO_SLUG" -echo "TRAVIS_PHP_VERSION: $TRAVIS_PHP_VERSION" -echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST" - -if [ "$TRAVIS_REPO_SLUG" == "PHPOffice/PHPWord" ] && [ "$TRAVIS_BRANCH" != "develop" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then - - echo -e "Publishing PHPDoc...\n" - - cp -R build/docs $HOME/docs-latest - cp -R build/coverage $HOME/coverage-latest - - cd $HOME - git config --global user.email "travis@travis-ci.org" - git config --global user.name "travis-ci" - git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/PHPOffice/PHPWord gh-pages > /dev/null - - cd gh-pages - echo "--DEBUG : Suppression" - git rm -rf ./docs/$TRAVIS_BRANCH - - echo "--DEBUG : Dossier" - mkdir -p docs/$TRAVIS_BRANCH - mkdir -p coverage/$TRAVIS_BRANCH - - echo "--DEBUG : Copie" - cp -Rf $HOME/docs-latest/* ./docs/$TRAVIS_BRANCH/ - cp -Rf $HOME/coverage-latest/* ./coverage/$TRAVIS_BRANCH/ - - echo "--DEBUG : Git" - git add -f . - git commit -m "PHPDocumentor (Travis Build: $TRAVIS_BUILD_NUMBER - Branch: $TRAVIS_BRANCH)" - git push -fq origin gh-pages > /dev/null - - echo -e "Published PHPDoc to gh-pages.\n" - -fi From 65b0f062ad05836d939a76b3f62fdae0e0895e0c Mon Sep 17 00:00:00 2001 From: JAEK-S Date: Fri, 11 May 2018 14:50:19 -0600 Subject: [PATCH 290/370] New features when creating charts (#1332) * add stacked bar and column charts * add chart colors feature * adding preliminary chart axis title functionality to XMLwriter * added percent_stacked to available types array * Make tick mark and tick label positions configurable * scrutinizer fixes * update changelog --- CHANGELOG.md | 1 + samples/Sample_32_Chart.php | 4 +- src/PhpWord/Element/Chart.php | 16 +- src/PhpWord/Style/Chart.php | 212 +++++++++++++++++++++ src/PhpWord/Writer/Word2007/Part/Chart.php | 131 +++++++++++-- tests/PhpWord/Style/ChartTest.php | 188 ++++++++++++++++++ 6 files changed, 531 insertions(+), 21 deletions(-) create mode 100644 tests/PhpWord/Style/ChartTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b5d7767..fdb2b22b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ v0.15.0 (?? ??? 2018) - Added the ability to enable gridlines and axislabels on charts @FrankMeyer #576 - Add support for table indent (tblInd) @Trainmaster #1343 - Added parsing of internal links in HTML reader @lalop #1336 +- Several improvements to charts @JAEK-S #1332 ### Fixed - Fix reading of docx default style - @troosan #1238 diff --git a/samples/Sample_32_Chart.php b/samples/Sample_32_Chart.php index 87d6f3e3..c24a6f8e 100644 --- a/samples/Sample_32_Chart.php +++ b/samples/Sample_32_Chart.php @@ -16,8 +16,8 @@ $section = $phpWord->addSection(); $section->addTitle('2D charts', 1); $section = $phpWord->addSection(array('colsNum' => 2, 'breakType' => 'continuous')); -$chartTypes = array('pie', 'doughnut', 'bar', 'column', 'line', 'area', 'scatter', 'radar'); -$twoSeries = array('bar', 'column', 'line', 'area', 'scatter', 'radar'); +$chartTypes = array('pie', 'doughnut', 'bar', 'column', 'line', 'area', 'scatter', 'radar', 'stacked_bar', 'percent_stacked_bar', 'stacked_column', 'percent_stacked_column'); +$twoSeries = array('bar', 'column', 'line', 'area', 'scatter', 'radar', 'stacked_bar', 'percent_stacked_bar', 'stacked_column', 'percent_stacked_column'); $threeSeries = array('bar', 'line'); $categories = array('A', 'B', 'C', 'D', 'E'); $series1 = array(1, 3, 2, 5, 4); diff --git a/src/PhpWord/Element/Chart.php b/src/PhpWord/Element/Chart.php index 755f45e1..92152c87 100644 --- a/src/PhpWord/Element/Chart.php +++ b/src/PhpWord/Element/Chart.php @@ -61,11 +61,12 @@ class Chart extends AbstractElement * @param array $categories * @param array $values * @param array $style + * @param null|mixed $seriesName */ - public function __construct($type, $categories, $values, $style = null) + public function __construct($type, $categories, $values, $style = null, $seriesName = null) { $this->setType($type); - $this->addSeries($categories, $values); + $this->addSeries($categories, $values, $seriesName); $this->style = $this->setNewStyle(new ChartStyle(), $style, true); } @@ -86,7 +87,7 @@ class Chart extends AbstractElement */ public function setType($value) { - $enum = array('pie', 'doughnut', 'line', 'bar', 'column', 'area', 'radar', 'scatter'); + $enum = array('pie', 'doughnut', 'line', 'bar', 'stacked_bar', 'percent_stacked_bar', 'column', 'stacked_column', 'percent_stacked_column', 'area', 'radar', 'scatter'); $this->type = $this->setEnumVal($value, $enum, 'pie'); } @@ -95,10 +96,15 @@ class Chart extends AbstractElement * * @param array $categories * @param array $values + * @param null|mixed $name */ - public function addSeries($categories, $values) + public function addSeries($categories, $values, $name = null) { - $this->series[] = array('categories' => $categories, 'values' => $values); + $this->series[] = array( + 'categories' => $categories, + 'values' => $values, + 'name' => $name, + ); } /** diff --git a/src/PhpWord/Style/Chart.php b/src/PhpWord/Style/Chart.php index 041736be..5b02e636 100644 --- a/src/PhpWord/Style/Chart.php +++ b/src/PhpWord/Style/Chart.php @@ -46,6 +46,60 @@ class Chart extends AbstractStyle private $is3d = false; /** + * A list of colors to use in the chart + * + * @var array + */ + private $colors = array(); + + /** + * A list of display options for data labels + * + * @var array + */ + private $dataLabelOptions = array( + 'showVal' => true, // value + 'showCatName' => true, // category name + 'showLegendKey' => false, //show the cart legend + 'showSerName' => false, // series name + 'showPercent' => false, + 'showLeaderLines' => false, + 'showBubbleSize' => false, + ); + + /** + * A string that tells the writer where to write chart labels or to skip + * "nextTo" - sets labels next to the axis (bar graphs on the left) (default) + * "low" - labels on the left side of the graph + * "high" - labels on the right side of the graph + * + * @var string + */ + private $categoryLabelPosition = 'nextTo'; + + /** + * A string that tells the writer where to write chart labels or to skip + * "nextTo" - sets labels next to the axis (bar graphs on the bottom) (default) + * "low" - labels are below the graph + * "high" - labels above the graph + * + * @var string + */ + private $valueLabelPosition = 'nextTo'; + + /** + * @var string + */ + private $categoryAxisTitle; + + /** + * @var string + */ + private $valueAxisTitle; + + private $majorTickMarkPos = 'none'; + + /* * Show labels for axis * * @var bool @@ -146,6 +200,28 @@ class Chart extends AbstractStyle } /** + * Get the list of colors to use in a chart. + * + * @return array + */ + public function getColors() + { + return $this->colors; + } + + /** + * Set the colors to use in a chart. + * + * @param array $value a list of colors to use in the chart + */ + public function setColors($value = array()) + { + $this->colors = $value; + + return $this; + } + + /* * Show labels for axis * * @return bool @@ -169,6 +245,31 @@ class Chart extends AbstractStyle } /** + * get the list of options for data labels + * + * @return array + */ + public function getDataLabelOptions() + { + return $this->dataLabelOptions; + } + + /** + * Set values for data label options. + * This will only change values for options defined in $this->dataLabelOptions, and cannot create new ones. + * + * @param array $values [description] + */ + public function setDataLabelOptions($values = array()) + { + foreach (array_keys($this->dataLabelOptions) as $option) { + if (isset($values[$option])) { + $this->dataLabelOptions[$option] = $this->setBoolVal($values[$option], $this->dataLabelOptions[$option]); + } + } + } + + /* * Show Gridlines for Y-Axis * * @return bool @@ -192,6 +293,117 @@ class Chart extends AbstractStyle } /** + * Get the categoryLabelPosition setting + * + * @return string + */ + public function getCategoryLabelPosition() + { + return $this->categoryLabelPosition; + } + + /** + * Set the categoryLabelPosition setting + * "none" - skips writing labels + * "nextTo" - sets labels next to the (bar graphs on the left) + * "low" - labels on the left side of the graph + * "high" - labels on the right side of the graph + * + * @param mixed $labelPosition + * @return self + */ + public function setCategoryLabelPosition($labelPosition) + { + $enum = array('nextTo', 'low', 'high'); + $this->categoryLabelPosition = $this->setEnumVal($labelPosition, $enum, $this->categoryLabelPosition); + + return $this; + } + + /** + * Get the valueAxisLabelPosition setting + * + * @return string + */ + public function getValueLabelPosition() + { + return $this->valueLabelPosition; + } + + /** + * Set the valueLabelPosition setting + * "none" - skips writing labels + * "nextTo" - sets labels next to the value + * "low" - sets labels are below the graph + * "high" - sets labels above the graph + * + * @param string + * @param mixed $labelPosition + */ + public function setValueLabelPosition($labelPosition) + { + $enum = array('nextTo', 'low', 'high'); + $this->valueLabelPosition = $this->setEnumVal($labelPosition, $enum, $this->valueLabelPosition); + + return $this; + } + + /** + * Get the categoryAxisTitle + * @return string + */ + public function getCategoryAxisTitle() + { + return $this->categoryAxisTitle; + } + + /** + * Set the title that appears on the category side of the chart + * @param string $axisTitle + */ + public function setCategoryAxisTitle($axisTitle) + { + $this->categoryAxisTitle = $axisTitle; + + return $this; + } + + /** + * Get the valueAxisTitle + * @return string + */ + public function getValueAxisTitle() + { + return $this->valueAxisTitle; + } + + /** + * Set the title that appears on the value side of the chart + * @param string $axisTitle + */ + public function setValueAxisTitle($axisTitle) + { + $this->valueAxisTitle = $axisTitle; + + return $this; + } + + public function getMajorTickPosition() + { + return $this->majorTickMarkPos; + } + + /** + * set the position for major tick marks + * @param string $position [description] + */ + public function setMajorTickPosition($position) + { + $enum = array('in', 'out', 'cross', 'none'); + $this->majorTickMarkPos = $this->setEnumVal($position, $enum, $this->majorTickMarkPos); + } + + /* * Show Gridlines for X-Axis * * @return bool diff --git a/src/PhpWord/Writer/Word2007/Part/Chart.php b/src/PhpWord/Writer/Word2007/Part/Chart.php index 2aeccca0..17c1fd54 100644 --- a/src/PhpWord/Writer/Word2007/Part/Chart.php +++ b/src/PhpWord/Writer/Word2007/Part/Chart.php @@ -41,14 +41,18 @@ class Chart extends AbstractPart * @var array */ private $types = array( - 'pie' => array('type' => 'pie', 'colors' => 1), - 'doughnut' => array('type' => 'doughnut', 'colors' => 1, 'hole' => 75, 'no3d' => true), - 'bar' => array('type' => 'bar', 'colors' => 0, 'axes' => true, 'bar' => 'bar'), - 'column' => array('type' => 'bar', 'colors' => 0, 'axes' => true, 'bar' => 'col'), - 'line' => array('type' => 'line', 'colors' => 0, 'axes' => true), - 'area' => array('type' => 'area', 'colors' => 0, 'axes' => true), - 'radar' => array('type' => 'radar', 'colors' => 0, 'axes' => true, 'radar' => 'standard', 'no3d' => true), - 'scatter' => array('type' => 'scatter', 'colors' => 0, 'axes' => true, 'scatter' => 'marker', 'no3d' => true), + 'pie' => array('type' => 'pie', 'colors' => 1), + 'doughnut' => array('type' => 'doughnut', 'colors' => 1, 'hole' => 75, 'no3d' => true), + 'bar' => array('type' => 'bar', 'colors' => 0, 'axes' => true, 'bar' => 'bar', 'grouping' => 'clustered'), + 'stacked_bar' => array('type' => 'bar', 'colors' => 0, 'axes' => true, 'bar' => 'bar', 'grouping' => 'stacked'), + 'percent_stacked_bar' => array('type' => 'bar', 'colors' => 0, 'axes' => true, 'bar' => 'bar', 'grouping' => 'percentStacked'), + 'column' => array('type' => 'bar', 'colors' => 0, 'axes' => true, 'bar' => 'col', 'grouping' => 'clustered'), + 'stacked_column' => array('type' => 'bar', 'colors' => 0, 'axes' => true, 'bar' => 'col', 'grouping' => 'stacked'), + 'percent_stacked_column' => array('type' => 'bar', 'colors' => 0, 'axes' => true, 'bar' => 'col', 'grouping' => 'percentStacked'), + 'line' => array('type' => 'line', 'colors' => 0, 'axes' => true), + 'area' => array('type' => 'area', 'colors' => 0, 'axes' => true), + 'radar' => array('type' => 'radar', 'colors' => 0, 'axes' => true, 'radar' => 'standard', 'no3d' => true), + 'scatter' => array('type' => 'scatter', 'colors' => 0, 'axes' => true, 'scatter' => 'marker', 'no3d' => true), ); /** @@ -145,7 +149,7 @@ class Chart extends AbstractPart } if (isset($this->options['bar'])) { $xmlWriter->writeElementBlock('c:barDir', 'val', $this->options['bar']); // bar|col - $xmlWriter->writeElementBlock('c:grouping', 'val', 'clustered'); // 3d; standard = percentStacked + $xmlWriter->writeElementBlock('c:grouping', 'val', $this->options['grouping']); // 3d; standard = percentStacked } if (isset($this->options['radar'])) { $xmlWriter->writeElementBlock('c:radarStyle', 'val', $this->options['radar']); @@ -157,6 +161,8 @@ class Chart extends AbstractPart // Series $this->writeSeries($xmlWriter, isset($this->options['scatter'])); + $xmlWriter->writeElementBlock('c:overlap', 'val', '100'); + // Axes if (isset($this->options['axes'])) { $xmlWriter->writeElementBlock('c:axId', 'val', 1); @@ -183,6 +189,8 @@ class Chart extends AbstractPart private function writeSeries(XMLWriter $xmlWriter, $scatter = false) { $series = $this->element->getSeries(); + $style = $this->element->getStyle(); + $colors = $style->getColors(); $index = 0; foreach ($series as $seriesItem) { @@ -194,6 +202,32 @@ class Chart extends AbstractPart $xmlWriter->writeElementBlock('c:idx', 'val', $index); $xmlWriter->writeElementBlock('c:order', 'val', $index); + if (!is_null($seriesItem['name']) && $seriesItem['name'] != '') { + $xmlWriter->startElement('c:tx'); + $xmlWriter->startElement('c:strRef'); + $xmlWriter->startElement('c:strCache'); + $xmlWriter->writeElementBlock('c:ptCount', 'val', 1); + $xmlWriter->startElement('c:pt'); + $xmlWriter->writeAttribute('idx', 0); + $xmlWriter->startElement('c:v'); + $xmlWriter->writeRaw($seriesItem['name']); + $xmlWriter->endElement(); // c:v + $xmlWriter->endElement(); // c:pt + $xmlWriter->endElement(); // c:strCache + $xmlWriter->endElement(); // c:strRef + $xmlWriter->endElement(); // c:tx + } + + // The c:dLbls was added to make word charts look more like the reports in SurveyGizmo + // This section needs to be made configurable before a pull request is made + $xmlWriter->startElement('c:dLbls'); + + foreach ($style->getDataLabelOptions() as $option => $val) { + $xmlWriter->writeElementBlock("c:{$option}", 'val', (int) $val); + } + + $xmlWriter->endElement(); // c:dLbls + if (isset($this->options['scatter'])) { $this->writeShape($xmlWriter); } @@ -204,6 +238,26 @@ class Chart extends AbstractPart } else { $this->writeSeriesItem($xmlWriter, 'cat', $categories); $this->writeSeriesItem($xmlWriter, 'val', $values); + + // setting the chart colors was taken from https://github.com/PHPOffice/PHPWord/issues/494 + if (is_array($colors) && count($colors)) { + // This is a workaround to make each series in a stack chart use a different color + if ($this->options['type'] == 'bar' && stristr($this->options['grouping'], 'stacked')) { + array_shift($colors); + } + $colorIndex = 0; + foreach ($colors as $color) { + $xmlWriter->startElement('c:dPt'); + $xmlWriter->writeElementBlock('c:idx', 'val', $colorIndex); + $xmlWriter->startElement('c:spPr'); + $xmlWriter->startElement('a:solidFill'); + $xmlWriter->writeElementBlock('a:srgbClr', 'val', $color); + $xmlWriter->endElement(); // a:solidFill + $xmlWriter->endElement(); // c:spPr + $xmlWriter->endElement(); // c:dPt + $colorIndex++; + } + } } $xmlWriter->endElement(); // c:ser @@ -230,14 +284,19 @@ class Chart extends AbstractPart $xmlWriter->startElement($itemType); $xmlWriter->startElement($itemLit); + $xmlWriter->writeElementBlock('c:ptCount', 'val', count($values)); $index = 0; foreach ($values as $value) { $xmlWriter->startElement('c:pt'); $xmlWriter->writeAttribute('idx', $index); - $xmlWriter->startElement('c:v'); - $xmlWriter->text($value); - $xmlWriter->endElement(); // c:v + if (\PhpOffice\PhpWord\Settings::isOutputEscapingEnabled()) { + $xmlWriter->writeElement('c:v', $value); + } else { + $xmlWriter->startElement('c:v'); + $xmlWriter->writeRaw($value); + $xmlWriter->endElement(); // c:v + } $xmlWriter->endElement(); // c:pt $index++; } @@ -266,15 +325,33 @@ class Chart extends AbstractPart $xmlWriter->writeElementBlock('c:axId', 'val', $axisId); $xmlWriter->writeElementBlock('c:axPos', 'val', $axisPos); + + $categoryAxisTitle = $style->getCategoryAxisTitle(); + $valueAxisTitle = $style->getValueAxisTitle(); + + if ($axisType == 'c:catAx') { + if (isset($categoryAxisTitle)) { + $this->writeAxisTitle($xmlWriter, $categoryAxisTitle); + } + } elseif ($axisType == 'c:valAx') { + if (isset($valueAxisTitle)) { + $this->writeAxisTitle($xmlWriter, $valueAxisTitle); + } + } + $xmlWriter->writeElementBlock('c:crossAx', 'val', $axisCross); $xmlWriter->writeElementBlock('c:auto', 'val', 1); if (isset($this->options['axes'])) { $xmlWriter->writeElementBlock('c:delete', 'val', 0); - $xmlWriter->writeElementBlock('c:majorTickMark', 'val', 'none'); + $xmlWriter->writeElementBlock('c:majorTickMark', 'val', $style->getMajorTickPosition()); $xmlWriter->writeElementBlock('c:minorTickMark', 'val', 'none'); if ($style->showAxisLabels()) { - $xmlWriter->writeElementBlock('c:tickLblPos', 'val', 'nextTo'); + if ($axisType == 'c:catAx') { + $xmlWriter->writeElementBlock('c:tickLblPos', 'val', $style->getCategoryLabelPosition()); + } else { + $xmlWriter->writeElementBlock('c:tickLblPos', 'val', $style->getValueLabelPosition()); + } } else { $xmlWriter->writeElementBlock('c:tickLblPos', 'val', 'none'); } @@ -312,4 +389,30 @@ class Chart extends AbstractPart $xmlWriter->endElement(); // a:ln $xmlWriter->endElement(); // c:spPr } + + private function writeAxisTitle(XMLWriter $xmlWriter, $title) + { + $xmlWriter->startElement('c:title'); //start c:title + $xmlWriter->startElement('c:tx'); //start c:tx + $xmlWriter->startElement('c:rich'); // start c:rich + $xmlWriter->writeElement('a:bodyPr'); + $xmlWriter->writeElement('a:lstStyle'); + $xmlWriter->startElement('a:p'); + $xmlWriter->startElement('a:pPr'); + $xmlWriter->writeElement('a:defRPr'); + $xmlWriter->endElement(); // end a:pPr + $xmlWriter->startElement('a:r'); + $xmlWriter->writeElementBlock('a:rPr', 'lang', 'en-US'); + + $xmlWriter->startElement('a:t'); + $xmlWriter->writeRaw($title); + $xmlWriter->endElement(); //end a:t + + $xmlWriter->endElement(); // end a:r + $xmlWriter->endElement(); //end a:p + $xmlWriter->endElement(); //end c:rich + $xmlWriter->endElement(); // end c:tx + $xmlWriter->writeElementBlock('c:overlay', 'val', '0'); + $xmlWriter->endElement(); // end c:title + } } diff --git a/tests/PhpWord/Style/ChartTest.php b/tests/PhpWord/Style/ChartTest.php new file mode 100644 index 00000000..9929a8f5 --- /dev/null +++ b/tests/PhpWord/Style/ChartTest.php @@ -0,0 +1,188 @@ +assertEquals($chart->getWidth(), 1000000); + + $chart->setWidth(200); + + $this->assertEquals($chart->getWidth(), 200); + } + + /** + * Testing getter and setter for chart height + */ + public function testSetGetHeight() + { + $chart = new Chart(); + + $this->assertEquals($chart->getHeight(), 1000000); + + $chart->setHeight(200); + + $this->assertEquals($chart->getHeight(), 200); + } + + /** + * Testing getter and setter for is3d + */ + public function testSetIs3d() + { + $chart = new Chart(); + + $this->assertEquals($chart->is3d(), false); + + $chart->set3d(true); + + $this->assertEquals($chart->is3d(), true); + } + + /** + * Testing getter and setter for chart colors + */ + public function testSetGetColors() + { + $chart = new Chart(); + + $this->assertInternalType('array', $chart->getColors()); + + $this->assertEquals(count($chart->getColors()), 0); + + $chart->setColors(array('FFFFFFFF', 'FF000000', 'FFFF0000')); + + $this->assertEquals($chart->getColors(), array('FFFFFFFF', 'FF000000', 'FFFF0000')); + } + + /** + * Testing getter and setter for dataLabelOptions + */ + public function testSetGetDataLabelOptions() + { + $chart = new Chart(); + + $originalDataLabelOptions = array( + 'showVal' => true, + 'showCatName' => true, + 'showLegendKey' => false, + 'showSerName' => false, + 'showPercent' => false, + 'showLeaderLines' => false, + 'showBubbleSize' => false, + ); + + $this->assertEquals($chart->getDataLabelOptions(), $originalDataLabelOptions); + + $changedDataLabelOptions = array( + 'showVal' => false, + 'showCatName' => false, + 'showLegendKey' => true, + 'showSerName' => true, + 'showPercent' => true, + 'showLeaderLines' => true, + 'showBubbleSize' => true, + ); + + $chart->setDataLabelOptions( + array( + 'showVal' => false, + 'showCatName' => false, + 'showLegendKey' => true, + 'showSerName' => true, + 'showPercent' => true, + 'showLeaderLines' => true, + 'showBubbleSize' => true, + ) + ); + $this->assertEquals($chart->getDataLabelOptions(), $changedDataLabelOptions); + } + + /** + * Testing categoryLabelPosition getter and setter + */ + public function testSetGetCategoryLabelPosition() + { + $chart = new Chart(); + + $this->assertEquals($chart->getCategoryLabelPosition(), 'nextTo'); + + $chart->setCategoryLabelPosition('high'); + + $this->assertEquals($chart->getCategoryLabelPosition(), 'high'); + } + + /** + * Testing valueLabelPosition getter and setter + */ + public function testSetGetValueLabelPosition() + { + $chart = new Chart(); + + $this->assertEquals($chart->getValueLabelPosition(), 'nextTo'); + + $chart->setValueLabelPosition('low'); + + $this->assertEquals($chart->getValueLabelPosition(), 'low'); + } + + /** + * Testing categoryAxisTitle getter and setter + */ + public function testSetGetCategoryAxisTitle() + { + $chart = new Chart(); + + $chart->getCategoryAxisTitle(); + + $this->assertEquals($chart->getCategoryAxisTitle(), null); + + $chart->setCategoryAxisTitle('Test Category Axis Title'); + + $this->assertEquals($chart->getCategoryAxisTitle(), 'Test Category Axis Title'); + } + + /** + * Testing valueAxisTitle getter and setter + */ + public function testSetGetValueAxisTitle() + { + $chart = new Chart(); + + $chart->getValueAxisTitle(); + + $this->assertEquals($chart->getValueAxisTitle(), null); + + $chart->setValueAxisTitle('Test Value Axis Title'); + + $this->assertEquals($chart->getValueAxisTitle(), 'Test Value Axis Title'); + } +} From e47ce1b4fc493ecfa7d5b5cd60c425d54cd78a3b Mon Sep 17 00:00:00 2001 From: Christian Zosel Date: Sat, 19 May 2018 12:39:30 +0200 Subject: [PATCH 291/370] Coveralls integration --- .travis.yml | 6 +++--- composer.json | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 52fa9580..d79a7dce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -54,6 +54,6 @@ script: ## PHPDocumentor - if [ -z "$COVERAGE" ]; then ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig" ; fi -after_script: - ## Scrutinizer - - if [ -n "$COVERAGE" ]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml ; fi +after_success: + ## Coveralls + - if [ -z "$COVERAGE" ]; then travis_retry php vendor/bin/php-coveralls -v ; fi diff --git a/composer.json b/composer.json index 742e4bc8..e4d5927e 100644 --- a/composer.json +++ b/composer.json @@ -61,7 +61,8 @@ "php": "^5.3.3 || ^7.0", "ext-xml": "*", "zendframework/zend-escaper": "^2.2", - "phpoffice/common": "^0.2" + "phpoffice/common": "^0.2", + "php-coveralls/php-coveralls": "1.1.0" }, "require-dev": { "phpunit/phpunit": "^4.8.36 || ^5.0", From 453ddf078b16f996900317e8b5fc4294d71b09f0 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 20 May 2018 14:37:59 +0200 Subject: [PATCH 292/370] Do not try to read document protection if not present --- src/PhpWord/Reader/Word2007/AbstractPart.php | 2 ++ src/PhpWord/Reader/Word2007/Settings.php | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index 48a84ff2..6cdf2b3a 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -588,6 +588,8 @@ abstract class AbstractPart return $possibleAttribute; } } + + return null; } return $attributes; diff --git a/src/PhpWord/Reader/Word2007/Settings.php b/src/PhpWord/Reader/Word2007/Settings.php index 5cfe5453..dbf34623 100644 --- a/src/PhpWord/Reader/Word2007/Settings.php +++ b/src/PhpWord/Reader/Word2007/Settings.php @@ -109,7 +109,9 @@ class Settings extends AbstractPart $documentProtection = $phpWord->getSettings()->getDocumentProtection(); $edit = $xmlReader->getAttribute('w:edit', $node); - $documentProtection->setEditing($edit); + if ($edit !== null) { + $documentProtection->setEditing($edit); + } } /** From 2480103b49c937da2c36a3573e5ab61f9469d8e6 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 20 May 2018 17:13:04 +0200 Subject: [PATCH 293/370] run coveralls when running build with code coverage --- .travis.yml | 2 +- composer.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index d79a7dce..bd85b2d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -56,4 +56,4 @@ script: after_success: ## Coveralls - - if [ -z "$COVERAGE" ]; then travis_retry php vendor/bin/php-coveralls -v ; fi + - if [ -n "$COVERAGE" ]; then travis_retry php vendor/bin/php-coveralls -v ; fi diff --git a/composer.json b/composer.json index e4d5927e..c29e901a 100644 --- a/composer.json +++ b/composer.json @@ -61,8 +61,7 @@ "php": "^5.3.3 || ^7.0", "ext-xml": "*", "zendframework/zend-escaper": "^2.2", - "phpoffice/common": "^0.2", - "php-coveralls/php-coveralls": "1.1.0" + "phpoffice/common": "^0.2" }, "require-dev": { "phpunit/phpunit": "^4.8.36 || ^5.0", @@ -73,7 +72,8 @@ "phploc/phploc": "2.* || 3.* || 4.*", "dompdf/dompdf":"0.8.*", "tecnickcom/tcpdf": "6.*", - "mpdf/mpdf": "5.* || 6.* || 7.*" + "mpdf/mpdf": "5.* || 6.* || 7.*", + "php-coveralls/php-coveralls": "1.1.0 || ^2.0" }, "suggest": { "ext-zip": "Allows writing OOXML and ODF", From 254064150d1515768ab576085ff0feda5f00d9c7 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 20 May 2018 20:59:34 +0200 Subject: [PATCH 294/370] disable external code coverage --- .scrutinizer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 291a6d60..2b395afd 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -19,7 +19,7 @@ tools: config: ruleset: phpmd.xml.dist external_code_coverage: - enabled: true + enabled: false timeout: 1200 php_cpd: true # php_sim: # Temporarily disabled to allow focus on things other than duplicates From 0b27bb927dc1af20510b0aa55e54ae74f1060692 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 20 May 2018 22:08:53 +0200 Subject: [PATCH 295/370] update changelog [ci skip] --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b5d7767..69f0c811 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,8 @@ v0.15.0 (?? ??? 2018) - Remove zend-stdlib dependency @Trainmaster #1284 - The default unit for `\PhpOffice\PhpWord\Style\Image` changed from `px` to `pt`. +### Miscelaneous +- Drop GitHub pages, switch to coveralls for code coverage analysis @czosel #1360 v0.14.0 (29 Dec 2017) ---------------------- From e6501eb9ff75d6de13768507d531c2327bae0e97 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 20 May 2018 23:45:03 +0200 Subject: [PATCH 296/370] Update coverage badge [skip ci] [skip Scrutinizer] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 59fc3c44..7531a6bc 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Latest Stable Version](https://poser.pugx.org/phpoffice/phpword/v/stable.png)](https://packagist.org/packages/phpoffice/phpword) [![Build Status](https://travis-ci.org/PHPOffice/PHPWord.svg?branch=master)](https://travis-ci.org/PHPOffice/PHPWord) [![Code Quality](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/badges/quality-score.png?s=b5997ce59ac2816b4514f3a38de9900f6d492c1d)](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/) -[![Code Coverage](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/badges/coverage.png?s=742a98745725c562955440edc8d2c39d7ff5ae25)](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/) +[![Coverage Status](https://coveralls.io/repos/github/PHPOffice/PHPWord/badge.svg?branch=develop)](https://coveralls.io/github/PHPOffice/PHPWord?branch=develop) [![Total Downloads](https://poser.pugx.org/phpoffice/phpword/downloads.png)](https://packagist.org/packages/phpoffice/phpword) [![License](https://poser.pugx.org/phpoffice/phpword/license.png)](https://packagist.org/packages/phpoffice/phpword) [![Join the chat at https://gitter.im/PHPOffice/PHPWord](https://img.shields.io/badge/GITTER-join%20chat-green.svg)](https://gitter.im/PHPOffice/PHPWord) From 90d4d30dd327d19aed30293e5ebebe8cd657ea2c Mon Sep 17 00:00:00 2001 From: woutersioen Date: Wed, 23 May 2018 09:18:24 +0200 Subject: [PATCH 297/370] Fix calls to the getEndingNotes method in the samples This call requires both an array of writes and the filename, which was missing in both method calls. --- samples/Sample_07_TemplateCloneRow.php | 2 +- samples/Sample_23_TemplateBlock.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/Sample_07_TemplateCloneRow.php b/samples/Sample_07_TemplateCloneRow.php index e845362c..81253d0a 100644 --- a/samples/Sample_07_TemplateCloneRow.php +++ b/samples/Sample_07_TemplateCloneRow.php @@ -56,7 +56,7 @@ $templateProcessor->setValue('userPhone#3', '+1 428 889 775'); echo date('H:i:s'), ' Saving the result document...', EOL; $templateProcessor->saveAs('results/Sample_07_TemplateCloneRow.docx'); -echo getEndingNotes(array('Word2007' => 'docx')); +echo getEndingNotes(array('Word2007' => 'docx'), 'results/Sample_07_TemplateCloneRow.docx'); if (!CLI) { include_once 'Sample_Footer.php'; } diff --git a/samples/Sample_23_TemplateBlock.php b/samples/Sample_23_TemplateBlock.php index 2b7e9f68..ed986618 100644 --- a/samples/Sample_23_TemplateBlock.php +++ b/samples/Sample_23_TemplateBlock.php @@ -14,7 +14,7 @@ $templateProcessor->deleteBlock('DELETEME'); echo date('H:i:s'), ' Saving the result document...', EOL; $templateProcessor->saveAs('results/Sample_23_TemplateBlock.docx'); -echo getEndingNotes(array('Word2007' => 'docx')); +echo getEndingNotes(array('Word2007' => 'docx'), 'results/Sample_23_TemplateBlock.docx'); if (!CLI) { include_once 'Sample_Footer.php'; } From 58c6c52ee94b5b1821f9c2fad7ee415fd4fca1c6 Mon Sep 17 00:00:00 2001 From: Javier Garcia Date: Wed, 23 May 2018 18:22:54 +0200 Subject: [PATCH 298/370] merged with local version --- src/PhpWord/Shared/Html.php | 51 +++++++++++++++++++++++++++-- tests/PhpWord/Shared/HtmlTest.php | 54 +++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index cbdcecd5..b308ec3e 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -22,6 +22,7 @@ use PhpOffice\PhpWord\Element\Row; use PhpOffice\PhpWord\Element\Table; use PhpOffice\PhpWord\SimpleType\Jc; use PhpOffice\PhpWord\SimpleType\NumberFormat; +use PhpOffice\PhpWord\Settings; /** * Common Html functions @@ -32,6 +33,7 @@ class Html { private static $listIndex = 0; private static $xpath; + private static $options; /** * Add HTML parts. @@ -44,13 +46,17 @@ class Html * @param string $html The code to parse * @param bool $fullHTML If it's a full HTML, no need to add 'body' tag * @param bool $preserveWhiteSpace If false, the whitespaces between nodes will be removed + * @param array $options: + * + IMG_SRC_SEARCH: optional to speed up images loading from remote url when files can be found locally + * + IMG_SRC_REPLACE: optional to speed up images loading from remote url when files can be found locally */ - public static function addHtml($element, $html, $fullHTML = false, $preserveWhiteSpace = true) + public static function addHtml($element, $html, $fullHTML = false, $preserveWhiteSpace = true, $options = null ) { /* * @todo parse $stylesheet for default styles. Should result in an array based on id, class and element, * which could be applied when such an element occurs in the parseNode function. */ + self::$options = $options; // Preprocess: remove all line ends, decode HTML entity, // fix ampersand and angle brackets and add body tag for HTML fragments @@ -141,6 +147,7 @@ class Html 'sup' => array('Property', null, null, $styles, null, 'superScript', true), 'sub' => array('Property', null, null, $styles, null, 'subScript', true), 'span' => array('Span', $node, null, $styles, null, null, null), + 'font' => array('Span', $node, null, $styles, null, null, null), 'table' => array('Table', $node, $element, $styles, null, null, null), 'tr' => array('Row', $node, $element, $styles, null, null, null), 'td' => array('Cell', $node, $element, $styles, null, null, null), @@ -296,8 +303,9 @@ class Html * * @todo As soon as TableItem, RowItem and CellItem support relative width and height */ - private static function parseTable($node, $element, &$styles) + private static function parseTable($node, $element, &$styles ) { + $elementStyles = self::parseInlineStyle($node, $styles['table']); $newElement = $element->addTable($elementStyles); @@ -648,6 +656,45 @@ class Html break; } } + if( strpos( $src, "data:image" ) !== false ){ + if( ! is_dir( self::$imgdir ) ) + mkdir( self::$imgdir ) ; + + $match = array(); + preg_match( '/data:image\/(\w+);base64,(.+)/', $src, $match ); + + $src = $imgFile = self::$imgdir . uniqid() . "." . $match[1]; + + $ifp = fopen( $imgFile, "wb"); + + fwrite($ifp, base64_decode( $match[2] ) ); + fclose($ifp); + + } + $src= urldecode($src); + + if( ! is_file( $src ) + && !is_null(self::$options) + && isset(self::$options['IMG_SRC_SEARCH']) + && isset(self::$options['IMG_SRC_REPLACE'])){ + $src = str_replace( self::$options['IMG_SRC_SEARCH'], self::$options['IMG_SRC_REPLACE'], $src ); + } + + if(! is_file($src)){ + if($imgBlob=file_get_contents($src)){ + $tmpDir= Settings::getTempDir().'/'; + if( ! is_dir( $tmpDir ) ) + mkdir( $tmpDir ) ; + $match = array(); + preg_match( '/.+\.(\w+)$/', $src, $match ); + $src = $tmpDir . uniqid() . "." . $match[1]; + + $ifp = fopen( $src, "wb"); + + fwrite($ifp, $imgBlob ); + fclose($ifp); + } + } $newElement = $element->addImage($src, $style); return $newElement; diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index b61418e0..63295d62 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -115,6 +115,20 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:rPr/w:u')); $this->assertEquals('single', $doc->getElementAttribute('/w:document/w:body/w:p/w:r/w:rPr/w:u', 'w:val')); } + /** + * Test font + */ + public function testParseFont() + { + $html = 'test'; + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + Html::addHtml($section, $html); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:rPr')); + //TODO check style + } /** * Test line-height style @@ -447,6 +461,46 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $this->assertStringMatchesFormat('%Smso-position-horizontal:left%S', $doc->getElementAttribute($baseXpath . '[2]/w:pict/v:shape', 'style')); } + /** + * Test parsing of remote img + */ + public function testParseRemoteImage() + { + $src = 'https://phpword.readthedocs.io/en/latest/_images/phpword.png'; + + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $html = '

                  '; + Html::addHtml($section, $html); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + + $baseXpath = '/w:document/w:body/w:p/w:r'; + $this->assertTrue($doc->elementExists($baseXpath . '/w:pict/v:shape')); + } + /** + * Test parsing of remote img that can be found locally + */ + public function testParseRemoteLocalImage() + { + $src = 'https://fakedomain.io/images/firefox.png'; + $localPath = __DIR__ . '/../_files/images/'; + $options= [ + 'IMG_SRC_SEARCH'=> 'https://fakedomain.io/images/', + 'IMG_SRC_REPLACE'=> $localPath + ]; + + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $html = '

                  '; + Html::addHtml($section, $html, false, true, $options); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + + $baseXpath = '/w:document/w:body/w:p/w:r'; + $this->assertTrue($doc->elementExists($baseXpath . '/w:pict/v:shape')); + } + public function testParseLink() { $phpWord = new \PhpOffice\PhpWord\PhpWord(); From d54cc6efeea1a43419d9b97a759a796c1124aa6e Mon Sep 17 00:00:00 2001 From: Javier Garcia Date: Wed, 23 May 2018 18:35:12 +0200 Subject: [PATCH 299/370] fix lint --- samples/resources/Sample_30_ReadHTML.html | 6 ++++++ tests/PhpWord/Shared/HtmlTest.php | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/samples/resources/Sample_30_ReadHTML.html b/samples/resources/Sample_30_ReadHTML.html index 5593298b..ea982218 100644 --- a/samples/resources/Sample_30_ReadHTML.html +++ b/samples/resources/Sample_30_ReadHTML.html @@ -11,5 +11,11 @@
                  • Item 1
                  • Item 2
                    • Item 2.1
                    • Item 2.1

                  Ordered (numbered) list:

                  1. Item 1
                  2. Item 2
                  + + +

                  Double height

                  + +

                  Includes images

                  + diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index 63295d62..9b5def85 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -485,10 +485,10 @@ class HtmlTest extends \PHPUnit\Framework\TestCase { $src = 'https://fakedomain.io/images/firefox.png'; $localPath = __DIR__ . '/../_files/images/'; - $options= [ + $options= array( 'IMG_SRC_SEARCH'=> 'https://fakedomain.io/images/', 'IMG_SRC_REPLACE'=> $localPath - ]; + ); $phpWord = new \PhpOffice\PhpWord\PhpWord(); $section = $phpWord->addSection(); From a228811a611fe015c3bdb916d33ec579aa5697b4 Mon Sep 17 00:00:00 2001 From: Javier Garcia Date: Wed, 23 May 2018 18:48:28 +0200 Subject: [PATCH 300/370] fixes --- src/PhpWord/Shared/Html.php | 66 +++++++++++++++---------------- tests/PhpWord/Shared/HtmlTest.php | 8 ++-- 2 files changed, 38 insertions(+), 36 deletions(-) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index b308ec3e..24f695c7 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -20,9 +20,9 @@ namespace PhpOffice\PhpWord\Shared; use PhpOffice\PhpWord\Element\AbstractContainer; use PhpOffice\PhpWord\Element\Row; use PhpOffice\PhpWord\Element\Table; +use PhpOffice\PhpWord\Settings; use PhpOffice\PhpWord\SimpleType\Jc; use PhpOffice\PhpWord\SimpleType\NumberFormat; -use PhpOffice\PhpWord\Settings; /** * Common Html functions @@ -50,7 +50,7 @@ class Html * + IMG_SRC_SEARCH: optional to speed up images loading from remote url when files can be found locally * + IMG_SRC_REPLACE: optional to speed up images loading from remote url when files can be found locally */ - public static function addHtml($element, $html, $fullHTML = false, $preserveWhiteSpace = true, $options = null ) + public static function addHtml($element, $html, $fullHTML = false, $preserveWhiteSpace = true, $options = null) { /* * @todo parse $stylesheet for default styles. Should result in an array based on id, class and element, @@ -303,9 +303,8 @@ class Html * * @todo As soon as TableItem, RowItem and CellItem support relative width and height */ - private static function parseTable($node, $element, &$styles ) + private static function parseTable($node, $element, &$styles) { - $elementStyles = self::parseInlineStyle($node, $styles['table']); $newElement = $element->addTable($elementStyles); @@ -656,45 +655,46 @@ class Html break; } } - if( strpos( $src, "data:image" ) !== false ){ - if( ! is_dir( self::$imgdir ) ) - mkdir( self::$imgdir ) ; + if (strpos($src, 'data:image') !== false) { + if (!is_dir(self::$imgdir)) { + mkdir(self::$imgdir); + } - $match = array(); - preg_match( '/data:image\/(\w+);base64,(.+)/', $src, $match ); + $match = array(); + preg_match('/data:image\/(\w+);base64,(.+)/', $src, $match); - $src = $imgFile = self::$imgdir . uniqid() . "." . $match[1]; + $src = $imgFile = self::$imgdir . uniqid() . '.' . $match[1]; - $ifp = fopen( $imgFile, "wb"); + $ifp = fopen($imgFile, 'wb'); - fwrite($ifp, base64_decode( $match[2] ) ); - fclose($ifp); + fwrite($ifp, base64_decode($match[2])); + fclose($ifp); + } + $src = urldecode($src); - } - $src= urldecode($src); - - if( ! is_file( $src ) + if (!is_file($src) && !is_null(self::$options) && isset(self::$options['IMG_SRC_SEARCH']) - && isset(self::$options['IMG_SRC_REPLACE'])){ - $src = str_replace( self::$options['IMG_SRC_SEARCH'], self::$options['IMG_SRC_REPLACE'], $src ); - } + && isset(self::$options['IMG_SRC_REPLACE'])) { + $src = str_replace(self::$options['IMG_SRC_SEARCH'], self::$options['IMG_SRC_REPLACE'], $src); + } - if(! is_file($src)){ - if($imgBlob=file_get_contents($src)){ - $tmpDir= Settings::getTempDir().'/'; - if( ! is_dir( $tmpDir ) ) - mkdir( $tmpDir ) ; - $match = array(); - preg_match( '/.+\.(\w+)$/', $src, $match ); - $src = $tmpDir . uniqid() . "." . $match[1]; + if (!is_file($src)) { + if ($imgBlob = file_get_contents($src)) { + $tmpDir = Settings::getTempDir() . '/'; + if (!is_dir($tmpDir)) { + mkdir($tmpDir); + } + $match = array(); + preg_match('/.+\.(\w+)$/', $src, $match); + $src = $tmpDir . uniqid() . '.' . $match[1]; - $ifp = fopen( $src, "wb"); + $ifp = fopen($src, 'wb'); - fwrite($ifp, $imgBlob ); - fclose($ifp); - } - } + fwrite($ifp, $imgBlob); + fclose($ifp); + } + } $newElement = $element->addImage($src, $style); return $newElement; diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index 9b5def85..8c42544d 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -115,6 +115,7 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:rPr/w:u')); $this->assertEquals('single', $doc->getElementAttribute('/w:document/w:body/w:p/w:r/w:rPr/w:u', 'w:val')); } + /** * Test font */ @@ -478,6 +479,7 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $baseXpath = '/w:document/w:body/w:p/w:r'; $this->assertTrue($doc->elementExists($baseXpath . '/w:pict/v:shape')); } + /** * Test parsing of remote img that can be found locally */ @@ -485,9 +487,9 @@ class HtmlTest extends \PHPUnit\Framework\TestCase { $src = 'https://fakedomain.io/images/firefox.png'; $localPath = __DIR__ . '/../_files/images/'; - $options= array( - 'IMG_SRC_SEARCH'=> 'https://fakedomain.io/images/', - 'IMG_SRC_REPLACE'=> $localPath + $options = array( + 'IMG_SRC_SEARCH' => 'https://fakedomain.io/images/', + 'IMG_SRC_REPLACE' => $localPath, ); $phpWord = new \PhpOffice\PhpWord\PhpWord(); From 46b7bea0975eb70a4cd6d8469d7fa859e277ec6e Mon Sep 17 00:00:00 2001 From: Javier Garcia Date: Thu, 24 May 2018 07:19:45 +0200 Subject: [PATCH 301/370] increased test coverage of new lines --- src/PhpWord/Shared/Html.php | 9 ++------- tests/PhpWord/Shared/HtmlTest.php | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 24f695c7..97b27018 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -656,14 +656,12 @@ class Html } } if (strpos($src, 'data:image') !== false) { - if (!is_dir(self::$imgdir)) { - mkdir(self::$imgdir); - } + $tmpDir = Settings::getTempDir() . '/'; $match = array(); preg_match('/data:image\/(\w+);base64,(.+)/', $src, $match); - $src = $imgFile = self::$imgdir . uniqid() . '.' . $match[1]; + $src = $imgFile = $tmpDir . uniqid() . '.' . $match[1]; $ifp = fopen($imgFile, 'wb'); @@ -682,9 +680,6 @@ class Html if (!is_file($src)) { if ($imgBlob = file_get_contents($src)) { $tmpDir = Settings::getTempDir() . '/'; - if (!is_dir($tmpDir)) { - mkdir($tmpDir); - } $match = array(); preg_match('/.+\.(\w+)$/', $src, $match); $src = $tmpDir . uniqid() . '.' . $match[1]; diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index 8c42544d..6925e3c2 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -480,6 +480,22 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists($baseXpath . '/w:pict/v:shape')); } + /** + * Test parsing embedded image + */ + public function testParseEmbeddedImage() + { + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $html = '

                  '; + Html::addHtml($section, $html); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + + $baseXpath = '/w:document/w:body/w:p/w:r'; + $this->assertTrue($doc->elementExists($baseXpath . '/w:pict/v:shape')); + } + /** * Test parsing of remote img that can be found locally */ From a89e4c93a78c964bd3b7e6dc5f1ab38bb0d18525 Mon Sep 17 00:00:00 2001 From: Javier Garcia Date: Fri, 25 May 2018 08:01:17 +0200 Subject: [PATCH 302/370] added exception control to file_get_contents error --- samples/resources/Sample_30_ReadHTML.html | 6 +++++- samples/results/.gitignore | 0 src/PhpWord/Shared/Html.php | 10 ++++++++-- tests/PhpWord/Shared/HtmlTest.php | 14 ++++++++++++++ 4 files changed, 27 insertions(+), 3 deletions(-) mode change 100644 => 100755 samples/results/.gitignore diff --git a/samples/resources/Sample_30_ReadHTML.html b/samples/resources/Sample_30_ReadHTML.html index ea982218..b3d2fad2 100644 --- a/samples/resources/Sample_30_ReadHTML.html +++ b/samples/resources/Sample_30_ReadHTML.html @@ -12,10 +12,14 @@

                  Ordered (numbered) list:

                  1. Item 1
                  2. Item 2
                  -

                  Double height

                  Includes images

                  + + + + + diff --git a/samples/results/.gitignore b/samples/results/.gitignore old mode 100644 new mode 100755 diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 97b27018..23172769 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -655,6 +655,7 @@ class Html break; } } + $origin_src= $src; if (strpos($src, 'data:image') !== false) { $tmpDir = Settings::getTempDir() . '/'; @@ -678,7 +679,7 @@ class Html } if (!is_file($src)) { - if ($imgBlob = file_get_contents($src)) { + if ($imgBlob = @file_get_contents($src)) { $tmpDir = Settings::getTempDir() . '/'; $match = array(); preg_match('/.+\.(\w+)$/', $src, $match); @@ -690,7 +691,12 @@ class Html fclose($ifp); } } - $newElement = $element->addImage($src, $style); + + if (is_file($src)){ + $newElement = $element->addImage($src, $style); + }else{ + throw new \Exception("Could not load image $origin_src"); + } return $newElement; } diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index 6925e3c2..481b5d75 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -519,6 +519,20 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists($baseXpath . '/w:pict/v:shape')); } + /** + * Test parsing of remote img that can be found locally + */ + public function testCouldNotLoadImage() + { + $src = 'https://fakedomain.io/images/firefox.png'; + $this->expectException(\Exception::class); + + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $html = '

                  '; + Html::addHtml($section, $html, false, true); + } + public function testParseLink() { $phpWord = new \PhpOffice\PhpWord\PhpWord(); From 65a594d2713b6ff876ca0a1d230404a0d160b6c9 Mon Sep 17 00:00:00 2001 From: Javier Garcia Date: Fri, 25 May 2018 09:29:58 +0200 Subject: [PATCH 303/370] cs-fixer fixes --- src/PhpWord/Shared/Html.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 23172769..58ce2412 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -655,7 +655,7 @@ class Html break; } } - $origin_src= $src; + $originSrc = $src; if (strpos($src, 'data:image') !== false) { $tmpDir = Settings::getTempDir() . '/'; @@ -692,10 +692,10 @@ class Html } } - if (is_file($src)){ - $newElement = $element->addImage($src, $style); - }else{ - throw new \Exception("Could not load image $origin_src"); + if (is_file($src)) { + $newElement = $element->addImage($src, $style); + } else { + throw new \Exception("Could not load image $originSrc"); } return $newElement; From 0c9626cedd0efe20de858c96cc9ba3fb2e2d78f1 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 27 May 2018 20:38:25 +0200 Subject: [PATCH 304/370] add .gitattributes --- .gitattributes | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..f3d033a7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,21 @@ +# build config +/.scrutinizer.yml export-ignore +/.travis.yml export-ignore +/php_cs.dist export-ignore +/phpmd.xml.dist export-ignore +/phpstan.neon export-ignore + +/composer.lock export-ignore + +# git files +/.gitignore export-ignore +/.gitattributes export-ignore + +# project directories +/build export-ignore +/docs export-ignore +/samples export-ignore + +# tests +/phpunit.xml.dist export-ignore +/tests export-ignore \ No newline at end of file From da604a80c43241b28c7cf6d07977f1533a70d39c Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 27 May 2018 20:53:42 +0200 Subject: [PATCH 305/370] use annotation instead --- tests/PhpWord/Shared/HtmlTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index 481b5d75..32f4bf46 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -521,11 +521,12 @@ class HtmlTest extends \PHPUnit\Framework\TestCase /** * Test parsing of remote img that can be found locally + * + * @expectedException \Exception */ public function testCouldNotLoadImage() { $src = 'https://fakedomain.io/images/firefox.png'; - $this->expectException(\Exception::class); $phpWord = new \PhpOffice\PhpWord\PhpWord(); $section = $phpWord->addSection(); From c22f7eab5e2a9e764946ddf77c8f82d21811871a Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 27 May 2018 21:27:45 +0200 Subject: [PATCH 306/370] add check on opened file --- src/PhpWord/Shared/Html.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 58ce2412..239cfd1d 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -666,8 +666,10 @@ class Html $ifp = fopen($imgFile, 'wb'); - fwrite($ifp, base64_decode($match[2])); - fclose($ifp); + if ($ifp !== false) { + fwrite($ifp, base64_decode($match[2])); + fclose($ifp); + } } $src = urldecode($src); @@ -687,8 +689,10 @@ class Html $ifp = fopen($src, 'wb'); - fwrite($ifp, $imgBlob); - fclose($ifp); + if ($ifp !== false) { + fwrite($ifp, $imgBlob); + fclose($ifp); + } } } From 82f3a2ab44f9de047087e5307fdb9269fb346e0c Mon Sep 17 00:00:00 2001 From: Edvin Hultberg Date: Thu, 31 May 2018 00:21:08 +0200 Subject: [PATCH 307/370] Update documentation for Style::add*Style methods (#1383) * Update documentation for Style::add*Style methods * remove phpDocumentor, simplify dependencies --- .travis.yml | 4 ++-- composer.json | 7 +++---- src/PhpWord/Element/AbstractElement.php | 2 +- src/PhpWord/PhpWord.php | 4 ++-- src/PhpWord/Style.php | 20 ++++++++++---------- src/PhpWord/Style/Font.php | 2 +- 6 files changed, 19 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index bd85b2d7..c72dd8c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,7 +37,7 @@ before_script: - composer self-update - travis_wait composer install --prefer-source ## PHPDocumentor - - mkdir -p build/docs + ##- mkdir -p build/docs - mkdir -p build/coverage script: @@ -52,7 +52,7 @@ script: ## PHPLOC - if [ -z "$COVERAGE" ]; then ./vendor/bin/phploc src/ ; fi ## PHPDocumentor - - if [ -z "$COVERAGE" ]; then ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig" ; fi + ##- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig" ; fi after_success: ## Coveralls diff --git a/composer.json b/composer.json index c29e901a..dd3a2de8 100644 --- a/composer.json +++ b/composer.json @@ -65,14 +65,13 @@ }, "require-dev": { "phpunit/phpunit": "^4.8.36 || ^5.0", - "phpdocumentor/phpdocumentor":"2.*", - "squizlabs/php_codesniffer": "^2.7", - "friendsofphp/php-cs-fixer": "^2.0", + "squizlabs/php_codesniffer": "^2.9", + "friendsofphp/php-cs-fixer": "^2.2", "phpmd/phpmd": "2.*", "phploc/phploc": "2.* || 3.* || 4.*", "dompdf/dompdf":"0.8.*", "tecnickcom/tcpdf": "6.*", - "mpdf/mpdf": "5.* || 6.* || 7.*", + "mpdf/mpdf": "5.7.4 || 6.* || 7.*", "php-coveralls/php-coveralls": "1.1.0 || ^2.0" }, "suggest": { diff --git a/src/PhpWord/Element/AbstractElement.php b/src/PhpWord/Element/AbstractElement.php index 5ff85b8f..e3e54ed4 100644 --- a/src/PhpWord/Element/AbstractElement.php +++ b/src/PhpWord/Element/AbstractElement.php @@ -347,7 +347,7 @@ abstract class AbstractElement * * @param \PhpOffice\PhpWord\Element\AbstractElement $container */ - public function setParentContainer(AbstractElement $container) + public function setParentContainer(self $container) { $this->parentContainer = substr(get_class($container), strrpos(get_class($container), '\\') + 1); $this->parent = $container; diff --git a/src/PhpWord/PhpWord.php b/src/PhpWord/PhpWord.php index b5cc0c51..a78df2c4 100644 --- a/src/PhpWord/PhpWord.php +++ b/src/PhpWord/PhpWord.php @@ -35,10 +35,10 @@ use PhpOffice\PhpWord\Exception\Exception; * @method int addChart(Element\Chart $chart) * @method int addComment(Element\Comment $comment) * - * @method Style\Paragraph addParagraphStyle(string $styleName, array $styles) + * @method Style\Paragraph addParagraphStyle(string $styleName, mixed $styles) * @method Style\Font addFontStyle(string $styleName, mixed $fontStyle, mixed $paragraphStyle = null) * @method Style\Font addLinkStyle(string $styleName, mixed $styles) - * @method Style\Font addTitleStyle(int $depth, mixed $fontStyle, mixed $paragraphStyle = null) + * @method Style\Font addTitleStyle(mixed $depth, mixed $fontStyle, mixed $paragraphStyle = null) * @method Style\Table addTableStyle(string $styleName, mixed $styleTable, mixed $styleFirstRow = null) * @method Style\Numbering addNumberingStyle(string $styleName, mixed $styles) */ diff --git a/src/PhpWord/Style.php b/src/PhpWord/Style.php index 47242621..62783b63 100644 --- a/src/PhpWord/Style.php +++ b/src/PhpWord/Style.php @@ -39,7 +39,7 @@ class Style * Add paragraph style * * @param string $styleName - * @param array $styles + * @param array|\PhpOffice\PhpWord\Style\AbstractStyle $styles * @return \PhpOffice\PhpWord\Style\Paragraph */ public static function addParagraphStyle($styleName, $styles) @@ -51,8 +51,8 @@ class Style * Add font style * * @param string $styleName - * @param array $fontStyle - * @param array $paragraphStyle + * @param array|\PhpOffice\PhpWord\Style\AbstractStyle $fontStyle + * @param array|\PhpOffice\PhpWord\Style\AbstractStyle $paragraphStyle * @return \PhpOffice\PhpWord\Style\Font */ public static function addFontStyle($styleName, $fontStyle, $paragraphStyle = null) @@ -64,7 +64,7 @@ class Style * Add link style * * @param string $styleName - * @param array $styles + * @param array|\PhpOffice\PhpWord\Style\AbstractStyle $styles * @return \PhpOffice\PhpWord\Style\Font */ public static function addLinkStyle($styleName, $styles) @@ -76,7 +76,7 @@ class Style * Add numbering style * * @param string $styleName - * @param array $styleValues + * @param array|\PhpOffice\PhpWord\Style\AbstractStyle $styleValues * @return \PhpOffice\PhpWord\Style\Numbering * @since 0.10.0 */ @@ -88,14 +88,14 @@ class Style /** * Add title style * - * @param int $depth - * @param array $fontStyle - * @param array $paragraphStyle + * @param int|null $depth Provide null to set title font + * @param array|\PhpOffice\PhpWord\Style\AbstractStyle $fontStyle + * @param array|\PhpOffice\PhpWord\Style\AbstractStyle $paragraphStyle * @return \PhpOffice\PhpWord\Style\Font */ public static function addTitleStyle($depth, $fontStyle, $paragraphStyle = null) { - if ($depth == null) { + if (empty($depth)) { $styleName = 'Title'; } else { $styleName = "Heading_{$depth}"; @@ -141,7 +141,7 @@ class Style /** * Set default paragraph style * - * @param array $styles Paragraph style definition + * @param array|\PhpOffice\PhpWord\Style\AbstractStyle $styles Paragraph style definition * @return \PhpOffice\PhpWord\Style\Paragraph */ public static function setDefaultParagraphStyle($styles) diff --git a/src/PhpWord/Style/Font.php b/src/PhpWord/Style/Font.php index c58cee49..e9f3c9d6 100644 --- a/src/PhpWord/Style/Font.php +++ b/src/PhpWord/Style/Font.php @@ -264,7 +264,7 @@ class Font extends AbstractStyle * Create new font style * * @param string $type Type of font - * @param array $paragraph Paragraph styles definition + * @param array|string|\PhpOffice\PhpWord\Style\AbstractStyle $paragraph Paragraph styles definition */ public function __construct($type = 'text', $paragraph = null) { From e76487172b78af26e44b250f85d41fce541f5084 Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 31 May 2018 00:31:41 +0200 Subject: [PATCH 308/370] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfcce5a4..e7b7ed68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ v0.15.0 (?? ??? 2018) - Add support for table indent (tblInd) @Trainmaster #1343 - Added parsing of internal links in HTML reader @lalop #1336 - Several improvements to charts @JAEK-S #1332 +- Add parsing of html image in base64 format @jgpATs2w #1382 ### Fixed - Fix reading of docx default style - @troosan #1238 From 1a06173e1b933cbb8945949aca3d6a90179b496e Mon Sep 17 00:00:00 2001 From: javier Date: Thu, 31 May 2018 01:28:14 +0200 Subject: [PATCH 309/370] Add parsing of html image in base64 format (#1382) * increased test coverage of new lines * added exception control to file_get_contents error * update changelog --- CHANGELOG.md | 1 + samples/resources/Sample_30_ReadHTML.html | 10 +++ samples/results/.gitignore | 0 src/PhpWord/Shared/Html.php | 56 ++++++++++++++- tests/PhpWord/Shared/HtmlTest.php | 87 +++++++++++++++++++++++ 5 files changed, 152 insertions(+), 2 deletions(-) mode change 100644 => 100755 samples/results/.gitignore diff --git a/CHANGELOG.md b/CHANGELOG.md index dfcce5a4..e7b7ed68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ v0.15.0 (?? ??? 2018) - Add support for table indent (tblInd) @Trainmaster #1343 - Added parsing of internal links in HTML reader @lalop #1336 - Several improvements to charts @JAEK-S #1332 +- Add parsing of html image in base64 format @jgpATs2w #1382 ### Fixed - Fix reading of docx default style - @troosan #1238 diff --git a/samples/resources/Sample_30_ReadHTML.html b/samples/resources/Sample_30_ReadHTML.html index 5593298b..b3d2fad2 100644 --- a/samples/resources/Sample_30_ReadHTML.html +++ b/samples/resources/Sample_30_ReadHTML.html @@ -11,5 +11,15 @@
                  • Item 1
                  • Item 2
                    • Item 2.1
                    • Item 2.1

                  Ordered (numbered) list:

                  1. Item 1
                  2. Item 2
                  + +

                  Double height

                  + +

                  Includes images

                  + + + + + + diff --git a/samples/results/.gitignore b/samples/results/.gitignore old mode 100644 new mode 100755 diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index cbdcecd5..239cfd1d 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -20,6 +20,7 @@ namespace PhpOffice\PhpWord\Shared; use PhpOffice\PhpWord\Element\AbstractContainer; use PhpOffice\PhpWord\Element\Row; use PhpOffice\PhpWord\Element\Table; +use PhpOffice\PhpWord\Settings; use PhpOffice\PhpWord\SimpleType\Jc; use PhpOffice\PhpWord\SimpleType\NumberFormat; @@ -32,6 +33,7 @@ class Html { private static $listIndex = 0; private static $xpath; + private static $options; /** * Add HTML parts. @@ -44,13 +46,17 @@ class Html * @param string $html The code to parse * @param bool $fullHTML If it's a full HTML, no need to add 'body' tag * @param bool $preserveWhiteSpace If false, the whitespaces between nodes will be removed + * @param array $options: + * + IMG_SRC_SEARCH: optional to speed up images loading from remote url when files can be found locally + * + IMG_SRC_REPLACE: optional to speed up images loading from remote url when files can be found locally */ - public static function addHtml($element, $html, $fullHTML = false, $preserveWhiteSpace = true) + public static function addHtml($element, $html, $fullHTML = false, $preserveWhiteSpace = true, $options = null) { /* * @todo parse $stylesheet for default styles. Should result in an array based on id, class and element, * which could be applied when such an element occurs in the parseNode function. */ + self::$options = $options; // Preprocess: remove all line ends, decode HTML entity, // fix ampersand and angle brackets and add body tag for HTML fragments @@ -141,6 +147,7 @@ class Html 'sup' => array('Property', null, null, $styles, null, 'superScript', true), 'sub' => array('Property', null, null, $styles, null, 'subScript', true), 'span' => array('Span', $node, null, $styles, null, null, null), + 'font' => array('Span', $node, null, $styles, null, null, null), 'table' => array('Table', $node, $element, $styles, null, null, null), 'tr' => array('Row', $node, $element, $styles, null, null, null), 'td' => array('Cell', $node, $element, $styles, null, null, null), @@ -648,7 +655,52 @@ class Html break; } } - $newElement = $element->addImage($src, $style); + $originSrc = $src; + if (strpos($src, 'data:image') !== false) { + $tmpDir = Settings::getTempDir() . '/'; + + $match = array(); + preg_match('/data:image\/(\w+);base64,(.+)/', $src, $match); + + $src = $imgFile = $tmpDir . uniqid() . '.' . $match[1]; + + $ifp = fopen($imgFile, 'wb'); + + if ($ifp !== false) { + fwrite($ifp, base64_decode($match[2])); + fclose($ifp); + } + } + $src = urldecode($src); + + if (!is_file($src) + && !is_null(self::$options) + && isset(self::$options['IMG_SRC_SEARCH']) + && isset(self::$options['IMG_SRC_REPLACE'])) { + $src = str_replace(self::$options['IMG_SRC_SEARCH'], self::$options['IMG_SRC_REPLACE'], $src); + } + + if (!is_file($src)) { + if ($imgBlob = @file_get_contents($src)) { + $tmpDir = Settings::getTempDir() . '/'; + $match = array(); + preg_match('/.+\.(\w+)$/', $src, $match); + $src = $tmpDir . uniqid() . '.' . $match[1]; + + $ifp = fopen($src, 'wb'); + + if ($ifp !== false) { + fwrite($ifp, $imgBlob); + fclose($ifp); + } + } + } + + if (is_file($src)) { + $newElement = $element->addImage($src, $style); + } else { + throw new \Exception("Could not load image $originSrc"); + } return $newElement; } diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index b61418e0..32f4bf46 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -116,6 +116,21 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $this->assertEquals('single', $doc->getElementAttribute('/w:document/w:body/w:p/w:r/w:rPr/w:u', 'w:val')); } + /** + * Test font + */ + public function testParseFont() + { + $html = 'test'; + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + Html::addHtml($section, $html); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:rPr')); + //TODO check style + } + /** * Test line-height style */ @@ -447,6 +462,78 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $this->assertStringMatchesFormat('%Smso-position-horizontal:left%S', $doc->getElementAttribute($baseXpath . '[2]/w:pict/v:shape', 'style')); } + /** + * Test parsing of remote img + */ + public function testParseRemoteImage() + { + $src = 'https://phpword.readthedocs.io/en/latest/_images/phpword.png'; + + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $html = '

                  '; + Html::addHtml($section, $html); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + + $baseXpath = '/w:document/w:body/w:p/w:r'; + $this->assertTrue($doc->elementExists($baseXpath . '/w:pict/v:shape')); + } + + /** + * Test parsing embedded image + */ + public function testParseEmbeddedImage() + { + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $html = '

                  '; + Html::addHtml($section, $html); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + + $baseXpath = '/w:document/w:body/w:p/w:r'; + $this->assertTrue($doc->elementExists($baseXpath . '/w:pict/v:shape')); + } + + /** + * Test parsing of remote img that can be found locally + */ + public function testParseRemoteLocalImage() + { + $src = 'https://fakedomain.io/images/firefox.png'; + $localPath = __DIR__ . '/../_files/images/'; + $options = array( + 'IMG_SRC_SEARCH' => 'https://fakedomain.io/images/', + 'IMG_SRC_REPLACE' => $localPath, + ); + + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $html = '

                  '; + Html::addHtml($section, $html, false, true, $options); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + + $baseXpath = '/w:document/w:body/w:p/w:r'; + $this->assertTrue($doc->elementExists($baseXpath . '/w:pict/v:shape')); + } + + /** + * Test parsing of remote img that can be found locally + * + * @expectedException \Exception + */ + public function testCouldNotLoadImage() + { + $src = 'https://fakedomain.io/images/firefox.png'; + + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + $html = '

                  '; + Html::addHtml($section, $html, false, true); + } + public function testParseLink() { $phpWord = new \PhpOffice\PhpWord\PhpWord(); From aa271091016a2ae8a793b404fcb170d37b87bbd3 Mon Sep 17 00:00:00 2001 From: Omar Piani Date: Thu, 31 May 2018 11:43:20 +0200 Subject: [PATCH 310/370] Update Language.php --- src/PhpWord/Style/Language.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/PhpWord/Style/Language.php b/src/PhpWord/Style/Language.php index 4e9220fd..21c416af 100644 --- a/src/PhpWord/Style/Language.php +++ b/src/PhpWord/Style/Language.php @@ -46,6 +46,9 @@ final class Language extends AbstractStyle const HE_IL = 'he-IL'; const HE_IL_ID = 1037; + + const IT_IT = 'it-IT'; + const IT_IT_ID = 1040; const JA_JP = 'ja-JP'; const JA_JP_ID = 1041; From 0bd7c0b301494f27e07b5984a5c24ac2d3f934b0 Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 31 May 2018 19:50:43 +0200 Subject: [PATCH 311/370] Add constants for Italian --- src/PhpWord/Style/Language.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Style/Language.php b/src/PhpWord/Style/Language.php index 21c416af..5284bbf3 100644 --- a/src/PhpWord/Style/Language.php +++ b/src/PhpWord/Style/Language.php @@ -46,7 +46,7 @@ final class Language extends AbstractStyle const HE_IL = 'he-IL'; const HE_IL_ID = 1037; - + const IT_IT = 'it-IT'; const IT_IT_ID = 1040; From 4e37afa15da62cdd695a18db2a40d86615086e9d Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 31 May 2018 20:10:49 +0200 Subject: [PATCH 312/370] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfb1cb5c..221377df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,7 +34,7 @@ v0.15.0 (?? ??? 2018) - Fix colspan and rowspan for tables in HTML Writer @mattbolt #1292 - Fix parsing of Heading and Title formating @troosan @gthomas2 #465 - Fix Dateformat typo, fix hours casing, add Month-Day-Year formats @ComputerTinker #591 -- Fix missing column with in ODText writer @potofcoffee #413 +- Fix missing column width in ODText writer @potofcoffee #413 ### Changed - Remove zend-stdlib dependency @Trainmaster #1284 From d9ddc162a362cae5ef3842e5d44e052aa946a1e9 Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 18 Apr 2018 22:34:53 +0200 Subject: [PATCH 313/370] write column width in ODT writer --- CHANGELOG.md | 1 + src/PhpWord/Element/Table.php | 24 +++++++ src/PhpWord/Style/Table.php | 27 ++++++++ src/PhpWord/Writer/ODText/Element/Table.php | 63 ++++++++++++++----- src/PhpWord/Writer/ODText/Part/Content.php | 1 + src/PhpWord/Writer/ODText/Style/Table.php | 13 ++++ src/PhpWord/Writer/Word2007/Element/Table.php | 16 +---- 7 files changed, 114 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7b7ed68..868a4eba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ v0.15.0 (?? ??? 2018) - Fix colspan and rowspan for tables in HTML Writer @mattbolt #1292 - Fix parsing of Heading and Title formating @troosan @gthomas2 #465 - Fix Dateformat typo, fix hours casing, add Month-Day-Year formats @ComputerTinker #591 +- Fix missing column with in ODText writer @potofcoffee #413 ### Changed - Remove zend-stdlib dependency @Trainmaster #1284 diff --git a/src/PhpWord/Element/Table.php b/src/PhpWord/Element/Table.php index 10c4db69..16102119 100644 --- a/src/PhpWord/Element/Table.php +++ b/src/PhpWord/Element/Table.php @@ -149,4 +149,28 @@ class Table extends AbstractElement return $columnCount; } + + /** + * The first declared cell width for each column + * + * @return int[] + */ + public function findFirstDefinedCellWidths() + { + $cellWidths = array(); + if (is_array($this->rows)) { + foreach ($this->rows as $row) { + $cells = $row->getCells(); + if (count($cells) <= count($cellWidths)) { + continue; + } + $cellWidths = array(); + foreach ($cells as $cell) { + $cellWidths[] = $cell->getWidth(); + } + } + } + + return $cellWidths; + } } diff --git a/src/PhpWord/Style/Table.php b/src/PhpWord/Style/Table.php index b622c78b..0f7bf7dc 100644 --- a/src/PhpWord/Style/Table.php +++ b/src/PhpWord/Style/Table.php @@ -163,6 +163,13 @@ class Table extends Border /** @var TblWidthComplexType|null */ private $indent; + /** + * The width of each column, computed based on the max cell width of each column + * + * @var int[] + */ + private $columnWidths; + /** * Create new table style * @@ -748,4 +755,24 @@ class Table extends Border return $this; } + + /** + * Get the columnWidths + * + * @return number[] + */ + public function getColumnWidths() + { + return $this->columnWidths; + } + + /** + * The column widths + * + * @param int[] $value + */ + public function setColumnWidths(array $value = null) + { + $this->columnWidths = $value; + } } diff --git a/src/PhpWord/Writer/ODText/Element/Table.php b/src/PhpWord/Writer/ODText/Element/Table.php index 8a21ee1b..088330ae 100644 --- a/src/PhpWord/Writer/ODText/Element/Table.php +++ b/src/PhpWord/Writer/ODText/Element/Table.php @@ -17,6 +17,10 @@ namespace PhpOffice\PhpWord\Writer\ODText\Element; +use PhpOffice\Common\XMLWriter; +use PhpOffice\PhpWord\Element\Row as RowElement; +use PhpOffice\PhpWord\Element\Table as TableElement; + /** * Table element writer * @@ -36,32 +40,59 @@ class Table extends AbstractElement } $rows = $element->getRows(); $rowCount = count($rows); - $colCount = $element->countColumns(); if ($rowCount > 0) { $xmlWriter->startElement('table:table'); $xmlWriter->writeAttribute('table:name', $element->getElementId()); $xmlWriter->writeAttribute('table:style', $element->getElementId()); - $xmlWriter->startElement('table:table-column'); - $xmlWriter->writeAttribute('table:number-columns-repeated', $colCount); - $xmlWriter->endElement(); // table:table-column + // Write columns + $this->writeColumns($xmlWriter, $element); + // Write rows foreach ($rows as $row) { - $xmlWriter->startElement('table:table-row'); - /** @var $row \PhpOffice\PhpWord\Element\Row Type hint */ - foreach ($row->getCells() as $cell) { - $xmlWriter->startElement('table:table-cell'); - $xmlWriter->writeAttribute('office:value-type', 'string'); - - $containerWriter = new Container($xmlWriter, $cell); - $containerWriter->write(); - - $xmlWriter->endElement(); // table:table-cell - } - $xmlWriter->endElement(); // table:table-row + $this->writeRow($xmlWriter, $row); } $xmlWriter->endElement(); // table:table } } + + /** + * Write column. + * + * @param \PhpOffice\Common\XMLWriter $xmlWriter + * @param \PhpOffice\PhpWord\Element\Table $element + */ + private function writeColumns(XMLWriter $xmlWriter, TableElement $element) + { + $colCount = $element->countColumns(); + + for ($i = 0; $i < $colCount; $i++) { + $xmlWriter->startElement('table:table-column'); + $xmlWriter->writeAttribute('table:style-name', $element->getElementId() . '.' . $i); + $xmlWriter->endElement(); + } + } + + /** + * Write row. + * + * @param \PhpOffice\Common\XMLWriter $xmlWriter + * @param \PhpOffice\PhpWord\Element\Row $row + */ + private function writeRow(XMLWriter $xmlWriter, RowElement $row) + { + $xmlWriter->startElement('table:table-row'); + /** @var $row \PhpOffice\PhpWord\Element\Row Type hint */ + foreach ($row->getCells() as $cell) { + $xmlWriter->startElement('table:table-cell'); + $xmlWriter->writeAttribute('office:value-type', 'string'); + + $containerWriter = new Container($xmlWriter, $cell); + $containerWriter->write(); + + $xmlWriter->endElement(); // table:table-cell + } + $xmlWriter->endElement(); // table:table-row + } } diff --git a/src/PhpWord/Writer/ODText/Part/Content.php b/src/PhpWord/Writer/ODText/Part/Content.php index a50eea7b..b705bb5e 100644 --- a/src/PhpWord/Writer/ODText/Part/Content.php +++ b/src/PhpWord/Writer/ODText/Part/Content.php @@ -246,6 +246,7 @@ class Content extends AbstractPart $style = Style::getStyle($style); } $style->setStyleName($element->getElementId()); + $style->setColumnWidths($element->findFirstDefinedCellWidths()); $this->autoStyles['Table'][] = $style; } } diff --git a/src/PhpWord/Writer/ODText/Style/Table.php b/src/PhpWord/Writer/ODText/Style/Table.php index 249321cf..f5a3c431 100644 --- a/src/PhpWord/Writer/ODText/Style/Table.php +++ b/src/PhpWord/Writer/ODText/Style/Table.php @@ -45,5 +45,18 @@ class Table extends AbstractStyle $xmlWriter->writeAttribute('table:align', 'center'); $xmlWriter->endElement(); // style:table-properties $xmlWriter->endElement(); // style:style + + $cellWidths = $style->getColumnWidths(); + + for ($i = 0; $i < count($cellWidths); $i++) { + $width = $cellWidths[$i]; + $xmlWriter->startElement('style:style'); + $xmlWriter->writeAttribute('style:name', $style->getStyleName() . '.' . $i); + $xmlWriter->writeAttribute('style:family', 'table-column'); + $xmlWriter->startElement('style:table-column-properties'); + $xmlWriter->writeAttribute('style:column-width', number_format($width * 0.0017638889, 2, '.', '') . 'cm'); + $xmlWriter->endElement(); // style:table-column-properties + $xmlWriter->endElement(); // style:style + } } } diff --git a/src/PhpWord/Writer/Word2007/Element/Table.php b/src/PhpWord/Writer/Word2007/Element/Table.php index 25a48ab2..c365b028 100644 --- a/src/PhpWord/Writer/Word2007/Element/Table.php +++ b/src/PhpWord/Writer/Word2007/Element/Table.php @@ -76,21 +76,7 @@ class Table extends AbstractElement */ private function writeColumns(XMLWriter $xmlWriter, TableElement $element) { - $rows = $element->getRows(); - $rowCount = count($rows); - - $cellWidths = array(); - for ($i = 0; $i < $rowCount; $i++) { - $row = $rows[$i]; - $cells = $row->getCells(); - if (count($cells) <= count($cellWidths)) { - continue; - } - $cellWidths = array(); - foreach ($cells as $cell) { - $cellWidths[] = $cell->getWidth(); - } - } + $cellWidths = $element->findFirstDefinedCellWidths(); $xmlWriter->startElement('w:tblGrid'); foreach ($cellWidths as $width) { From da43a880e36fc43c6d715cfbb5adb89eee02350f Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 3 Jun 2018 00:22:08 +0200 Subject: [PATCH 314/370] Address scrutinizer issues --- src/PhpWord/Element/Table.php | 36 ++++++++++------------ src/PhpWord/Writer/ODText/Part/Content.php | 1 + src/PhpWord/Writer/ODText/Style/Table.php | 3 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/PhpWord/Element/Table.php b/src/PhpWord/Element/Table.php index 16102119..44fe3744 100644 --- a/src/PhpWord/Element/Table.php +++ b/src/PhpWord/Element/Table.php @@ -135,15 +135,14 @@ class Table extends AbstractElement public function countColumns() { $columnCount = 0; - if (is_array($this->rows)) { - $rowCount = count($this->rows); - for ($i = 0; $i < $rowCount; $i++) { - /** @var \PhpOffice\PhpWord\Element\Row $row Type hint */ - $row = $this->rows[$i]; - $cellCount = count($row->getCells()); - if ($columnCount < $cellCount) { - $columnCount = $cellCount; - } + + $rowCount = count($this->rows); + for ($i = 0; $i < $rowCount; $i++) { + /** @var \PhpOffice\PhpWord\Element\Row $row Type hint */ + $row = $this->rows[$i]; + $cellCount = count($row->getCells()); + if ($columnCount < $cellCount) { + $columnCount = $cellCount; } } @@ -158,16 +157,15 @@ class Table extends AbstractElement public function findFirstDefinedCellWidths() { $cellWidths = array(); - if (is_array($this->rows)) { - foreach ($this->rows as $row) { - $cells = $row->getCells(); - if (count($cells) <= count($cellWidths)) { - continue; - } - $cellWidths = array(); - foreach ($cells as $cell) { - $cellWidths[] = $cell->getWidth(); - } + + foreach ($this->rows as $row) { + $cells = $row->getCells(); + if (count($cells) <= count($cellWidths)) { + continue; + } + $cellWidths = array(); + foreach ($cells as $cell) { + $cellWidths[] = $cell->getWidth(); } } diff --git a/src/PhpWord/Writer/ODText/Part/Content.php b/src/PhpWord/Writer/ODText/Part/Content.php index b705bb5e..99ee9353 100644 --- a/src/PhpWord/Writer/ODText/Part/Content.php +++ b/src/PhpWord/Writer/ODText/Part/Content.php @@ -239,6 +239,7 @@ class Content extends AbstractPart $style->setStyleName('fr' . $element->getMediaIndex()); $this->autoStyles['Image'][] = $style; } elseif ($element instanceof Table) { + /** @var \PhpOffice\PhpWord\Style\Table $style */ $style = $element->getStyle(); if ($style === null) { $style = new TableStyle(); diff --git a/src/PhpWord/Writer/ODText/Style/Table.php b/src/PhpWord/Writer/ODText/Style/Table.php index f5a3c431..5ddee25a 100644 --- a/src/PhpWord/Writer/ODText/Style/Table.php +++ b/src/PhpWord/Writer/ODText/Style/Table.php @@ -47,8 +47,9 @@ class Table extends AbstractStyle $xmlWriter->endElement(); // style:style $cellWidths = $style->getColumnWidths(); + $countCellWidths = count($cellWidths); - for ($i = 0; $i < count($cellWidths); $i++) { + for ($i = 0; $i < $countCellWidths; $i++) { $width = $cellWidths[$i]; $xmlWriter->startElement('style:style'); $xmlWriter->writeAttribute('style:name', $style->getStyleName() . '.' . $i); From 5b9719071e1454bdbd4faa5940ba81636334ca73 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 3 Jun 2018 22:36:30 +0200 Subject: [PATCH 315/370] remove unused imports --- samples/Sample_01_SimpleText.php | 1 - tests/PhpWord/Style/PaperTest.php | 1 - tests/PhpWord/Writer/Word2007/Part/SettingsTest.php | 1 - 3 files changed, 3 deletions(-) diff --git a/samples/Sample_01_SimpleText.php b/samples/Sample_01_SimpleText.php index 5a3393b3..8af44d20 100644 --- a/samples/Sample_01_SimpleText.php +++ b/samples/Sample_01_SimpleText.php @@ -1,6 +1,5 @@ Date: Wed, 13 Jun 2018 17:41:17 +0200 Subject: [PATCH 316/370] fix when style line-height size comes in decimal number --- samples/resources/Sample_30_ReadHTML.html | 9 ++++++--- src/PhpWord/Shared/Html.php | 2 +- tests/PhpWord/Shared/ConverterTest.php | 1 + tests/PhpWord/Shared/HtmlTest.php | 5 +++++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/samples/resources/Sample_30_ReadHTML.html b/samples/resources/Sample_30_ReadHTML.html index b3d2fad2..3ccbb5f2 100644 --- a/samples/resources/Sample_30_ReadHTML.html +++ b/samples/resources/Sample_30_ReadHTML.html @@ -17,9 +17,12 @@

                  Includes images

                  - - - +

                  Nested p and i

                  +

                  + Contenido + B.O. de la Provincia de Barcelona + , 6-9-1939, citado en Díaz Plaja, F.: "España 1939-1979", +

                  diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 58ce2412..f5a7e567 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -530,7 +530,7 @@ class Html $styles['bgColor'] = trim($cValue, '#'); break; case 'line-height': - if (preg_match('/([0-9]+[a-z]+)/', $cValue, $matches)) { + if (preg_match('/([0-9]+\.?[0-9]*[a-z]+)/', $cValue, $matches)) { $spacingLineRule = \PhpOffice\PhpWord\SimpleType\LineSpacingRule::EXACT; $spacing = Converter::cssToTwip($matches[1]) / \PhpOffice\PhpWord\Style\Paragraph::LINE_HEIGHT; } elseif (preg_match('/([0-9]+)%/', $cValue, $matches)) { diff --git a/tests/PhpWord/Shared/ConverterTest.php b/tests/PhpWord/Shared/ConverterTest.php index 3798a07b..fbe92c25 100644 --- a/tests/PhpWord/Shared/ConverterTest.php +++ b/tests/PhpWord/Shared/ConverterTest.php @@ -126,6 +126,7 @@ class ConverterTest extends \PHPUnit\Framework\TestCase $this->assertEquals(10, Converter::cssToPoint('10pt')); $this->assertEquals(7.5, Converter::cssToPoint('10px')); $this->assertEquals(720, Converter::cssToPoint('10in')); + $this->assertEquals(7.2, Converter::cssToPoint('0.1in')); $this->assertEquals(120, Converter::cssToPoint('10pc')); $this->assertEquals(28.346457, Converter::cssToPoint('10mm'), '', 0.000001); $this->assertEquals(283.464567, Converter::cssToPoint('10cm'), '', 0.000001); diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index 481b5d75..ac273ad0 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -141,6 +141,7 @@ class HtmlTest extends \PHPUnit\Framework\TestCase Html::addHtml($section, '

                  test

                  '); Html::addHtml($section, '

                  test

                  '); Html::addHtml($section, '

                  test

                  '); + Html::addHtml($section, '

                  test

                  '); $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); $this->assertTrue($doc->elementExists('/w:document/w:body/w:p[1]/w:pPr/w:spacing')); @@ -154,6 +155,10 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $this->assertTrue($doc->elementExists('/w:document/w:body/w:p[3]/w:pPr/w:spacing')); $this->assertEquals(Paragraph::LINE_HEIGHT * 1.2, $doc->getElementAttribute('/w:document/w:body/w:p[3]/w:pPr/w:spacing', 'w:line')); $this->assertEquals(LineSpacingRule::AUTO, $doc->getElementAttribute('/w:document/w:body/w:p[3]/w:pPr/w:spacing', 'w:lineRule')); + + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p[4]/w:pPr/w:spacing')); + $this->assertEquals(244.8, $doc->getElementAttribute('/w:document/w:body/w:p[4]/w:pPr/w:spacing', 'w:line')); + $this->assertEquals(LineSpacingRule::EXACT, $doc->getElementAttribute('/w:document/w:body/w:p[4]/w:pPr/w:spacing', 'w:lineRule')); } /** From c93880b1250b06a73b557617f693c3cfd30dd59d Mon Sep 17 00:00:00 2001 From: Javier Garcia Date: Wed, 13 Jun 2018 18:14:13 +0200 Subject: [PATCH 317/370] clean sample resource --- samples/resources/Sample_30_ReadHTML.html | 7 ------- 1 file changed, 7 deletions(-) diff --git a/samples/resources/Sample_30_ReadHTML.html b/samples/resources/Sample_30_ReadHTML.html index 3ccbb5f2..0ff1a414 100644 --- a/samples/resources/Sample_30_ReadHTML.html +++ b/samples/resources/Sample_30_ReadHTML.html @@ -17,12 +17,5 @@

                  Includes images

                  -

                  Nested p and i

                  -

                  - Contenido - B.O. de la Provincia de Barcelona - , 6-9-1939, citado en Díaz Plaja, F.: "España 1939-1979", -

                  - From 94cf1aecb6fa9dce566a4b88aeb282b33e9cc5b7 Mon Sep 17 00:00:00 2001 From: Jonathan Jefferies Date: Fri, 13 Jul 2018 23:12:34 +0100 Subject: [PATCH 318/370] Require `ext-zip` for development (#1419) * Require `ext-zip` for development * Require `ext-gd` for development --- composer.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/composer.json b/composer.json index dd3a2de8..9a14618e 100644 --- a/composer.json +++ b/composer.json @@ -64,6 +64,8 @@ "phpoffice/common": "^0.2" }, "require-dev": { + "ext-zip": "*", + "ext-gd": "*", "phpunit/phpunit": "^4.8.36 || ^5.0", "squizlabs/php_codesniffer": "^2.9", "friendsofphp/php-cs-fixer": "^2.2", From 536a1b89d73c1f7a14322839cd5598eddb3d1cfc Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 14 Jul 2018 00:50:01 +0200 Subject: [PATCH 319/370] disable entity loader --- composer.json | 2 +- src/PhpWord/Shared/Html.php | 1 + src/PhpWord/TemplateProcessor.php | 1 + tests/PhpWord/_includes/XmlDocument.php | 2 ++ 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 9a14618e..4bba86b3 100644 --- a/composer.json +++ b/composer.json @@ -66,7 +66,7 @@ "require-dev": { "ext-zip": "*", "ext-gd": "*", - "phpunit/phpunit": "^4.8.36 || ^5.0", + "phpunit/phpunit": "^4.8.36 || ^7.0", "squizlabs/php_codesniffer": "^2.9", "friendsofphp/php-cs-fixer": "^2.2", "phpmd/phpmd": "2.*", diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 239cfd1d..a4281678 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -71,6 +71,7 @@ class Html } // Load DOM + libxml_disable_entity_loader(true); $dom = new \DOMDocument(); $dom->preserveWhiteSpace = $preserveWhiteSpace; $dom->loadXML($html); diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php index 72446ae7..946d6691 100644 --- a/src/PhpWord/TemplateProcessor.php +++ b/src/PhpWord/TemplateProcessor.php @@ -113,6 +113,7 @@ class TemplateProcessor */ protected function transformSingleXml($xml, $xsltProcessor) { + libxml_disable_entity_loader(true); $domDocument = new \DOMDocument(); if (false === $domDocument->loadXML($xml)) { throw new Exception('Could not load the given XML document.'); diff --git a/tests/PhpWord/_includes/XmlDocument.php b/tests/PhpWord/_includes/XmlDocument.php index 8c937bf5..81de7eff 100644 --- a/tests/PhpWord/_includes/XmlDocument.php +++ b/tests/PhpWord/_includes/XmlDocument.php @@ -76,8 +76,10 @@ class XmlDocument $this->file = $file; $file = $this->path . '/' . $file; + libxml_disable_entity_loader(false); $this->dom = new \DOMDocument(); $this->dom->load($file); + libxml_disable_entity_loader(true); return $this->dom; } From 96b21badaf99442f2a1de5a1b2298ae371d0e901 Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 14 Jul 2018 00:54:41 +0200 Subject: [PATCH 320/370] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cdd78870..d2b009dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ v0.15.0 (?? ??? 2018) - Fix parsing of Heading and Title formating @troosan @gthomas2 #465 - Fix Dateformat typo, fix hours casing, add Month-Day-Year formats @ComputerTinker #591 - Fix missing column width in ODText writer @potofcoffee #413 +- Disable entity loader before parsing XML to avoid XXE injection @Tom4t0 #1427 ### Changed - Remove zend-stdlib dependency @Trainmaster #1284 From 4c4c6f43ca446c0998f925f52b3b1aa3fe5289bb Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 14 Jul 2018 00:59:54 +0200 Subject: [PATCH 321/370] remove options not compatible with latest phpunit version --- phpunit.xml.dist | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 015dd2ed..17fcfa39 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -6,8 +6,7 @@ convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" - stopOnFailure="false" - syntaxCheck="false"> + stopOnFailure="false"> ./tests/PhpWord @@ -22,7 +21,7 @@ - + \ No newline at end of file From 3906be19ee92729a4e12bdbd499f031aae12bf03 Mon Sep 17 00:00:00 2001 From: smaug1985 Date: Sat, 14 Jul 2018 02:13:45 +0200 Subject: [PATCH 322/370] Added Support for Indentation & Tabs on RTF Writer. (#1405) * Added Support for Indentation & Tabs on RTF Writer. * add decimal tab writer + tests * Update CHANGELOG.md --- CHANGELOG.md | 1 + src/PhpWord/Writer/RTF/Style/Indentation.php | 45 ++++++++++++++++ src/PhpWord/Writer/RTF/Style/Paragraph.php | 40 ++++++++++++++ src/PhpWord/Writer/RTF/Style/Tab.php | 49 +++++++++++++++++ tests/PhpWord/Writer/RTF/StyleTest.php | 55 +++++++++++++++++++- 5 files changed, 189 insertions(+), 1 deletion(-) create mode 100644 src/PhpWord/Writer/RTF/Style/Indentation.php create mode 100644 src/PhpWord/Writer/RTF/Style/Tab.php diff --git a/CHANGELOG.md b/CHANGELOG.md index d2b009dc..03387b37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ v0.15.0 (?? ??? 2018) - Added parsing of internal links in HTML reader @lalop #1336 - Several improvements to charts @JAEK-S #1332 - Add parsing of html image in base64 format @jgpATs2w #1382 +- Added Support for Indentation & Tabs on RTF Writer. @smaug1985 #1405 ### Fixed - Fix reading of docx default style - @troosan #1238 diff --git a/src/PhpWord/Writer/RTF/Style/Indentation.php b/src/PhpWord/Writer/RTF/Style/Indentation.php new file mode 100644 index 00000000..5c80af0c --- /dev/null +++ b/src/PhpWord/Writer/RTF/Style/Indentation.php @@ -0,0 +1,45 @@ +getStyle(); + if (!$style instanceof \PhpOffice\PhpWord\Style\Indentation) { + return; + } + + $content = '\fi' . $style->getFirstLine(); + $content .= '\li' . $style->getLeft(); + $content .= '\ri' . $style->getRight(); + + return $content . ' '; + } +} diff --git a/src/PhpWord/Writer/RTF/Style/Paragraph.php b/src/PhpWord/Writer/RTF/Style/Paragraph.php index 3b8690cd..cb50a31b 100644 --- a/src/PhpWord/Writer/RTF/Style/Paragraph.php +++ b/src/PhpWord/Writer/RTF/Style/Paragraph.php @@ -64,9 +64,49 @@ class Paragraph extends AbstractStyle if (isset($alignments[$style->getAlignment()])) { $content .= $alignments[$style->getAlignment()]; } + $content .= $this->writeIndentation($style->getIndentation()); $content .= $this->getValueIf($spaceBefore !== null, '\sb' . $spaceBefore); $content .= $this->getValueIf($spaceAfter !== null, '\sa' . $spaceAfter); + $styles = $style->getStyleValues(); + $content .= $this->writeTabs($styles['tabs']); + + return $content; + } + + /** + * Writes an \PhpOffice\PhpWord\Style\Indentation + * + * @param null|\PhpOffice\PhpWord\Style\Indentation $indent + * @return string + */ + private function writeIndentation($indent = null) + { + if (isset($indent) && $indent instanceof \PhpOffice\PhpWord\Style\Indentation) { + $writer = new Indentation($indent); + + return $writer->write(); + } + + return ''; + } + + /** + * Writes tabs + * + * @param \PhpOffice\PhpWord\Style\Tab[] $tabs + * @return string + */ + private function writeTabs($tabs = null) + { + $content = ''; + if (!empty($tabs)) { + foreach ($tabs as $tab) { + $styleWriter = new Tab($tab); + $content .= $styleWriter->write(); + } + } + return $content; } diff --git a/src/PhpWord/Writer/RTF/Style/Tab.php b/src/PhpWord/Writer/RTF/Style/Tab.php new file mode 100644 index 00000000..fe1f9363 --- /dev/null +++ b/src/PhpWord/Writer/RTF/Style/Tab.php @@ -0,0 +1,49 @@ +getStyle(); + if (!$style instanceof \PhpOffice\PhpWord\Style\Tab) { + return; + } + $tabs = array( + \PhpOffice\PhpWord\Style\Tab::TAB_STOP_RIGHT => '\tqr', + \PhpOffice\PhpWord\Style\Tab::TAB_STOP_CENTER => '\tqc', + \PhpOffice\PhpWord\Style\Tab::TAB_STOP_DECIMAL => '\tqdec', + ); + $content = ''; + if (isset($tabs[$style->getType()])) { + $content .= $tabs[$style->getType()]; + } + $content .= '\tx' . $style->getPosition(); + + return $content; + } +} diff --git a/tests/PhpWord/Writer/RTF/StyleTest.php b/tests/PhpWord/Writer/RTF/StyleTest.php index 5f04f1a8..317014c6 100644 --- a/tests/PhpWord/Writer/RTF/StyleTest.php +++ b/tests/PhpWord/Writer/RTF/StyleTest.php @@ -17,7 +17,9 @@ namespace PhpOffice\PhpWord\Writer\RTF; +use PhpOffice\PhpWord\Writer\RTF; use PhpOffice\PhpWord\Writer\RTF\Style\Border; +use PHPUnit\Framework\Assert; /** * Test class for PhpOffice\PhpWord\Writer\RTF\Style subnamespace @@ -29,7 +31,7 @@ class StyleTest extends \PHPUnit\Framework\TestCase */ public function testEmptyStyles() { - $styles = array('Font', 'Paragraph', 'Section'); + $styles = array('Font', 'Paragraph', 'Section', 'Tab', 'Indentation'); foreach ($styles as $style) { $objectClass = 'PhpOffice\\PhpWord\\Writer\\RTF\\Style\\' . $style; $object = new $objectClass(); @@ -55,4 +57,55 @@ class StyleTest extends \PHPUnit\Framework\TestCase $this->assertEquals($expected, $content); } + + public function testIndentation() + { + $indentation = new \PhpOffice\PhpWord\Style\Indentation(); + $indentation->setLeft(1); + $indentation->setRight(2); + $indentation->setFirstLine(3); + + $indentWriter = new \PhpOffice\PhpWord\Writer\RTF\Style\Indentation($indentation); + $indentWriter->setParentWriter(new RTF()); + $result = $indentWriter->write(); + + Assert::assertEquals('\fi3\li1\ri2 ', $result); + } + + public function testRightTab() + { + $tabRight = new \PhpOffice\PhpWord\Style\Tab(); + $tabRight->setType(\PhpOffice\PhpWord\Style\Tab::TAB_STOP_RIGHT); + $tabRight->setPosition(5); + + $tabWriter = new \PhpOffice\PhpWord\Writer\RTF\Style\Tab($tabRight); + $tabWriter->setParentWriter(new RTF()); + $result = $tabWriter->write(); + + Assert::assertEquals('\tqr\tx5', $result); + } + + public function testCenterTab() + { + $tabRight = new \PhpOffice\PhpWord\Style\Tab(); + $tabRight->setType(\PhpOffice\PhpWord\Style\Tab::TAB_STOP_CENTER); + + $tabWriter = new \PhpOffice\PhpWord\Writer\RTF\Style\Tab($tabRight); + $tabWriter->setParentWriter(new RTF()); + $result = $tabWriter->write(); + + Assert::assertEquals('\tqc\tx0', $result); + } + + public function testDecimalTab() + { + $tabRight = new \PhpOffice\PhpWord\Style\Tab(); + $tabRight->setType(\PhpOffice\PhpWord\Style\Tab::TAB_STOP_DECIMAL); + + $tabWriter = new \PhpOffice\PhpWord\Writer\RTF\Style\Tab($tabRight); + $tabWriter->setParentWriter(new RTF()); + $result = $tabWriter->write(); + + Assert::assertEquals('\tqdec\tx0', $result); + } } From e028aef6d2cb6dd27a24be6334c14c38f5849dbc Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 14 Jul 2018 02:26:47 +0200 Subject: [PATCH 323/370] update to final phpoffice/common version --- CHANGELOG.md | 1 + composer.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0b39ce1..1f1e194b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ v0.15.0 (?? ??? 2018) - Fix colspan and rowspan for tables in HTML Writer @mattbolt #1292 - Fix parsing of Heading and Title formating @troosan @gthomas2 #465 - Fix Dateformat typo, fix hours casing, add Month-Day-Year formats @ComputerTinker #591 +- Support reading of w:drawing for documents produced by word 2011+ @gthomas2 #464 #1324 ### Changed - Remove zend-stdlib dependency @Trainmaster #1284 diff --git a/composer.json b/composer.json index 6dc9be2c..1844e82e 100644 --- a/composer.json +++ b/composer.json @@ -61,7 +61,7 @@ "php": "^5.3.3 || ^7.0", "ext-xml": "*", "zendframework/zend-escaper": "^2.2", - "phpoffice/common": "dev-develop" + "phpoffice/common": "^0.2.9" }, "require-dev": { "phpunit/phpunit": "^4.8.36 || ^5.0", From adc1428607d73018ec0d088196953e99c9045c58 Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 14 Jul 2018 02:51:08 +0200 Subject: [PATCH 324/370] use PasswordEncoder from phpoffice/common instead --- src/PhpWord/Metadata/Protection.php | 2 +- .../Shared/Microsoft/PasswordEncoder.php | 235 ------------------ src/PhpWord/Writer/Word2007/Part/Settings.php | 2 +- .../Shared/Microsoft/PasswordEncoderTest.php | 91 ------- .../Writer/Word2007/Part/SettingsTest.php | 2 +- 5 files changed, 3 insertions(+), 329 deletions(-) delete mode 100644 src/PhpWord/Shared/Microsoft/PasswordEncoder.php delete mode 100644 tests/PhpWord/Shared/Microsoft/PasswordEncoderTest.php diff --git a/src/PhpWord/Metadata/Protection.php b/src/PhpWord/Metadata/Protection.php index 584ed83e..197f8022 100644 --- a/src/PhpWord/Metadata/Protection.php +++ b/src/PhpWord/Metadata/Protection.php @@ -17,7 +17,7 @@ namespace PhpOffice\PhpWord\Metadata; -use PhpOffice\PhpWord\Shared\Microsoft\PasswordEncoder; +use PhpOffice\Common\Microsoft\PasswordEncoder; use PhpOffice\PhpWord\SimpleType\DocProtect; /** diff --git a/src/PhpWord/Shared/Microsoft/PasswordEncoder.php b/src/PhpWord/Shared/Microsoft/PasswordEncoder.php deleted file mode 100644 index fc0c7ecd..00000000 --- a/src/PhpWord/Shared/Microsoft/PasswordEncoder.php +++ /dev/null @@ -1,235 +0,0 @@ - array(1, 'md2'), - self::ALGORITHM_MD4 => array(2, 'md4'), - self::ALGORITHM_MD5 => array(3, 'md5'), - self::ALGORITHM_SHA_1 => array(4, 'sha1'), - self::ALGORITHM_MAC => array(5, ''), // 'mac' -> not possible with hash() - self::ALGORITHM_RIPEMD => array(6, 'ripemd'), - self::ALGORITHM_RIPEMD_160 => array(7, 'ripemd160'), - self::ALGORITHM_HMAC => array(9, ''), //'hmac' -> not possible with hash() - self::ALGORITHM_SHA_256 => array(12, 'sha256'), - self::ALGORITHM_SHA_384 => array(13, 'sha384'), - self::ALGORITHM_SHA_512 => array(14, 'sha512'), - ); - - private static $initialCodeArray = array( - 0xE1F0, - 0x1D0F, - 0xCC9C, - 0x84C0, - 0x110C, - 0x0E10, - 0xF1CE, - 0x313E, - 0x1872, - 0xE139, - 0xD40F, - 0x84F9, - 0x280C, - 0xA96A, - 0x4EC3, - ); - - private static $encryptionMatrix = array( - array(0xAEFC, 0x4DD9, 0x9BB2, 0x2745, 0x4E8A, 0x9D14, 0x2A09), - array(0x7B61, 0xF6C2, 0xFDA5, 0xEB6B, 0xC6F7, 0x9DCF, 0x2BBF), - array(0x4563, 0x8AC6, 0x05AD, 0x0B5A, 0x16B4, 0x2D68, 0x5AD0), - array(0x0375, 0x06EA, 0x0DD4, 0x1BA8, 0x3750, 0x6EA0, 0xDD40), - array(0xD849, 0xA0B3, 0x5147, 0xA28E, 0x553D, 0xAA7A, 0x44D5), - array(0x6F45, 0xDE8A, 0xAD35, 0x4A4B, 0x9496, 0x390D, 0x721A), - array(0xEB23, 0xC667, 0x9CEF, 0x29FF, 0x53FE, 0xA7FC, 0x5FD9), - array(0x47D3, 0x8FA6, 0x0F6D, 0x1EDA, 0x3DB4, 0x7B68, 0xF6D0), - array(0xB861, 0x60E3, 0xC1C6, 0x93AD, 0x377B, 0x6EF6, 0xDDEC), - array(0x45A0, 0x8B40, 0x06A1, 0x0D42, 0x1A84, 0x3508, 0x6A10), - array(0xAA51, 0x4483, 0x8906, 0x022D, 0x045A, 0x08B4, 0x1168), - array(0x76B4, 0xED68, 0xCAF1, 0x85C3, 0x1BA7, 0x374E, 0x6E9C), - array(0x3730, 0x6E60, 0xDCC0, 0xA9A1, 0x4363, 0x86C6, 0x1DAD), - array(0x3331, 0x6662, 0xCCC4, 0x89A9, 0x0373, 0x06E6, 0x0DCC), - array(0x1021, 0x2042, 0x4084, 0x8108, 0x1231, 0x2462, 0x48C4), - ); - - private static $passwordMaxLength = 15; - - /** - * Create a hashed password that MS Word will be able to work with - * @see https://blogs.msdn.microsoft.com/vsod/2010/04/05/how-to-set-the-editing-restrictions-in-word-using-open-xml-sdk-2-0/ - * - * @param string $password - * @param string $algorithmName - * @param string $salt - * @param int $spinCount - * @return string - */ - public static function hashPassword($password, $algorithmName = self::ALGORITHM_SHA_1, $salt = null, $spinCount = 10000) - { - $origEncoding = mb_internal_encoding(); - mb_internal_encoding('UTF-8'); - - $password = mb_substr($password, 0, min(self::$passwordMaxLength, mb_strlen($password))); - - // Get the single-byte values by iterating through the Unicode characters of the truncated password. - // For each character, if the low byte is not equal to 0, take it. Otherwise, take the high byte. - $passUtf8 = mb_convert_encoding($password, 'UCS-2LE', 'UTF-8'); - $byteChars = array(); - - for ($i = 0; $i < mb_strlen($password); $i++) { - $byteChars[$i] = ord(substr($passUtf8, $i * 2, 1)); - - if ($byteChars[$i] == 0) { - $byteChars[$i] = ord(substr($passUtf8, $i * 2 + 1, 1)); - } - } - - // build low-order word and hig-order word and combine them - $combinedKey = self::buildCombinedKey($byteChars); - // build reversed hexadecimal string - $hex = str_pad(strtoupper(dechex($combinedKey & 0xFFFFFFFF)), 8, '0', \STR_PAD_LEFT); - $reversedHex = $hex[6] . $hex[7] . $hex[4] . $hex[5] . $hex[2] . $hex[3] . $hex[0] . $hex[1]; - - $generatedKey = mb_convert_encoding($reversedHex, 'UCS-2LE', 'UTF-8'); - - // Implementation Notes List: - // Word requires that the initial hash of the password with the salt not be considered in the count. - // The initial hash of salt + key is not included in the iteration count. - $algorithm = self::getAlgorithm($algorithmName); - $generatedKey = hash($algorithm, $salt . $generatedKey, true); - - for ($i = 0; $i < $spinCount; $i++) { - $generatedKey = hash($algorithm, $generatedKey . pack('CCCC', $i, $i >> 8, $i >> 16, $i >> 24), true); - } - $generatedKey = base64_encode($generatedKey); - - mb_internal_encoding($origEncoding); - - return $generatedKey; - } - - /** - * Get algorithm from self::$algorithmMapping - * - * @param string $algorithmName - * @return string - */ - private static function getAlgorithm($algorithmName) - { - $algorithm = self::$algorithmMapping[$algorithmName][1]; - if ($algorithm == '') { - $algorithm = 'sha1'; - } - - return $algorithm; - } - - /** - * Returns the algorithm ID - * - * @param string $algorithmName - * @return int - */ - public static function getAlgorithmId($algorithmName) - { - return self::$algorithmMapping[$algorithmName][0]; - } - - /** - * Build combined key from low-order word and high-order word - * - * @param array $byteChars byte array representation of password - * @return int - */ - private static function buildCombinedKey($byteChars) - { - $byteCharsLength = count($byteChars); - // Compute the high-order word - // Initialize from the initial code array (see above), depending on the passwords length. - $highOrderWord = self::$initialCodeArray[$byteCharsLength - 1]; - - // For each character in the password: - // For every bit in the character, starting with the least significant and progressing to (but excluding) - // the most significant, if the bit is set, XOR the key’s high-order word with the corresponding word from - // the Encryption Matrix - for ($i = 0; $i < $byteCharsLength; $i++) { - $tmp = self::$passwordMaxLength - $byteCharsLength + $i; - $matrixRow = self::$encryptionMatrix[$tmp]; - for ($intBit = 0; $intBit < 7; $intBit++) { - if (($byteChars[$i] & (0x0001 << $intBit)) != 0) { - $highOrderWord = ($highOrderWord ^ $matrixRow[$intBit]); - } - } - } - - // Compute low-order word - // Initialize with 0 - $lowOrderWord = 0; - // For each character in the password, going backwards - for ($i = $byteCharsLength - 1; $i >= 0; $i--) { - // low-order word = (((low-order word SHR 14) AND 0x0001) OR (low-order word SHL 1) AND 0x7FFF)) XOR character - $lowOrderWord = (((($lowOrderWord >> 14) & 0x0001) | (($lowOrderWord << 1) & 0x7FFF)) ^ $byteChars[$i]); - } - // Lastly, low-order word = (((low-order word SHR 14) AND 0x0001) OR (low-order word SHL 1) AND 0x7FFF)) XOR strPassword length XOR 0xCE4B. - $lowOrderWord = (((($lowOrderWord >> 14) & 0x0001) | (($lowOrderWord << 1) & 0x7FFF)) ^ $byteCharsLength ^ 0xCE4B); - - // Combine the Low and High Order Word - return self::int32(($highOrderWord << 16) + $lowOrderWord); - } - - /** - * Simulate behaviour of (signed) int32 - * - * @codeCoverageIgnore - * @param int $value - * @return int - */ - private static function int32($value) - { - $value = ($value & 0xFFFFFFFF); - - if ($value & 0x80000000) { - $value = -((~$value & 0xFFFFFFFF) + 1); - } - - return $value; - } -} diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index 42d3a5d5..b764642a 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -17,9 +17,9 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Part; +use PhpOffice\Common\Microsoft\PasswordEncoder; use PhpOffice\PhpWord\ComplexType\ProofState; use PhpOffice\PhpWord\ComplexType\TrackChangesView; -use PhpOffice\PhpWord\Shared\Microsoft\PasswordEncoder; use PhpOffice\PhpWord\Style\Language; /** diff --git a/tests/PhpWord/Shared/Microsoft/PasswordEncoderTest.php b/tests/PhpWord/Shared/Microsoft/PasswordEncoderTest.php deleted file mode 100644 index 5a050c54..00000000 --- a/tests/PhpWord/Shared/Microsoft/PasswordEncoderTest.php +++ /dev/null @@ -1,91 +0,0 @@ - Date: Sat, 14 Jul 2018 02:54:17 +0200 Subject: [PATCH 325/370] fix phpstan issues --- phpstan.neon | 2 +- src/PhpWord/Element/Title.php | 14 ++++++-------- src/PhpWord/Shared/Html.php | 2 +- src/PhpWord/Writer/Word2007/Element/Title.php | 1 + src/PhpWord/Writer/Word2007/Part/Chart.php | 4 ++-- tests/PhpWord/Writer/HTML/ElementTest.php | 6 +++--- tests/PhpWord/_includes/XmlDocument.php | 6 +++--- 7 files changed, 17 insertions(+), 18 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 5ae6d0f2..666c63b9 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,7 +1,7 @@ includes: - vendor/phpstan/phpstan/conf/config.level1.neon parameters: - memory-limit: 200000 + memory-limit: 20000000 autoload_directories: - tests autoload_files: diff --git a/src/PhpWord/Element/Title.php b/src/PhpWord/Element/Title.php index 569cea92..eb261b1f 100644 --- a/src/PhpWord/Element/Title.php +++ b/src/PhpWord/Element/Title.php @@ -61,14 +61,12 @@ class Title extends AbstractElement */ public function __construct($text, $depth = 1) { - if (isset($text)) { - if (is_string($text)) { - $this->text = CommonText::toUTF8($text); - } elseif ($text instanceof TextRun) { - $this->text = $text; - } else { - throw new \InvalidArgumentException('Invalid text, should be a string or a TextRun'); - } + if (is_string($text)) { + $this->text = CommonText::toUTF8($text); + } elseif ($text instanceof TextRun) { + $this->text = $text; + } else { + throw new \InvalidArgumentException('Invalid text, should be a string or a TextRun'); } $this->depth = $depth; diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index a4281678..f725c366 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -75,7 +75,7 @@ class Html $dom = new \DOMDocument(); $dom->preserveWhiteSpace = $preserveWhiteSpace; $dom->loadXML($html); - self::$xpath = new \DOMXpath($dom); + self::$xpath = new \DOMXPath($dom); $node = $dom->getElementsByTagName('body'); self::parseNode($node->item(0), $element); diff --git a/src/PhpWord/Writer/Word2007/Element/Title.php b/src/PhpWord/Writer/Word2007/Element/Title.php index 858ecfef..6a05a34d 100644 --- a/src/PhpWord/Writer/Word2007/Element/Title.php +++ b/src/PhpWord/Writer/Word2007/Element/Title.php @@ -47,6 +47,7 @@ class Title extends AbstractElement $xmlWriter->endElement(); } + $bookmarkRId = null; if ($element->getDepth() !== 0) { $rId = $element->getRelationId(); $bookmarkRId = $element->getPhpWord()->addBookmark(); diff --git a/src/PhpWord/Writer/Word2007/Part/Chart.php b/src/PhpWord/Writer/Word2007/Part/Chart.php index 17c1fd54..5a3ef276 100644 --- a/src/PhpWord/Writer/Word2007/Part/Chart.php +++ b/src/PhpWord/Writer/Word2007/Part/Chart.php @@ -330,11 +330,11 @@ class Chart extends AbstractPart $valueAxisTitle = $style->getValueAxisTitle(); if ($axisType == 'c:catAx') { - if (isset($categoryAxisTitle)) { + if (!is_null($categoryAxisTitle)) { $this->writeAxisTitle($xmlWriter, $categoryAxisTitle); } } elseif ($axisType == 'c:valAx') { - if (isset($valueAxisTitle)) { + if (!is_null($valueAxisTitle)) { $this->writeAxisTitle($xmlWriter, $valueAxisTitle); } } diff --git a/tests/PhpWord/Writer/HTML/ElementTest.php b/tests/PhpWord/Writer/HTML/ElementTest.php index 90044b92..b76ddded 100644 --- a/tests/PhpWord/Writer/HTML/ElementTest.php +++ b/tests/PhpWord/Writer/HTML/ElementTest.php @@ -70,7 +70,7 @@ class ElementTest extends \PHPUnit\Framework\TestCase $text2->setTrackChange(new TrackChange(TrackChange::DELETED, 'another author', new \DateTime())); $dom = $this->getAsHTML($phpWord); - $xpath = new \DOMXpath($dom); + $xpath = new \DOMXPath($dom); $this->assertTrue($xpath->query('/html/body/p[1]/ins')->length == 1); $this->assertTrue($xpath->query('/html/body/p[2]/del')->length == 1); @@ -94,7 +94,7 @@ class ElementTest extends \PHPUnit\Framework\TestCase $cell22->addText('second cell'); $dom = $this->getAsHTML($phpWord); - $xpath = new \DOMXpath($dom); + $xpath = new \DOMXPath($dom); $this->assertTrue($xpath->query('/html/body/table/tr[1]/td')->length == 1); $this->assertEquals('2', $xpath->query('/html/body/table/tr/td[1]')->item(0)->attributes->getNamedItem('colspan')->textContent); @@ -123,7 +123,7 @@ class ElementTest extends \PHPUnit\Framework\TestCase $row3->addCell(500)->addText('third cell being spanned'); $dom = $this->getAsHTML($phpWord); - $xpath = new \DOMXpath($dom); + $xpath = new \DOMXPath($dom); $this->assertTrue($xpath->query('/html/body/table/tr[1]/td')->length == 2); $this->assertEquals('3', $xpath->query('/html/body/table/tr[1]/td[1]')->item(0)->attributes->getNamedItem('rowspan')->textContent); diff --git a/tests/PhpWord/_includes/XmlDocument.php b/tests/PhpWord/_includes/XmlDocument.php index 81de7eff..7062ebbf 100644 --- a/tests/PhpWord/_includes/XmlDocument.php +++ b/tests/PhpWord/_includes/XmlDocument.php @@ -37,9 +37,9 @@ class XmlDocument private $dom; /** - * DOMXpath object + * DOMXPath object * - * @var \DOMXpath + * @var \DOMXPath */ private $xpath; @@ -98,7 +98,7 @@ class XmlDocument } if (null === $this->xpath) { - $this->xpath = new \DOMXpath($this->dom); + $this->xpath = new \DOMXPath($this->dom); $this->xpath->registerNamespace('w14', 'http://schemas.microsoft.com/office/word/2010/wordml'); } From 6475812e828be030a39adc8c8d9a925bd9d163b7 Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 14 Jul 2018 03:28:09 +0200 Subject: [PATCH 326/370] fix documentation --- src/PhpWord/Element/OLEObject.php | 2 +- src/PhpWord/Element/PreserveText.php | 6 ++---- src/PhpWord/Element/Title.php | 2 -- src/PhpWord/Metadata/Protection.php | 6 +++--- src/PhpWord/Reader/Word2007/Settings.php | 10 +++++----- src/PhpWord/Writer/RTF/Style/Indentation.php | 2 +- 6 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/PhpWord/Element/OLEObject.php b/src/PhpWord/Element/OLEObject.php index c0c7f217..1a17b747 100644 --- a/src/PhpWord/Element/OLEObject.php +++ b/src/PhpWord/Element/OLEObject.php @@ -83,7 +83,7 @@ class OLEObject extends AbstractElement $this->style = $this->setNewStyle(new ImageStyle(), $style, true); $this->icon = realpath(__DIR__ . "/../resources/{$ext}.png"); - return $this; + return; } throw new InvalidObjectException(); diff --git a/src/PhpWord/Element/PreserveText.php b/src/PhpWord/Element/PreserveText.php index 1ce2dcdd..374f1a99 100644 --- a/src/PhpWord/Element/PreserveText.php +++ b/src/PhpWord/Element/PreserveText.php @@ -29,7 +29,7 @@ class PreserveText extends AbstractElement /** * Text content * - * @var string + * @var string|array */ private $text; @@ -64,8 +64,6 @@ class PreserveText extends AbstractElement if (isset($matches[0])) { $this->text = $matches; } - - return $this; } /** @@ -91,7 +89,7 @@ class PreserveText extends AbstractElement /** * Get Text content * - * @return string + * @return string|array */ public function getText() { diff --git a/src/PhpWord/Element/Title.php b/src/PhpWord/Element/Title.php index eb261b1f..d01f7f33 100644 --- a/src/PhpWord/Element/Title.php +++ b/src/PhpWord/Element/Title.php @@ -74,8 +74,6 @@ class Title extends AbstractElement if (array_key_exists($styleName, Style::getStyles())) { $this->style = str_replace('_', '', $styleName); } - - return $this; } /** diff --git a/src/PhpWord/Metadata/Protection.php b/src/PhpWord/Metadata/Protection.php index 197f8022..15aa3ff1 100644 --- a/src/PhpWord/Metadata/Protection.php +++ b/src/PhpWord/Metadata/Protection.php @@ -113,7 +113,7 @@ class Protection /** * Set password * - * @param $password + * @param string $password * @return self */ public function setPassword($password) @@ -136,7 +136,7 @@ class Protection /** * Set count for hash iterations * - * @param $spinCount + * @param int $spinCount * @return self */ public function setSpinCount($spinCount) @@ -159,7 +159,7 @@ class Protection /** * Set algorithm * - * @param $algorithm + * @param string $algorithm * @return self */ public function setAlgorithm($algorithm) diff --git a/src/PhpWord/Reader/Word2007/Settings.php b/src/PhpWord/Reader/Word2007/Settings.php index dbf34623..3084943b 100644 --- a/src/PhpWord/Reader/Word2007/Settings.php +++ b/src/PhpWord/Reader/Word2007/Settings.php @@ -81,7 +81,7 @@ class Settings extends AbstractPart * * @param XMLReader $xmlReader * @param PhpWord $phpWord - * @param \DOMNode $node + * @param \DOMElement $node */ protected function setThemeFontLang(XMLReader $xmlReader, PhpWord $phpWord, \DOMElement $node) { @@ -102,7 +102,7 @@ class Settings extends AbstractPart * * @param XMLReader $xmlReader * @param PhpWord $phpWord - * @param \DOMNode $node + * @param \DOMElement $node */ protected function setDocumentProtection(XMLReader $xmlReader, PhpWord $phpWord, \DOMElement $node) { @@ -119,7 +119,7 @@ class Settings extends AbstractPart * * @param XMLReader $xmlReader * @param PhpWord $phpWord - * @param \DOMNode $node + * @param \DOMElement $node */ protected function setProofState(XMLReader $xmlReader, PhpWord $phpWord, \DOMElement $node) { @@ -141,7 +141,7 @@ class Settings extends AbstractPart * * @param XMLReader $xmlReader * @param PhpWord $phpWord - * @param \DOMNode $node + * @param \DOMElement $node */ protected function setZoom(XMLReader $xmlReader, PhpWord $phpWord, \DOMElement $node) { @@ -158,7 +158,7 @@ class Settings extends AbstractPart * * @param XMLReader $xmlReader * @param PhpWord $phpWord - * @param \DOMNode $node + * @param \DOMElement $node */ protected function setRevisionView(XMLReader $xmlReader, PhpWord $phpWord, \DOMElement $node) { diff --git a/src/PhpWord/Writer/RTF/Style/Indentation.php b/src/PhpWord/Writer/RTF/Style/Indentation.php index 5c80af0c..dd52230e 100644 --- a/src/PhpWord/Writer/RTF/Style/Indentation.php +++ b/src/PhpWord/Writer/RTF/Style/Indentation.php @@ -33,7 +33,7 @@ class Indentation extends AbstractStyle { $style = $this->getStyle(); if (!$style instanceof \PhpOffice\PhpWord\Style\Indentation) { - return; + return ''; } $content = '\fi' . $style->getFirstLine(); From 54155bf5a99102378f7c399ea60f898fa2abeeff Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 14 Jul 2018 17:16:24 +0200 Subject: [PATCH 327/370] Update Sample_30_ReadHTML.html --- samples/resources/Sample_30_ReadHTML.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/samples/resources/Sample_30_ReadHTML.html b/samples/resources/Sample_30_ReadHTML.html index 0ff1a414..b3d2fad2 100644 --- a/samples/resources/Sample_30_ReadHTML.html +++ b/samples/resources/Sample_30_ReadHTML.html @@ -17,5 +17,9 @@

                  Includes images

                  + + + + From 87498e43e18f31e3161256ac0f70092c86718914 Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 14 Jul 2018 17:21:30 +0200 Subject: [PATCH 328/370] Allow passing short lang code --- CHANGELOG.md | 3 ++- src/PhpWord/Style/Language.php | 17 ++++++++++------- tests/PhpWord/Style/LanguageTest.php | 15 +++++++++++++++ 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03387b37..56a1d9ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ Change Log All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). -v0.15.0 (?? ??? 2018) +v0.15.0 (14 Jul 2018) ---------------------- ### Added - Parsing of `align` HTML attribute - @troosan #1231 @@ -25,6 +25,7 @@ v0.15.0 (?? ??? 2018) - Several improvements to charts @JAEK-S #1332 - Add parsing of html image in base64 format @jgpATs2w #1382 - Added Support for Indentation & Tabs on RTF Writer. @smaug1985 #1405 +- Allows decimal numbers in HTML line-height style @jgpATs2w #1413 ### Fixed - Fix reading of docx default style - @troosan #1238 diff --git a/src/PhpWord/Style/Language.php b/src/PhpWord/Style/Language.php index 4a50a595..d7a76f78 100644 --- a/src/PhpWord/Style/Language.php +++ b/src/PhpWord/Style/Language.php @@ -123,8 +123,7 @@ final class Language extends AbstractStyle */ public function setLatin($latin) { - $this->validateLocale($latin); - $this->latin = $latin; + $this->latin = $this->validateLocale($latin); return $this; } @@ -173,8 +172,7 @@ final class Language extends AbstractStyle */ public function setEastAsia($eastAsia) { - $this->validateLocale($eastAsia); - $this->eastAsia = $eastAsia; + $this->eastAsia = $this->validateLocale($eastAsia); return $this; } @@ -198,8 +196,7 @@ final class Language extends AbstractStyle */ public function setBidirectional($bidirectional) { - $this->validateLocale($bidirectional); - $this->bidirectional = $bidirectional; + $this->bidirectional = $this->validateLocale($bidirectional); return $this; } @@ -218,12 +215,18 @@ final class Language extends AbstractStyle * Validates that the language passed is in the format xx-xx * * @param string $locale - * @return bool + * @return string */ private function validateLocale($locale) { + if (strlen($locale) === 2) { + return strtolower($locale) . '-' . strtoupper($locale); + } + if ($locale !== null && strstr($locale, '-') === false) { throw new \InvalidArgumentException($locale . ' is not a valid language code'); } + + return $locale; } } diff --git a/tests/PhpWord/Style/LanguageTest.php b/tests/PhpWord/Style/LanguageTest.php index 99741cea..3bf516f8 100644 --- a/tests/PhpWord/Style/LanguageTest.php +++ b/tests/PhpWord/Style/LanguageTest.php @@ -17,6 +17,8 @@ namespace PhpOffice\PhpWord\Style; +use PHPUnit\Framework\Assert; + /** * Test class for PhpOffice\PhpWord\Style\Language * @@ -56,7 +58,20 @@ class LanguageTest extends \PHPUnit\Framework\TestCase */ public function testWrongLanguage() { + $language = new Language(); + $language->setLatin('fra'); + } + + /** + * Tests that a language can be set with just a 2 char code + */ + public function testShortLanguage() + { + //when $language = new Language(); $language->setLatin('fr'); + + //then + Assert::assertEquals('fr-FR', $language->getLatin()); } } From 8fa1d4f2244c081ee009b16dddf9a69296c8adfe Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 14 Jul 2018 17:47:34 +0200 Subject: [PATCH 329/370] run checks with php 7.0 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c72dd8c2..db77ff05 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ php: matrix: include: - - php: 5.6 + - php: 7.0 env: COVERAGE=1 cache: From 4c9e75088a9f0794ec038d1f4cfccc268cdaea08 Mon Sep 17 00:00:00 2001 From: troosan Date: Sat, 14 Jul 2018 18:36:29 +0200 Subject: [PATCH 330/370] alias for develop branch [ci skip] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 9f0e8a43..5d8a855b 100644 --- a/composer.json +++ b/composer.json @@ -90,7 +90,7 @@ }, "extra": { "branch-alias": { - "dev-develop": "0.15-dev" + "dev-develop": "0.16-dev" } } } From 198165ce5984c4b94550e15efb4a57f8e84997ff Mon Sep 17 00:00:00 2001 From: Nicolas Dermine Date: Mon, 16 Jul 2018 19:49:30 +0200 Subject: [PATCH 331/370] allow to override TemplateProcessor#ensureUtf8Encoded the method is `protected`, but since it is called with `self` instead of `static` it does not allow for subclasses to override it --- src/PhpWord/TemplateProcessor.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php index 946d6691..74cd4639 100644 --- a/src/PhpWord/TemplateProcessor.php +++ b/src/PhpWord/TemplateProcessor.php @@ -217,10 +217,10 @@ class TemplateProcessor if (is_array($replace)) { foreach ($replace as &$item) { - $item = self::ensureUtf8Encoded($item); + $item = static::ensureUtf8Encoded($item); } } else { - $replace = self::ensureUtf8Encoded($replace); + $replace = static::ensureUtf8Encoded($replace); } if (Settings::isOutputEscapingEnabled()) { From 0c3eb4bafc9b28313fb31c48c6bfc958a362b47f Mon Sep 17 00:00:00 2001 From: Tom-Magill <41332981+Tom-Magill@users.noreply.github.com> Date: Tue, 17 Jul 2018 14:10:02 +0100 Subject: [PATCH 332/370] Update Chart.php --- src/PhpWord/Style/Chart.php | 58 +++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/src/PhpWord/Style/Chart.php b/src/PhpWord/Style/Chart.php index 5b02e636..5c96afd2 100644 --- a/src/PhpWord/Style/Chart.php +++ b/src/PhpWord/Style/Chart.php @@ -51,6 +51,20 @@ class Chart extends AbstractStyle * @var array */ private $colors = array(); + + /** + * Chart title + * + * @var string + */ + private $title = null; + + /** + * Chart legend visibility + * + * @var bool + */ + private $showLegend = false; /** * A list of display options for data labels @@ -220,6 +234,50 @@ class Chart extends AbstractStyle return $this; } + + /** + * Get the chart title + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set the chart title + * + * @param string $value + */ + public function setTitle($value = null) + { + $this->title = $value; + + return $this; + } + + /** + * Get chart legend visibility + * + * @return bool + */ + public function getShowLegend() + { + return $this->showLegend; + } + + /** + * Set chart legend visibility + * + * @param bool $value + */ + public function setShowLegend($value = false) + { + $this->showLegend = $value; + + return $this; + } /* * Show labels for axis From 139242612d750f0258472cf0bbc1f7044610785d Mon Sep 17 00:00:00 2001 From: Tom-Magill <41332981+Tom-Magill@users.noreply.github.com> Date: Tue, 17 Jul 2018 14:11:55 +0100 Subject: [PATCH 333/370] Update Chart.php --- src/PhpWord/Writer/Word2007/Part/Chart.php | 32 ++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/Writer/Word2007/Part/Chart.php b/src/PhpWord/Writer/Word2007/Part/Chart.php index 5a3ef276..e14a708b 100644 --- a/src/PhpWord/Writer/Word2007/Part/Chart.php +++ b/src/PhpWord/Writer/Word2007/Part/Chart.php @@ -105,8 +105,6 @@ class Chart extends AbstractPart { $xmlWriter->startElement('c:chart'); - $xmlWriter->writeElementBlock('c:autoTitleDeleted', 'val', 1); - $this->writePlotArea($xmlWriter); $xmlWriter->endElement(); // c:chart @@ -130,6 +128,36 @@ class Chart extends AbstractPart $type = $this->element->getType(); $style = $this->element->getStyle(); $this->options = $this->types[$type]; + + $title = $style->getTitle(); + $showLegend = $style->getShowLegend(); + + //Chart title + if($title){ + $xmlWriter->startElement('c:title'); + $xmlWriter->startElement('c:tx'); + $xmlWriter->startElement('c:rich'); + $xmlWriter->writeRaw(' + + + + + '.$title.' + + '); + + $xmlWriter->endElement(); // c:rich + $xmlWriter->endElement(); // c:tx + $xmlWriter->endElement(); // c:title + + }else{ + $xmlWriter->writeElementBlock('c:autoTitleDeleted', 'val', 1); + } + + //Chart legend + if($showLegend){ + $xmlWriter->writeRaw(''); + } $xmlWriter->startElement('c:plotArea'); $xmlWriter->writeElement('c:layout'); From 8c62cea580e5d9aa7b5c496ccad98114b7466422 Mon Sep 17 00:00:00 2001 From: Humberto Pereira Date: Tue, 17 Jul 2018 21:10:53 -0400 Subject: [PATCH 334/370] Fix Writer losing text when Title contains a TextRun instead a string. --- src/PhpWord/Writer/HTML/Element/Title.php | 2 +- tests/PhpWord/Writer/HTML/ElementTest.php | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/PhpWord/Writer/HTML/Element/Title.php b/src/PhpWord/Writer/HTML/Element/Title.php index 7307ce0c..04ed61f5 100644 --- a/src/PhpWord/Writer/HTML/Element/Title.php +++ b/src/PhpWord/Writer/HTML/Element/Title.php @@ -45,7 +45,7 @@ class Title extends AbstractElement $text = $this->escaper->escapeHtml($text); } } elseif ($text instanceof \PhpOffice\PhpWord\Element\AbstractContainer) { - $writer = new Container($this->parentWriter, $this->element); + $writer = new Container($this->parentWriter, $text); $text = $writer->write(); } diff --git a/tests/PhpWord/Writer/HTML/ElementTest.php b/tests/PhpWord/Writer/HTML/ElementTest.php index b76ddded..7a6397ef 100644 --- a/tests/PhpWord/Writer/HTML/ElementTest.php +++ b/tests/PhpWord/Writer/HTML/ElementTest.php @@ -18,6 +18,7 @@ namespace PhpOffice\PhpWord\Writer\HTML; use PhpOffice\PhpWord\Element\Text as TextElement; +use PhpOffice\PhpWord\Element\TextRun; use PhpOffice\PhpWord\Element\TrackChange; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\Writer\HTML; @@ -138,4 +139,22 @@ class ElementTest extends \PHPUnit\Framework\TestCase return $dom; } + + public function testWriteTitleTextRun() + { + $expected = 'Title with TextRun'; + + $phpWord = new PhpWord(); + $section = $phpWord->addSection(); + + $textRun = new TextRun(); + $textRun->addText($expected); + + $section->addTitle($textRun); + + $htmlWriter = new HTML($phpWord); + $content = $htmlWriter->getContent(); + + $this->assertTrue(strpos($content, $expected) !== false); + } } From e07c6559a9d1bdac676f00e2c290cb2c99e1a7e0 Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 19 Jul 2018 00:52:22 +0200 Subject: [PATCH 335/370] adapt test --- tests/PhpWord/TemplateProcessorTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/PhpWord/TemplateProcessorTest.php b/tests/PhpWord/TemplateProcessorTest.php index 770428cb..ea739561 100644 --- a/tests/PhpWord/TemplateProcessorTest.php +++ b/tests/PhpWord/TemplateProcessorTest.php @@ -260,6 +260,7 @@ final class TemplateProcessorTest extends \PHPUnit\Framework\TestCase // and the placeholders have been replaced correctly $phpWord = IOFactory::load($templatePath); $sections = $phpWord->getSections(); + /** @var \PhpOffice\PhpWord\Element\TextRun[] $actualElements */ $actualElements = $sections[0]->getElements(); unlink($templatePath); $expectedElements = array( @@ -271,7 +272,7 @@ final class TemplateProcessorTest extends \PHPUnit\Framework\TestCase foreach ($expectedElements as $i => $expectedElement) { $this->assertEquals( $expectedElement, - $actualElements[$i]->getText() + $actualElements[$i]->getElement(0)->getText() ); } } From 1951db58c18e6a0492db5a1b46dd5963c12b052f Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 19 Jul 2018 01:16:25 +0200 Subject: [PATCH 336/370] update changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a166345c..d822357c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,13 @@ Change Log All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +v0.16.0 (xx xxx 2018) +---------------------- +### Added + +### Fixed +- Fix regex in `cloneBlock` function @nicoder #1269 + v0.15.0 (14 Jul 2018) ---------------------- ### Added From d09da0b6f23b5bde65ced648377190291c2b9535 Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 19 Jul 2018 02:01:40 +0200 Subject: [PATCH 337/370] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d822357c..abf34834 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ v0.16.0 (xx xxx 2018) ### Fixed - Fix regex in `cloneBlock` function @nicoder #1269 +- HTML Title Writer loses text when Title contains a TextRun instead a string. @begnini #1436 v0.15.0 (14 Jul 2018) ---------------------- From e61c40e71d8670d3334afeb6e2478d8ee8ef1325 Mon Sep 17 00:00:00 2001 From: Abubakkar Rangara <> Date: Tue, 24 Jul 2018 13:59:16 +0100 Subject: [PATCH 338/370] Adding table layout to the generated HTML if element has layout style. This is useful when using creating PDF from PHPWord (e.g. using dompdf), otherwise the PDF does not contain any layout for table. --- src/PhpWord/Writer/HTML/Element/Table.php | 4 +++- tests/PhpWord/Writer/HTML/ElementTest.php | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/PhpWord/Writer/HTML/Element/Table.php b/src/PhpWord/Writer/HTML/Element/Table.php index 844066f4..068f489a 100644 --- a/src/PhpWord/Writer/HTML/Element/Table.php +++ b/src/PhpWord/Writer/HTML/Element/Table.php @@ -39,7 +39,9 @@ class Table extends AbstractElement $rows = $this->element->getRows(); $rowCount = count($rows); if ($rowCount > 0) { - $content .= '
                ' . PHP_EOL; + $tableStyle = $this->element->getStyle(); + $tableLayout = $tableStyle === null ? '' : $tableStyle->getLayout(); + $content .= ''. PHP_EOL; for ($i = 0; $i < $rowCount; $i++) { /** @var $row \PhpOffice\PhpWord\Element\Row Type hint */ $rowStyle = $rows[$i]->getStyle(); diff --git a/tests/PhpWord/Writer/HTML/ElementTest.php b/tests/PhpWord/Writer/HTML/ElementTest.php index 7a6397ef..1f286c5f 100644 --- a/tests/PhpWord/Writer/HTML/ElementTest.php +++ b/tests/PhpWord/Writer/HTML/ElementTest.php @@ -157,4 +157,23 @@ class ElementTest extends \PHPUnit\Framework\TestCase $this->assertTrue(strpos($content, $expected) !== false); } + + /** + * Tests writing table with layout + */ + public function testWriteTableLayout() + { + $phpWord = new PhpWord(); + $section = $phpWord->addSection(); + $section->addTable(); + $table = $section->addTable(array('layout' => 'fixed')); + + $row1 = $table->addRow(); + $row1->addCell()->addText('fixed layout table'); + + $dom = $this->getAsHTML($phpWord); + $xpath = new \DOMXPath($dom); + + $this->assertEquals('table-layout: fixed', $xpath->query('/html/body/table')->item(0)->attributes->getNamedItem('style')->textContent); + } } From 4b9ae18d5aefee34bb631b96a752dfca6be56b4d Mon Sep 17 00:00:00 2001 From: Abubakkar Rangara <> Date: Tue, 24 Jul 2018 14:23:23 +0100 Subject: [PATCH 339/370] Adding table layout to the generated HTML - fixed php-cs-fixer error --- src/PhpWord/Writer/HTML/Element/Table.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Writer/HTML/Element/Table.php b/src/PhpWord/Writer/HTML/Element/Table.php index 068f489a..50c5a777 100644 --- a/src/PhpWord/Writer/HTML/Element/Table.php +++ b/src/PhpWord/Writer/HTML/Element/Table.php @@ -41,7 +41,7 @@ class Table extends AbstractElement if ($rowCount > 0) { $tableStyle = $this->element->getStyle(); $tableLayout = $tableStyle === null ? '' : $tableStyle->getLayout(); - $content .= ''. PHP_EOL; + $content .= '' . PHP_EOL; for ($i = 0; $i < $rowCount; $i++) { /** @var $row \PhpOffice\PhpWord\Element\Row Type hint */ $rowStyle = $rows[$i]->getStyle(); From 677e3f6a19bcd5d3f4a81e6a0059bbce773e8ee7 Mon Sep 17 00:00:00 2001 From: Maxim Bulygin Date: Tue, 31 Jul 2018 18:25:29 +0300 Subject: [PATCH 340/370] writer / word2007 / support valign and watermark withouth paragraph --- src/PhpWord/Writer/Word2007/Element/Image.php | 8 ++++++-- src/PhpWord/Writer/Word2007/Style/Frame.php | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/Writer/Word2007/Element/Image.php b/src/PhpWord/Writer/Word2007/Element/Image.php index 3614ec18..5bebb89c 100644 --- a/src/PhpWord/Writer/Word2007/Element/Image.php +++ b/src/PhpWord/Writer/Word2007/Element/Image.php @@ -103,7 +103,9 @@ class Image extends AbstractElement $style->setPositioning('absolute'); $styleWriter = new ImageStyleWriter($xmlWriter, $style); - $xmlWriter->startElement('w:p'); + if (!$this->withoutP) { + $xmlWriter->startElement('w:p'); + } $xmlWriter->startElement('w:r'); $xmlWriter->startElement('w:pict'); $xmlWriter->startElement('v:shape'); @@ -118,6 +120,8 @@ class Image extends AbstractElement $xmlWriter->endElement(); // v:shape $xmlWriter->endElement(); // w:pict $xmlWriter->endElement(); // w:r - $xmlWriter->endElement(); // w:p + if (!$this->withoutP) { + $xmlWriter->endElement(); // w:p + } } } diff --git a/src/PhpWord/Writer/Word2007/Style/Frame.php b/src/PhpWord/Writer/Word2007/Style/Frame.php index ea5abf78..10e5b151 100644 --- a/src/PhpWord/Writer/Word2007/Style/Frame.php +++ b/src/PhpWord/Writer/Word2007/Style/Frame.php @@ -61,6 +61,7 @@ class Frame extends AbstractStyle 'hPos' => 'mso-position-horizontal', 'vPos' => 'mso-position-vertical', 'hPosRelTo' => 'mso-position-horizontal-relative', + 'vPosRelTo' => 'mso-position-vertical-relative', ); $posStyles = $this->getStyles($style, $properties); From 683d91990ff53f46c2ad3dd8ceaeeffc28a62ce1 Mon Sep 17 00:00:00 2001 From: vblinden Date: Mon, 3 Sep 2018 12:30:05 +0200 Subject: [PATCH 341/370] Added Dutch (nl-NL) --- src/PhpWord/Style/Language.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/PhpWord/Style/Language.php b/src/PhpWord/Style/Language.php index d7a76f78..8a3b0315 100644 --- a/src/PhpWord/Style/Language.php +++ b/src/PhpWord/Style/Language.php @@ -64,6 +64,9 @@ final class Language extends AbstractStyle const PT_BR = 'pt-BR'; const PT_BR_ID = 1046; + + const NL_NL = 'nl-NL'; + const NL_NL_ID = 1043; /** * Language ID, used for RTF document generation From d8c0441975e2032ba86bb82ecdfc754d15c92cd9 Mon Sep 17 00:00:00 2001 From: vblinden Date: Mon, 3 Sep 2018 13:32:00 +0200 Subject: [PATCH 342/370] Fix indenting --- src/PhpWord/Style/Language.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Style/Language.php b/src/PhpWord/Style/Language.php index 8a3b0315..412a76a7 100644 --- a/src/PhpWord/Style/Language.php +++ b/src/PhpWord/Style/Language.php @@ -64,7 +64,7 @@ final class Language extends AbstractStyle const PT_BR = 'pt-BR'; const PT_BR_ID = 1046; - + const NL_NL = 'nl-NL'; const NL_NL_ID = 1043; From 7f55816ebaa2777cefd759f6628e7753c91e0faf Mon Sep 17 00:00:00 2001 From: Martin Hanzl Date: Thu, 11 Oct 2018 08:55:38 +0200 Subject: [PATCH 343/370] detect actual filename of document xml (prevent mismatching document22.xml as in #1253) --- src/PhpWord/TemplateProcessor.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php index 7a5eaf55..86c9e1c9 100644 --- a/src/PhpWord/TemplateProcessor.php +++ b/src/PhpWord/TemplateProcessor.php @@ -507,7 +507,13 @@ class TemplateProcessor */ protected function getMainPartName() { - return 'word/document.xml'; + $contentTypes = $this->zipClass->getFromName('[Content_Types].xml'); + + $pattern = '~PartName="\/(word\/document.*?\.xml)" ContentType="application\/vnd\.openxmlformats-officedocument\.wordprocessingml\.document\.main\+xml"~'; + + preg_match($pattern, $contentTypes, $m); + + return (array_key_exists(1, $m) ? $m[1] : 'word/document.xml'); } /** From 7eb19c8f76c6a0a4ba56bc779d3f6024dc172822 Mon Sep 17 00:00:00 2001 From: Martin Hanzl Date: Thu, 11 Oct 2018 09:40:12 +0200 Subject: [PATCH 344/370] add test case for issue #1253 --- tests/PhpWord/TemplateProcessorTest.php | 10 ++++++++++ .../_files/templates/document22-xml.docx | Bin 0 -> 11126 bytes 2 files changed, 10 insertions(+) create mode 100644 tests/PhpWord/_files/templates/document22-xml.docx diff --git a/tests/PhpWord/TemplateProcessorTest.php b/tests/PhpWord/TemplateProcessorTest.php index ea739561..2b3a9fd1 100644 --- a/tests/PhpWord/TemplateProcessorTest.php +++ b/tests/PhpWord/TemplateProcessorTest.php @@ -276,4 +276,14 @@ final class TemplateProcessorTest extends \PHPUnit\Framework\TestCase ); } } + + public function testMainPartNameDetection() + { + $templatePath = 'templates/document22-xml.docx'; + $templateProcessor = new TemplateProcessor($templatePath); + + $variables = array('test'); + + $this->assertEquals($variables, $templateProcessor->getVariables()); + } } diff --git a/tests/PhpWord/_files/templates/document22-xml.docx b/tests/PhpWord/_files/templates/document22-xml.docx new file mode 100644 index 0000000000000000000000000000000000000000..206d80f46063d4f9ec4594b191bbd6f493879b8e GIT binary patch literal 11126 zcmeHtWmH_t)@|eNjT1s}cW(&p65L$^1b27WK+_N)I01rNaF+zPAi*IJJOp=paLzq9 z$@$K^@BP2u9%Jv(yQ=1@+Er^-RnJ;Vaxkz!06YK@z``e|a06?grT_&15W@igH~>Uw zT`_w*7jruoLp4tab7y^K4_h0uTv%w@YydRif3N@Q9;k&VD0Z`AhE|w(>QdP?3nOyv zLC=U%c|m9oMQKfR zq$5XW(r&b>RGJMez#$-*?JG8&Wy1rg1pYgU&ZS0BH~a?6J>FWhr#m>RgM*L9;g&>d z_Xkk=E#jWDgJb-s4aUTG6I)`rQ*r(THzt4ypdP2@ z;suVLg;{qY%KIYk&Y)UXO{ z&*ejxcuY}+=IsJdh!+&Y;gC2d1{E`;rfNl6FEAjU44cK(>iWEJRM{XiQ}b=2(0lKZ zj~}y*XHTA5g z;ZU=?bF!iP`bSm`RDXOgIZny$OG$qrmA4m@o#81=bFc5l z5Sf-kD=(3EHGfiqD=tW$Wk}*<06YNTOAP?vKJi>0}(`JYd=$E9gcXViY4 z8`y?1b1%I0LkE1?&AfwGXH&16SZ7&{F8G<SG(Uw>*niJ5*Vw&!% zSlh!T$RL;ak*P?QX{WI@Oj%ytNIfs4*tFOGqgt#$lDa4tfd?EhS+uUoER~vD{nTDr z<-mw4AC+49(zdo8TT)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Boqx5+T!!lJ%j%DZFaGNxJjD!8;HSLvm4+m;c&`b}C z>|=Q1V_?+p;fa5rA^ss)@$UwHkF5IDK-j~W{1RvNEAXGxM&Kd(DKp$|h& r`7iKq1pGVxcjEqvH=y|!{{Kc}B{{eU2YHO+LjiO@EPWZYk8l46F;eAv literal 0 HcmV?d00001 From e19de8e8a481ce3fb1aa84ff236952c22debb277 Mon Sep 17 00:00:00 2001 From: Martin Hanzl Date: Thu, 11 Oct 2018 11:28:44 +0200 Subject: [PATCH 345/370] #1253 - add explanatory comment --- src/PhpWord/TemplateProcessor.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php index 86c9e1c9..ced3880e 100644 --- a/src/PhpWord/TemplateProcessor.php +++ b/src/PhpWord/TemplateProcessor.php @@ -503,6 +503,8 @@ class TemplateProcessor } /** + * Usually, the name of main part document will be 'document.xml'. However, some .docx files (possibly those from Office 365, experienced also on documents from Word Online created from blank templates) have file 'document22.xml' in their zip archive instead of 'document.xml'. This method searches content types file to correctly determine the file name. + * * @return string */ protected function getMainPartName() From 28505b0b77573d9f36936bf481ff8aef11eeec3a Mon Sep 17 00:00:00 2001 From: Ralph02 Date: Thu, 25 Oct 2018 11:23:53 +0100 Subject: [PATCH 346/370] RTF writer: Round getPageSizeW and getPageSizeH to avoid decimals --- src/PhpWord/Writer/RTF/Style/Section.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/Writer/RTF/Style/Section.php b/src/PhpWord/Writer/RTF/Style/Section.php index 5c34fa86..ee6efcf3 100644 --- a/src/PhpWord/Writer/RTF/Style/Section.php +++ b/src/PhpWord/Writer/RTF/Style/Section.php @@ -43,8 +43,8 @@ class Section extends AbstractStyle $content .= '\sectd '; // Size & margin - $content .= $this->getValueIf($style->getPageSizeW() !== null, '\pgwsxn' . $style->getPageSizeW()); - $content .= $this->getValueIf($style->getPageSizeH() !== null, '\pghsxn' . $style->getPageSizeH()); + $content .= $this->getValueIf($style->getPageSizeW() !== null, '\pgwsxn' . round($style->getPageSizeW())); + $content .= $this->getValueIf($style->getPageSizeH() !== null, '\pghsxn' . round($style->getPageSizeH())); $content .= ' '; $content .= $this->getValueIf($style->getMarginTop() !== null, '\margtsxn' . $style->getMarginTop()); $content .= $this->getValueIf($style->getMarginRight() !== null, '\margrsxn' . $style->getMarginRight()); From 54eb6e6f2cf73d9983b08d80e2da9de8311fd6bc Mon Sep 17 00:00:00 2001 From: Stefan Thoolen Date: Tue, 6 Nov 2018 14:24:56 +0100 Subject: [PATCH 347/370] Fix for undefined index PHP Notice: Undefined index: document in /home/stefan/Projects/garrcomm/PHPWord/src/PhpWord/Reader/Word2007.php on line 65 PHP Warning: Invalid argument supplied for foreach() in /home/stefan/Projects/garrcomm/PHPWord/src/PhpWord/Reader/Word2007.php on line 65 --- src/PhpWord/Reader/Word2007.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/PhpWord/Reader/Word2007.php b/src/PhpWord/Reader/Word2007.php index deed3ce3..52030ef8 100644 --- a/src/PhpWord/Reader/Word2007.php +++ b/src/PhpWord/Reader/Word2007.php @@ -62,6 +62,9 @@ class Word2007 extends AbstractReader implements ReaderInterface foreach ($steps as $step) { $stepPart = $step['stepPart']; $stepItems = $step['stepItems']; + if (!isset($relationships[$stepPart])) { + continue; + } foreach ($relationships[$stepPart] as $relItem) { $relType = $relItem['type']; if (isset($stepItems[$relType])) { From 768a07071503cd24b8089f04899bc5f6d43bf61e Mon Sep 17 00:00:00 2001 From: Gordon Franke Date: Mon, 12 Nov 2018 08:02:15 +0100 Subject: [PATCH 348/370] add/align possible values from class constant --- docs/styles.rst | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/styles.rst b/docs/styles.rst index 03366427..8c5de7cb 100644 --- a/docs/styles.rst +++ b/docs/styles.rst @@ -29,6 +29,7 @@ Available Section style options: - ``marginRight``. Page margin right in *twip*. - ``marginBottom``. Page margin bottom in *twip*. - ``orientation``. Page orientation (``portrait``, which is default, or ``landscape``). + See ``\PhpOffice\PhpWord\Style\Section::ORIENTATION_...`` class constants for possible values - ``pageSizeH``. Page height in *twip*. Implicitly defined by ``orientation`` option. Any changes are discouraged. - ``pageSizeW``. Page width in *twip*. Implicitly defined by ``orientation`` option. Any changes are discouraged. @@ -45,7 +46,7 @@ Available Font style options: - ``color``. Font color, e.g. *FF0000*. - ``doubleStrikethrough``. Double strikethrough, *true* or *false*. - ``fgColor``. Font highlight color, e.g. *yellow*, *green*, *blue*. - See ``\PhpOffice\PhpWord\Style\Font::FGCOLOR_...`` constants for more values + See ``\PhpOffice\PhpWord\Style\Font::FGCOLOR_...`` class constants for possible values - ``hint``. Font content type, *default*, *eastAsia*, or *cs*. - ``italic``. Italic, *true* or *false*. - ``name``. Font name, e.g. *Arial*. @@ -56,7 +57,7 @@ Available Font style options: - ``subScript``. Subscript, *true* or *false*. - ``superScript``. Superscript, *true* or *false*. - ``underline``. Underline, *single*, *dash*, *dotted*, etc. - See ``\PhpOffice\PhpWord\Style\Font::UNDERLINE_...`` constants for more values + See ``\PhpOffice\PhpWord\Style\Font::UNDERLINE_...`` class constants for possible values - ``lang``. Language, either a language code like *en-US*, *fr-BE*, etc. or an object (or as an array) if you need to set eastAsian or bidirectional languages See ``\PhpOffice\PhpWord\Style\Language`` class for some language codes. - ``position``. The text position, raised or lowered, in half points @@ -69,7 +70,7 @@ Paragraph Available Paragraph style options: - ``alignment``. Supports all alignment modes since 1st Edition of ECMA-376 standard up till ISO/IEC 29500:2012. - See ``\PhpOffice\PhpWord\SimpleType\Jc`` class for the details. + See ``\PhpOffice\PhpWord\SimpleType\Jc`` class constants for possible values. - ``basedOn``. Parent style. - ``hanging``. Hanging in *twip*. - ``indent``. Indent in *twip*. @@ -82,6 +83,7 @@ Available Paragraph style options: - ``spaceAfter``. Space after paragraph in *twip*. - ``spacing``. Space between lines. - ``spacingLineRule``. Line Spacing Rule. *auto*, *exact*, *atLeast* + See ``\PhpOffice\PhpWord\SimpleType\LineSpacingRule`` class constants for possible values. - ``suppressAutoHyphens``. Hyphenation for paragraph, *true* or *false*. - ``tabs``. Set of custom tab stops. - ``widowControl``. Allow first/last line to display on a separate page, *true* or *false*. @@ -89,7 +91,7 @@ Available Paragraph style options: - ``bidi``. Right to Left Paragraph Layout, *true* or *false*. - ``shading``. Paragraph Shading. - ``textAlignment``. Vertical Character Alignment on Line. - See ``\PhpOffice\PhpWord\SimpleType\TextAlignment`` class for possible values. + See ``\PhpOffice\PhpWord\SimpleType\TextAlignment`` class constants for possible values. .. _table-style: @@ -99,7 +101,7 @@ Table Available Table style options: - ``alignment``. Supports all alignment modes since 1st Edition of ECMA-376 standard up till ISO/IEC 29500:2012. - See ``\PhpOffice\PhpWord\SimpleType\JcTable`` and ``\PhpOffice\PhpWord\SimpleType\Jc`` classes for the details. + See ``\PhpOffice\PhpWord\SimpleType\JcTable`` and ``\PhpOffice\PhpWord\SimpleType\Jc`` class constants for possible values. - ``bgColor``. Background color, e.g. '9966CC'. - ``border(Top|Right|Bottom|Left)Color``. Border color, e.g. '9966CC'. - ``border(Top|Right|Bottom|Left)Size``. Border size in *twip*. @@ -168,7 +170,7 @@ Numbering level Available NumberingLevel style options: - ``alignment``. Supports all alignment modes since 1st Edition of ECMA-376 standard up till ISO/IEC 29500:2012. - See ``\PhpOffice\PhpWord\SimpleType\Jc`` class for the details. + See ``\PhpOffice\PhpWord\SimpleType\Jc`` class constants for possible values. - ``font``. Font name. - ``format``. Numbering format bullet\|decimal\|upperRoman\|lowerRoman\|upperLetter\|lowerLetter. - ``hanging``. See paragraph style. From 9f28ece4e9b4d8c917135af05d58370c62a40287 Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 16 Nov 2018 22:40:37 +0100 Subject: [PATCH 349/370] Fix path to test document --- tests/PhpWord/TemplateProcessorTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/PhpWord/TemplateProcessorTest.php b/tests/PhpWord/TemplateProcessorTest.php index 2b3a9fd1..1513486e 100644 --- a/tests/PhpWord/TemplateProcessorTest.php +++ b/tests/PhpWord/TemplateProcessorTest.php @@ -279,8 +279,7 @@ final class TemplateProcessorTest extends \PHPUnit\Framework\TestCase public function testMainPartNameDetection() { - $templatePath = 'templates/document22-xml.docx'; - $templateProcessor = new TemplateProcessor($templatePath); + $templateProcessor = new TemplateProcessor(__DIR__ . '/_files/templates/document22-xml.docx'); $variables = array('test'); From c51b6febc0feb8841202e38b817422ab0bcb09c5 Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 16 Nov 2018 23:00:23 +0100 Subject: [PATCH 350/370] rename variable to comply with rules --- src/PhpWord/TemplateProcessor.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php index ced3880e..b4102bcd 100644 --- a/src/PhpWord/TemplateProcessor.php +++ b/src/PhpWord/TemplateProcessor.php @@ -513,9 +513,9 @@ class TemplateProcessor $pattern = '~PartName="\/(word\/document.*?\.xml)" ContentType="application\/vnd\.openxmlformats-officedocument\.wordprocessingml\.document\.main\+xml"~'; - preg_match($pattern, $contentTypes, $m); + preg_match($pattern, $contentTypes, $matches); - return (array_key_exists(1, $m) ? $m[1] : 'word/document.xml'); + return (array_key_exists(1, $matches) ? $matches[1] : 'word/document.xml'); } /** From 925e9e091910bf90290dcfcfeb3a36fe94aa6855 Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 16 Nov 2018 23:33:38 +0100 Subject: [PATCH 351/370] remove trailing spaces --- src/PhpWord/TemplateProcessor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php index b4102bcd..f9a8ceb6 100644 --- a/src/PhpWord/TemplateProcessor.php +++ b/src/PhpWord/TemplateProcessor.php @@ -514,7 +514,7 @@ class TemplateProcessor $pattern = '~PartName="\/(word\/document.*?\.xml)" ContentType="application\/vnd\.openxmlformats-officedocument\.wordprocessingml\.document\.main\+xml"~'; preg_match($pattern, $contentTypes, $matches); - + return (array_key_exists(1, $matches) ? $matches[1] : 'word/document.xml'); } From ea6edf95ccefca19ab3a87cd192d8e9ca54a9c61 Mon Sep 17 00:00:00 2001 From: Christopher ARZUR Date: Fri, 16 Nov 2018 23:35:57 +0000 Subject: [PATCH 352/370] Added PHP 7.3 support for travis (#1495) * Added PHP 7.3 support for travis * mark php 7.3 as failable --- .travis.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index db77ff05..6fcdad43 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,11 +10,19 @@ php: - 7.0 - 7.1 - 7.2 + - 7.3 matrix: include: - php: 7.0 env: COVERAGE=1 + - php: 5.3 + env: COMPOSER_MEMORY_LIMIT=2G + exclude: + - php: 7.0 + - php: 5.3 + allow_failures: + - php: 7.3 cache: directories: @@ -32,7 +40,7 @@ before_install: before_script: ## Deactivate xdebug if we don't do code coverage - - if [ -z "$COVERAGE" ]; then phpenv config-rm xdebug.ini ; fi + - if [ -z "$COVERAGE" ]; then phpenv config-rm xdebug.ini || echo "xdebug not available" ; fi ## Composer - composer self-update - travis_wait composer install --prefer-source From 9b174e52c1600cb9f302a4dc40354eeb8fc6f01b Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Mon, 19 Nov 2018 01:35:03 -0200 Subject: [PATCH 354/370] Fix typo in the PR template --- docs/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/PULL_REQUEST_TEMPLATE.md b/docs/PULL_REQUEST_TEMPLATE.md index 24ba001c..5430a996 100644 --- a/docs/PULL_REQUEST_TEMPLATE.md +++ b/docs/PULL_REQUEST_TEMPLATE.md @@ -8,4 +8,4 @@ Fixes # (issue) - [ ] I have run `composer run-script check --timeout=0` and no errors were reported - [ ] The new code is covered by unit tests (check build/coverage for coverage report) -- [ ] I have update the documentation to describe the changes +- [ ] I have updated the documentation to describe the changes From 663fb036d003d2cd98c29639818ca3673dda22fb Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Mon, 19 Nov 2018 01:36:23 -0200 Subject: [PATCH 355/370] Use dedicated PHPUnit assertions --- tests/PhpWord/Writer/HTML/ElementTest.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/PhpWord/Writer/HTML/ElementTest.php b/tests/PhpWord/Writer/HTML/ElementTest.php index 7a6397ef..61aaf71c 100644 --- a/tests/PhpWord/Writer/HTML/ElementTest.php +++ b/tests/PhpWord/Writer/HTML/ElementTest.php @@ -73,8 +73,8 @@ class ElementTest extends \PHPUnit\Framework\TestCase $dom = $this->getAsHTML($phpWord); $xpath = new \DOMXPath($dom); - $this->assertTrue($xpath->query('/html/body/p[1]/ins')->length == 1); - $this->assertTrue($xpath->query('/html/body/p[2]/del')->length == 1); + $this->assertEquals(1, $xpath->query('/html/body/p[1]/ins')->length); + $this->assertEquals(1, $xpath->query('/html/body/p[2]/del')->length); } /** @@ -97,9 +97,9 @@ class ElementTest extends \PHPUnit\Framework\TestCase $dom = $this->getAsHTML($phpWord); $xpath = new \DOMXPath($dom); - $this->assertTrue($xpath->query('/html/body/table/tr[1]/td')->length == 1); + $this->assertEquals(1, $xpath->query('/html/body/table/tr[1]/td')->length); $this->assertEquals('2', $xpath->query('/html/body/table/tr/td[1]')->item(0)->attributes->getNamedItem('colspan')->textContent); - $this->assertTrue($xpath->query('/html/body/table/tr[2]/td')->length == 2); + $this->assertEquals(2, $xpath->query('/html/body/table/tr[2]/td')->length); } /** @@ -126,9 +126,9 @@ class ElementTest extends \PHPUnit\Framework\TestCase $dom = $this->getAsHTML($phpWord); $xpath = new \DOMXPath($dom); - $this->assertTrue($xpath->query('/html/body/table/tr[1]/td')->length == 2); + $this->assertEquals(2, $xpath->query('/html/body/table/tr[1]/td')->length); $this->assertEquals('3', $xpath->query('/html/body/table/tr[1]/td[1]')->item(0)->attributes->getNamedItem('rowspan')->textContent); - $this->assertTrue($xpath->query('/html/body/table/tr[2]/td')->length == 1); + $this->assertEquals(1, $xpath->query('/html/body/table/tr[2]/td')->length); } private function getAsHTML(PhpWord $phpWord) @@ -155,6 +155,6 @@ class ElementTest extends \PHPUnit\Framework\TestCase $htmlWriter = new HTML($phpWord); $content = $htmlWriter->getContent(); - $this->assertTrue(strpos($content, $expected) !== false); + $this->assertContains($expected, $content); } } From d9d79c0666928ce564dbdf3d08dca9bcdc678863 Mon Sep 17 00:00:00 2001 From: Ralph02 Date: Thu, 25 Oct 2018 11:23:53 +0100 Subject: [PATCH 356/370] RTF writer: Round getPageSizeW and getPageSizeH to avoid decimals --- src/PhpWord/Writer/RTF/Style/Section.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/Writer/RTF/Style/Section.php b/src/PhpWord/Writer/RTF/Style/Section.php index 5c34fa86..ee6efcf3 100644 --- a/src/PhpWord/Writer/RTF/Style/Section.php +++ b/src/PhpWord/Writer/RTF/Style/Section.php @@ -43,8 +43,8 @@ class Section extends AbstractStyle $content .= '\sectd '; // Size & margin - $content .= $this->getValueIf($style->getPageSizeW() !== null, '\pgwsxn' . $style->getPageSizeW()); - $content .= $this->getValueIf($style->getPageSizeH() !== null, '\pghsxn' . $style->getPageSizeH()); + $content .= $this->getValueIf($style->getPageSizeW() !== null, '\pgwsxn' . round($style->getPageSizeW())); + $content .= $this->getValueIf($style->getPageSizeH() !== null, '\pghsxn' . round($style->getPageSizeH())); $content .= ' '; $content .= $this->getValueIf($style->getMarginTop() !== null, '\margtsxn' . $style->getMarginTop()); $content .= $this->getValueIf($style->getMarginRight() !== null, '\margrsxn' . $style->getMarginRight()); From b5865b2fc2bb4773450add0c354e49166d32ea02 Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 20 Nov 2018 19:59:30 +0100 Subject: [PATCH 357/370] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index abf34834..7ce722c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ v0.16.0 (xx xxx 2018) ### Fixed - Fix regex in `cloneBlock` function @nicoder #1269 - HTML Title Writer loses text when Title contains a TextRun instead a string. @begnini #1436 +- RTF writer: Round getPageSizeW and getPageSizeH to avoid decimals @Patrick64 #1493 v0.15.0 (14 Jul 2018) ---------------------- From 1c20a4ed22c791e3cc574291c1f40e53b328568d Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 20 Nov 2018 21:22:50 +0100 Subject: [PATCH 358/370] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ce722c4..ce553f05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ v0.16.0 (xx xxx 2018) - Fix regex in `cloneBlock` function @nicoder #1269 - HTML Title Writer loses text when Title contains a TextRun instead a string. @begnini #1436 - RTF writer: Round getPageSizeW and getPageSizeH to avoid decimals @Patrick64 #1493 +- Fix parsing of Office 365 documents @Timanx #1485 v0.15.0 (14 Jul 2018) ---------------------- From c12f98f69a201502f3f994d261c106c8926ef62b Mon Sep 17 00:00:00 2001 From: troosan Date: Tue, 20 Nov 2018 22:40:54 +0100 Subject: [PATCH 359/370] fix check style warning --- src/PhpWord/TemplateProcessor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php index f9a8ceb6..95468878 100644 --- a/src/PhpWord/TemplateProcessor.php +++ b/src/PhpWord/TemplateProcessor.php @@ -515,7 +515,7 @@ class TemplateProcessor preg_match($pattern, $contentTypes, $matches); - return (array_key_exists(1, $matches) ? $matches[1] : 'word/document.xml'); + return array_key_exists(1, $matches) ? $matches[1] : 'word/document.xml'; } /** From 5ccf985f9ad1c596c8b60d0730ff0bdaa2124804 Mon Sep 17 00:00:00 2001 From: Christopher ARZUR Date: Fri, 16 Nov 2018 23:35:57 +0000 Subject: [PATCH 360/370] Added PHP 7.3 support for travis (#1495) * Added PHP 7.3 support for travis * mark php 7.3 as failable --- .travis.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index db77ff05..6fcdad43 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,11 +10,19 @@ php: - 7.0 - 7.1 - 7.2 + - 7.3 matrix: include: - php: 7.0 env: COVERAGE=1 + - php: 5.3 + env: COMPOSER_MEMORY_LIMIT=2G + exclude: + - php: 7.0 + - php: 5.3 + allow_failures: + - php: 7.3 cache: directories: @@ -32,7 +40,7 @@ before_install: before_script: ## Deactivate xdebug if we don't do code coverage - - if [ -z "$COVERAGE" ]; then phpenv config-rm xdebug.ini ; fi + - if [ -z "$COVERAGE" ]; then phpenv config-rm xdebug.ini || echo "xdebug not available" ; fi ## Composer - composer self-update - travis_wait composer install --prefer-source From a2a70736addbe2929c3edf41851bb83b75d00414 Mon Sep 17 00:00:00 2001 From: troosan Date: Thu, 22 Nov 2018 23:05:43 +0100 Subject: [PATCH 361/370] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index abf34834..8c3a174d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ v0.16.0 (xx xxx 2018) ### Fixed - Fix regex in `cloneBlock` function @nicoder #1269 - HTML Title Writer loses text when Title contains a TextRun instead a string. @begnini #1436 +- Fix loading of Sharepoint document @Garrcomm #1498 v0.15.0 (14 Jul 2018) ---------------------- From 7aef21facaf78e78da3902d1c2dc7766bca52c30 Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 28 Nov 2018 22:02:39 +0100 Subject: [PATCH 362/370] add test for parsing HTML containing entities --- tests/PhpWord/Shared/HtmlTest.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index 51d92431..89292a20 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -86,6 +86,21 @@ class HtmlTest extends \PHPUnit\Framework\TestCase $this->assertCount(2, $section->getElements()); } + /** + * Test HTML entities + */ + public function testParseHtmlEntities() + { + \PhpOffice\PhpWord\Settings::setOutputEscapingEnabled(true); + $phpWord = new \PhpOffice\PhpWord\PhpWord(); + $section = $phpWord->addSection(); + Html::addHtml($section, 'text with entities <my text>'); + + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p[1]/w:r/w:t')); + $this->assertEquals('text with entities ', $doc->getElement('/w:document/w:body/w:p[1]/w:r/w:t')->nodeValue); + } + /** * Test underline */ From 32fb85fc8e4ad5bc059574995344fd60dc950aaa Mon Sep 17 00:00:00 2001 From: Christopher ARZUR Date: Fri, 16 Nov 2018 23:35:57 +0000 Subject: [PATCH 363/370] Added PHP 7.3 support for travis (#1495) * Added PHP 7.3 support for travis * mark php 7.3 as failable --- .travis.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index db77ff05..6fcdad43 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,11 +10,19 @@ php: - 7.0 - 7.1 - 7.2 + - 7.3 matrix: include: - php: 7.0 env: COVERAGE=1 + - php: 5.3 + env: COMPOSER_MEMORY_LIMIT=2G + exclude: + - php: 7.0 + - php: 5.3 + allow_failures: + - php: 7.3 cache: directories: @@ -32,7 +40,7 @@ before_install: before_script: ## Deactivate xdebug if we don't do code coverage - - if [ -z "$COVERAGE" ]; then phpenv config-rm xdebug.ini ; fi + - if [ -z "$COVERAGE" ]; then phpenv config-rm xdebug.ini || echo "xdebug not available" ; fi ## Composer - composer self-update - travis_wait composer install --prefer-source From b50de97a41f29987901b1370b74cbf08c643e741 Mon Sep 17 00:00:00 2001 From: troosan Date: Wed, 28 Nov 2018 22:54:57 +0100 Subject: [PATCH 364/370] support `auto` table layout too --- CHANGELOG.md | 1 + src/PhpWord/Writer/HTML/Element/Table.php | 26 ++++++++++++++++++++--- tests/PhpWord/Writer/HTML/ElementTest.php | 11 +++++++--- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index abf34834..7e2325fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ v0.16.0 (xx xxx 2018) ### Fixed - Fix regex in `cloneBlock` function @nicoder #1269 - HTML Title Writer loses text when Title contains a TextRun instead a string. @begnini #1436 +- Adding table layout to the generated HTML @aarangara #1441 v0.15.0 (14 Jul 2018) ---------------------- diff --git a/src/PhpWord/Writer/HTML/Element/Table.php b/src/PhpWord/Writer/HTML/Element/Table.php index 50c5a777..a5143d2b 100644 --- a/src/PhpWord/Writer/HTML/Element/Table.php +++ b/src/PhpWord/Writer/HTML/Element/Table.php @@ -39,9 +39,8 @@ class Table extends AbstractElement $rows = $this->element->getRows(); $rowCount = count($rows); if ($rowCount > 0) { - $tableStyle = $this->element->getStyle(); - $tableLayout = $tableStyle === null ? '' : $tableStyle->getLayout(); - $content .= '' . PHP_EOL; + $content .= 'element->getStyle()) . '>' . PHP_EOL; + for ($i = 0; $i < $rowCount; $i++) { /** @var $row \PhpOffice\PhpWord\Element\Row Type hint */ $rowStyle = $rows[$i]->getStyle(); @@ -104,4 +103,25 @@ class Table extends AbstractElement return $content; } + + /** + * Translates Table style in CSS equivalent + * + * @param \PhpOffice\PhpWord\Style\Table|null $tableStyle + * @return string + */ + private function getTableStyle(\PhpOffice\PhpWord\Style\Table $tableStyle = null) + { + if ($tableStyle == null) { + return ''; + } + $style = ' style="'; + if ($tableStyle->getLayout() == \PhpOffice\PhpWord\Style\Table::LAYOUT_FIXED) { + $style .= 'table-layout: fixed;'; + } elseif ($tableStyle->getLayout() == \PhpOffice\PhpWord\Style\Table::LAYOUT_AUTO) { + $style .= 'table-layout: auto;'; + } + + return $style . '"'; + } } diff --git a/tests/PhpWord/Writer/HTML/ElementTest.php b/tests/PhpWord/Writer/HTML/ElementTest.php index 1f286c5f..73c6ede9 100644 --- a/tests/PhpWord/Writer/HTML/ElementTest.php +++ b/tests/PhpWord/Writer/HTML/ElementTest.php @@ -166,14 +166,19 @@ class ElementTest extends \PHPUnit\Framework\TestCase $phpWord = new PhpWord(); $section = $phpWord->addSection(); $section->addTable(); - $table = $section->addTable(array('layout' => 'fixed')); - $row1 = $table->addRow(); + $table1 = $section->addTable(array('layout' => \PhpOffice\PhpWord\Style\Table::LAYOUT_FIXED)); + $row1 = $table1->addRow(); $row1->addCell()->addText('fixed layout table'); + $table2 = $section->addTable(array('layout' => \PhpOffice\PhpWord\Style\Table::LAYOUT_AUTO)); + $row2 = $table2->addRow(); + $row2->addCell()->addText('auto layout table'); + $dom = $this->getAsHTML($phpWord); $xpath = new \DOMXPath($dom); - $this->assertEquals('table-layout: fixed', $xpath->query('/html/body/table')->item(0)->attributes->getNamedItem('style')->textContent); + $this->assertEquals('table-layout: fixed;', $xpath->query('/html/body/table[1]')->item(0)->attributes->getNamedItem('style')->textContent); + $this->assertEquals('table-layout: auto;', $xpath->query('/html/body/table[2]')->item(0)->attributes->getNamedItem('style')->textContent); } } From 6a7594630ce1a3adf7dbb8d9893f2f0f0e739faf Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 30 Nov 2018 23:01:05 +0100 Subject: [PATCH 365/370] add sonar config files --- .gitignore | 1 + phpunit.xml.dist | 1 + sonar-project.properties | 17 +++++++++++++++++ 3 files changed, 19 insertions(+) create mode 100644 sonar-project.properties diff --git a/.gitignore b/.gitignore index 2ac6e2b5..b2ec7e23 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ vendor /.settings phpword.ini /.buildpath +/.scannerwork /.project /nbproject /.php_cs.cache diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 17fcfa39..4a882446 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -23,5 +23,6 @@ + \ No newline at end of file diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000..7741cfb4 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,17 @@ +# must be unique in a given SonarQube instance +sonar.projectKey=phpoffice:phpword +# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1. +sonar.projectName=PHPWord +sonar.projectVersion=0.16 + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +# This property is optional if sonar.modules is set. +sonar.sources=src +sonar.tests=tests +sonar.php.coverage.reportPaths=build/logs/clover.xml +sonar.php.tests.reportPath=build/logs/logfile.xml + +# Encoding of the source code. Default is default system encoding +#sonar.sourceEncoding=UTF-8 + +sonar.host.url=http://localhost:9000 \ No newline at end of file From a44aee8c34a78ed93d755224b8afd26d99737311 Mon Sep 17 00:00:00 2001 From: troosan Date: Fri, 30 Nov 2018 22:59:21 +0100 Subject: [PATCH 366/370] fix some sonar warnings --- src/PhpWord/Reader/MsDoc.php | 2 ++ src/PhpWord/Shared/Html.php | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/Reader/MsDoc.php b/src/PhpWord/Reader/MsDoc.php index d4945229..187d5b17 100644 --- a/src/PhpWord/Reader/MsDoc.php +++ b/src/PhpWord/Reader/MsDoc.php @@ -2185,6 +2185,8 @@ class MsDoc extends AbstractReader implements ReaderInterface $sprmCPicLocation += $embeddedBlipRH['recLen']; break; + case self::OFFICEARTBLIPPNG: + break; default: // print_r(dechex($embeddedBlipRH['recType'])); } diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 873234de..60fd7e16 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -531,6 +531,7 @@ class Html $styles['bgColor'] = trim($cValue, '#'); break; case 'line-height': + $matches = array(); if (preg_match('/([0-9]+\.?[0-9]*[a-z]+)/', $cValue, $matches)) { $spacingLineRule = \PhpOffice\PhpWord\SimpleType\LineSpacingRule::EXACT; $spacing = Converter::cssToTwip($matches[1]) / \PhpOffice\PhpWord\Style\Paragraph::LINE_HEIGHT; @@ -743,8 +744,6 @@ class Html default: return Jc::START; } - - return null; } /** From fb60865b8dfa6b9e038d7798d126a0a717b09a2f Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 2 Dec 2018 15:39:25 +0100 Subject: [PATCH 367/370] test build php 7.3 --- .travis.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6fcdad43..881decfe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,9 +18,12 @@ matrix: env: COVERAGE=1 - php: 5.3 env: COMPOSER_MEMORY_LIMIT=2G + - php: 7.3 + env: DEPENDENCIES="--ignore-platform-reqs" exclude: - - php: 7.0 - php: 5.3 + - php: 7.0 + - php: 7.3 allow_failures: - php: 7.3 @@ -43,7 +46,7 @@ before_script: - if [ -z "$COVERAGE" ]; then phpenv config-rm xdebug.ini || echo "xdebug not available" ; fi ## Composer - composer self-update - - travis_wait composer install --prefer-source + - travis_wait composer install --prefer-source $(if [ -n "$DEPENDENCIES" ]; then echo $DEPENDENCIES; fi) ## PHPDocumentor ##- mkdir -p build/docs - mkdir -p build/coverage From 5b688d50d82cf491b6114e94bc84de59dc96941d Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 2 Dec 2018 23:54:25 +0100 Subject: [PATCH 368/370] fix formatting --- src/PhpWord/Style/Chart.php | 26 +++++++++++++--------- src/PhpWord/Writer/Word2007/Part/Chart.php | 16 ++++++------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/PhpWord/Style/Chart.php b/src/PhpWord/Style/Chart.php index 5c96afd2..06b4829c 100644 --- a/src/PhpWord/Style/Chart.php +++ b/src/PhpWord/Style/Chart.php @@ -51,8 +51,8 @@ class Chart extends AbstractStyle * @var array */ private $colors = array(); - - /** + + /** * Chart title * * @var string @@ -111,9 +111,15 @@ class Chart extends AbstractStyle */ private $valueAxisTitle; + /** + * The position for major tick marks + * Possible values are 'in', 'out', 'cross', 'none' + * + * @var string + */ private $majorTickMarkPos = 'none'; - /* + /** * Show labels for axis * * @var bool @@ -234,7 +240,7 @@ class Chart extends AbstractStyle return $this; } - + /** * Get the chart title * @@ -248,7 +254,7 @@ class Chart extends AbstractStyle /** * Set the chart title * - * @param string $value + * @param string $value */ public function setTitle($value = null) { @@ -262,7 +268,7 @@ class Chart extends AbstractStyle * * @return bool */ - public function getShowLegend() + public function isShowLegend() { return $this->showLegend; } @@ -270,7 +276,7 @@ class Chart extends AbstractStyle /** * Set chart legend visibility * - * @param bool $value + * @param bool $value */ public function setShowLegend($value = false) { @@ -452,8 +458,8 @@ class Chart extends AbstractStyle } /** - * set the position for major tick marks - * @param string $position [description] + * Set the position for major tick marks + * @param string $position */ public function setMajorTickPosition($position) { @@ -461,7 +467,7 @@ class Chart extends AbstractStyle $this->majorTickMarkPos = $this->setEnumVal($position, $enum, $this->majorTickMarkPos); } - /* + /** * Show Gridlines for X-Axis * * @return bool diff --git a/src/PhpWord/Writer/Word2007/Part/Chart.php b/src/PhpWord/Writer/Word2007/Part/Chart.php index e14a708b..812d3bf1 100644 --- a/src/PhpWord/Writer/Word2007/Part/Chart.php +++ b/src/PhpWord/Writer/Word2007/Part/Chart.php @@ -128,12 +128,12 @@ class Chart extends AbstractPart $type = $this->element->getType(); $style = $this->element->getStyle(); $this->options = $this->types[$type]; - - $title = $style->getTitle(); - $showLegend = $style->getShowLegend(); + + $title = $style->getTitle(); + $showLegend = $style->isShowLegend(); //Chart title - if($title){ + if ($title) { $xmlWriter->startElement('c:title'); $xmlWriter->startElement('c:tx'); $xmlWriter->startElement('c:rich'); @@ -142,20 +142,18 @@ class Chart extends AbstractPart - '.$title.' + ' . $title . ' '); - $xmlWriter->endElement(); // c:rich $xmlWriter->endElement(); // c:tx $xmlWriter->endElement(); // c:title - - }else{ + } else { $xmlWriter->writeElementBlock('c:autoTitleDeleted', 'val', 1); } //Chart legend - if($showLegend){ + if ($showLegend) { $xmlWriter->writeRaw(''); } From 0c4bd1d02f3b175d3944d6577c377a800e27aace Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 2 Dec 2018 23:54:32 +0100 Subject: [PATCH 369/370] update documentation --- docs/styles.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/styles.rst b/docs/styles.rst index 8c5de7cb..f8d26a9b 100644 --- a/docs/styles.rst +++ b/docs/styles.rst @@ -192,6 +192,14 @@ Available Chart style options: - ``width``. Width (in EMU). - ``height``. Height (in EMU). - ``3d``. Is 3D; applies to pie, bar, line, area, *true* or *false*. +- ``colors``. A list of colors to use in the chart. +- ``title``. The title for the chart. +- ``showLegend``. Show legend, *true* or *false*. +- ``categoryLabelPosition``. Label position for categories, *nextTo* (default), *low* or *high*. +- ``valueLabelPosition``. Label position for values, *nextTo* (default), *low* or *high*. +- ``categoryAxisTitle``. The title for the category axis. +- ``valueAxisTitle``. The title for the values axis. +- ``majorTickMarkPos``. The position for major tick marks, *in*, *out*, *cross*, *none* (default). - ``showAxisLabels``. Show labels for axis, *true* or *false*. - ``gridX``. Show Gridlines for X-Axis, *true* or *false*. - ``gridY``. Show Gridlines for Y-Axis, *true* or *false*. From 9f684c745e3b7f41c304659a77c74967e662f3f1 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 2 Dec 2018 23:54:40 +0100 Subject: [PATCH 370/370] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1db7a5e..79ae2511 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). v0.16.0 (xx xxx 2018) ---------------------- ### Added +- Add setting Chart Title and Legend visibility @Tom-Magill #1433 ### Fixed - Fix regex in `cloneBlock` function @nicoder #1269