PluginOutput: Properly handle whitespace for html output

refs #2846
This commit is contained in:
Johannes Meyer 2018-01-16 15:37:30 +01:00
parent fe9d355e84
commit dff6c16bf8
1 changed files with 26 additions and 2 deletions

View File

@ -51,6 +51,30 @@ class Zend_View_Helper_PluginOutput extends Zend_View_Helper_Abstract
'@@@@@@',
);
/**
* Patterns to be replaced in html plugin output
*
* @var array
*/
protected static $htmlPatterns = array(
'~\\\n~',
'~\\\t~',
'~\\\n\\\n~',
'~<table~'
);
/**
* Replacements for $htmlPatterns
*
* @var array
*/
protected static $htmlReplacements = array(
"\n",
"\t",
"\n",
'<table style="font-size: 0.75em"'
);
/**
* Render plugin output
*
@ -68,8 +92,8 @@ class Zend_View_Helper_PluginOutput extends Zend_View_Helper_Abstract
if (preg_match('~<[^>]*["/\'][^>]*>~', $output)) {
// HTML
$output = preg_replace(
'~<table~',
'<table style="font-size: 0.75em"',
self::$htmlPatterns,
self::$htmlReplacements,
$this->getPurifier()->purify($output)
);
$isHtml = true;