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


PHP Diff::sequentialChanges方法代码示例

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


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

示例1: saveTextRevision

 public function saveTextRevision($moduleId, $moduleContentTypeId, $moduleContentId, $oldText, $newText, $textfieldIndex = 0, $revision = 0)
 {
     global $dbi, $login, $settings;
     if (!$settings->enableRevisioning) {
         return;
     }
     // Get latest revision number and increment
     $maxRevision = 0;
     if (empty($revision)) {
         $result = $dbi->query("SELECT MAX(revision) FROM " . revisionTableName . " WHERE moduleId=" . $dbi->quote($moduleId) . " AND moduleContentTypeId=" . $dbi->quote($moduleContentTypeId) . " AND moduleContentId=" . $dbi->quote($moduleContentId));
         if ($result->rows()) {
             list($maxRevision) = $result->fetchrow_array();
             $maxRevision++;
         }
     } else {
         $maxRevision = $revision;
     }
     // Parse text strings
     $newText = parseString($newText);
     $oldText = parseString($oldText);
     // Calculate diff
     $diff = new Diff();
     $result = $diff->stringDiff($newText, $oldText, " ");
     $changes = $diff->sequentialChanges($result);
     if (sizeof($changes) > 0) {
         $serializedChanges = serialize($changes);
         // Insert diff
         $dbi->query("INSERT INTO " . revisionTableName . "(moduleId,moduleContentTypeId,moduleContentId,textfieldIndex,diff,revision,userId,timestamp) VALUES(" . $dbi->quote($moduleId) . "," . $dbi->quote($moduleContentTypeId) . "," . $dbi->quote($moduleContentId) . "," . $dbi->quote($textfieldIndex) . "," . $dbi->quote($serializedChanges) . "," . $dbi->quote($maxRevision) . "," . $dbi->quote($login->id) . ",NOW())");
     }
     return $maxRevision;
 }
开发者ID:gkathir15,项目名称:catmis,代码行数:31,代码来源:Revision.class.php


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