class _HWLDF_WordAccumulator in Diff 7.3
Same name and namespace in other branches
- 5.2 DiffEngine.php \_HWLDF_WordAccumulator
- 5 DiffEngine.php \_HWLDF_WordAccumulator
- 6.2 DiffEngine.php \_HWLDF_WordAccumulator
- 6 DiffEngine.php \_HWLDF_WordAccumulator
- 7.2 DiffEngine.php \_HWLDF_WordAccumulator
@todo document @private @subpackage DifferenceEngine
Hierarchy
- class \_HWLDF_WordAccumulator
Expanded class hierarchy of _HWLDF_WordAccumulator
File
- ./
DiffEngine.php, line 959 - A PHP diff engine for phpwiki. (Taken from phpwiki-1.3.3)
View source
class _HWLDF_WordAccumulator {
function __construct() {
$this->_lines = array();
$this->_line = '';
$this->_group = '';
$this->_tag = '';
}
function _flushGroup($new_tag) {
if ($this->_group !== '') {
if ($this->_tag == 'mark') {
$this->_line .= '<span class="diffchange">' . check_plain($this->_group) . '</span>';
}
else {
$this->_line .= check_plain($this->_group);
}
}
$this->_group = '';
$this->_tag = $new_tag;
}
function _flushLine($new_tag) {
$this
->_flushGroup($new_tag);
if ($this->_line != '') {
array_push($this->_lines, $this->_line);
}
else {
// make empty lines visible by inserting an NBSP
array_push($this->_lines, NBSP);
}
$this->_line = '';
}
function addWords($words, $tag = '') {
if ($tag != $this->_tag) {
$this
->_flushGroup($tag);
}
foreach ($words as $word) {
// new-line should only come as first char of word.
if ($word == '') {
continue;
}
if ($word[0] == "\n") {
$this
->_flushLine($tag);
$word = drupal_substr($word, 1);
}
USE_ASSERTS && assert(!strstr($word, "\n"));
$this->_group .= $word;
}
}
function getLines() {
$this
->_flushLine('~done');
return $this->_lines;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
_HWLDF_WordAccumulator:: |
function | |||
_HWLDF_WordAccumulator:: |
function | |||
_HWLDF_WordAccumulator:: |
function | |||
_HWLDF_WordAccumulator:: |
function | |||
_HWLDF_WordAccumulator:: |
function |