Some more PHP5 stuff
authorAntoine Musso <hashar@users.mediawiki.org>
Thu, 11 May 2006 20:24:28 +0000 (20:24 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Thu, 11 May 2006 20:24:28 +0000 (20:24 +0000)
19 files changed:
includes/DifferenceEngine.php
includes/EditPage.php
includes/LogPage.php
includes/OutputPage.php
includes/PageHistory.php
includes/Parser.php
includes/ParserCache.php
includes/QueryPage.php
includes/Sanitizer.php
includes/SpecialAllpages.php
includes/SpecialBlockip.php
includes/SpecialContributions.php
includes/SpecialLog.php
includes/SpecialNewpages.php
includes/SpecialPreferences.php
includes/SpecialUserlogin.php
includes/SpecialWantedpages.php
includes/Title.php
includes/User.php

index 15f5878..3a58392 100644 (file)
@@ -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.
index abb5e16..bc295ff 100644 (file)
  */
 
 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' );
index e01ec0b..f9181a7 100644 (file)
@@ -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 {
index 3bacd96..71aa0b8 100644 (file)
@@ -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
        ;
 
        /**
index 4cfee47..312056d 100644 (file)
@@ -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.
index 0e38b91..62e1e96 100644 (file)
@@ -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 = '' )
index 712c664..32514ad 100644 (file)
@@ -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<!-- Saved in parser cache with key $key and timestamp $now -->\n";
                wfDebug( "Saved in parser cache with key $key and timestamp $now\n" );
 
index cd16576..8377d99 100644 (file)
@@ -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;
index 7d4551e..c91c741 100644 (file)
@@ -651,7 +651,7 @@ class Sanitizer {
         * @return string
         * @private
         */
-       function armorLinksCallback( $matches ) {
+       private static function armorLinksCallback( $matches ) {
                return str_replace( ':', '&#58;', $matches[1] );
        }
 
index 8ea51ba..1142e68 100644 (file)
@@ -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
index b3f67ab..3e7f7f7 100644 (file)
@@ -37,7 +37,10 @@ function wfSpecialBlockip( $par ) {
  * @subpackage SpecialPage
  */
 class IPBlockForm {
-       var $BlockAddress, $BlockExpiry, $BlockReason;
+       private
+               $BlockAddress,
+               $BlockExpiry,
+               $BlockReason;
 
        function IPBlockForm( $par ) {
                global $wgRequest;
index 5354cca..10633c1 100644 (file)
@@ -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'));
index f673306..4d71a6c 100644 (file)
@@ -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
index 3f72352..359cdf6 100644 (file)
@@ -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;
index 8b972b0..627f04b 100644 (file)
@@ -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
index 65ff6e2..5e37f6f 100644 (file)
@@ -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
index 92958e8..55118dc 100644 (file)
@@ -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 );
index 1875059..4c76682 100644 (file)
@@ -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();
 
index 81c45ec..5879a7e 100644 (file)
@@ -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 );