當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。