[ Index ]

PHP Cross Reference of MyBB

title

Body

[close]

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

   1  <?php
   2  /**
   3   * "Context" diff renderer.
   4   *
   5   * This class renders the diff in classic "context diff" format.
   6   *
   7   * Copyright 2004-2011 Horde LLC (http://www.horde.org/)
   8   *
   9   * See the enclosed file COPYING for license information (LGPL). If you did
  10   * not receive this file, see http://www.horde.org/licenses/lgpl21.
  11   *
  12   * @package Text_Diff
  13   */
  14  
  15  // Disallow direct access to this file for security reasons
  16  if(!defined("IN_MYBB"))
  17  {
  18      die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
  19  }
  20  
  21  class Horde_Text_Diff_Renderer_Context extends Horde_Text_Diff_Renderer
  22  {
  23      /**
  24       * Number of leading context "lines" to preserve.
  25       */
  26      protected $_leading_context_lines = 4;
  27  
  28      /**
  29       * Number of trailing context "lines" to preserve.
  30       */
  31      protected $_trailing_context_lines = 4;
  32  
  33      protected $_second_block = '';
  34  
  35      protected function _blockHeader($xbeg, $xlen, $ybeg, $ylen)
  36      {
  37          if ($xlen != 1) {
  38              $xbeg .= ',' . $xlen;
  39          }
  40          if ($ylen != 1) {
  41              $ybeg .= ',' . $ylen;
  42          }
  43          $this->_second_block = "--- $ybeg ----\n";
  44          return "***************\n*** $xbeg ****";
  45      }
  46  
  47      protected function _endBlock()
  48      {
  49          return $this->_second_block;
  50      }
  51  
  52      protected function _context($lines)
  53      {
  54          $this->_second_block .= $this->_lines($lines, '  ');
  55          return $this->_lines($lines, '  ');
  56      }
  57  
  58      protected function _added($lines)
  59      {
  60          $this->_second_block .= $this->_lines($lines, '+ ');
  61          return '';
  62      }
  63  
  64      protected function _deleted($lines)
  65      {
  66          return $this->_lines($lines, '- ');
  67      }
  68  
  69      protected function _changed($orig, $final)
  70      {
  71          $this->_second_block .= $this->_lines($final, '! ');
  72          return $this->_lines($orig, '! ');
  73      }
  74  
  75  }


Generated: Tue Oct 8 19:19:50 2013 Cross-referenced by PHPXref 0.7.1