r109782 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109781‎ | r109782 | r109783 >
Date:23:28, 22 January 2012
Author:yaron
Status:deferred
Tags:
Comment:
Improved comments and some formatting
Modified paths:
  • /trunk/extensions/SemanticResultFormats/Calendar/SRF_Calendar.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/Calendar/SRF_Calendar.php
@@ -24,8 +24,8 @@
2525
2626 if ( $params['lang'] !== false ) {
2727 global $wgLang;
28 - // store the actual user's language, so we can revert
29 - // back to it after printing the calendar
 28+ // Store the actual user's language, so we can revert
 29+ // back to it after printing the calendar.
3030 $this->mRealUserLang = clone ( $wgLang );
3131 $wgLang = Language::factory( trim( $params['lang'] ) );
3232 }
@@ -39,7 +39,7 @@
4040 $this->isHTML = false;
4141 $this->hasTemplates = false;
4242
43 - // skip checks, results with 0 entries are normal
 43+ // Skip checks - results with 0 entries are normal.
4444 $this->handleParameters( $params, $outputmode );
4545 return $this->getResultText( $results, SMW_OUTPUT_HTML );
4646 }
@@ -53,12 +53,13 @@
5454 protected function getResultText( SMWQueryResult $res, $outputmode ) {
5555 $events = array();
5656
57 - // print all result rows
 57+ // Print all result rows.
5858 while ( $row = $res->getNext() ) {
5959 $dates = array();
6060 $title = $text = $color = '';
6161
62 - if ( $this->mTemplate != '' ) { // build template code
 62+ if ( $this->mTemplate != '' ) {
 63+ // Build template code
6364 $this->hasTemplates = true;
6465
6566 if ( $this->mUserParam ) {
@@ -88,21 +89,22 @@
8990 }
9091 }
9192 }
92 - } else { // build simple text
 93+ } else {
 94+ // Build simple text.
9395 $numNonDateProperties = 0;
94 - // cycle through a 'row', which is the page
 96+ // Cycle through a 'row', which is the page
9597 // name (the first field) plus all its
96 - // properties
 98+ // properties.
9799 foreach ( $row as $i => $field ) {
98100 $pr = $field->getPrintRequest();
99 - // a property can have more than one
 101+ // A property can have more than one
100102 // value - cycle through all the values
101 - // for this property
 103+ // for this property.
102104 $textForProperty = '';
103105
104106 while ( ( $object = $field->getNextDataValue() ) !== false ) {
105107 if ( $object->getTypeID() == '_dat' ) {
106 - // don't add date values to the display
 108+ // Don't add date values to the display.
107109 } elseif ( $object->getTypeID() == '_wpg' ) { // use shorter "LongText" for wikipage
108110 if ( $i == 0 ) {
109111 $title = Title::newFromText( $object->getShortWikiText( false ) );
@@ -116,7 +118,7 @@
117119 $textForProperty .= $pr->getLabel() . ' ';
118120 }
119121
120 - // if $this->mShowHeaders == SMW_HEADERS_HIDE, print nothing
 122+ // If $this->mShowHeaders == SMW_HEADERS_HIDE, print nothing.
121123 // handling of "link=" param
122124 if ( $this->mLinkOthers ) {
123125 $textForProperty .= $object->getLongText( $outputmode, smwfGetLinker() );
@@ -133,9 +135,9 @@
134136 }
135137 }
136138
137 - // add the text for this property to
 139+ // Add the text for this property to
138140 // the main text, adding on parentheses
139 - // or commas as needed
 141+ // or commas as needed.
140142 if ( $numNonDateProperties == 1 ) {
141143 $text .= ' (';
142144 } elseif ( $numNonDateProperties > 1 ) {
@@ -149,8 +151,8 @@
150152 }
151153
152154 if ( count( $dates ) > 0 ) {
153 - // handle the 'color=' value, whether it came
154 - // from a compound query or a regular one
 155+ // Handle the 'color=' value, whether it came
 156+ // from a compound query or a regular one.
155157 // handling is different for SMW 1.5+
156158 $realFunction = array( $field, 'getResultSubject' );
157159 if ( is_callable( $realFunction ) ) {
@@ -176,8 +178,8 @@
177179
178180 $result = $this->displayCalendar( $events );
179181
180 - // go back to the actual user's language, in case a different
181 - // language had been specified for this calendar
 182+ // Go back to the actual user's language, in case a different
 183+ // language had been specified for this calendar.
182184 if ( ! is_null( $this->mRealUserLang ) ) {
183185 global $wgLang;
184186 $wgLang = $this->mRealUserLang;
@@ -187,8 +189,7 @@
188190
189191 if ( is_null( $wgParser->getTitle() ) ) {
190192 return $result;
191 - }
192 - else {
 193+ } else {
193194 return array( $result, 'noparse' => 'true', 'isHTML' => 'true' );
194195 }
195196 }