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


PHP DifferenceEngine::loadRevisionData方法代码示例

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


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

示例1: testLoadRevisionData

 public function testLoadRevisionData()
 {
     $cases = $this->getLoadRevisionDataCases();
     foreach ($cases as $case) {
         list($expectedOld, $expectedNew, $old, $new, $message) = $case;
         $diffEngine = new DifferenceEngine($this->context, $old, $new, 2, true, false);
         $diffEngine->loadRevisionData();
         $this->assertEquals($diffEngine->getOldid(), $expectedOld, $message);
         $this->assertEquals($diffEngine->getNewid(), $expectedNew, $message);
     }
 }
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:11,代码来源:DifferenceEngineTest.php

示例2: execute

 function execute($par)
 {
     global $wgRequest, $wgOut;
     $t = Title::newFromText($wgRequest->getVal('target'));
     $wgOut->setArticleBodyOnly(true);
     if ($wgRequest->getVal('action') == 'permalink') {
         $result = array();
         $result['title'] = $t;
         $result['rchi'] = $wgRequest->getVal('rchi');
         $result['rclo'] = $wgRequest->getVal('rclow');
         $result['rcid'] = $wgRequest->getVal('rcid');
         $result['old'] = $wgRequest->getVal('old');
         $result['new'] = $wgRequest->getVal('new');
         $result['vandal'] = $wgRequest->getVal('vandal');
         $result['rc_cur_id'] = $t->getArticleID();
         $result = RCPatrolData::getListofEditors($result);
         $wgOut->addHTML("<div id='articletitle' style='display:none;'><a href='{$t->getLocalURL()}'>{$t->getFullText()}</a></div>");
         $oldTitle = $this->getContext()->getTitle();
         $this->getContext()->setTitle($result['title']);
         $d = new DifferenceEngine($this->getContext(), RCPatrol::cleanOldId($wgRequest->getVal('old')), $wgRequest->getVal('new'), $wgRequest->getVal('rcid'));
         $d->loadRevisionData();
         $this->getContext()->setTitle($oldTitle);
         $wgOut->addHTML("<div id='rc_header' class='tool_header'>");
         $wgOut->addHTML('<a href="#" id="rcpatrol_keys">Get Shortcuts</a>');
         $wgOut->addHTML(RCPatrol::getButtons($result, $d->mNewRev));
         $wgOut->addHTML("</div>");
         $wgOut->addHTML('<div id="rcpatrol_info" style="display:none;">' . wfMessage('rcpatrol_keys')->text() . '</div>');
         $d->showDiffPage();
         $wgOut->disable();
         $response['html'] = $wgOut->getHTML();
         print_r(json_encode($response));
         return;
     }
     $a = new Article($t);
     if (!$wgRequest->getVal('grabnext')) {
         if (class_exists('RCTest') && RCTest::isEnabled() && $wgRequest->getVal('rctest')) {
             // Don't do anything if it's a test
         } elseif (!$wgRequest->getVal('skip') && $wgRequest->getVal('action') == 'markpatrolled') {
             $this->markRevisionsPatrolled($a);
         } elseif ($wgRequest->getVal('skip')) {
             // skip the article for now
             RCPatrol::skipArticle($t->getArticleID());
         }
     }
     $wgOut->clearHTML();
     $wgOut->redirect('');
     $result = RCPatrol::getNextArticleToPatrol($wgRequest->getVal('rcid'));
     $response = array();
     if ($result) {
         $rcTest = null;
         $testHtml = "";
         if (class_exists('RCTest') && RCTest::isEnabled()) {
             $rcTest = new RCTest();
             $testHtml = $rcTest->getTestHtml();
             /* Uncomment to debug rctest
             			$response['testtime'] = $rcTest->isTestTime() ? 1 : 0;
             			$response['totpatrol'] = $rcTest->getTotalPatrols();
             			$response['adjpatrol'] = $rcTest->getAdjustedPatrolCount();
             			global $wgCookiePrefix;
             			$response['testcookie'] = $_COOKIE[$wgCookiePrefix . '_rct_a'];
             			*/
         }
         $t = $result['title'];
         $wgOut->addHTML("<div id='bodycontents2'>");
         $titleText = RCTestStub::getTitleText($result, $rcTest);
         $wgOut->addHTML("<div id='articletitle' style='display:none;'>{$titleText}</div>");
         // Initialize the RCTest object. This is use to inject
         // tests into the RC Patrol queue.
         $d = RCTestStub::getDifferenceEngine($this->getContext(), $result, $rcTest);
         $d->loadRevisionData();
         $wgOut->addHTML("<div id='rc_header' class='tool_header'>");
         $wgOut->addHTML('<a href="#" id="rcpatrol_keys">Get Shortcuts</a>');
         $wgOut->addHTML(RCPatrol::getButtons($result, $d->mNewRev, $rcTest));
         $wgOut->addHTML("</div>");
         $wgOut->addHTML('<div id="rcpatrol_info" style="display:none;">' . wfMessage('rcpatrol_keys')->text() . '</div>');
         $d->showDiffPage();
         $wgOut->addHtml($testHtml);
         $wgOut->addHTML("</div>");
         $response['unpatrolled'] = self::getUnpatrolledCount();
     } else {
         $wgOut->addWikiMsg('markedaspatrolledtext');
         $response['unpatrolled'] = self::getUnpatrolledCount();
     }
     $wgOut->disable();
     header('Vary: Cookie');
     $response['html'] = $wgOut->getHTML();
     print_r(json_encode($response));
     return;
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:89,代码来源:RCPatrol.body.php

示例3: getMarkPatrolledLink

 static function getMarkPatrolledLink()
 {
     global $wgRequest, $wgUser;
     // Append a [Mark as Patrolled] link in certain cases
     $markPatrolledLink = '';
     $rcid = $wgRequest->getInt('rcid');
     $fromRC = $wgRequest->getInt('fromrc');
     if ($wgUser && $rcid > 0 && $fromRC && $wgUser->isAllowed('patrol')) {
         $rc = RecentChange::newFromId($rcid);
         if ($rc) {
             $oldRevId = $rc->getAttribute('rc_last_oldid');
             $newRevId = $rc->getAttribute('rc_this_oldid');
             $diff = new DifferenceEngine(null, $oldRevId, $newRevId);
             if ($diff->loadRevisionData()) {
                 $markPatrolledLink = $diff->markPatrolledLink();
             } else {
                 throw new MWException("wikiHow internal error: we know there is an rcid ({$rcid}) and newrevid ({$newRevId}), but couldn't find the revision");
             }
         }
     }
     return $markPatrolledLink;
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:22,代码来源:WikihowArticle.class.php

示例4: getNextToPatrolHTML

 function getNextToPatrolHTML()
 {
     global $wgOut;
     if (!$this->mResult) {
         // nothing to patrol
         return null;
     }
     // construct the HTML to reply
     // load the page
     $t = $this->mTitle;
     // Title::newFromID($this->mResult->qc_page);
     if (!$t) {
         $this->deleteBad($this->mResult->qc_page);
         return "<!--{$this->mResult->qc_page}-->error creating title, oops, please <a href='#' onclick='window.location.reload()'>refresh</a>";
     }
     // get current revsion
     $r = Revision::newFromTitle($t);
     if (!$r) {
         return "Error creating revision";
     }
     $d = new DifferenceEngine($t, $this->mResult->qc_old_rev_id, $this->mResult->qc_rev_id);
     $d->loadRevisionData();
     // interesting
     $html = "";
     $changedby = self::getChangedBy("Edits patrolled by: ");
     $wgOut->clearHTML();
     $d->showDiffPage(true);
     $html = "<div id='qc_box'>" . $changedby . $html . $wgOut->getHTML() . "</div>";
     $wgOut->clearHTML();
     $html .= "<div id='quickeditlink'></div>";
     $popts = $wgOut->parserOptions();
     $popts->setTidy(true);
     $html .= WikihowArticleHTML::processArticleHTML($wgOut->parse($r->getText(), $t, $popts), array('no-ads' => 1, 'ns' => $t->getNamespace()));
     $html .= "<input type='hidden' name='qc_id' value='{$this->mResult->qc_id}'/>";
     $html .= "<div id='numqcusers'>{$this->mUsers}</div>";
     return $html;
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:37,代码来源:QC.body.php


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