From c3c2084ee2c3d1e664245b20305452523f4aaea3 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Thu, 11 May 2006 20:24:28 +0000 Subject: [PATCH] Some more PHP5 stuff --- includes/DifferenceEngine.php | 49 ++++++++++++++++---------- includes/EditPage.php | 58 +++++++++++++++++++------------ includes/LogPage.php | 24 +++++++++---- includes/OutputPage.php | 4 +-- includes/PageHistory.php | 13 ++++--- includes/Parser.php | 5 +-- includes/ParserCache.php | 3 +- includes/QueryPage.php | 6 ++-- includes/Sanitizer.php | 2 +- includes/SpecialAllpages.php | 11 +++--- includes/SpecialBlockip.php | 5 ++- includes/SpecialContributions.php | 10 ++++-- includes/SpecialLog.php | 14 +++++--- includes/SpecialNewpages.php | 3 +- includes/SpecialPreferences.php | 37 ++++++++++++++++---- includes/SpecialUserlogin.php | 18 ++++++++-- includes/SpecialWantedpages.php | 2 +- includes/Title.php | 4 +-- includes/User.php | 2 +- 19 files changed, 181 insertions(+), 89 deletions(-) diff --git a/includes/DifferenceEngine.php b/includes/DifferenceEngine.php index 15f5878181..3a5839218b 100644 --- a/includes/DifferenceEngine.php +++ b/includes/DifferenceEngine.php @@ -21,14 +21,24 @@ class DifferenceEngine { /**#@+ * @private */ - var $mOldid, $mNewid, $mTitle; - var $mOldtitle, $mNewtitle, $mPagetitle; - var $mOldtext, $mNewtext; - var $mOldPage, $mNewPage; - var $mRcidMarkPatrolled; - var $mOldRev, $mNewRev; - var $mRevisionsLoaded = false; // Have the revisions been loaded - var $mTextLoaded = 0; // How many text blobs have been loaded, 0, 1 or 2? + private + $mNewid, + $mNewPage, + $mNewRev, + $mNewtext, + $mNewtitle, + + $mOldid, + $mOldPage, + $mOldRev, + $mOldtext, + $mOldtitle, + + $mPagetitle, + $mRcidMarkPatrolled, + $mRevisionsLoaded = false, // Have the revisions been loaded + $mTextLoaded = 0, // How many text blobs have been loaded, 0, 1 or 2? + $mTitle; /**#@-*/ /** @@ -593,9 +603,10 @@ define('USE_ASSERTS', function_exists('assert')); * @subpackage DifferenceEngine */ class _DiffOp { - var $type; - var $orig; - var $closing; + private + $closing, + $orig, + $type; function reverse() { trigger_error('pure virtual', E_USER_ERROR); @@ -617,7 +628,8 @@ class _DiffOp { * @subpackage DifferenceEngine */ class _DiffOp_Copy extends _DiffOp { - var $type = 'copy'; + public + $type = 'copy'; function _DiffOp_Copy ($orig, $closing = false) { if (!is_array($closing)) @@ -638,7 +650,7 @@ class _DiffOp_Copy extends _DiffOp { * @subpackage DifferenceEngine */ class _DiffOp_Delete extends _DiffOp { - var $type = 'delete'; + public $type = 'delete'; function _DiffOp_Delete ($lines) { $this->orig = $lines; @@ -657,7 +669,7 @@ class _DiffOp_Delete extends _DiffOp { * @subpackage DifferenceEngine */ class _DiffOp_Add extends _DiffOp { - var $type = 'add'; + public $type = 'add'; function _DiffOp_Add ($lines) { $this->closing = $lines; @@ -676,7 +688,8 @@ class _DiffOp_Add extends _DiffOp { * @subpackage DifferenceEngine */ class _DiffOp_Change extends _DiffOp { - var $type = 'change'; + private + $type = 'change'; function _DiffOp_Change ($orig, $closing) { $this->orig = $orig; @@ -1135,7 +1148,7 @@ class _DiffEngine */ class Diff { - var $edits; + public $edits; /** * Constructor. @@ -1347,7 +1360,7 @@ class DiffFormatter * This should be left at zero for this class, but subclasses * may want to set this to other values. */ - var $leading_context_lines = 0; + public $leading_context_lines = 0; /** * Number of trailing context "lines" to preserve. @@ -1355,7 +1368,7 @@ class DiffFormatter * This should be left at zero for this class, but subclasses * may want to set this to other values. */ - var $trailing_context_lines = 0; + public $trailing_context_lines = 0; /** * Format a diff. diff --git a/includes/EditPage.php b/includes/EditPage.php index abb5e16f8d..bc295ffdcc 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -14,30 +14,42 @@ */ class EditPage { - var $mArticle; - var $mTitle; - var $mMetaData = ''; - var $isConflict = false; - var $isCssJsSubpage = false; - var $deletedSinceEdit = false; - var $formtype; - var $firsttime; - var $lastDelete; - var $mTokenOk = true; - var $tooBig = false; - var $kblength = false; - var $missingComment = false; - var $missingSummary = false; - var $allowBlankSummary = false; - var $autoSumm = ''; - var $hookError = ''; + private + $allowBlankSummary = false, + $autoSumm = '', + $deletedSinceEdit = false, + $firsttime, + $formtype, + $hookError = '', + $isConflict = false, + $isCssJsSubpage = false, + $kblength = false, + $lastDelete, + $mArticle, + $missingComment = false, + $missingSummary = false, + $mMetaData = '', + $mTitle, + $mTokenOk = true, + $tooBig = false ; # Form values - var $save = false, $preview = false, $diff = false; - var $minoredit = false, $watchthis = false, $recreate = false; - var $textbox1 = '', $textbox2 = '', $summary = ''; - var $edittime = '', $section = '', $starttime = ''; - var $oldid = 0, $editintro = '', $scrolltop = null; + private + $diff = false, + $editintro = '', + $edittime = '', + $minoredit = false, + $oldid = 0, + $preview = false, + $recreate = false, + $save = false, + $scrolltop = null, + $section = '', + $starttime = '', + $summary = '', + $textbox1 = '', + $textbox2 = '', + $watchthis = false ; /** * @todo document @@ -388,7 +400,7 @@ class EditPage { $this->watchthis = $request->getCheck( 'wpWatchthis' ); # Don't force edit summaries when a user is editing their own user or talk page - if( ( $this->mTitle->mNamespace == NS_USER || $this->mTitle->mNamespace == NS_USER_TALK ) && $this->mTitle->getText() == $wgUser->getName() ) { + if( ( $this->mTitle->getNamespace() == NS_USER || $this->mTitle->getNamespace() == NS_USER_TALK ) && $this->mTitle->getText() == $wgUser->getName() ) { $this->allowBlankSummary = true; } else { $this->allowBlankSummary = $request->getBool( 'wpIgnoreBlankSummary' ); diff --git a/includes/LogPage.php b/includes/LogPage.php index e01ec0b765..f9181a7672 100644 --- a/includes/LogPage.php +++ b/includes/LogPage.php @@ -93,23 +93,25 @@ class LogPage { /** * @static */ - function validTypes() { + static function validTypes() { static $types = array( '', 'block', 'protect', 'rights', 'delete', 'upload', 'move' ); wfRunHooks( 'LogPageValidTypes', array( &$types ) ); return $types; } /** + * @param $type * @static */ - function isLogType( $type ) { + static function isLogType( $type ) { return in_array( $type, LogPage::validTypes() ); } /** + * @param $type * @static */ - function logName( $type ) { + static function logName( $type ) { static $typeText = array( '' => 'log', 'block' => 'blocklogpage', @@ -132,7 +134,7 @@ class LogPage { /** * @static */ - function logHeader( $type ) { + static function logHeader( $type ) { static $headerText = array( '' => 'alllogstext', 'block' => 'blocklogtext', @@ -148,9 +150,16 @@ class LogPage { } /** + * @param $type + * @param $action + * @param $title (Default: NULL) + * @param $skin (Default: NULL) + * @param $params (Default: array() ) + * @param $filterWikilinks (Default: false) + * @param $translate (Default: false) * @static */ - function actionText( $type, $action, $title = NULL, $skin = NULL, $params = array(), $filterWikilinks=false, $translate=false ) { + static function actionText( $type, $action, $title = NULL, $skin = NULL, $params = array(), $filterWikilinks=false, $translate=false ) { global $wgLang, $wgContLang; static $actions = array( 'block/block' => 'blocklogentry', @@ -256,9 +265,10 @@ class LogPage { /** * Create a blob from a parameter array + * @param $params Need documentation. * @static */ - function makeParamBlob( $params ) { + static function makeParamBlob( $params ) { return implode( "\n", $params ); } @@ -266,7 +276,7 @@ class LogPage { * Extract a parameter array from a blob * @static */ - function extractParams( $blob ) { + static function extractParams( $blob ) { if ( $blob === '' ) { return array(); } else { diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 3bacd96f79..71aa0b8bbe 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -24,7 +24,6 @@ class OutputPage { private $mDoNothing; private $mContainsOldMagic, $mContainsNewMagic; private $mIsArticleRelated; - private $mParserOptions; private $mShowFeedLinks = false; private $mEnableClientCache = true; private $mArticleBodyOnly = false; @@ -35,7 +34,8 @@ class OutputPage { $mPageLinkTitle, $mCategoryLinks, $mDebugtext, - $mBodytext + $mBodytext, + $mParserOptions // Called in SkinTemplate when using Special::UserLogin ; /** diff --git a/includes/PageHistory.php b/includes/PageHistory.php index 4cfee47a89..312056dc36 100644 --- a/includes/PageHistory.php +++ b/includes/PageHistory.php @@ -21,11 +21,14 @@ define('DIR_NEXT', 1); */ class PageHistory { - var $mArticle, $mTitle, $mSkin; - var $lastdate; - var $linesonpage; - var $mNotificationTimestamp; - var $mLatestId = null; + private + $lastdate, + $linesonpage, + $mArticle, + $mLatestId = null, + $mNotificationTimestamp, + $mSkin, + $mTitle ; /** * Construct a new PageHistory. diff --git a/includes/Parser.php b/includes/Parser.php index 0e38b912fb..62e1e96f63 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -4100,14 +4100,15 @@ class ParserOutput $mNewSection, # Show a new section link? $mSubtitle, # Additional subtitle $mTemplates, # 2-D map of NS/DBK to ID for the template references. ID=zero for broken. - $mText, # The output text $mTitleText, # title text of the chosen language variant $mVersion ; # Compatibility check + /** @todo FIXME should those be public ? */ public $mContainsOldMagic, # Boolean variable indicating if the input contained variables like {{CURRENTDAY}} - $mHTMLtitle ; # Display HTML title + $mHTMLtitle, # Display HTML title + $mText ; # The output text // public cause its used in ParserCache::save function ParserOutput( $text = '', $languageLinks = array(), $categoryLinks = array(), $containsOldMagic = false, $titletext = '' ) diff --git a/includes/ParserCache.php b/includes/ParserCache.php index 712c664cdf..32514adff8 100644 --- a/includes/ParserCache.php +++ b/includes/ParserCache.php @@ -102,7 +102,8 @@ class ParserCache { // Save the timestamp so that we don't have to load the revision row on view $parserOutput->mTimestamp = $article->getTimestamp(); - + + # FIXME : attempt to access private parserOutput::mText ? $parserOutput->mText .= "\n\n"; wfDebug( "Saved in parser cache with key $key and timestamp $now\n" ); diff --git a/includes/QueryPage.php b/includes/QueryPage.php index cd16576a98..8377d99c50 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -62,15 +62,15 @@ abstract class QueryPage { * * @var bool */ - var $listoutput = false; + private $listoutput = false; /** * The offset and limit in use, as passed to the query() function * * @var integer */ - var $offset = 0; - var $limit = 0; + protected $offset = 0; + protected $limit = 0; /** * A mutator for $this->listoutput; diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index 7d4551e8d4..c91c741b17 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -651,7 +651,7 @@ class Sanitizer { * @return string * @private */ - function armorLinksCallback( $matches ) { + private static function armorLinksCallback( $matches ) { return str_replace( ':', ':', $matches[1] ); } diff --git a/includes/SpecialAllpages.php b/includes/SpecialAllpages.php index 8ea51ba912..1142e68365 100644 --- a/includes/SpecialAllpages.php +++ b/includes/SpecialAllpages.php @@ -38,11 +38,12 @@ function wfSpecialAllpages( $par=NULL, $specialPage ) { } class SpecialAllpages { - var $maxPerPage=960; - var $topLevelMax=50; - var $name='Allpages'; - # Determines, which message describes the input field 'nsfrom' (->SpecialPrefixindex.php) - var $nsfromMsg='allpagesfrom'; + private + $maxPerPage = 960, + $name = 'Allpages', + # Determines, which message describes the input field 'nsfrom' (->SpecialPrefixindex.php) + $nsfromMsg = 'allpagesfrom', + $topLevelMax = 50; /** * HTML for the top form diff --git a/includes/SpecialBlockip.php b/includes/SpecialBlockip.php index b3f67ab10d..3e7f7f7823 100644 --- a/includes/SpecialBlockip.php +++ b/includes/SpecialBlockip.php @@ -37,7 +37,10 @@ function wfSpecialBlockip( $par ) { * @subpackage SpecialPage */ class IPBlockForm { - var $BlockAddress, $BlockExpiry, $BlockReason; + private + $BlockAddress, + $BlockExpiry, + $BlockReason; function IPBlockForm( $par ) { global $wgRequest; diff --git a/includes/SpecialContributions.php b/includes/SpecialContributions.php index 5354ccad36..10633c1cea 100644 --- a/includes/SpecialContributions.php +++ b/includes/SpecialContributions.php @@ -6,8 +6,12 @@ /** @package MediaWiki */ class contribs_finder { - var $username, $offset, $limit, $namespace; - var $dbr; + private + $dbr, + $limit, + $namespace, + $offset, + $username; function contribs_finder($username) { $this->username = $username; @@ -112,7 +116,7 @@ class contribs_finder { return $rows[count($rows) - 1]->rev_timestamp; } - /* private */ function make_sql() { + private function make_sql() { $userCond = $condition = $index = $offsetQuery = ''; extract($this->dbr->tableNames('page', 'revision')); diff --git a/includes/SpecialLog.php b/includes/SpecialLog.php index f67330677a..4d71a6cb29 100644 --- a/includes/SpecialLog.php +++ b/includes/SpecialLog.php @@ -42,8 +42,13 @@ function wfSpecialLog( $par = '' ) { * @subpackage SpecialPage */ class LogReader { - var $db, $joinClauses, $whereClauses; - var $type = '', $user = '', $title = null; + private + $db, + $joinClauses, + $title = null, + $type = '', + $user = '', + $whereClauses ; /** * @param WebRequest $request For internal use use a FauxRequest object to pass arbitrary parameters. @@ -211,8 +216,9 @@ class LogViewer { /** * @var LogReader $reader */ - var $reader; - var $numResults = 0; + private + $numResults = 0, + $reader ; /** * @param LogReader &$reader where to get our data from diff --git a/includes/SpecialNewpages.php b/includes/SpecialNewpages.php index 3f72352f61..359cdf6b7f 100644 --- a/includes/SpecialNewpages.php +++ b/includes/SpecialNewpages.php @@ -16,7 +16,8 @@ require_once( 'QueryPage.php' ); * @subpackage SpecialPage */ class NewPagesPage extends QueryPage { - var $namespace; + private + $namespace; function NewPagesPage( $namespace = NS_MAIN ) { $this->namespace = $namespace; diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index 8b972b01a6..627f04bd7c 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -22,12 +22,37 @@ function wfSpecialPreferences() { * @subpackage SpecialPage */ class PreferencesForm { - var $mQuickbar, $mOldpass, $mNewpass, $mRetypePass, $mStubs; - var $mRows, $mCols, $mSkin, $mMath, $mDate, $mUserEmail, $mEmailFlag, $mNick; - var $mUserLanguage, $mUserVariant; - var $mSearch, $mRecent, $mHourDiff, $mSearchLines, $mSearchChars, $mAction; - var $mReset, $mPosted, $mToggles, $mSearchNs, $mRealName, $mImageSize; - var $mUnderline, $mWatchlistEdits; + + private + $mAction, + $mCols, + $mDate, + $mEmailFlag, + $mHourDiff, + $mImageSize, + $mMath, + $mNewpass, + $mNick, + $mOldpass, + $mPosted, + $mQuickbar, + $mRealName, + $mRecent, + $mReset, + $mRetypePass, + $mRows, + $mSearch, + $mSearchChars, + $mSearchLines, + $mSearchNs, + $mSkin, + $mStubs, + $mToggles, + $mUnderline, + $mUserEmail, + $mUserLanguage, + $mUserVariant, + $mWatchlistEdits ; /** * Constructor diff --git a/includes/SpecialUserlogin.php b/includes/SpecialUserlogin.php index 65ff6e2d35..5e37f6f6bc 100644 --- a/includes/SpecialUserlogin.php +++ b/includes/SpecialUserlogin.php @@ -25,9 +25,21 @@ function wfSpecialUserlogin() { * @subpackage SpecialPage */ class LoginForm { - var $mName, $mPassword, $mRetype, $mReturnTo, $mCookieCheck, $mPosted; - var $mAction, $mCreateaccount, $mCreateaccountMail, $mMailmypassword; - var $mLoginattempt, $mRemember, $mEmail, $mDomain; + private + $mAction, + $mCookieCheck, + $mCreateaccount, + $mCreateaccountMail, + $mDomain, + $mEmail, // Entered user email ?? + $mLoginattempt, + $mMailmypassword, + $mName, // Entered username + $mPassword, // Entered user password + $mPosted, + $mRemember, // bool, if user want to be remembered + $mReturnTo, // article to return to once logged in + $mRetype ; /** * Constructor diff --git a/includes/SpecialWantedpages.php b/includes/SpecialWantedpages.php index 92958e8d1c..55118dcde9 100644 --- a/includes/SpecialWantedpages.php +++ b/includes/SpecialWantedpages.php @@ -16,7 +16,7 @@ require_once 'QueryPage.php'; * @subpackage SpecialPage */ class WantedPagesPage extends QueryPage { - var $nlinks; + private $nlinks; function WantedPagesPage( $inc = false, $nlinks = true ) { $this->setListoutput( $inc ); diff --git a/includes/Title.php b/includes/Title.php index 1875059e66..4c76682f35 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -105,7 +105,7 @@ class Title { * @static * @access public */ - function newFromText( $text, $defaultNamespace = NS_MAIN ) { + public static function newFromText( $text, $defaultNamespace = NS_MAIN ) { global $wgTitleCache; $fname = 'Title::newFromText'; @@ -160,7 +160,7 @@ class Title { * @static * @access public */ - function newFromURL( $url ) { + public static function newFromURL( $url ) { global $wgLegalTitleChars; $t = new Title(); diff --git a/includes/User.php b/includes/User.php index 81c45ec1a8..5879a7e7a9 100644 --- a/includes/User.php +++ b/includes/User.php @@ -168,7 +168,7 @@ class User { * @return integer|null Database user id (null: if non existent * @static */ - function idFromName( $name ) { + public static function idFromName( $name ) { $fname = "User::idFromName"; $nt = Title::newFromText( $name ); -- 2.20.1