WordPress是一个Blog程序,用它你可以架设完全属于你自己的Blog. 而WordPress现在的应用又不仅仅只是在Blog方面,因为其强大的扩展性,部分网站甚至已经开始使用WordPress

源代码在线查看: xdiff.php

软件大小: 2035 K
上传用户: bi_yangfeng
关键词: WordPress Blog 程序 方面
下载地址: 免注册下载 普通下载 VIP

相关代码

								/**				 * Class used internally by Diff to actually compute the diffs.				 *				 * This class uses the xdiff PECL package (http://pecl.php.net/package/xdiff)				 * to compute the differences between the two input arrays.				 *				 * $Horde: framework/Text_Diff/Diff/Engine/xdiff.php,v 1.6 2008/01/04 10:07:50 jan Exp $				 *				 * Copyright 2004-2008 The Horde Project (http://www.horde.org/)				 *				 * See the enclosed file COPYING for license information (LGPL). If you did				 * not receive this file, see http://opensource.org/licenses/lgpl-license.php.				 *				 * @author  Jon Parise 				 * @package Text_Diff				 */				class Text_Diff_Engine_xdiff {								    /**				     */				    function diff($from_lines, $to_lines)				    {				        array_walk($from_lines, array('Text_Diff', 'trimNewlines'));				        array_walk($to_lines, array('Text_Diff', 'trimNewlines'));								        /* Convert the two input arrays into strings for xdiff processing. */				        $from_string = implode("\n", $from_lines);				        $to_string = implode("\n", $to_lines);								        /* Diff the two strings and convert the result to an array. */				        $diff = xdiff_string_diff($from_string, $to_string, count($to_lines));				        $diff = explode("\n", $diff);								        /* Walk through the diff one line at a time.  We build the $edits				         * array of diff operations by reading the first character of the				         * xdiff output (which is in the "unified diff" format).				         *				         * Note that we don't have enough information to detect "changed"				         * lines using this approach, so we can't add Text_Diff_Op_changed				         * instances to the $edits array.  The result is still perfectly				         * valid, albeit a little less descriptive and efficient. */				        $edits = array();				        foreach ($diff as $line) {				            switch ($line[0]) {				            case ' ':				                $edits[] = &new Text_Diff_Op_copy(array(substr($line, 1)));				                break;								            case '+':				                $edits[] = &new Text_Diff_Op_add(array(substr($line, 1)));				                break;								            case '-':				                $edits[] = &new Text_Diff_Op_delete(array(substr($line, 1)));				                break;				            }				        }								        return $edits;				    }								}							

相关资源