ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
_HWLDF_WordAccumulator Class Reference
+ Collaboration diagram for _HWLDF_WordAccumulator:

Public Member Functions

 __construct ()
 
 _flushGroup ($new_tag)
 
 _flushLine ($new_tag)
 
 addWords ($words, $tag='')
 
 getLines ()
 

Private Attributes

array $_lines
 
string $_line
 
string $_group
 
string $_tag
 

Detailed Description

Definition at line 1026 of file class.WordLevelDiff.php.

Constructor & Destructor Documentation

◆ __construct()

_HWLDF_WordAccumulator::__construct ( )

Definition at line 1033 of file class.WordLevelDiff.php.

1034 {
1035 $this->_lines = array();
1036 $this->_line = '';
1037 $this->_group = '';
1038 $this->_tag = '';
1039 }

Member Function Documentation

◆ _flushGroup()

_HWLDF_WordAccumulator::_flushGroup (   $new_tag)

Definition at line 1041 of file class.WordLevelDiff.php.

1042 {
1043 if ($this->_group !== '') {
1044 if ($this->_tag == 'ins') {
1045 $this->_line .= '[ilDiffInsStart]' .
1046 htmlspecialchars($this->_group) . '[ilDiffInsEnd]';
1047 } elseif ($this->_tag == 'del') {
1048 $this->_line .= '[ilDiffDelStart]' .
1049 htmlspecialchars($this->_group) . '[ilDiffDelEnd]';
1050 } else {
1051 $this->_line .= htmlspecialchars($this->_group);
1052 }
1053 }
1054 $this->_group = '';
1055 $this->_tag = $new_tag;
1056 }

Referenced by _flushLine(), and addWords().

+ Here is the caller graph for this function:

◆ _flushLine()

_HWLDF_WordAccumulator::_flushLine (   $new_tag)

Definition at line 1058 of file class.WordLevelDiff.php.

1059 {
1060 $this->_flushGroup($new_tag);
1061 if ($this->_line != '') {
1062 array_push($this->_lines, $this->_line);
1063 } else {
1064 # make empty lines visible by inserting an NBSP
1065 array_push($this->_lines, NBSP);
1066 }
1067 $this->_line = '';
1068 }
const NBSP
Additions by Axel Boldt follow, partly taken from diff.php, phpwiki-1.3.3.

References _flushGroup(), and NBSP.

Referenced by addWords(), and getLines().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addWords()

_HWLDF_WordAccumulator::addWords (   $words,
  $tag = '' 
)

Definition at line 1070 of file class.WordLevelDiff.php.

1071 {
1072 if ($tag != $this->_tag) {
1073 $this->_flushGroup($tag);
1074 }
1075
1076 foreach ($words as $word) {
1077 // new-line should only come as first char of word.
1078 if ($word == '') {
1079 continue;
1080 }
1081 if ($word[0] == "\n") {
1082 $this->_flushLine($tag);
1083 $word = substr($word, 1);
1084 }
1085 assert(!strstr($word, "\n"));
1086 $this->_group .= $word;
1087 }
1088 }

References _flushGroup(), and _flushLine().

+ Here is the call graph for this function:

◆ getLines()

_HWLDF_WordAccumulator::getLines ( )

Definition at line 1090 of file class.WordLevelDiff.php.

1091 {
1092 $this->_flushLine('~done');
1093 return $this->_lines;
1094 }

References $_lines, and _flushLine().

+ Here is the call graph for this function:

Field Documentation

◆ $_group

string _HWLDF_WordAccumulator::$_group
private

Definition at line 1030 of file class.WordLevelDiff.php.

◆ $_line

string _HWLDF_WordAccumulator::$_line
private

Definition at line 1029 of file class.WordLevelDiff.php.

◆ $_lines

array _HWLDF_WordAccumulator::$_lines
private

Definition at line 1028 of file class.WordLevelDiff.php.

Referenced by getLines().

◆ $_tag

string _HWLDF_WordAccumulator::$_tag
private

Definition at line 1031 of file class.WordLevelDiff.php.


The documentation for this class was generated from the following file: