b2evolution PHP Cross Reference Blogging Systems

Source: /inc/_ext/phpsvnclient/ext/Diff/Diff/Renderer/unified.php - 69 lines - 1574 bytes - Summary - Text - Print

Description: "Unified" diff renderer. This class renders the diff in classic "unified diff" format.

   1  <?php
   2  /**
   3   * "Unified" diff renderer.
   4   *
   5   * This class renders the diff in classic "unified diff" format.
   6   *
   7   * $Horde: framework/Text_Diff/Diff/Renderer/unified.php,v 1.3.10.7 2009/01/06 15:23:42 jan Exp $
   8   *
   9   * Copyright 2004-2009 The Horde Project (http://www.horde.org/)
  10   *
  11   * See the enclosed file COPYING for license information (LGPL). If you did
  12   * not receive this file, see http://opensource.org/licenses/lgpl-license.php.
  13   *
  14   * @author  Ciprian Popovici
  15   * @package Text_Diff
  16   */
  17  if( ! defined( 'EVO_MAIN_INIT' ) ) die( 'Please, do not access this page directly.' );
  18  
  19  /** Text_Diff_Renderer */
  20  require_once 'Text/Diff/Renderer.php';
  21  
  22  /**
  23   * @package Text_Diff
  24   */
  25  class Text_Diff_Renderer_unified extends Text_Diff_Renderer {
  26  
  27      /**
  28       * Number of leading context "lines" to preserve.
  29       */
  30      var $_leading_context_lines = 4;
  31  
  32      /**
  33       * Number of trailing context "lines" to preserve.
  34       */
  35      var $_trailing_context_lines = 4;
  36  
  37      function _blockHeader($xbeg, $xlen, $ybeg, $ylen)
  38      {
  39          if ($xlen != 1) {
  40              $xbeg .= ',' . $xlen;
  41          }
  42          if ($ylen != 1) {
  43              $ybeg .= ',' . $ylen;
  44          }
  45          return "@@ -$xbeg +$ybeg @@";
  46      }
  47  
  48      function _context($lines)
  49      {
  50          return $this->_lines($lines, ' ');
  51      }
  52  
  53      function _added($lines)
  54      {
  55          return $this->_lines($lines, '+');
  56      }
  57  
  58      function _deleted($lines)
  59      {
  60          return $this->_lines($lines, '-');
  61      }
  62  
  63      function _changed($orig, $final)
  64      {
  65          return $this->_deleted($orig) . $this->_added($final);
  66      }
  67  
  68  }
  69  ?>

title

Description

title

Description

title

Description

title

title

Body