svn: /web/doc-editor/trunk/php/ class.php

From: Date: Wed, 11 Nov 2009 22:03:00 +0000
Subject: svn: /web/doc-editor/trunk/php/ class.php
Groups: php.doc.web 
Request: Send a blank email to doc-web+get-1155@lists.php.net to get a copy of this message
yannick Wed, 11 Nov 2009 22:03:00 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=290558 Log: Remove getDiffFromExec's method from class.php. This method is present in File.php as vcsDiff's method Changed paths: U web/doc-editor/trunk/php/class.php Modified: web/doc-editor/trunk/php/class.php =================================================================== --- web/doc-editor/trunk/php/class.php 2009-11-11 22:01:54 UTC (rev 290557) +++ web/doc-editor/trunk/php/class.php 2009-11-11 22:03:00 UTC (rev 290558) @@ -803,90 +803,6 @@ } /** - * Get the diff of a file with his modified version. - * - * @param $path The path to the file. - * @param $file The name of the file. - * @param $rev1 Frist revison. - * @param $rev2 Second revision. - * @return The diff a the file with his modified version, as HTML, reday to be display. - */ - function getDiffFromExec($path, $file, $rev1, $rev2) { - - $cmd = 'cd '.DOC_EDITOR_CVS_PATH.$path.'; cvs diff -kk -u -r '.$rev2.' -r '.$rev1.' '.$file; - - $output = array(); - exec($cmd, $output); - - $output = htmlentities(join("\n", $output)); - - $match = array(); - - preg_match_all('/@@(.*?)@@(.[^@@]*)/s', $output, $match); - - $diff = array(); - - for ($i = 0; $i < count($match[1]); $i++ ) { - - $diff[$i]['line'] = $match[1][$i]; - $diff[$i]['content'] = $match[2][$i]; - - } - - $return = '<table class="code">'; - - for ($i = 0; $i < count($diff); $i++ ) { - - // Line - $return .= ' - <tr> - <td class="line">'.$diff[$i]['line'].'</td> - </tr> - '; - - // Content - $tmp = explode("\n", trim($diff[$i]['content'])); - - for ($j=0; $j < count($tmp); $j++ ) { - $tmp[$j] = str_replace(" ", "&nbsp;", $tmp[$j]); - - switch (substr($tmp[$j], 0, 1)) { - case '+': - $class = 'ins'; - break; - case '-': - $class = 'del'; - break; - - default: - $class = ''; - break; - } - - $return .= ' - <tr> - <td class="'.$class.'">'.$tmp[$j].'</td> - </tr> - '; - } // Fin for J - - // Separator - $return .= ' - <tr> - <td class="truncated">&nbsp;</td> - </tr> - '; - - } // Fin for I - - - $return .= '<table>'; - - return $return; - - } - - /** * Get all commit message. * * Each time we commit, we store in DB the commit message to be use later. This method get all this message from DB.

« previous php.doc.web (#1155) next »