[ Index ]

PHP Cross Reference of MyBB 1.6.7

title

Body

[close]

/inc/3rdparty/diff/Diff/Renderer/ -> unified.php (source)

   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.6 2008/01/04 10:37:27 jan Exp $
   8   *
   9   * Copyright 2004-2008 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  
  18  // Disallow direct access to this file for security reasons
  19  if(!defined("IN_MYBB"))
  20  {
  21      die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
  22  }
  23   
  24  /** Text_Diff_Renderer */
  25  require_once  MYBB_ROOT.'inc/3rdparty/diff/Diff/Renderer.php';
  26  
  27  /**
  28   * @package Text_Diff
  29   */
  30  class Text_Diff_Renderer_unified extends Text_Diff_Renderer {
  31  
  32      /**
  33       * Number of leading context "lines" to preserve.
  34       */
  35      var $_leading_context_lines = 4;
  36  
  37      /**
  38       * Number of trailing context "lines" to preserve.
  39       */
  40      var $_trailing_context_lines = 4;
  41  
  42      function _blockHeader($xbeg, $xlen, $ybeg, $ylen)
  43      {
  44          if ($xlen != 1) {
  45              $xbeg .= ',' . $xlen;
  46          }
  47          if ($ylen != 1) {
  48              $ybeg .= ',' . $ylen;
  49          }
  50          return "@@ -$xbeg +$ybeg @@";
  51      }
  52  
  53      function _context($lines)
  54      {
  55          return $this->_lines($lines, ' ');
  56      }
  57  
  58      function _added($lines)
  59      {
  60          return $this->_lines($lines, '+');
  61      }
  62  
  63      function _deleted($lines)
  64      {
  65          return $this->_lines($lines, '-');
  66      }
  67  
  68      function _changed($orig, $final)
  69      {
  70          return $this->_deleted($orig) . $this->_added($final);
  71      }
  72  
  73  }


Generated: Sat Mar 31 17:55:03 2012 Cross-referenced by PHPXref 0.7.1