_added example



            if ( isset( $final_diffs[ $final_rows[ $row ] ] ) ) {
                $final_line = $final_diffs[ $final_rows[ $row ] ];
            } elseif ( isset( $final[ $final_rows[ $row ] ] ) ) {
                $final_line = htmlspecialchars( $final[ $final_rows[ $row ] ] );
            } else {
                $final_line = '';
            }

            if ( $orig_rows[ $row ] < 0 ) { // Orig is blank. This is really an added row.                 $r .= $this->_added( array( $final_line ), false );
            } elseif ( $final_rows[ $row ] < 0 ) { // Final is blank. This is really a deleted row.                 $r .= $this->_deleted( array( $orig_line ), false );
            } else { // A true changed row.                 if ( $this->_show_split_view ) {
                    $r .= '<tr>' . $this->deletedLine( $orig_line ) . $this->addedLine( $final_line ) . "</tr>\n";
                } else {
                    $r .= '<tr>' . $this->deletedLine( $orig_line ) . '</tr><tr>' . $this->addedLine( $final_line ) . "</tr>\n";
                }
            }
        }

        
return $end;
  }

  protected function _block($xbeg$xlen$ybeg$ylen, &$edits) {
    $this->_start_block($this->_block_header($xbeg$xlen$ybeg$ylen));
    foreach ($edits as $edit) {
      if ($edit->type == 'copy') {
        $this->_context($edit->orig);
      }
      elseif ($edit->type == 'add') {
        $this->_added($edit->closing);
      }
      elseif ($edit->type == 'delete') {
        $this->_deleted($edit->orig);
      }
      elseif ($edit->type == 'change') {
        $this->_changed($edit->orig, $edit->closing);
      }
      else {
        trigger_error('Unknown edit type', E_USER_ERROR);
      }
    }
    
array_walk($lines, array(&$this, '_encode'));
        $lines[0] = $this->_del_prefix . $lines[0];
        $lines[count($lines) - 1] .= $this->_del_suffix;
        return $this->_lines($lines, ' ', false);
    }

    function _changed($orig$final)
    {
        /* If we've already split on characters, just display. */
        if ($this->_split_level == 'characters') {
            return $this->_deleted($orig)
                . $this->_added($final);
        }

        /* If we've already split on words, just display. */
        if ($this->_split_level == 'words') {
            $prefix = '';
            while ($orig[0] !== false && $final[0] !== false &&
                   substr($orig[0], 0, 1) == ' ' &&
                   substr($final[0], 0, 1) == ' ') {
                $prefix .= substr($orig[0], 0, 1);
                $orig[0] = substr($orig[0], 1);
                $final[0] = substr($final[0], 1);
            }
function _block($xbeg$xlen$ybeg$ylen, &$edits)
    {
        $output = $this->_startBlock($this->_blockHeader($xbeg$xlen$ybeg$ylen));

        foreach ($edits as $edit) {
            switch (strtolower(get_class($edit))) {
            case 'text_diff_op_copy':
                $output .= $this->_context($edit->orig);
                break;

            case 'text_diff_op_add':
                $output .= $this->_added($edit->final);
                break;

            case 'text_diff_op_delete':
                $output .= $this->_deleted($edit->orig);
                break;

            case 'text_diff_op_change':
                $output .= $this->_changed($edit->orig, $edit->final);
                break;
            }
        }

        
Home | Imprint | This part of the site doesn't use cookies.