Index: trunk/extensions/SemanticResultFormats/Calendar/SRF_Calendar.php |
— | — | @@ -24,8 +24,8 @@ |
25 | 25 | |
26 | 26 | if ( $params['lang'] !== false ) { |
27 | 27 | 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. |
30 | 30 | $this->mRealUserLang = clone ( $wgLang ); |
31 | 31 | $wgLang = Language::factory( trim( $params['lang'] ) ); |
32 | 32 | } |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | $this->isHTML = false; |
41 | 41 | $this->hasTemplates = false; |
42 | 42 | |
43 | | - // skip checks, results with 0 entries are normal |
| 43 | + // Skip checks - results with 0 entries are normal. |
44 | 44 | $this->handleParameters( $params, $outputmode ); |
45 | 45 | return $this->getResultText( $results, SMW_OUTPUT_HTML ); |
46 | 46 | } |
— | — | @@ -53,12 +53,13 @@ |
54 | 54 | protected function getResultText( SMWQueryResult $res, $outputmode ) { |
55 | 55 | $events = array(); |
56 | 56 | |
57 | | - // print all result rows |
| 57 | + // Print all result rows. |
58 | 58 | while ( $row = $res->getNext() ) { |
59 | 59 | $dates = array(); |
60 | 60 | $title = $text = $color = ''; |
61 | 61 | |
62 | | - if ( $this->mTemplate != '' ) { // build template code |
| 62 | + if ( $this->mTemplate != '' ) { |
| 63 | + // Build template code |
63 | 64 | $this->hasTemplates = true; |
64 | 65 | |
65 | 66 | if ( $this->mUserParam ) { |
— | — | @@ -88,21 +89,22 @@ |
89 | 90 | } |
90 | 91 | } |
91 | 92 | } |
92 | | - } else { // build simple text |
| 93 | + } else { |
| 94 | + // Build simple text. |
93 | 95 | $numNonDateProperties = 0; |
94 | | - // cycle through a 'row', which is the page |
| 96 | + // Cycle through a 'row', which is the page |
95 | 97 | // name (the first field) plus all its |
96 | | - // properties |
| 98 | + // properties. |
97 | 99 | foreach ( $row as $i => $field ) { |
98 | 100 | $pr = $field->getPrintRequest(); |
99 | | - // a property can have more than one |
| 101 | + // A property can have more than one |
100 | 102 | // value - cycle through all the values |
101 | | - // for this property |
| 103 | + // for this property. |
102 | 104 | $textForProperty = ''; |
103 | 105 | |
104 | 106 | while ( ( $object = $field->getNextDataValue() ) !== false ) { |
105 | 107 | if ( $object->getTypeID() == '_dat' ) { |
106 | | - // don't add date values to the display |
| 108 | + // Don't add date values to the display. |
107 | 109 | } elseif ( $object->getTypeID() == '_wpg' ) { // use shorter "LongText" for wikipage |
108 | 110 | if ( $i == 0 ) { |
109 | 111 | $title = Title::newFromText( $object->getShortWikiText( false ) ); |
— | — | @@ -116,7 +118,7 @@ |
117 | 119 | $textForProperty .= $pr->getLabel() . ' '; |
118 | 120 | } |
119 | 121 | |
120 | | - // if $this->mShowHeaders == SMW_HEADERS_HIDE, print nothing |
| 122 | + // If $this->mShowHeaders == SMW_HEADERS_HIDE, print nothing. |
121 | 123 | // handling of "link=" param |
122 | 124 | if ( $this->mLinkOthers ) { |
123 | 125 | $textForProperty .= $object->getLongText( $outputmode, smwfGetLinker() ); |
— | — | @@ -133,9 +135,9 @@ |
134 | 136 | } |
135 | 137 | } |
136 | 138 | |
137 | | - // add the text for this property to |
| 139 | + // Add the text for this property to |
138 | 140 | // the main text, adding on parentheses |
139 | | - // or commas as needed |
| 141 | + // or commas as needed. |
140 | 142 | if ( $numNonDateProperties == 1 ) { |
141 | 143 | $text .= ' ('; |
142 | 144 | } elseif ( $numNonDateProperties > 1 ) { |
— | — | @@ -149,8 +151,8 @@ |
150 | 152 | } |
151 | 153 | |
152 | 154 | 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. |
155 | 157 | // handling is different for SMW 1.5+ |
156 | 158 | $realFunction = array( $field, 'getResultSubject' ); |
157 | 159 | if ( is_callable( $realFunction ) ) { |
— | — | @@ -176,8 +178,8 @@ |
177 | 179 | |
178 | 180 | $result = $this->displayCalendar( $events ); |
179 | 181 | |
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. |
182 | 184 | if ( ! is_null( $this->mRealUserLang ) ) { |
183 | 185 | global $wgLang; |
184 | 186 | $wgLang = $this->mRealUserLang; |
— | — | @@ -187,8 +189,7 @@ |
188 | 190 | |
189 | 191 | if ( is_null( $wgParser->getTitle() ) ) { |
190 | 192 | return $result; |
191 | | - } |
192 | | - else { |
| 193 | + } else { |
193 | 194 | return array( $result, 'noparse' => 'true', 'isHTML' => 'true' ); |
194 | 195 | } |
195 | 196 | } |