r80192 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80191‎ | r80192 | r80193 >
Date:21:08, 13 January 2011
Author:hashar
Status:ok (Comments)
Tags:
Comment:
OutputPage properties documentation

This is following a pair session with Zak Greant on november 12th 2010.
Please review, ammend and commit your changes if you have anything useful
to add.
Please note you will find some humoristics quotes.
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -4,58 +4,198 @@
55 }
66
77 /**
 8+ * This class should be covered by a general architecture document which does
 9+ * not exist as of january 2011. This is one of the Core class and should
 10+ * be read at least once by any new developers.
 11+ *
 12+ * This class is used to prepare the final rendering. A skin is then
 13+ * applied to the output parameters (links, javascript, html, categories ...).
 14+ *
 15+ * Another class (fixme) handle sending the whole page to the client.
 16+ *
 17+ * Some comments comes from a pairing session between Zak Greant and Ashar Voultoiz
 18+ * in november 2010.
 19+ *
820 * @todo document
921 */
1022 class OutputPage {
11 - var $mMetatags = array(), $mKeywords = array(), $mLinktags = array();
 23+ // should be private. Used with addMeta() which add <meta>
 24+ var $mMetatags = array();
 25+
 26+ // <meta keyworkds="stuff"> most of the time the first 10 links to an article
 27+ var $mKeywords = array();
 28+
 29+ var $mLinktags = array();
 30+
 31+ // additional stylesheets. Looks like this is for extensions. Might be replaced by ressource loader.
1232 var $mExtStyles = array();
13 - var $mPagetitle = '', $mBodytext = '';
 33+
 34+ // should be private. We got set/get accessors. Set the HTML title
 35+ var $mPagetitle = '';
1436
 37+ // Contains all of the <BODY> content. Should be private we got set/get accessors and the append() method.
 38+ var $mBodytext = '';
 39+
1540 /**
1641 * Holds the debug lines that will be outputted as comments in page source if
1742 * $wgDebugComments is enabled. See also $wgShowDebug.
1843 * TODO: make a getter method for this
1944 */
20 - public $mDebugtext = '';
 45+ public $mDebugtext = ''; // TODO: we might want to replace it by wfDebug() wfDebugLog()
2146
22 - var $mHTMLtitle = '', $mIsarticle = true, $mPrintable = false;
23 - var $mSubtitle = '', $mRedirect = '', $mStatusCode;
24 - var $mLastModified = '', $mETag = false;
25 - var $mCategoryLinks = array(), $mCategories = array(), $mLanguageLinks = array();
 47+ // should be private. Stores contents of <title> tg
 48+ var $mHTMLtitle = '';
2649
27 - var $mScripts = '', $mInlineStyles = '', $mLinkColours, $mPageLinkTitle = '', $mHeadItems = array();
 50+ // should be private. Is the displayed content related to the source of the corresponding wiki article.
 51+ var $mIsarticle = true;
 52+
 53+ /*
 54+ * should be private. We have to set isPrintable(). Some pages should
 55+ * never be printed (ex: redirections.
 56+ */
 57+ var $mPrintable = false;
 58+
 59+ /*
 60+ * Should be private. We have set/get/append methods.
 61+ *
 62+ * Contains the article subtitle.
 63+ *
 64+ * Example: 'From Wikipedia, the free encyclopedia'
 65+ var $mSubtitle = '';
 66+
 67+ var $mRedirect = '';
 68+ var $mStatusCode;
 69+
 70+ // mLastModified and mEtag are used for sending cache control.
 71+ // The whole caching system should probably be moved in its own class.
 72+ var $mLastModified = '';
 73+
 74+ /*
 75+ * Should be private. No getter but used in sendCacheControl();
 76+ * Contains an HTTP Entity Tags (see RFC 2616 section 3.13) which is used
 77+ * as a unique identifier for the content. It is later used by the client
 78+ * to compare its cache version with the server version. Client sends
 79+ * headers If-Match and If-None-Match containing its local cache ETAG value.
 80+ *
 81+ * To get more information, you will have to look at HTTP1/1 protocols which
 82+ * is properly described in RFC 2616 : http://tools.ietf.org/html/rfc2616
 83+ */
 84+ var $mETag = false;
 85+
 86+ var $mCategoryLinks = array();
 87+ var $mCategories = array();
 88+
 89+ // Should be private. Associative array mapping language code to the page name
 90+ var $mLanguageLinks = array();
 91+
 92+ /*
 93+ * Should be private. Used for javascript (or VB?)
 94+ * We should split js / css.
 95+ * mScripts content is inserted as is in <head> by Skin. This might contains
 96+ * either a link to a stylesheet or inline css.
 97+ */
 98+ var $mScripts = '';
 99+ var $mInlineStyles = ''; // ???
 100+
 101+ //
 102+ var $mLinkColours;
 103+
 104+ /**
 105+ * Used by skin template.
 106+ * Example: $tpl->set( 'displaytitle', $out->mPageLinkTitle );
 107+ */
 108+ var $mPageLinkTitle = '';
 109+
 110+ // Array of <head> elements. Parser might add its own headers!
 111+ var $mHeadItems = array();
 112+
 113+ // Next variables probably comes from the ressource loader @todo FIXME
28114 var $mModules = array(), $mModuleScripts = array(), $mModuleStyles = array(), $mModuleMessages = array();
29115 var $mResourceLoader;
 116+
 117+ /** @fixme is this still used ?*/
30118 var $mInlineMsg = array();
31119
32120 var $mTemplateIds = array();
33121
 122+ // Initialized with a global value. Let us override it.
 123+ // Should probably get deleted / rewritten ...
34124 var $mAllowUserJs;
 125+
 126+ /*
 127+ * This was for the old skins and for users with 640x480 screen.
 128+ * Please note old sckins are still used and might prove useful for
 129+ * users having old computers or visually impaired.
 130+ */
35131 var $mSuppressQuickbar = false;
 132+
 133+ /**
 134+ * @EasterEgg I just love the name for this self documenting variable.
 135+ * @todo document
 136+ */
36137 var $mDoNothing = false;
 138+
 139+ // Parser related.
37140 var $mContainsOldMagic = 0, $mContainsNewMagic = 0;
 141+
 142+ /*
 143+ * should be private. Has get/set methods properly documented.
 144+ * Stores "article flag" toggle.
 145+ */
38146 var $mIsArticleRelated = true;
39 - protected $mParserOptions = null; // lazy initialised, use parserOptions()
40147
 148+ // lazy initialised, use parserOptions()
 149+ protected $mParserOptions = null;
 150+
 151+ /*
 152+ * Handles the atom / rss links.
 153+ * We probably only support atom in 2011.
 154+ * Looks like a private variable.
 155+ */
41156 var $mFeedLinks = array();
42157
 158+ // Gwicke work on squid caching? Roughly from 2003.
43159 var $mEnableClientCache = true;
 160+
 161+ /*
 162+ * Flag if output should only contain the body of the article.
 163+ * Should be private.
 164+ */
44165 var $mArticleBodyOnly = false;
45166
46167 var $mNewSectionLink = false;
47168 var $mHideNewSectionLink = false;
 169+
 170+ /*
 171+ * Comes from the parser. This was probably made to laod CSS/JS only
 172+ * if we had <gallery>. Used directly in CategoryPage.php
 173+ * Looks like resource loader can replace this.
 174+ */
48175 var $mNoGallery = false;
 176+
 177+ // should be private.
49178 var $mPageTitleActionText = '';
50179 var $mParseWarnings = array();
 180+
 181+ // Cache stuff. Looks like mEnableClientCache
51182 var $mSquidMaxage = 0;
 183+
 184+ // @todo document
52185 var $mPreventClickjacking = true;
 186+
 187+ // should be private. To include the variable {{REVISIONID}}
53188 var $mRevisionId = null;
 189+
 190+ // Stores a Title object.
54191 protected $mTitle = null;
55192
56193 /**
57194 * An array of stylesheet filenames (relative from skins path), with options
58195 * for CSS media, IE conditions, and RTL/LTR direction.
59196 * For internal use; add settings in the skin via $this->addStyle()
 197+ *
 198+ * Style again! This seems like a code duplication since we already have
 199+ * mStyles. This is what makes OpenSource amazing.
60200 */
61201 var $styles = array();
62202

Follow-up revisions

RevisionCommit summaryAuthorDate
r80195Fixing up spaces to tabs in r80192...reedy22:08, 13 January 2011
r80197Followup r80192 which had an unclosed comment causing some php notices result...dantman22:20, 13 January 2011
r80239Follow-up r80192, tweak docsnikerabbit07:54, 14 January 2011

Comments

#Comment by Hashar (talk | contribs)   21:10, 13 January 2011

No code change AFAIK.

#Comment by Reedy (talk | contribs)   22:03, 13 January 2011
+    var	$mLinktags = array();

Mix of tabs and spaces, aswell as the big gap in the middle :P

#Comment by Nikerabbit (talk | contribs)   07:54, 14 January 2011

 

+	public $mDebugtext = ; // TODO: we might want to replace it by wfDebug() wfDebugLog()

it=?

+	 * should be private. We have to set isPrintable(). Some pages should

we=who?

+	 * Example: 'From Wikipedia, the free encyclopedia'

That's site subtitle, this one is for content.

#Comment by Tim Starling (talk | contribs)   00:37, 20 October 2011

There seems to be a lot of completely uninformed speculation here. And if the goal is to document, why do you spend so much time rambling about possible future architectural changes? That's not really a helpful way to explain what is going on in the class.

Status & tagging log