Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
Daniel Morris 2018-12-26 21:49:41 +02:00
commit 5e2374be4a
3 changed files with 13 additions and 6 deletions

View File

@ -22,6 +22,9 @@ v0.16.0 (xx dec 2018)
- RTF writer: Round getPageSizeW and getPageSizeH to avoid decimals @Patrick64 #1493 - RTF writer: Round getPageSizeW and getPageSizeH to avoid decimals @Patrick64 #1493
- Fix parsing of Office 365 documents @Timanx #1485 - Fix parsing of Office 365 documents @Timanx #1485
### Miscelaneous
- Get rid of duplicated code in TemplateProcessor @abcdmitry #1161
v0.15.0 (14 Jul 2018) v0.15.0 (14 Jul 2018)
---------------------- ----------------------
### Added ### Added

View File

@ -104,6 +104,12 @@ You can pass an optional parameter to specify where the header/footer should be
- ``Footer::FIRST`` each first page of the section - ``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 - ``Footer::EVEN`` each even page of the section. Will only be applied if the evenAndOddHeaders is set to true in phpWord->settings
To change the evenAndOddHeaders use the ``getSettings`` method to return the Settings object, and then call the ``setEvenAndOddHeaders`` method:
.. code-block:: php
$phpWord->getSettings()->setEvenAndOddHeaders(true);
Footers Footers
------- -------

View File

@ -244,10 +244,10 @@ class TemplateProcessor
{ {
if (is_array($search)) { if (is_array($search)) {
foreach ($search as &$item) { foreach ($search as &$item) {
$item = self::ensureMacroCompleted($item); $item = static::ensureMacroCompleted($item);
} }
} else { } else {
$search = self::ensureMacroCompleted($search); $search = static::ensureMacroCompleted($search);
} }
if (is_array($replace)) { if (is_array($replace)) {
@ -521,7 +521,7 @@ class TemplateProcessor
$xmlImage = str_replace(array('{RID}', '{WIDTH}', '{HEIGHT}'), array($rid, $preparedImageAttrs['width'], $preparedImageAttrs['height']), $imgTpl); $xmlImage = str_replace(array('{RID}', '{WIDTH}', '{HEIGHT}'), array($rid, $preparedImageAttrs['width'], $preparedImageAttrs['height']), $imgTpl);
// replace variable // replace variable
$varNameWithArgsFixed = self::ensureMacroCompleted($varNameWithArgs); $varNameWithArgsFixed = static::ensureMacroCompleted($varNameWithArgs);
$matches = array(); $matches = array();
if (preg_match('/(<[^<]+>)([^<]*)(' . preg_quote($varNameWithArgsFixed) . ')([^>]*)(<[^>]+>)/Uu', $partContent, $matches)) { if (preg_match('/(<[^<]+>)([^<]*)(' . preg_quote($varNameWithArgsFixed) . ')([^>]*)(<[^>]+>)/Uu', $partContent, $matches)) {
$wholeTag = $matches[0]; $wholeTag = $matches[0];
@ -582,9 +582,7 @@ class TemplateProcessor
*/ */
public function cloneRow($search, $numberOfClones) public function cloneRow($search, $numberOfClones)
{ {
if ('${' !== substr($search, 0, 2) && '}' !== substr($search, -1)) { $search = static::ensureMacroCompleted($search);
$search = '${' . $search . '}';
}
$tagPos = strpos($this->tempDocumentMainPart, $search); $tagPos = strpos($this->tempDocumentMainPart, $search);
if (!$tagPos) { if (!$tagPos) {