Text_Diff
[ class tree: Text_Diff ] [ index: Text_Diff ] [ all elements ]

Source for file context.php

Documentation is available at context.php

  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.  
  17. /** Text_Diff_Renderer */
  18. require_once 'Text/Diff/Renderer.php';
  19.  
  20. /**
  21.  * @package Text_Diff
  22.  */
  23.  
  24.     /**
  25.      * Number of leading context "lines" to preserve.
  26.      */
  27.     var $_leading_context_lines = 4;
  28.  
  29.     /**
  30.      * Number of trailing context "lines" to preserve.
  31.      */
  32.     var $_trailing_context_lines = 4;
  33.  
  34.     var $_second_block '';
  35.  
  36.     function _blockHeader($xbeg$xlen$ybeg$ylen)
  37.     {
  38.         if ($xlen != 1{
  39.             $xbeg .= ',' $xlen;
  40.         }
  41.         if ($ylen != 1{
  42.             $ybeg .= ',' $ylen;
  43.         }
  44.         $this->_second_block = "--- $ybeg ----\n";
  45.         return "***************\n*** $xbeg ****";
  46.     }
  47.  
  48.     function _endBlock()
  49.     {
  50.         return $this->_second_block;
  51.     }
  52.  
  53.     function _context($lines)
  54.     {
  55.         $this->_second_block .= $this->_lines($lines'  ');
  56.         return $this->_lines($lines'  ');
  57.     }
  58.  
  59.     function _added($lines)
  60.     {
  61.         $this->_second_block .= $this->_lines($lines'+ ');
  62.         return '';
  63.     }
  64.  
  65.     function _deleted($lines)
  66.     {
  67.         return $this->_lines($lines'- ');
  68.     }
  69.  
  70.     function _changed($orig$final)
  71.     {
  72.         $this->_second_block .= $this->_lines($final'! ');
  73.         return $this->_lines($orig'! ');
  74.     }
  75.  
  76. }

Documentation generated on Fri, 24 Jul 2009 15:00:02 +0000 by phpDocumentor 1.4.2. PEAR Logo Copyright © PHP Group 2004.