forked from extern/egroupware
Move applying HTML styles into its own function
This commit is contained in:
parent
a182e0b9cc
commit
e6355334f4
@ -314,9 +314,16 @@ abstract class bo_merge
|
||||
$mimetype = 'application/rtf';
|
||||
}
|
||||
|
||||
// Apply HTML formatting to target document, if possible
|
||||
try {
|
||||
$content = $this->merge_string($content,$ids,$err,$mimetype,$fix);
|
||||
} catch (Exception $e) {
|
||||
$err = $e->getMessage();
|
||||
return false;
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
||||
protected function apply_styles (&$content, $mimetype) {
|
||||
// Tags we can replace with the target document's version
|
||||
$replace_tags = array();
|
||||
switch($mimetype)
|
||||
@ -330,11 +337,13 @@ abstract class bo_merge
|
||||
//'/<(li)(.*?)>(.*?)<\/\1>/' => '<$1 $2>$3</$1>',
|
||||
);
|
||||
$content = preg_replace(array_keys($replace_tags),array_values($replace_tags),$content);
|
||||
//echo $content;die();
|
||||
|
||||
$doc = new DOMDocument();
|
||||
$xslt = new XSLTProcessor();
|
||||
$doc->load(EGW_INCLUDE_ROOT.'/etemplate/templates/default/openoffice.xslt');
|
||||
$xslt->importStyleSheet($doc);
|
||||
|
||||
//echo $content;die();
|
||||
break;
|
||||
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': // ms office 2007
|
||||
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
|
||||
@ -370,12 +379,6 @@ abstract class bo_merge
|
||||
// Failed...
|
||||
}
|
||||
}
|
||||
return $content;
|
||||
|
||||
} catch (Exception $e) {
|
||||
$err = $e->getMessage();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -937,6 +940,10 @@ abstract class bo_merge
|
||||
//error_log(__METHOD__."() !this->merge() err=$err");
|
||||
return $err;
|
||||
}
|
||||
|
||||
// Apply HTML formatting to target document, if possible
|
||||
$this->apply_styles($merged, $mimetype);
|
||||
|
||||
if(!empty($name))
|
||||
{
|
||||
if(empty($ext))
|
||||
|
Loading…
Reference in New Issue
Block a user