当前位置: 首页>>代码示例>>PHP>>正文


PHP Diff::renderDiff方法代码示例

本文整理汇总了PHP中Diff::renderDiff方法的典型用法代码示例。如果您正苦于以下问题:PHP Diff::renderDiff方法的具体用法?PHP Diff::renderDiff怎么用?PHP Diff::renderDiff使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Diff的用法示例。


在下文中一共展示了Diff::renderDiff方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getTextRevisionChanges

 public function getTextRevisionChanges($moduleId, $moduleContentTypeId, $moduleContentId, $newText, $revision)
 {
     global $dbi;
     $result = $dbi->query("SELECT diff FROM " . revisionTableName . " WHERE moduleId=" . $dbi->quote($moduleId) . " AND moduleContentTypeId=" . $dbi->quote($moduleContentTypeId) . " AND moduleContentId=" . $moduleContentId . " AND revision>=" . $dbi->quote($revision) . " ORDER BY revision DESC");
     if ($result->rows()) {
         $diff = new Diff();
         $text = parseString($newText);
         for ($i = 0; list($diffText) = $result->fetchrow_array(); $i++) {
             $changes = unserialize(parseString($diffText));
             $text = $diff->renderChanges($changes, $text);
             $result = $diff->stringDiff($text, $newText);
             print_r($result);
             $diffString = $diff->renderDiff($result);
             return $diffString;
         }
     }
     return "";
 }
开发者ID:gkathir15,项目名称:catmis,代码行数:18,代码来源:Revision.class.php

示例2: array

    $first_retweet[$text] = array_search(array_search($short_text, $retweets_short), $tweets);
}
$first_retweet_ids = array_values($first_retweet);
sort($first_retweet_ids);
$first_tweet = $tweets[$first_retweet_ids[0]];
$first_tweet_short = $retweets_short[$first_tweet];
// calculate levenshtein and diff for first occurences of modified text of retweet
$levenshtein = $diffs = array();
foreach ($first_retweet as $text => $id) {
    if (empty($levenshtein)) {
        $levenshtein[$first_tweet_short] = 0;
        $diffs[$retweets_short[$text]] = $retweets_short[$text];
    } else {
        $levenshtein[$retweets_short[$text]] = levenshtein($first_tweet_short, $retweets_short[$text]);
        $diffClass = new Diff();
        $diffs[$retweets_short[$text]] = $diffClass->renderDiff($diffClass->stringDiff($first_tweet_short, $retweets_short[$text]));
    }
}
echo "<Br>Zoom: <span id='zoomin' class='zoom'>in</span> / <span id='zoomout' class='zoom'>out</span><Br>";
echo '<fieldset class="if_parameters">';
echo '<legend>Retweet URLs</legend>';
print "<div id='content'>";
//$palette = array("108cbf", "f62221", "008027", "97c932", "fad40d", "f8962b", "c99997", "7e7e7e", "cbcbcb", "44bdec", "ff6364", "42c168", "bced5e"); // issue crawler
//$palette = array_reverse($palette);
$palette = array("#90C4A7", "#EDA391", "#DEE287", "#DAC0D8", "#E0B97B", "#D6D0AA", "#A9DFDE", "#A2D093", "#D4D5CC", "#BABD7B", "#D6B4A2", "#E8ABBC", "#B0C1D0", "#D9EFAC", "#B6EECA");
asort($first_retweet);
$distinct_retweets = count($indentation);
print "<table cellspacing='0' cellpadding='0'>";
// header row
print "<tr><td>date</td><td>user</td><td>source</td><td class='seperator'>tweet</td>";
foreach ($first_retweet_ids as $id) {
开发者ID:jlorberkasunic,项目名称:dmi-tcat,代码行数:31,代码来源:mod.retweet_urls.php


注:本文中的Diff::renderDiff方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。