summaryrefslogtreecommitdiff
path: root/content_history_inc.php
diff options
context:
space:
mode:
authorNick Palmer <nick@sluggardy.net>2007-06-07 19:02:24 +0000
committerNick Palmer <nick@sluggardy.net>2007-06-07 19:02:24 +0000
commit78abf2a2bb635794b3274ed765454bbec2fc03d6 (patch)
tree56163bd03e9479305f6980bc38db9a5b5218664a /content_history_inc.php
parent1732ef99fd1dcb3478b69a284b0a206d778ab2d1 (diff)
downloadliberty-78abf2a2bb635794b3274ed765454bbec2fc03d6.tar.gz
liberty-78abf2a2bb635794b3274ed765454bbec2fc03d6.tar.bz2
liberty-78abf2a2bb635794b3274ed765454bbec2fc03d6.zip
Added inline diff option to liberty which works much better with the WYSIWYG editors and can use xdiff for speed.
Diffstat (limited to 'content_history_inc.php')
-rw-r--r--content_history_inc.php19
1 files changed, 14 insertions, 5 deletions
diff --git a/content_history_inc.php b/content_history_inc.php
index 8befe26..b5a5f01 100644
--- a/content_history_inc.php
+++ b/content_history_inc.php
@@ -29,11 +29,20 @@ if (isset($_REQUEST["delete"]) && isset($_REQUEST["hist"])) {
$from_lines = explode("\n",$from_page["data"][0]["data"]);
$to_version = $gContent->mInfo["version"];
$to_lines = explode("\n",$gContent->mInfo["data"]);
-
- include_once( UTIL_PKG_PATH.'diff.php');
- $diffx = new WikiDiff($from_lines,$to_lines);
- $fmt = new WikiUnifiedDiffFormatter;
- $html = $fmt->format($diffx, $from_lines);
+
+ if ( $gBitSystem->isFeatureActive('liberty_inline_diff') ) {
+ include_once( UTIL_PKG_PATH.'pear/Text/Diff/Diff.php' );
+ include_once( UTIL_PKG_PATH.'pear/Text/Diff/Diff/Renderer/inline.php' );
+ $diff = &new Text_Diff($from_lines,$to_lines);
+ $renderer = &new Text_Diff_Renderer_inline();
+ $html = $renderer->render($diff);
+ }
+ else {
+ include_once( UTIL_PKG_PATH.'diff.php');
+ $diffx = new WikiDiff($from_lines,$to_lines);
+ $fmt = new WikiUnifiedDiffFormatter;
+ $html = $fmt->format($diffx, $from_lines);
+ }
$gBitSmarty->assign('diffdata', $html);
$gBitSmarty->assign('diff2', 'y');
$gBitSmarty->assign('version_from', $from_version);