Skip to content

Commit 5e2374b

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into develop
2 parents a5ec49d + 575c553 commit 5e2374b

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ v0.16.0 (xx dec 2018)
2222
- RTF writer: Round getPageSizeW and getPageSizeH to avoid decimals @Patrick64 #1493
2323
- Fix parsing of Office 365 documents @Timanx #1485
2424

25+
### Miscelaneous
26+
- Get rid of duplicated code in TemplateProcessor @abcdmitry #1161
27+
2528
v0.15.0 (14 Jul 2018)
2629
----------------------
2730
### Added

docs/containers.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ You can pass an optional parameter to specify where the header/footer should be
104104
- ``Footer::FIRST`` each first page of the section
105105
- ``Footer::EVEN`` each even page of the section. Will only be applied if the evenAndOddHeaders is set to true in phpWord->settings
106106

107+
To change the evenAndOddHeaders use the ``getSettings`` method to return the Settings object, and then call the ``setEvenAndOddHeaders`` method:
108+
109+
.. code-block:: php
110+
$phpWord->getSettings()->setEvenAndOddHeaders(true);
111+
112+
107113
Footers
108114
-------
109115

src/PhpWord/TemplateProcessor.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,10 @@ public function setValue($search, $replace, $limit = self::MAXIMUM_REPLACEMENTS_
244244
{
245245
if (is_array($search)) {
246246
foreach ($search as &$item) {
247-
$item = self::ensureMacroCompleted($item);
247+
$item = static::ensureMacroCompleted($item);
248248
}
249249
} else {
250-
$search = self::ensureMacroCompleted($search);
250+
$search = static::ensureMacroCompleted($search);
251251
}
252252

253253
if (is_array($replace)) {
@@ -521,7 +521,7 @@ public function setImageValue($search, $replace, $limit = self::MAXIMUM_REPLACEM
521521
$xmlImage = str_replace(array('{RID}', '{WIDTH}', '{HEIGHT}'), array($rid, $preparedImageAttrs['width'], $preparedImageAttrs['height']), $imgTpl);
522522

523523
// replace variable
524-
$varNameWithArgsFixed = self::ensureMacroCompleted($varNameWithArgs);
524+
$varNameWithArgsFixed = static::ensureMacroCompleted($varNameWithArgs);
525525
$matches = array();
526526
if (preg_match('/(<[^<]+>)([^<]*)(' . preg_quote($varNameWithArgsFixed) . ')([^>]*)(<[^>]+>)/Uu', $partContent, $matches)) {
527527
$wholeTag = $matches[0];
@@ -582,9 +582,7 @@ public function getVariables()
582582
*/
583583
public function cloneRow($search, $numberOfClones)
584584
{
585-
if ('${' !== substr($search, 0, 2) && '}' !== substr($search, -1)) {
586-
$search = '${' . $search . '}';
587-
}
585+
$search = static::ensureMacroCompleted($search);
588586

589587
$tagPos = strpos($this->tempDocumentMainPart, $search);
590588
if (!$tagPos) {

0 commit comments

Comments
 (0)