r90555 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90554‎ | r90555 | r90556 >
Date:22:06, 21 June 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
follow up to r90554
Modified paths:
  • /trunk/extensions/SemanticResultFormats/iCalendar/SRF_iCalendar.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/iCalendar/SRF_iCalendar.php
@@ -167,28 +167,27 @@
168168 $location = '';
169169 $description = '';
170170
171 - foreach ( $row as $field ) {
 171+ foreach ( $row as /* SMWResultArray */ $field ) {
172172 // later we may add more things like a generic
173173 // mechanism to add whatever you want :)
174174 // could include funny things like geo, description etc. though
175175 $req = $field->getPrintRequest();
176 - if ( ( strtolower( $req->getLabel() ) == "start" ) && ( $req->getTypeID() == "_dat" ) ) {
177 - $startdate = current( $field->getContent() ); // save only the first
178 - }
 176+ $label = strtolower( $req->getLabel() );
179177
180 - if ( ( strtolower( $req->getLabel() ) == 'end' ) && ( $req->getTypeID() == '_dat' ) ) {
181 - $enddate = current( $field->getContent() ); // save only the first
 178+ if ( $label == 'start' && $req->getTypeID() == '_dat' ) {
 179+ $startdate = efSRFGetNextDV( $field ); // save only the first
182180 }
183 -
184 - if ( strtolower( $req->getLabel() ) == 'location' ) {
185 - $value = current( $field->getContent() ); // save only the first
 181+ else if ( $label == 'end' && $req->getTypeID() == '_dat' ) {
 182+ $enddate = efSRFGetNextDV( $field ); // save only the first
 183+ }
 184+ else if ( $label == 'location' ) {
 185+ $value = efSRFGetNextDV( $field ); // save only the first
186186 if ( $value !== false ) {
187187 $location = $value->getShortWikiText();
188188 }
189189 }
190 -
191 - if ( strtolower( $req->getLabel() ) == 'description' ) {
192 - $value = current( $field->getContent() ); // save only the first
 190+ else if ( $label == 'description' ) {
 191+ $value = efSRFGetNextDV( $field ); // save only the first
193192 if ( $value !== false ) {
194193 $description = $value->getShortWikiText();
195194 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r90554fix compat issue spotted by André Kelpejeroendedauw21:57, 21 June 2011