b2evolution PHP Cross Reference Blogging Systems

Source: /inc/_ext/phpsvnclient/ext/Diff/Diff/Renderer/context.php - 79 lines - 1853 bytes - Summary - Text - Print

Description: "Context" diff renderer. This class renders the diff in classic "context diff" format.

   1  <?php
   2  /**
   3   * "Context" diff renderer.
   4   *
   5   * This class renders the diff in classic "context diff" format.
   6   *
   7   * $Horde: framework/Text_Diff/Diff/Renderer/context.php,v 1.3.2.4 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   * @package Text_Diff
  15   */
  16  if( ! defined( 'EVO_MAIN_INIT' ) ) die( 'Please, do not access this page directly.' );
  17  
  18  /** Text_Diff_Renderer */
  19  require_once 'Text/Diff/Renderer.php';
  20  
  21  /**
  22   * @package Text_Diff
  23   */
  24  class Text_Diff_Renderer_context extends Text_Diff_Renderer {
  25  
  26      /**
  27       * Number of leading context "lines" to preserve.
  28       */
  29      var $_leading_context_lines = 4;
  30  
  31      /**
  32       * Number of trailing context "lines" to preserve.
  33       */
  34      var $_trailing_context_lines = 4;
  35  
  36      var $_second_block = '';
  37  
  38      function _blockHeader($xbeg, $xlen, $ybeg, $ylen)
  39      {
  40          if ($xlen != 1) {
  41              $xbeg .= ',' . $xlen;
  42          }
  43          if ($ylen != 1) {
  44              $ybeg .= ',' . $ylen;
  45          }
  46          $this->_second_block = "--- $ybeg ----\n";
  47          return "***************\n*** $xbeg ****";
  48      }
  49  
  50      function _endBlock()
  51      {
  52          return $this->_second_block;
  53      }
  54  
  55      function _context($lines)
  56      {
  57          $this->_second_block .= $this->_lines($lines, '  ');
  58          return $this->_lines($lines, '  ');
  59      }
  60  
  61      function _added($lines)
  62      {
  63          $this->_second_block .= $this->_lines($lines, '+ ');
  64          return '';
  65      }
  66  
  67      function _deleted($lines)
  68      {
  69          return $this->_lines($lines, '- ');
  70      }
  71  
  72      function _changed($orig, $final)
  73      {
  74          $this->_second_block .= $this->_lines($final, '! ');
  75          return $this->_lines($orig, '! ');
  76      }
  77  
  78  }
  79  ?>

title

Description

title

Description

title

Description

title

title

Body