From 762199e69bbcdcbddbb6a67abdf059af88a1d725 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Tue, 16 Sep 2008 19:19:12 +0000 Subject: [PATCH] Remove two useless classes from HTMLDiff. One was entirely unused and useless, and the other was a wrapper for a more simple solution. --- includes/AutoLoader.php | 2 -- includes/diff/HTMLDiff.php | 43 ++++++-------------------------------- 2 files changed, 6 insertions(+), 39 deletions(-) diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 38bed465a8..f138638352 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -316,7 +316,6 @@ $wgAutoloadLocalClasses = array( # includes/diff 'AncestorComparator' => 'includes/diff/HTMLDiff.php', - 'AncestorComparatorResult' => 'includes/diff/HTMLDiff.php', 'AnchorToString' => 'includes/diff/HTMLDiff.php', 'ArrayDiffFormatter' => 'includes/diff/DifferenceEngine.php', 'BodyNode' => 'includes/diff/Nodes.php', @@ -334,7 +333,6 @@ $wgAutoloadLocalClasses = array( '_DiffOp' => 'includes/diff/DifferenceEngine.php', 'DomTreeBuilder' => 'includes/diff/HTMLDiff.php', 'DummyNode' => 'includes/diff/Nodes.php', - 'EchoingContentHandler' => 'includes/diff/HTMLDiff.php', 'HTMLDiffer' => 'includes/diff/HTMLDiff.php', 'HTMLOutput' => 'includes/diff/HTMLDiff.php', '_HWLDF_WordAccumulator' => 'includes/diff/DifferenceEngine.php', diff --git a/includes/diff/HTMLDiff.php b/includes/diff/HTMLDiff.php index 8af4a27df9..cb169aaf9e 100644 --- a/includes/diff/HTMLDiff.php +++ b/includes/diff/HTMLDiff.php @@ -252,21 +252,21 @@ class TextNodeDiffer { $result = $acthis->getResult($acother); unset($acthis, $acother); - if ($result->changed) { + if ( $result ) { $mod = new Modification(Modification::CHANGED); if (!$this->changedIDUsed) { $mod->firstOfID = true; - } else if (!is_null($result->changes) && $result->changes !== $this->changes) { + } else if (!is_null( $result ) && $result !== $this->changes) { ++$this->changedID; $mod->firstOfID = true; } - $mod->changes = $result->changes; + $mod->changes = $result; $mod->id = $this->changedID; $this->textNodes[$i]->modification = $mod; - $this->changes = $result->changes; + $this->changes = $result; $this->changedIDUsed = true; } else if ($this->changedIDUsed) { ++$this->changedID; @@ -588,13 +588,6 @@ class TextOnlyComparator { } } -class AncestorComparatorResult { - - public $changed = false; - - public $changes = ""; -} - /** * A comparator used when calculating the difference in ancestry of two Nodes. */ @@ -611,20 +604,16 @@ class AncestorComparator { public $compareTxt = ""; public function getResult(AncestorComparator $other) { - $result = new AncestorComparatorResult(); $diffengine = new WikiDiff3(10000, 1.35); $differences = $diffengine->diff_range($other->ancestorsText,$this->ancestorsText); if (count($differences) == 0){ - return $result; + return null; } $changeTxt = new ChangeTextGenerator($this, $other); - $result->changed = true; - $result->changes = $changeTxt->getChanged($differences)->toString(); - - return $result; + return $changeTxt->getChanged($differences)->toString();; } } @@ -990,26 +979,6 @@ class HTMLOutput{ } } -class EchoingContentHandler { - - function startElement($qname, /*array*/ $arguments) { - echo Xml::openElement($qname, $arguments); - } - - function endElement($qname){ - echo Xml::closeElement($qname); - } - - function characters($chars){ - echo htmlspecialchars($chars); - } - - function html($html){ - echo $html; - } - -} - class DelegatingContentHandler { private $delegate; -- 2.20.1