ILIAS  release_8 Revision v8.24
_HWLDF_WordAccumulator Class Reference
+ Collaboration diagram for _HWLDF_WordAccumulator:

Public Member Functions

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

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

_HWLDF_WordAccumulator::__construct ( )

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

1715 {
1716 $this->_lines = array();
1717 $this->_line = '';
1718 $this->_group = '';
1719 $this->_tag = '';
1720 }

Member Function Documentation

◆ _flushGroup()

_HWLDF_WordAccumulator::_flushGroup (   $new_tag)

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

1723 {
1724 if ($this->_group !== '') {
1725 if ($this->_tag == 'ins') {
1726 $this->_line .= '[ilDiffInsStart]' .
1727 htmlspecialchars($this->_group) . '[ilDiffInsEnd]';
1728 } elseif ($this->_tag == 'del') {
1729 $this->_line .= '[ilDiffDelStart]' .
1730 htmlspecialchars($this->_group) . '[ilDiffDelEnd]';
1731 } else {
1732 $this->_line .= htmlspecialchars($this->_group);
1733 }
1734 }
1735 $this->_group = '';
1736 $this->_tag = $new_tag;
1737 }

Referenced by _flushLine(), and addWords().

+ Here is the caller graph for this function:

◆ _flushLine()

_HWLDF_WordAccumulator::_flushLine (   $new_tag)

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

1740 {
1741 $this->_flushGroup($new_tag);
1742 if ($this->_line != '') {
1743 array_push($this->_lines, $this->_line);
1744 } else {
1745 # make empty lines visible by inserting an NBSP
1746 array_push($this->_lines, NBSP);
1747 }
1748 $this->_line = '';
1749 }
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 1751 of file class.WordLevelDiff.php.

1752 {
1753 if ($tag != $this->_tag) {
1754 $this->_flushGroup($tag);
1755 }
1756
1757 foreach ($words as $word) {
1758 // new-line should only come as first char of word.
1759 if ($word == '') {
1760 continue;
1761 }
1762 if ($word[0] == "\n") {
1763 $this->_flushLine($tag);
1764 $word = substr($word, 1);
1765 }
1766 assert(!strstr($word, "\n"));
1767 $this->_group .= $word;
1768 }
1769 }

References _flushGroup(), and _flushLine().

+ Here is the call graph for this function:

◆ getLines()

_HWLDF_WordAccumulator::getLines ( )

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

1772 {
1773 $this->_flushLine('~done');
1774 return $this->_lines;
1775 }

References _flushLine().

+ Here is the call graph for this function:

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