/** * Get a diff between the current contents of the edit box and the * version of the page we're editing from. * * If this is a section edit, we'll replace the section as for final * save and then make a comparison. */ function showDiff() { $oldtext = $this->mArticle->fetchContent(); $newtext = $this->mArticle->replaceSection($this->section, $this->textbox1, $this->summary, $this->edittime); wfRunHooks('EditPageGetDiffText', array($this, &$newtext)); $newtext = $this->mArticle->preSaveTransform($newtext); $oldtitle = wfMsgExt('currentrev', array('parseinline')); $newtitle = wfMsgExt('yourtext', array('parseinline')); if ($oldtext !== false || $newtext != '') { $de = new DifferenceEngine($this->mTitle); $de->setText($oldtext, $newtext); $difftext = $de->getDiff($oldtitle, $newtitle); $de->showDiffStyle(); } else { $difftext = ''; } global $wgOut; $wgOut->addHTML('<div id="wikiDiff">' . $difftext . '</div>'); }