includes/diffengine/Renderer.php
changeset 1383 198f5207119b
parent 1227 bdac73ed481e
equal deleted inserted replaced
1382:78fbedb876f3 1383:198f5207119b
    28 		var $_trailing_context_lines = 0;
    28 		var $_trailing_context_lines = 0;
    29 
    29 
    30 		/**
    30 		/**
    31  		* Constructor.
    31  		* Constructor.
    32  		*/
    32  		*/
    33 		function Text_Diff_Renderer($params = array())
    33 		function __construct($params = array())
    34 		{
    34 		{
    35 				foreach ($params as $param => $value) {
    35 				foreach ($params as $param => $value) {
    36 						$v = '_' . $param;
    36 						$v = '_' . $param;
    37 						if (isset($this->$v)) {
    37 						if (isset($this->$v)) {
    38 								$this->$v = $value;
    38 								$this->$v = $value;
    83 										if (count($edit->orig) <= $keep) {
    83 										if (count($edit->orig) <= $keep) {
    84 												$block[] = $edit;
    84 												$block[] = $edit;
    85 										} else {
    85 										} else {
    86 												if ($ntrail) {
    86 												if ($ntrail) {
    87 														$context = array_slice($edit->orig, 0, $ntrail);
    87 														$context = array_slice($edit->orig, 0, $ntrail);
    88 														$block[] = &new Text_Diff_Op_copy($context);
    88 														$block[] = new Text_Diff_Op_copy($context);
    89 												}
    89 												}
    90 												$output .= $this->_block($x0, $ntrail + $xi - $x0,
    90 												$output .= $this->_block($x0, $ntrail + $xi - $x0,
    91  																								$y0, $ntrail + $yi - $y0,
    91  																								$y0, $ntrail + $yi - $y0,
    92  																								$block);
    92  																								$block);
    93 												$block = false;
    93 												$block = false;
    99 										$context = array_slice($context, count($context) - $nlead);
    99 										$context = array_slice($context, count($context) - $nlead);
   100 										$x0 = $xi - count($context);
   100 										$x0 = $xi - count($context);
   101 										$y0 = $yi - count($context);
   101 										$y0 = $yi - count($context);
   102 										$block = array();
   102 										$block = array();
   103 										if ($context) {
   103 										if ($context) {
   104 												$block[] = &new Text_Diff_Op_copy($context);
   104 												$block[] = new Text_Diff_Op_copy($context);
   105 										}
   105 										}
   106 								}
   106 								}
   107 								$block[] = $edit;
   107 								$block[] = $edit;
   108 						}
   108 						}
   109 
   109