ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
_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 1023 of file class.WordLevelDiff.php.

Constructor & Destructor Documentation

◆ __construct()

_HWLDF_WordAccumulator::__construct ( )

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

1031 {
1032 $this->_lines = array();
1033 $this->_line = '';
1034 $this->_group = '';
1035 $this->_tag = '';
1036 }

Member Function Documentation

◆ _flushGroup()

_HWLDF_WordAccumulator::_flushGroup (   $new_tag)

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

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

Referenced by _flushLine(), and addWords().

+ Here is the caller graph for this function:

◆ _flushLine()

_HWLDF_WordAccumulator::_flushLine (   $new_tag)

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

1056 {
1057 $this->_flushGroup($new_tag);
1058 if ($this->_line != '') {
1059 array_push($this->_lines, $this->_line);
1060 } else {
1061 # make empty lines visible by inserting an NBSP
1062 array_push($this->_lines, NBSP);
1063 }
1064 $this->_line = '';
1065 }
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 1067 of file class.WordLevelDiff.php.

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

References _flushGroup(), and _flushLine().

+ Here is the call graph for this function:

◆ getLines()

_HWLDF_WordAccumulator::getLines ( )

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

1088 {
1089 $this->_flushLine('~done');
1090 return $this->_lines;
1091 }

References $_lines, and _flushLine().

+ Here is the call graph for this function:

Field Documentation

◆ $_group

string _HWLDF_WordAccumulator::$_group
private

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

◆ $_line

string _HWLDF_WordAccumulator::$_line
private

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

◆ $_lines

array _HWLDF_WordAccumulator::$_lines
private

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

Referenced by getLines().

◆ $_tag

string _HWLDF_WordAccumulator::$_tag
private

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


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