GH-51 : Adding a value that contains "&" in a template breaks it

This commit is contained in:
Progi1984 2014-03-06 23:29:51 +01:00
parent 55a5b7e089
commit 545cbc6e23
2 changed files with 13 additions and 10 deletions

View File

@ -101,14 +101,16 @@ class PHPWord_Template
if (!PHPWord_Shared_String::IsUTF8($replace)) {
$replace = utf8_encode($replace);
}
$replace = htmlspecialchars($replace);
} else {
foreach($replace as $key=>$value) {
$replace[$key] = htmlspecialchars($value);
}
}
$regExpDelim = '/';
$escapedSearch = preg_quote($search, $regExpDelim);
$this->_documentXML = preg_replace("{$regExpDelim}{$escapedSearch}{$regExpDelim}u",
$replace,
$this->_documentXML,
$limit);
$this->_documentXML = preg_replace("{$regExpDelim}{$escapedSearch}{$regExpDelim}u", $replace, $this->_documentXML, $limit);
}
/**

View File

@ -23,19 +23,20 @@
**************************************************************************************
Changes in branch for release 0.7.1 :
- Feature: (ivanlanin) GH-48 GH-86 - Table row: Repeat as header row & allow row to break across pages
- Feature: (ivanlanin) GH-48 GH-86 - Table: Table width in percentage
- Feature: (ivanlanin) GH-48 GH-86 - Font: Superscript and subscript
- Feature: (ivanlanin) GH-48 GH-86 - Paragraph: Hanging paragraph
- Feature: (ivanlanin) GH-48 GH-86 - Section: Multicolumn and section break
- Bugfix: (gabrielbull) - Fixed bug with cell styling
- Bugfix: (gabrielbull) - Fixed bug list items inside of cells
- Bugfix: (SiebelsTim) GH-51 - Adding a value that contains "&" in a template breaks it
- Feature: (RomanSyroeshko) GH-56 GH-57 - Template : Permit to save a template generated as a file (PHPWord_Template::saveAs())
- Feature: (gabrielbull) - Word2007 : Support sections page numbering
- Feature: (gabrielbull) - Word2007 : Added support for line height
- Feature: (JillElaine) GH-5 - Word2007 : Added support for page header & page footer height
- Feature: (bskrtich) GH-6 GH-66 GH-84 - General : Add ability to manage line breaks after image insertion
- Feature: (RomanSyroeshko) GH-52 GH-53 GH-85 - Template : Ability to limit number of replacements performed by setValue() method of Template class
- Feature: (ivanlanin) GH-48 GH-86 - Table row: Repeat as header row & allow row to break across pages
- Feature: (ivanlanin) GH-48 GH-86 - Table: Table width in percentage
- Feature: (ivanlanin) GH-48 GH-86 - Font: Superscript and subscript
- Feature: (ivanlanin) GH-48 GH-86 - Paragraph: Hanging paragraph
- Feature: (ivanlanin) GH-48 GH-86 - Section: Multicolumn and section break
- QA: (Progi1984) - UnitTests
Changes in branch for release 0.7.0 :