@@ -8,19 +8,19 @@ class HtmlDiff
88    public  static  $ defaultSpecialCaseCharsarray ('. ' , ', ' , '( ' , ') ' , '\'' );
99    public  static  $ defaultGroupDiffstrue ;
1010
11-     private  $ content
12-     private  $ oldText
13-     private  $ newText
14-     private  $ oldWordsarray ();
15-     private  $ newWordsarray ();
16-     private  $ wordIndices
17-     private  $ encoding
18-     private  $ specialCaseOpeningTagsarray ();
19-     private  $ specialCaseClosingTagsarray ();
20-     private  $ specialCaseTags
21-     private  $ specialCaseChars
22-     private  $ groupDiffs
23-     private  $ insertSpaceInReplacefalse ;
11+     protected  $ content
12+     protected  $ oldText
13+     protected  $ newText
14+     protected  $ oldWordsarray ();
15+     protected  $ newWordsarray ();
16+     protected  $ wordIndices
17+     protected  $ encoding
18+     protected  $ specialCaseOpeningTagsarray ();
19+     protected  $ specialCaseClosingTagsarray ();
20+     protected  $ specialCaseTags
21+     protected  $ specialCaseChars
22+     protected  $ groupDiffs
23+     protected  $ insertSpaceInReplacefalse ;
2424
2525    public  function  __construct ($ oldText$ newText$ encoding'UTF-8 ' , $ specialCaseTagsnull , $ groupDiffsnull )
2626    {        
@@ -158,17 +158,17 @@ public function isGroupDiffs()
158158        return  $ this groupDiffs ;
159159    }
160160
161-     private  function  getOpeningTag ($ tag
161+     protected  function  getOpeningTag ($ tag
162162    {
163163        return  "/< " .$ tag"[^>]*/i " ;
164164    }
165165
166-     private  function  getClosingTag ($ tag
166+     protected  function  getClosingTag ($ tag
167167    {
168168        return  "</ " .$ tag"> " ;
169169    }
170170
171-     private  function  getStringBetween ($ str$ start$ end
171+     protected  function  getStringBetween ($ str$ start$ end
172172    {
173173        $ expStrexplode ( $ start$ str2  );
174174        if  ( count ( $ expStr1  ) {
@@ -183,7 +183,7 @@ private function getStringBetween($str, $start, $end)
183183        return  '' ;
184184    }
185185
186-     private  function  purifyHtml ($ html$ tagsnull )
186+     protected  function  purifyHtml ($ html$ tagsnull )
187187    {
188188        if  ( class_exists ( 'Tidy '  ) && false  ) {
189189            $ configarray ( 'output-xhtml '    => true , 'indent '  => false  );
@@ -209,7 +209,7 @@ public function build()
209209        return  $ this content ;
210210    }
211211
212-     private  function  indexNewWords ()
212+     protected  function  indexNewWords ()
213213    {
214214        $ this wordIndices  = array ();
215215        foreach  ($ this newWords  as  $ i$ word
@@ -224,18 +224,18 @@ private function indexNewWords()
224224        }
225225    }
226226
227-     private  function  splitInputsToWords ()
227+     protected  function  splitInputsToWords ()
228228    {
229229        $ this oldWords  = $ this convertHtmlToListOfWords ( $ this explode ( $ this oldText  ) );
230230        $ this newWords  = $ this convertHtmlToListOfWords ( $ this explode ( $ this newText  ) );
231231    }
232232
233-     private  function  isPartOfWord ($ text
233+     protected  function  isPartOfWord ($ text
234234    {
235235        return  ctype_alnum (str_replace ($ this specialCaseChars , '' , $ text
236236    }
237237
238-     private  function  convertHtmlToListOfWords ($ characterString
238+     protected  function  convertHtmlToListOfWords ($ characterString
239239    {
240240        $ mode'character ' ;
241241        $ current_word'' ;
@@ -310,28 +310,28 @@ private function convertHtmlToListOfWords($characterString)
310310        return  $ words
311311    }
312312
313-     private  function  isStartOfTag ($ val
313+     protected  function  isStartOfTag ($ val
314314    {
315315        return  $ val"< " ;
316316    }
317317
318-     private  function  isEndOfTag ($ val
318+     protected  function  isEndOfTag ($ val
319319    {
320320        return  $ val"> " ;
321321    }
322322
323-     private  function  isWhiteSpace ($ value
323+     protected  function  isWhiteSpace ($ value
324324    {
325325        return  !preg_match ( '[^\s] ' , $ value
326326    }
327327
328-     private  function  explode ($ value
328+     protected  function  explode ($ value
329329    {
330330        // as suggested by @onassar 
331331        return  preg_split ( '//u ' , $ value
332332    }
333333
334-     private  function  performOperation ($ operation
334+     protected  function  performOperation ($ operation
335335    {
336336        switch  ($ operationaction ) {
337337            case  'equal '  :
@@ -351,7 +351,7 @@ private function performOperation($operation)
351351        }
352352    }
353353
354-     private  function  processReplaceOperation ($ operation
354+     protected  function  processReplaceOperation ($ operation
355355    {
356356        $ processDeletestrlen ($ this oldText ) > 0 ;
357357        $ processInsertstrlen ($ this newText ) > 0 ;
@@ -369,7 +369,7 @@ private function processReplaceOperation($operation)
369369        }
370370    }
371371
372-     private  function  processInsertOperation ($ operation$ cssClass
372+     protected  function  processInsertOperation ($ operation$ cssClass
373373    {
374374        $ textarray ();
375375        foreach  ($ this newWords  as  $ pos$ s
@@ -380,7 +380,7 @@ private function processInsertOperation($operation, $cssClass)
380380        $ this insertTag ( "ins " , $ cssClass$ text
381381    }
382382
383-     private  function  processDeleteOperation ($ operation$ cssClass
383+     protected  function  processDeleteOperation ($ operation$ cssClass
384384    {
385385        $ textarray ();
386386        foreach  ($ this oldWords  as  $ pos$ s
@@ -391,7 +391,7 @@ private function processDeleteOperation($operation, $cssClass)
391391        $ this insertTag ( "del " , $ cssClass$ text
392392    }
393393
394-     private  function  processEqualOperation ($ operation
394+     protected  function  processEqualOperation ($ operation
395395    {
396396        $ resultarray ();
397397        foreach  ($ this newWords  as  $ pos$ s
@@ -402,7 +402,7 @@ private function processEqualOperation($operation)
402402        $ this content  .= implode ( "" , $ result
403403    }
404404
405-     private  function  insertTag ($ tag$ cssClass$ words
405+     protected  function  insertTag ($ tag$ cssClass$ words
406406    {
407407        while  (true ) {
408408            if  ( count ( $ words0  ) {
@@ -458,17 +458,17 @@ private function insertTag($tag, $cssClass, &$words)
458458        }
459459    }
460460
461-     private  function  checkCondition ($ word$ condition
461+     protected  function  checkCondition ($ word$ condition
462462    {
463463        return  $ condition'tag '  ? $ this isTag ( $ word$ this isTag ( $ word
464464    }
465465
466-     private  function  wrapText ($ text$ tagName$ cssClass
466+     protected  function  wrapText ($ text$ tagName$ cssClass
467467    {
468468        return  sprintf ( '<%1$s class="%2$s">%3$s</%1$s> ' , $ tagName$ cssClass$ text
469469    }
470470
471-     private  function  extractConsecutiveWords (&$ words$ condition
471+     protected  function  extractConsecutiveWords (&$ words$ condition
472472    {
473473        $ indexOfFirstTagnull ;
474474        foreach  ($ wordsas  $ i$ word
@@ -502,22 +502,22 @@ private function extractConsecutiveWords(&$words, $condition)
502502        }
503503    }
504504
505-     private  function  isTag ($ item
505+     protected  function  isTag ($ item
506506    {
507507        return  $ this isOpeningTag ( $ item$ this isClosingTag ( $ item
508508    }
509509
510-     private  function  isOpeningTag ($ item
510+     protected  function  isOpeningTag ($ item
511511    {
512512        return  preg_match ( "#<[^>]+> \\s*#iU " , $ item
513513    }
514514
515-     private  function  isClosingTag ($ item
515+     protected  function  isClosingTag ($ item
516516    {
517517        return  preg_match ( "#</[^>]+> \\s*#iU " , $ item
518518    }
519519
520-     private  function  operations ()
520+     protected  function  operations ()
521521    {
522522        $ positionInOld0 ;
523523        $ positionInNew0 ;
@@ -551,15 +551,15 @@ private function operations()
551551        return  $ operations
552552    }
553553
554-     private  function  matchingBlocks ()
554+     protected  function  matchingBlocks ()
555555    {
556556        $ matchingBlocksarray ();
557557        $ this findMatchingBlocks ( 0 , count ( $ this oldWords  ), 0 , count ( $ this newWords  ), $ matchingBlocks
558558
559559        return  $ matchingBlocks
560560    }
561561
562-     private  function  findMatchingBlocks ($ startInOld$ endInOld$ startInNew$ endInNew$ matchingBlocks
562+     protected  function  findMatchingBlocks ($ startInOld$ endInOld$ startInNew$ endInNew$ matchingBlocks
563563    {
564564        $ match$ this findMatch ( $ startInOld$ endInOld$ startInNew$ endInNew
565565        if  ($ matchnull ) {
@@ -573,14 +573,14 @@ private function findMatchingBlocks($startInOld, $endInOld, $startInNew, $endInN
573573        }
574574    }
575575
576-     private  function  stripTagAttributes ($ word
576+     protected  function  stripTagAttributes ($ word
577577    {
578578        $ wordexplode ( '  ' , trim ( $ word'<> '  ) );
579579
580580        return  '< '  . $ word0  ] . '> ' ;
581581    }
582582
583-     private  function  findMatch ($ startInOld$ endInOld$ startInNew$ endInNew
583+     protected  function  findMatch ($ startInOld$ endInOld$ startInNew$ endInNew
584584    {
585585        $ bestMatchInOld$ startInOld
586586        $ bestMatchInNew$ startInNew
0 commit comments