Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -4,58 +4,198 @@ |
5 | 5 | } |
6 | 6 | |
7 | 7 | /** |
| 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 | + * |
8 | 20 | * @todo document |
9 | 21 | */ |
10 | 22 | 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. |
12 | 32 | var $mExtStyles = array(); |
13 | | - var $mPagetitle = '', $mBodytext = ''; |
| 33 | + |
| 34 | + // should be private. We got set/get accessors. Set the HTML title |
| 35 | + var $mPagetitle = ''; |
14 | 36 | |
| 37 | + // Contains all of the <BODY> content. Should be private we got set/get accessors and the append() method. |
| 38 | + var $mBodytext = ''; |
| 39 | + |
15 | 40 | /** |
16 | 41 | * Holds the debug lines that will be outputted as comments in page source if |
17 | 42 | * $wgDebugComments is enabled. See also $wgShowDebug. |
18 | 43 | * TODO: make a getter method for this |
19 | 44 | */ |
20 | | - public $mDebugtext = ''; |
| 45 | + public $mDebugtext = ''; // TODO: we might want to replace it by wfDebug() wfDebugLog() |
21 | 46 | |
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 = ''; |
26 | 49 | |
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 |
28 | 114 | var $mModules = array(), $mModuleScripts = array(), $mModuleStyles = array(), $mModuleMessages = array(); |
29 | 115 | var $mResourceLoader; |
| 116 | + |
| 117 | + /** @fixme is this still used ?*/ |
30 | 118 | var $mInlineMsg = array(); |
31 | 119 | |
32 | 120 | var $mTemplateIds = array(); |
33 | 121 | |
| 122 | + // Initialized with a global value. Let us override it. |
| 123 | + // Should probably get deleted / rewritten ... |
34 | 124 | 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 | + */ |
35 | 131 | var $mSuppressQuickbar = false; |
| 132 | + |
| 133 | + /** |
| 134 | + * @EasterEgg I just love the name for this self documenting variable. |
| 135 | + * @todo document |
| 136 | + */ |
36 | 137 | var $mDoNothing = false; |
| 138 | + |
| 139 | + // Parser related. |
37 | 140 | var $mContainsOldMagic = 0, $mContainsNewMagic = 0; |
| 141 | + |
| 142 | + /* |
| 143 | + * should be private. Has get/set methods properly documented. |
| 144 | + * Stores "article flag" toggle. |
| 145 | + */ |
38 | 146 | var $mIsArticleRelated = true; |
39 | | - protected $mParserOptions = null; // lazy initialised, use parserOptions() |
40 | 147 | |
| 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 | + */ |
41 | 156 | var $mFeedLinks = array(); |
42 | 157 | |
| 158 | + // Gwicke work on squid caching? Roughly from 2003. |
43 | 159 | var $mEnableClientCache = true; |
| 160 | + |
| 161 | + /* |
| 162 | + * Flag if output should only contain the body of the article. |
| 163 | + * Should be private. |
| 164 | + */ |
44 | 165 | var $mArticleBodyOnly = false; |
45 | 166 | |
46 | 167 | var $mNewSectionLink = false; |
47 | 168 | 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 | + */ |
48 | 175 | var $mNoGallery = false; |
| 176 | + |
| 177 | + // should be private. |
49 | 178 | var $mPageTitleActionText = ''; |
50 | 179 | var $mParseWarnings = array(); |
| 180 | + |
| 181 | + // Cache stuff. Looks like mEnableClientCache |
51 | 182 | var $mSquidMaxage = 0; |
| 183 | + |
| 184 | + // @todo document |
52 | 185 | var $mPreventClickjacking = true; |
| 186 | + |
| 187 | + // should be private. To include the variable {{REVISIONID}} |
53 | 188 | var $mRevisionId = null; |
| 189 | + |
| 190 | + // Stores a Title object. |
54 | 191 | protected $mTitle = null; |
55 | 192 | |
56 | 193 | /** |
57 | 194 | * An array of stylesheet filenames (relative from skins path), with options |
58 | 195 | * for CSS media, IE conditions, and RTL/LTR direction. |
59 | 196 | * 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. |
60 | 200 | */ |
61 | 201 | var $styles = array(); |
62 | 202 | |