diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php
index 649fde40..a591ad5a 100644
--- a/src/PhpWord/TemplateProcessor.php
+++ b/src/PhpWord/TemplateProcessor.php
@@ -1,4 +1,5 @@
getMainPartName() => &$this->tempDocumentMainPart,
- );
+ $this->getMainPartName() => &$this->tempDocumentMainPart,
+ );
foreach (array_keys($this->tempDocumentHeaders) as $headerIndex) {
$searchParts[$this->getHeaderName($headerIndex)] = &$this->tempDocumentHeaders[$headerIndex];
}
@@ -661,7 +662,7 @@ class TemplateProcessor
if (preg_match('/(<[^<]+>)([^<]*)(' . preg_quote($varNameWithArgsFixed) . ')([^>]*)(<[^>]+>)/Uu', $partContent, $matches)) {
$wholeTag = $matches[0];
array_shift($matches);
- list($openTag, $prefix, , $postfix, $closeTag) = $matches;
+ list($openTag, $prefix,, $postfix, $closeTag) = $matches;
$replaceXml = $openTag . $prefix . $closeTag . $xmlImage . $openTag . $postfix . $closeTag;
// replace on each iteration, because in one tag we can have 2+ inline variables => before proceed next variable we need to change $partContent
$partContent = $this->setValueForPart($wholeTag, $replaceXml, $partContent, $limit);
@@ -747,8 +748,10 @@ class TemplateProcessor
// If tmpXmlRow doesn't contain continue, this row is no longer part of the spanned row.
$tmpXmlRow = $this->getSlice($extraRowStart, $extraRowEnd);
- if (!preg_match('##', $tmpXmlRow) &&
- !preg_match('##', $tmpXmlRow)) {
+ if (
+ !preg_match('##', $tmpXmlRow) &&
+ !preg_match('##', $tmpXmlRow)
+ ) {
break;
}
// This row was a spanned row, update $rowEnd and search for the next row.
@@ -1067,7 +1070,11 @@ class TemplateProcessor
protected function getNextRelationsIndex($documentPartName)
{
if (isset($this->tempDocumentRelations[$documentPartName])) {
- return substr_count($this->tempDocumentRelations[$documentPartName], 'tempDocumentRelations[$documentPartName], 'tempDocumentRelations[$documentPartName], 'Id="rId' . $candidate . '"') !== false) {
+ $candidate++;
+ }
+ return $candidate;
}
return 1;