check if we can use the XSL extension, to not give a fatal error and rendering whole merge-print non-functional AND only keep tags, if XSL is available

This commit is contained in:
Ralf Becker 2011-09-12 10:56:08 +00:00
parent fcb9320b54
commit 1d6f9f0bfe

View File

@ -698,23 +698,27 @@ abstract class bo_merge
// Tags we can replace with the target document's version // Tags we can replace with the target document's version
$replace_tags = array(); $replace_tags = array();
switch($mimetype.$mso_application_progid) // only keep tags, if we have xsl extension available
if (class_exists(XSLTProcessor) && class_exists(DOMDocument))
{ {
case 'application/vnd.oasis.opendocument.text': // open office switch($mimetype.$mso_application_progid)
case 'application/vnd.oasis.opendocument.spreadsheet': {
$replace_tags = array( case 'application/vnd.oasis.opendocument.text': // open office
'<b>','<strong>','<i>','<em>','<u>','<span>','<ol>','<ul>','<li>', case 'application/vnd.oasis.opendocument.spreadsheet':
'<table>','<tr>','<td>', $replace_tags = array(
); '<b>','<strong>','<i>','<em>','<u>','<span>','<ol>','<ul>','<li>',
break; '<table>','<tr>','<td>',
case 'application/xmlWord.Document': // Word 2003*/ );
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': // ms office 2007 break;
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': case 'application/xmlWord.Document': // Word 2003*/
$replace_tags = array( case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': // ms office 2007
'<b>','<strong>','<i>','<em>','<u>','<span>','<ol>','<ul>','<li>', case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
'<table>','<tr>','<td>', $replace_tags = array(
); '<b>','<strong>','<i>','<em>','<u>','<span>','<ol>','<ul>','<li>',
break; '<table>','<tr>','<td>',
);
break;
}
} }
// clean replacements from array values and html or html-entities, which mess up xml // clean replacements from array values and html or html-entities, which mess up xml
foreach($replacements as $name => &$value) foreach($replacements as $name => &$value)
@ -1039,8 +1043,11 @@ abstract class bo_merge
} }
// Apply HTML formatting to target document, if possible // Apply HTML formatting to target document, if possible
$this->apply_styles($merged, $mimetype); // check if we can use the XSL extension, to not give a fatal error and rendering whole merge-print non-functional
if (class_exists(XSLTProcessor) && class_exists(DOMDocument))
{
$this->apply_styles($merged, $mimetype);
}
if(!empty($name)) if(!empty($name))
{ {
if(empty($ext)) if(empty($ext))