Skip to content
Browse files

Swapped to Horde_Text_Diff

  • Loading branch information...
1 parent a41a24d commit fbf344620188761febcb7c1de84879f6f8962939 @CloCkWeRX CloCkWeRX committed Nov 10, 2011
Showing with 16 additions and 26 deletions.
  1. +9 −20 include/bugs/Diff/pearweb.php
  2. +1 −1 package.php
  3. +3 −2 package.xml
  4. +3 −3 public_html/bugs/patch-display.php
View
29 include/bugs/Diff/pearweb.php
@@ -6,10 +6,10 @@
*
* $Horde: framework/Text_Diff/Diff/Renderer/unified.php,v 1.2 2004/01/09 21:46:30 chuck Exp $
*
- * @package Text_Diff
+ * @package Horde_Text_Diff
*/
-require_once 'Text/Diff/Renderer.php';
-class Text_Diff_Renderer_pearweb extends Text_Diff_Renderer {
+require_once 'Horde/Text/Diff/Renderer.php';
+class Horde_Text_Diff_Renderer_pearweb extends Horde_Text_Diff_Renderer {
/**
* Number of leading context "lines" to preserve.
@@ -21,13 +21,7 @@ class Text_Diff_Renderer_pearweb extends Text_Diff_Renderer {
*/
var $_trailing_context_lines = 4;
- function __construct($d)
- {
- $this->diff = $d;
- parent::Text_Diff_Renderer();
- }
-
- function _blockHeader($xbeg, $xlen, $ybeg, $ylen)
+ protected function _blockHeader($xbeg, $xlen, $ybeg, $ylen)
{
$removed = $xlen - $ylen;
if ($removed > 0) {
@@ -36,33 +30,28 @@ function _blockHeader($xbeg, $xlen, $ybeg, $ylen)
}
}
- function _added($lines)
+ protected function _added($lines)
{
array_walk($lines, create_function('&$a,$b', '$a=htmlspecialchars($a);'));
return '<span class="newdiff"> ' . implode("</span>\n<span class='newdiff'> ", $lines) .
'</span>';
}
- function _context($lines)
+ protected function _context($lines)
{
array_walk($lines, create_function('&$a,$b', '$a=htmlspecialchars($a);'));
return "\n" . parent::_context($lines);
}
-
- function _deleted($lines)
+
+ protected function _deleted($lines)
{
array_walk($lines, create_function('&$a,$b', '$a=htmlspecialchars($a);'));
return '<span class="olddiff"> ' . implode("</span>\n<span class='olddiff'> ", $lines) .
'</span>';
}
- function _changed($orig, $final)
+ protected function _changed($orig, $final)
{
return $this->_deleted($orig) . "\n" . $this->_added($final);
}
-
- function render()
- {
- return parent::render($this->diff);
- }
}
View
2 package.php
@@ -63,7 +63,7 @@
$a->addPackageDepWithChannel('required', 'PEAR_PackageUpdate', 'pear.php.net', '1.1.0RC1');
//$a->addPackageDepWithChannel('required', 'PEAR_PackageFileManager', 'pear.php.net', '1.6.0');
$a->addPackageDepWithChannel('required', 'Net_URL2', 'pear.php.net', '0.1.0');
-$a->addPackageDepWithChannel('required', 'Text_Diff', 'pear.php.net');
+$a->addPackageDepWithChannel('required', 'Horde_Text_Diff', 'pear.php.net');
$a->addPackageDepWithChannel('required', 'HTTP_Upload', 'pear.php.net', '0.8.1');
$a->addPackageDepWithChannel('required', 'MDB2_Schema', 'pear.php.net', '0.6.0');
$a->addPackageDepWithChannel('required', 'Log', 'pear.php.net', '1.8.4');
View
5 package.xml
@@ -722,8 +722,9 @@ Bug #18294 Forgot password says: Unknown user &quot;hm2k&quot;
<min>0.1.0</min>
</package>
<package>
- <name>Text_Diff</name>
- <channel>pear.php.net</channel>
+ <name>Horde_Text_Diff</name>
+ <channel>pear.horde.org</channel>
+ <min>1.0.0</min>
</package>
<package>
<name>HTTP_Upload</name>
View
6 public_html/bugs/patch-display.php
@@ -124,11 +124,11 @@
exit();
}
- require_once 'Text/Diff.php';
+ require_once 'Horde/Text/Diff.php';
require_once 'bugs/Diff/pearweb.php';
assert_options(ASSERT_WARNING, 0);
- $d = new Text_Diff($orig = file($old), $now = file($new));
- $diff = new Text_Diff_Renderer_pearweb($d);
+ $d = new Horde_Text_Diff('auto', array($orig = file($old), $now = file($new)));
+ $diff = new Horde_Text_Diff_Renderer_pearweb();
include PEARWEB_TEMPLATEDIR . '/bugs/patchinfo.php';
include PEARWEB_TEMPLATEDIR . '/bugs/patchdiff.php';
response_footer();

0 comments on commit fbf3446

Please sign in to comment.
Something went wrong with that request. Please try again.