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


PHP Diff::load方法代码示例

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


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

示例1: diff

 /**
  * Generate a diff between two or three revision IDs
  *
  * @access public
  * @param string $method Revision method. Options: unified, inline, context, threeway, raw (default: 'unified')
  * @param mixed $rev1
  * @param mixed $rev2
  * @param mixed $rev3
  * @return string|bool False on failure
  * @see Diff::load
  *
  * @fixme: this uses Diff::load, which has been deprecated and Plugin removed from codebase
  */
 public function diff($method = 'unified', $rev1, $rev2, $rev3 = null)
 {
     $r1array = array('action' => 'query', 'prop' => 'revisions', 'revids' => $rev1, 'rvprop' => 'content');
     $r2array = array('action' => 'query', 'prop' => 'revisions', 'revids' => $rev2, 'rvprop' => 'content');
     $r3array = array('action' => 'query', 'prop' => 'revisions', 'revids' => $rev3, 'rvprop' => 'content');
     Hooks::runHook('PreDiff', array(&$r1array, &$r2array, &$r3array, &$method));
     $r1text = $r2text = $r3text = null;
     if (!is_null($rev3)) {
         pecho("Getting {$method} diff of revisions {$rev1}, {$rev2}, and {$rev3}...\n\n", PECHO_NORMAL);
         $r3 = $this->apiQuery($r3array);
         if (isset($r3['query']['badrevids'])) {
             pecho("A bad third revision ID was passed.\n\n", PECHO_FATAL);
             return false;
         }
         foreach ($r3['query']['pages'] as $r3pages) {
             $r3text = $r3pages['revisions'][0]['*'];
         }
     } else {
         pecho("Getting {$method} diff of revisions {$rev1} and {$rev2}...\n\n", PECHO_NORMAL);
     }
     $r1 = $this->apiQuery($r1array);
     $r2 = $this->apiQuery($r2array);
     if (isset($r1['query']['badrevids'])) {
         pecho("A bad first revision ID was passed.\n\n", PECHO_FATAL);
         return false;
     } elseif (isset($r2['query']['badrevids'])) {
         pecho("A bad second revision ID was passed.\n\n", PECHO_FATAL);
         return false;
     } else {
         foreach ($r1['query']['pages'] as $r1pages) {
             $r1text = $r1pages['revisions'][0]['*'];
         }
         foreach ($r2['query']['pages'] as $r2pages) {
             $r2text = $r2pages['revisions'][0]['*'];
         }
         if ($method == "raw") {
             return array($r1text, $r2text, $r3text);
         }
         return Diff::load($method, $r1text, $r2text, $r3text);
     }
 }
开发者ID:emijrp,项目名称:Peachy,代码行数:54,代码来源:Wiki.php


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