Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -36,14 +36,17 @@ |
37 | 37 | var $mShowFeedLinks = false; |
38 | 38 | var $mEnableClientCache = true; |
39 | 39 | |
40 | | - function OutputPage() |
41 | | - { |
| 40 | + /** |
| 41 | + * Constructor |
| 42 | + * Initialise private variables |
| 43 | + */ |
| 44 | + function OutputPage() { |
42 | 45 | $this->mHeaders = $this->mCookies = $this->mMetatags = |
43 | 46 | $this->mKeywords = $this->mLinktags = array(); |
44 | 47 | $this->mHTMLtitle = $this->mPagetitle = $this->mBodytext = |
45 | 48 | $this->mRedirect = $this->mLastModified = |
46 | 49 | $this->mSubtitle = $this->mDebugtext = $this->mRobotpolicy = |
47 | | - $this->mOnloadHandler = ""; |
| 50 | + $this->mOnloadHandler = ''; |
48 | 51 | $this->mIsArticleRelated = $this->mIsarticle = $this->mPrintable = true; |
49 | 52 | $this->mSuppressQuickbar = $this->mPrintable = false; |
50 | 53 | $this->mLanguageLinks = array(); |
— | — | @@ -52,10 +55,10 @@ |
53 | 56 | $this->mContainsOldMagic = $this->mContainsNewMagic = 0; |
54 | 57 | $this->mParserOptions = ParserOptions::newFromUser( $temp = NULL ); |
55 | 58 | $this->mSquidMaxage = 0; |
56 | | - $this->mScripts = ""; |
| 59 | + $this->mScripts = ''; |
57 | 60 | } |
58 | 61 | |
59 | | - function addHeader( $name, $val ) { array_push( $this->mHeaders, "$name: $val" ) ; } |
| 62 | + function addHeader( $name, $val ) { array_push( $this->mHeaders, $name.': '.$val ) ; } |
60 | 63 | function addCookie( $name, $val ) { array_push( $this->mCookies, array( $name, $val ) ); } |
61 | 64 | function redirect( $url, $responsecode = '302' ) { $this->mRedirect = $url; $this->mRedirectCode = $responsecode; } |
62 | 65 | |
— | — | @@ -84,8 +87,7 @@ |
85 | 88 | * any future call to OutputPage->output() have no effect. The method |
86 | 89 | * returns true iff cache-ok headers was sent. |
87 | 90 | */ |
88 | | - function checkLastModified ( $timestamp ) |
89 | | - { |
| 91 | + function checkLastModified ( $timestamp ) { |
90 | 92 | global $wgLang, $wgCachePages, $wgUser; |
91 | 93 | $timestamp=wfTimestamp(TS_MW,$timestamp); |
92 | 94 | if( !$wgCachePages ) { |
— | — | @@ -102,7 +104,7 @@ |
103 | 105 | return; |
104 | 106 | } |
105 | 107 | |
106 | | - $lastmod = gmdate( "D, j M Y H:i:s", wfTimestamp(TS_UNIX, max( $timestamp, $wgUser->mTouched ) ) ) . " GMT"; |
| 108 | + $lastmod = gmdate( 'D, j M Y H:i:s', wfTimestamp(TS_UNIX, max( $timestamp, $wgUser->mTouched ) ) ) . ' GMT'; |
107 | 109 | |
108 | 110 | if( !empty( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) { |
109 | 111 | # IE sends sizes after the date like this: |
— | — | @@ -155,6 +157,7 @@ |
156 | 158 | return ''; |
157 | 159 | } |
158 | 160 | } |
| 161 | + |
159 | 162 | function setRobotpolicy( $str ) { $this->mRobotpolicy = $str; } |
160 | 163 | function setHTMLTitle( $name ) {$this->mHTMLtitle = $name; } |
161 | 164 | function setPageTitle( $name ) { |
— | — | @@ -181,8 +184,7 @@ |
182 | 185 | function getOnloadHandler() { return $this->mOnloadHandler; } |
183 | 186 | function disable() { $this->mDoNothing = true; } |
184 | 187 | |
185 | | - function setArticleRelated( $v ) |
186 | | - { |
| 188 | + function setArticleRelated( $v ) { |
187 | 189 | $this->mIsArticleRelated = $v; |
188 | 190 | if ( !$v ) { |
189 | 191 | $this->mIsarticle = false; |
— | — | @@ -195,20 +197,16 @@ |
196 | 198 | } |
197 | 199 | } |
198 | 200 | |
199 | | - function isArticleRelated() |
200 | | - { |
201 | | - return $this->mIsArticleRelated; |
202 | | - } |
| 201 | + function isArticleRelated() { return $this->mIsArticleRelated; } |
203 | 202 | |
204 | | - function getLanguageLinks() { |
205 | | - return $this->mLanguageLinks; |
206 | | - } |
| 203 | + function getLanguageLinks() { return $this->mLanguageLinks; } |
207 | 204 | function addLanguageLinks($newLinkArray) { |
208 | 205 | $this->mLanguageLinks += $newLinkArray; |
209 | 206 | } |
210 | 207 | function setLanguageLinks($newLinkArray) { |
211 | 208 | $this->mLanguageLinks = $newLinkArray; |
212 | 209 | } |
| 210 | + |
213 | 211 | function getCategoryLinks() { |
214 | 212 | return $this->mCategoryLinks; |
215 | 213 | } |
— | — | @@ -226,16 +224,14 @@ |
227 | 225 | function clearHTML() { $this->mBodytext = ''; } |
228 | 226 | function debug( $text ) { $this->mDebugtext .= $text; } |
229 | 227 | |
230 | | - function setParserOptions( $options ) |
231 | | - { |
| 228 | + function setParserOptions( $options ) { |
232 | 229 | return wfSetVar( $this->mParserOptions, $options ); |
233 | 230 | } |
234 | 231 | |
235 | 232 | /** |
236 | 233 | * Convert wikitext to HTML and add it to the buffer |
237 | 234 | */ |
238 | | - function addWikiText( $text, $linestart = true ) |
239 | | - { |
| 235 | + function addWikiText( $text, $linestart = true ) { |
240 | 236 | global $wgParser, $wgTitle; |
241 | 237 | |
242 | 238 | $parserOutput = $wgParser->parse( $text, $wgTitle, $this->mParserOptions, $linestart ); |
— | — | @@ -266,7 +262,11 @@ |
267 | 263 | $this->mCategoryLinks += $parserOutput->getCategoryLinks(); |
268 | 264 | $this->addHTML( $text ); |
269 | 265 | } |
270 | | - |
| 266 | + |
| 267 | + /** |
| 268 | + * @param $article |
| 269 | + * @param $user |
| 270 | + */ |
271 | 271 | function tryParserCache( $article, $user ) { |
272 | 272 | global $wgParserCache; |
273 | 273 | $parserOutput = $wgParserCache->get( $article, $user ); |
— | — | @@ -282,6 +282,7 @@ |
283 | 283 | |
284 | 284 | /** |
285 | 285 | * Set the maximum cache time on the Squid in seconds |
| 286 | + * @param $maxage |
286 | 287 | */ |
287 | 288 | function setSquidMaxage( $maxage ) { |
288 | 289 | $this->mSquidMaxage = $maxage; |
— | — | @@ -289,6 +290,7 @@ |
290 | 291 | |
291 | 292 | /** |
292 | 293 | * Use enableClientCache(false) to force it to send nocache headers |
| 294 | + * @param $state |
293 | 295 | */ |
294 | 296 | function enableClientCache( $state ) { |
295 | 297 | return wfSetVar( $this->mEnableClientCache, $state ); |
— | — | @@ -344,8 +346,7 @@ |
345 | 347 | * Finally, all the text has been munged and accumulated into |
346 | 348 | * the object, let's actually output it: |
347 | 349 | */ |
348 | | - function output() |
349 | | - { |
| 350 | + function output() { |
350 | 351 | global $wgUser, $wgLang, $wgDebugComments, $wgCookieExpiration; |
351 | 352 | global $wgInputEncoding, $wgOutputEncoding, $wgLanguageCode; |
352 | 353 | global $wgDebugRedirects, $wgMimeType, $wgProfiler; |