Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
UNL Information Services
NMC-PHP-Framework
Commits
d2d620eb
Commit
d2d620eb
authored
Jun 28, 2010
by
Tim Steiner
Browse files
Add some comments to the HtmlDiff view helper.
parent
af5d2111
Changes
1
Hide whitespace changes
Inline
Side-by-side
library/Unl/View/Helper/HtmlDiff.php
View file @
d2d620eb
...
...
@@ -6,6 +6,9 @@ class Unl_View_Helper_HtmlDiff extends Zend_View_Helper_Abstract
public
function
htmlDiff
(
$from
,
$to
,
$delimiter
=
"
\r\n
"
)
{
/* First we need to do a bit of filtering to be sure that HTML Tags are
* treated as atomic elements (and aren't split up or grouped with other text)
*/
do
{
$from
=
preg_replace
(
'/(<[^> ]*) ([^>]*>)/'
,
'$1#TAG_SPACE#$2'
,
$from
,
-
1
,
$count
);
}
while
(
$count
>
0
);
...
...
@@ -17,6 +20,8 @@ class Unl_View_Helper_HtmlDiff extends Zend_View_Helper_Abstract
$from
=
strtr
(
$from
,
array
(
'<'
=>
' <'
,
'>'
=>
'> '
));
$to
=
strtr
(
$to
,
array
(
'<'
=>
' <'
,
'>'
=>
'> '
));
// Now the real work.
if
(
!
self
::
$_diffRenderer
)
{
require_once
'Text/Diff/Renderer/inline.php'
;
self
::
$_diffRenderer
=
new
Text_Diff_Renderer_inline
();
...
...
@@ -36,6 +41,7 @@ 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
));
// Undo the filtering.
$diffHtml
=
strtr
(
$diffHtml
,
array
(
'#TAG_SPACE#'
=>
' '
));
$tidyConfig
=
array
(
'show-body-only'
=>
true
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment