From 6a5c9bd28b8eaf80845aa72e1b1a22968e40f783 Mon Sep 17 00:00:00 2001 From: aude Date: Tue, 25 Feb 2014 09:23:32 +0100 Subject: [PATCH] Add visibility to DifferenceEngine methods Change-Id: I415719442ca1778be36f173067d4b090fbe9265a --- includes/diff/DifferenceEngine.php | 55 +++++++++++++++--------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 52eb003980..414b9f80e3 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -105,8 +105,9 @@ class DifferenceEngine extends ContextSource { * @param bool $refreshCache If set, refreshes the diff cache * @param bool $unhide If set, allow viewing deleted revs */ - function __construct( $context = null, $old = 0, $new = 0, $rcid = 0, - $refreshCache = false, $unhide = false ) { + public function __construct( $context = null, $old = 0, $new = 0, $rcid = 0, + $refreshCache = false, $unhide = false + ) { if ( $context instanceof IContextSource ) { $this->setContext( $context ); } @@ -122,14 +123,14 @@ class DifferenceEngine extends ContextSource { /** * @param bool $value */ - function setReducedLineNumbers( $value = true ) { + public function setReducedLineNumbers( $value = true ) { $this->mReducedLineNumbers = $value; } /** * @return Language */ - function getDiffLang() { + public function getDiffLang() { if ( $this->mDiffLang === null ) { # Default language in which the diff text is written. $this->mDiffLang = $this->getTitle()->getPageLanguage(); @@ -141,14 +142,14 @@ class DifferenceEngine extends ContextSource { /** * @return bool */ - function wasCacheHit() { + public function wasCacheHit() { return $this->mCacheHit; } /** * @return int */ - function getOldid() { + public function getOldid() { $this->loadRevisionIds(); return $this->mOldid; @@ -157,7 +158,7 @@ class DifferenceEngine extends ContextSource { /** * @return bool|int */ - function getNewid() { + public function getNewid() { $this->loadRevisionIds(); return $this->mNewid; @@ -171,7 +172,7 @@ class DifferenceEngine extends ContextSource { * * @return mixed URL or false */ - function deletedLink( $id ) { + public function deletedLink( $id ) { if ( $this->getUser()->isAllowed( 'deletedhistory' ) ) { $dbr = wfGetDB( DB_SLAVE ); $row = $dbr->selectRow( 'archive', '*', @@ -198,7 +199,7 @@ class DifferenceEngine extends ContextSource { * * @return string Wikitext fragment */ - function deletedIdMarker( $id ) { + public function deletedIdMarker( $id ) { $link = $this->deletedLink( $id ); if ( $link ) { return "[$link $id]"; @@ -227,7 +228,7 @@ class DifferenceEngine extends ContextSource { $this->getLanguage()->listToText( $missing ), count( $missing ) ); } - function showDiffPage( $diffOnly = false ) { + public function showDiffPage( $diffOnly = false ) { wfProfileIn( __METHOD__ ); # Allow frames except in certain special cases @@ -536,7 +537,7 @@ class DifferenceEngine extends ContextSource { /** * Show the new revision of the page. */ - function renderNewRevision() { + public function renderNewRevision() { wfProfileIn( __METHOD__ ); $out = $this->getOutput(); $revHeader = $this->getRevisionHeader( $this->mNewRev ); @@ -619,7 +620,7 @@ class DifferenceEngine extends ContextSource { * * @return bool */ - function showDiff( $otitle, $ntitle, $notice = '' ) { + public function showDiff( $otitle, $ntitle, $notice = '' ) { $diff = $this->getDiff( $otitle, $ntitle, $notice ); if ( $diff === false ) { $this->showMissingRevision(); @@ -636,7 +637,7 @@ class DifferenceEngine extends ContextSource { /** * Add style sheets and supporting JS for diff display. */ - function showDiffStyle() { + public function showDiffStyle() { $this->getOutput()->addModuleStyles( 'mediawiki.action.history.diff' ); } @@ -649,7 +650,7 @@ class DifferenceEngine extends ContextSource { * * @return mixed */ - function getDiff( $otitle, $ntitle, $notice = '' ) { + public function getDiff( $otitle, $ntitle, $notice = '' ) { $body = $this->getDiffBody(); if ( $body === false ) { return false; @@ -784,7 +785,7 @@ class DifferenceEngine extends ContextSource { * @throws MWException If old or new content is not an instance of TextContent. * @return bool|string */ - function generateContentDiffBody( Content $old, Content $new ) { + public function generateContentDiffBody( Content $old, Content $new ) { if ( !( $old instanceof TextContent ) ) { throw new MWException( "Diff not implemented for " . get_class( $old ) . "; " . "override generateContentDiffBody to fix this." ); @@ -810,7 +811,7 @@ class DifferenceEngine extends ContextSource { * @return bool|string * @deprecated since 1.21, use generateContentDiffBody() instead! */ - function generateDiffBody( $otext, $ntext ) { + public function generateDiffBody( $otext, $ntext ) { ContentHandler::deprecated( __METHOD__, "1.21" ); return $this->generateTextDiffBody( $otext, $ntext ); @@ -826,7 +827,7 @@ class DifferenceEngine extends ContextSource { * * @return bool|string */ - function generateTextDiffBody( $otext, $ntext ) { + public function generateTextDiffBody( $otext, $ntext ) { global $wgExternalDiffEngine, $wgContLang; wfProfileIn( __METHOD__ ); @@ -932,7 +933,7 @@ class DifferenceEngine extends ContextSource { * * @return mixed */ - function localiseLineNumbers( $text ) { + public function localiseLineNumbers( $text ) { return preg_replace_callback( '//', array( &$this, 'localiseLineNumbersCb' ), @@ -940,7 +941,7 @@ class DifferenceEngine extends ContextSource { ); } - function localiseLineNumbersCb( $matches ) { + public function localiseLineNumbersCb( $matches ) { if ( $matches[1] === '1' && $this->mReducedLineNumbers ) { return ''; } @@ -953,7 +954,7 @@ class DifferenceEngine extends ContextSource { * * @return string */ - function getMultiNotice() { + public function getMultiNotice() { if ( !is_object( $this->mOldRev ) || !is_object( $this->mNewRev ) ) { return ''; } elseif ( !$this->mOldPage->equals( $this->mNewPage ) ) { @@ -1076,7 +1077,7 @@ class DifferenceEngine extends ContextSource { * * @return string */ - function addHeader( $diff, $otitle, $ntitle, $multi = '', $notice = '' ) { + public function addHeader( $diff, $otitle, $ntitle, $multi = '', $notice = '' ) { // shared.css sets diff in interface language/dir, but the actual content // is often in a different language, mostly the page content language/dir $tableClass = 'diff diff-contentalign-' . htmlspecialchars( $this->getDiffLang()->alignStart() ); @@ -1125,7 +1126,7 @@ class DifferenceEngine extends ContextSource { * Use specified text instead of loading from the database * @deprecated since 1.21, use setContent() instead. */ - function setText( $oldText, $newText ) { + public function setText( $oldText, $newText ) { ContentHandler::deprecated( __METHOD__, "1.21" ); $oldContent = ContentHandler::makeContent( $oldText, $this->getTitle() ); @@ -1138,7 +1139,7 @@ class DifferenceEngine extends ContextSource { * Use specified text instead of loading from the database * @since 1.21 */ - function setContent( Content $oldContent, Content $newContent ) { + public function setContent( Content $oldContent, Content $newContent ) { $this->mOldContent = $oldContent; $this->mNewContent = $newContent; @@ -1151,7 +1152,7 @@ class DifferenceEngine extends ContextSource { * (Defaults to page content language). * @since 1.19 */ - function setTextLanguage( $lang ) { + public function setTextLanguage( $lang ) { $this->mDiffLang = wfGetLangObj( $lang ); } @@ -1221,7 +1222,7 @@ class DifferenceEngine extends ContextSource { * * @return bool */ - function loadRevisionData() { + public function loadRevisionData() { if ( $this->mRevisionsLoaded ) { return true; } @@ -1301,7 +1302,7 @@ class DifferenceEngine extends ContextSource { * * @return bool */ - function loadText() { + public function loadText() { if ( $this->mTextLoaded == 2 ) { return true; } @@ -1335,7 +1336,7 @@ class DifferenceEngine extends ContextSource { * * @return bool */ - function loadNewText() { + public function loadNewText() { if ( $this->mTextLoaded >= 1 ) { return true; } -- 2.20.1