public function getDiff($wikitext, $section = '')
 {
     wfProfileIn(__METHOD__);
     $section = intval($section);
     // create "fake" EditPage
     if (function_exists('CategorySelectInitializeHooks')) {
         CategorySelectInitializeHooks(null, null, $this->mTitle, null, null, null, true);
     }
     $article = new Article($this->mTitle);
     $editPage = new EditPage($article);
     $editPage->textbox1 = $wikitext;
     $editPage->edittime = null;
     $editPage->section = $section > 0 ? $section : '';
     // render diff HTML to $wgOut
     $out = $this->app->getGlobal('wgOut');
     $oldHtml = $out->getHTML();
     $out->clearHTML();
     $editPage->showDiff();
     $diff = $out->getHTML();
     // restore state of output
     $out->clearHTML();
     $out->addHTML($oldHtml);
     wfProfileOut(__METHOD__);
     return $diff;
 }
 /**
  * This is a hack to fix
  * http://dev.fckeditor.net/ticket/1174
  * If RTE is enabled, diff must be performed on WikiText, not on HTML
  */
 function showDiff()
 {
     global $wgFCKWikiTextBeforeParse;
     if (isset($wgFCKWikiTextBeforeParse)) {
         $_textbox1 = $this->textbox1;
         $this->textbox1 = $wgFCKWikiTextBeforeParse;
     }
     $result = parent::showDiff();
     if (isset($wgFCKWikiTextBeforeParse)) {
         $this->textbox1 = $_textbox1;
     }
 }
 public function getDiff($wikitext, $section = '')
 {
     wfProfileIn(__METHOD__);
     $section = intval($section);
     $article = new Article($this->mTitle);
     // create "fake" EditPage
     $editPage = new EditPage($article);
     // rtrim is a fix for https://wikia-inc.atlassian.net/browse/MAIN-152
     // To understand better look at "$this->textbox1 = $this->safeUnicodeInput( $request, 'wpTextbox1' );" in EditPage.php
     $editPage->textbox1 = rtrim($wikitext);
     $editPage->edittime = null;
     $editPage->section = $section > 0 ? $section : '';
     // render diff HTML to $wgOut
     $out = $this->app->getGlobal('wgOut');
     $oldHtml = $out->getHTML();
     $out->clearHTML();
     $editPage->showDiff();
     $diff = $out->getHTML();
     // restore state of output
     $out->clearHTML();
     $out->addHTML($oldHtml);
     wfProfileOut(__METHOD__);
     return $diff;
 }