[ Index ]

PHP Cross Reference of MyBB 1.8.30

title

Body

[close]

/inc/3rdparty/diff/Diff/ThreeWay/ -> BlockBuilder.php (source)

   1  <?php
   2  /**
   3   * Copyright 2007-2017 Horde LLC (http://www.horde.org/)
   4   *
   5   * See the enclosed file COPYING for license information (LGPL). If you did
   6   * not receive this file, see http://www.horde.org/licenses/lgpl21.
   7   *
   8   * @package Text_Diff
   9   * @author  Geoffrey T. Dairiki <dairiki@dairiki.org>
  10   */
  11  
  12  // Disallow direct access to this file for security reasons
  13  if(!defined("IN_MYBB"))
  14  {
  15      die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
  16  }
  17  
  18  class Horde_Text_Diff_ThreeWay_BlockBuilder
  19  {
  20      public function __construct()
  21      {
  22          $this->_init();
  23      }
  24  
  25      public function input($lines)
  26      {
  27          if ($lines) {
  28              $this->_append($this->orig, $lines);
  29          }
  30      }
  31  
  32      public function out1($lines)
  33      {
  34          if ($lines) {
  35              $this->_append($this->final1, $lines);
  36          }
  37      }
  38  
  39      public function out2($lines)
  40      {
  41          if ($lines) {
  42              $this->_append($this->final2, $lines);
  43          }
  44      }
  45  
  46      public function isEmpty()
  47      {
  48          return !$this->orig && !$this->final1 && !$this->final2;
  49      }
  50  
  51      public function finish()
  52      {
  53          if ($this->isEmpty()) {
  54              return false;
  55          } else {
  56              $edit = new Horde_Text_Diff_ThreeWay_Op_Base($this->orig, $this->final1, $this->final2);
  57              $this->_init();
  58              return $edit;
  59          }
  60      }
  61  
  62      protected function _init()
  63      {
  64          $this->orig = $this->final1 = $this->final2 = array();
  65      }
  66  
  67      protected function _append(&$array, $lines)
  68      {
  69          array_splice($array, sizeof($array), 0, $lines);
  70      }
  71  }


2005 - 2021 © MyBB.de | Alle Rechte vorbehalten! | Sponsor: netcup Cross-referenced by PHPXref