mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 23:00:56 +01:00
check if we can use the XSL extension, to not give a fatal error and rendering whole merge-print non-functional
This commit is contained in:
parent
2aff9d170b
commit
9066385fa5
@ -389,6 +389,9 @@ abstract class bo_merge
|
||||
}
|
||||
// Tags we can replace with the target document's version
|
||||
$replace_tags = array();
|
||||
// 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))
|
||||
{
|
||||
switch($mimetype.$mso_application_progid)
|
||||
{
|
||||
case 'application/vnd.oasis.opendocument.text': // open office
|
||||
@ -405,8 +408,6 @@ abstract class bo_merge
|
||||
$xslt = new XSLTProcessor();
|
||||
$doc->load(EGW_INCLUDE_ROOT.'/etemplate/templates/default/openoffice.xslt');
|
||||
$xslt->importStyleSheet($doc);
|
||||
|
||||
//echo $content;die();
|
||||
break;
|
||||
case 'application/xmlWord.Document': // Word 2003*/
|
||||
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': // ms office 2007
|
||||
@ -428,7 +429,6 @@ abstract class bo_merge
|
||||
'/<span>(.*?)<\/span>/' => '$1'
|
||||
);
|
||||
$content = preg_replace(array_keys($replace_tags),array_values($replace_tags),$content);
|
||||
//echo $content;die();
|
||||
$doc = new DOMDocument();
|
||||
$xslt = new XSLTProcessor();
|
||||
$xslt_file = $mimetype == 'application/xml' ? 'wordml.xslt' : 'msoffice.xslt';
|
||||
@ -436,6 +436,7 @@ abstract class bo_merge
|
||||
$xslt->importStyleSheet($doc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// XSLT transform known tags
|
||||
if($xslt)
|
||||
@ -444,8 +445,6 @@ abstract class bo_merge
|
||||
{
|
||||
$element = new SimpleXMLelement($content);
|
||||
$content = @$xslt->transformToXml($element);
|
||||
|
||||
//echo $content;die();
|
||||
// Word 2003 needs two declarations, add extra declaration back in
|
||||
if($mimetype == 'application/xml' && $mso_application_progid == 'Word.Document' && strpos($content, '<?xml') !== 0) {
|
||||
$content = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'.$content;
|
||||
|
Loading…
Reference in New Issue
Block a user