Commit af5d2111 authored by Tim Steiner's avatar Tim Steiner
Browse files

Hopefully prevent any style tags from showing up in the differences create...

Hopefully prevent any style tags from showing up in the differences create from the HtmlDiff view helper.
parent 8fd54fdd
......@@ -6,6 +6,17 @@ class Unl_View_Helper_HtmlDiff extends Zend_View_Helper_Abstract
public function htmlDiff($from, $to, $delimiter = " \r\n")
{
do {
$from = preg_replace('/(<[^> ]*) ([^>]*>)/', '$1#TAG_SPACE#$2', $from, -1, $count);
} while ($count > 0);
do {
$to = preg_replace('/(<[^> ]*) ([^>]*>)/', '$1#TAG_SPACE#$2', $to, -1 , $count);
} while ($count > 0);
$from = strtr($from, array('<' => ' <', '>' => '> '));
$to = strtr($to, array('<' => ' <', '>' => '> '));
if (!self::$_diffRenderer) {
require_once 'Text/Diff/Renderer/inline.php';
self::$_diffRenderer = new Text_Diff_Renderer_inline();
......@@ -25,6 +36,8 @@ class Unl_View_Helper_HtmlDiff extends Zend_View_Helper_Abstract
$diff = new Text_Diff('auto', array($currentArray, $proposedArray));
$diffHtml = ($diff->isEmpty() ? $from : self::$_diffRenderer->render($diff));
$diffHtml = strtr($diffHtml, array('#TAG_SPACE#' => ' '));
$tidyConfig = array('show-body-only' => true);
$diffHtml = tidy_repair_string($diffHtml, $tidyConfig, 'utf8');
return $diffHtml;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment