Template processor setValue() improvements #614

This commit is contained in:
kazi Tanvir Ahsan 2015-09-10 23:33:02 +10:00
parent 3a58c818bd
commit a123ce41e5

View File

@ -144,6 +144,10 @@ class TemplateProcessor
*/
public function setValue($macro, $replace, $limit = self::MAXIMUM_REPLACEMENTS_DEFAULT)
{
if (substr($macro, 0, 2) !== '${' && substr($macro, -1) !== '}') {
$macro = '${' . $macro . '}';
}
foreach ($this->tempDocumentHeaders as $index => $headerXML) {
$this->tempDocumentHeaders[$index] = $this->setValueForPart($this->tempDocumentHeaders[$index], $macro, $replace, $limit);
}
@ -399,10 +403,7 @@ class TemplateProcessor
*/
protected function setValueForPart($documentPartXML, $search, $replace, $limit)
{
if (substr($search, 0, 2) !== '${' && substr($search, -1) !== '}') {
$search = '${' . $search . '}';
}
if (!String::isUTF8($replace)) {
$replace = utf8_encode($replace);
}