r5265 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r5264‎ | r5265 | r5266 >
Date:15:24, 17 September 2004
Author:hashar
Status:old
Tags:
Comment:
some comments / code foobar () { schemas
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -36,14 +36,17 @@
3737 var $mShowFeedLinks = false;
3838 var $mEnableClientCache = true;
3939
40 - function OutputPage()
41 - {
 40+ /**
 41+ * Constructor
 42+ * Initialise private variables
 43+ */
 44+ function OutputPage() {
4245 $this->mHeaders = $this->mCookies = $this->mMetatags =
4346 $this->mKeywords = $this->mLinktags = array();
4447 $this->mHTMLtitle = $this->mPagetitle = $this->mBodytext =
4548 $this->mRedirect = $this->mLastModified =
4649 $this->mSubtitle = $this->mDebugtext = $this->mRobotpolicy =
47 - $this->mOnloadHandler = "";
 50+ $this->mOnloadHandler = '';
4851 $this->mIsArticleRelated = $this->mIsarticle = $this->mPrintable = true;
4952 $this->mSuppressQuickbar = $this->mPrintable = false;
5053 $this->mLanguageLinks = array();
@@ -52,10 +55,10 @@
5356 $this->mContainsOldMagic = $this->mContainsNewMagic = 0;
5457 $this->mParserOptions = ParserOptions::newFromUser( $temp = NULL );
5558 $this->mSquidMaxage = 0;
56 - $this->mScripts = "";
 59+ $this->mScripts = '';
5760 }
5861
59 - function addHeader( $name, $val ) { array_push( $this->mHeaders, "$name: $val" ) ; }
 62+ function addHeader( $name, $val ) { array_push( $this->mHeaders, $name.': '.$val ) ; }
6063 function addCookie( $name, $val ) { array_push( $this->mCookies, array( $name, $val ) ); }
6164 function redirect( $url, $responsecode = '302' ) { $this->mRedirect = $url; $this->mRedirectCode = $responsecode; }
6265
@@ -84,8 +87,7 @@
8588 * any future call to OutputPage->output() have no effect. The method
8689 * returns true iff cache-ok headers was sent.
8790 */
88 - function checkLastModified ( $timestamp )
89 - {
 91+ function checkLastModified ( $timestamp ) {
9092 global $wgLang, $wgCachePages, $wgUser;
9193 $timestamp=wfTimestamp(TS_MW,$timestamp);
9294 if( !$wgCachePages ) {
@@ -102,7 +104,7 @@
103105 return;
104106 }
105107
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';
107109
108110 if( !empty( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) {
109111 # IE sends sizes after the date like this:
@@ -155,6 +157,7 @@
156158 return '';
157159 }
158160 }
 161+
159162 function setRobotpolicy( $str ) { $this->mRobotpolicy = $str; }
160163 function setHTMLTitle( $name ) {$this->mHTMLtitle = $name; }
161164 function setPageTitle( $name ) {
@@ -181,8 +184,7 @@
182185 function getOnloadHandler() { return $this->mOnloadHandler; }
183186 function disable() { $this->mDoNothing = true; }
184187
185 - function setArticleRelated( $v )
186 - {
 188+ function setArticleRelated( $v ) {
187189 $this->mIsArticleRelated = $v;
188190 if ( !$v ) {
189191 $this->mIsarticle = false;
@@ -195,20 +197,16 @@
196198 }
197199 }
198200
199 - function isArticleRelated()
200 - {
201 - return $this->mIsArticleRelated;
202 - }
 201+ function isArticleRelated() { return $this->mIsArticleRelated; }
203202
204 - function getLanguageLinks() {
205 - return $this->mLanguageLinks;
206 - }
 203+ function getLanguageLinks() { return $this->mLanguageLinks; }
207204 function addLanguageLinks($newLinkArray) {
208205 $this->mLanguageLinks += $newLinkArray;
209206 }
210207 function setLanguageLinks($newLinkArray) {
211208 $this->mLanguageLinks = $newLinkArray;
212209 }
 210+
213211 function getCategoryLinks() {
214212 return $this->mCategoryLinks;
215213 }
@@ -226,16 +224,14 @@
227225 function clearHTML() { $this->mBodytext = ''; }
228226 function debug( $text ) { $this->mDebugtext .= $text; }
229227
230 - function setParserOptions( $options )
231 - {
 228+ function setParserOptions( $options ) {
232229 return wfSetVar( $this->mParserOptions, $options );
233230 }
234231
235232 /**
236233 * Convert wikitext to HTML and add it to the buffer
237234 */
238 - function addWikiText( $text, $linestart = true )
239 - {
 235+ function addWikiText( $text, $linestart = true ) {
240236 global $wgParser, $wgTitle;
241237
242238 $parserOutput = $wgParser->parse( $text, $wgTitle, $this->mParserOptions, $linestart );
@@ -266,7 +262,11 @@
267263 $this->mCategoryLinks += $parserOutput->getCategoryLinks();
268264 $this->addHTML( $text );
269265 }
270 -
 266+
 267+ /**
 268+ * @param $article
 269+ * @param $user
 270+ */
271271 function tryParserCache( $article, $user ) {
272272 global $wgParserCache;
273273 $parserOutput = $wgParserCache->get( $article, $user );
@@ -282,6 +282,7 @@
283283
284284 /**
285285 * Set the maximum cache time on the Squid in seconds
 286+ * @param $maxage
286287 */
287288 function setSquidMaxage( $maxage ) {
288289 $this->mSquidMaxage = $maxage;
@@ -289,6 +290,7 @@
290291
291292 /**
292293 * Use enableClientCache(false) to force it to send nocache headers
 294+ * @param $state
293295 */
294296 function enableClientCache( $state ) {
295297 return wfSetVar( $this->mEnableClientCache, $state );
@@ -344,8 +346,7 @@
345347 * Finally, all the text has been munged and accumulated into
346348 * the object, let's actually output it:
347349 */
348 - function output()
349 - {
 350+ function output() {
350351 global $wgUser, $wgLang, $wgDebugComments, $wgCookieExpiration;
351352 global $wgInputEncoding, $wgOutputEncoding, $wgLanguageCode;
352353 global $wgDebugRedirects, $wgMimeType, $wgProfiler;

Status & tagging log