_x = $xbeg;
$this->_y = $ybeg;
}
function _startBlock($header) {
return '
' . $header;
}
function _endBlock() {
return '
';
}
function _lines($lines, $xi = 1, $yi = 1, $op = '', $clazz = 'normal', $nofirst = false, $nolast = false) {
$r = '';
for ($i = 0; $i < count($lines); $i++) {
$line = $lines[$i];
$clazz1 = $clazz;
if ($i == 0 && $clazz1 != 'normal' && !$nofirst) {
$clazz1 .= ' first';
}
if ($i == count($lines)-1 && $clazz1 != 'normal' && !$nolast) {
$clazz1 .= ' last';
}
$r .= '';
$r .= '| '.($xi ? $this->_x : '').' | ';
$r .= ''.($yi ? $this->_y : '').' | ';
$r .= ''.$op.' | ';
$r .= ''.htmlspecialchars($line).' | ';
$r .= '
';
$this->_x += $xi;
$this->_y += $yi;
}
return $r;
}
function _context($lines) {
return $this->_lines($lines);
}
function _added($lines)
{
return $this->_lines($lines, 0, 1, '+', 'added');
}
function _deleted($lines)
{
return $this->_lines($lines, 1, 0, '-', 'deleted');
}
function _changed($orig, $final)
{
return $this->_lines($orig, 1, 0, '-', 'deleted', false, true) . $this->_lines($final, 0, 1, '+', 'added', true, false);
}
}
?>