diff --git a/HtmlDiff.php b/HtmlDiff.php index 74a5d35..11c46de 100644 --- a/HtmlDiff.php +++ b/HtmlDiff.php @@ -13,8 +13,8 @@ class HtmlDiff { private $specialCaseClosingTags = array( "", "", "", "", "", "", "", "", "", "", '

' ); public function __construct( $oldText, $newText, $encoding = 'UTF-8' ) { - $this->oldText = $this->purifyHtml( trim( $oldText ) ); - $this->newText = $this->purifyHtml( trim( $newText ) ); + $this->oldText = trim( $oldText ); + $this->newText = trim( $newText ); $this->encoding = $encoding; $this->content = ''; } @@ -31,28 +31,28 @@ public function getDifference() { return $this->content; } - private function getStringBetween( $str, $start, $end ) { - $expStr = explode( $start, $str, 2 ); - if( count( $expStr ) > 1 ) { - $expStr = explode( $end, $expStr[ 1 ] ); - if( count( $expStr ) > 1 ) { - array_pop( $expStr ); - return implode( $end, $expStr ); - } - } - return ''; - } - - private function purifyHtml( $html, $tags = null ) { - if( class_exists( 'Tidy' ) && false ) { - $config = array( 'output-xhtml' => true, 'indent' => false ); - $tidy = new tidy; - $tidy->parseString( $html, $config, 'utf8' ); - $html = ( string )$tidy; - return $this->getStringBetween( $html, '' ); - } - return $html; - } + // private function getStringBetween( $str, $start, $end ) { + // $expStr = explode( $start, $str, 2 ); + // if( count( $expStr ) > 1 ) { + // $expStr = explode( $end, $expStr[ 1 ] ); + // if( count( $expStr ) > 1 ) { + // array_pop( $expStr ); + // return implode( $end, $expStr ); + // } + // } + // return ''; + // } + + // private function purifyHtml( $html, $tags = null ) { + // if( class_exists( 'Tidy' ) && false ) { + // $config = array( 'output-xhtml' => true, 'indent' => false ); + // $tidy = new tidy; + // $tidy->parseString( $html, $config, 'utf8' ); + // $html = ( string )$tidy; + // return $this->getStringBetween( $html, '' ); + // } + // return $html; + // } public function build() { $this->SplitInputsToWords();