r87073 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87072‎ | r87073 | r87074 >
Date:13:49, 28 April 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
replace getNextObject calls by getNextDataValue and some tweaks
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_CSV.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_DSV.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_JSONlink.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_RSSlink.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_RSSlink.php
@@ -64,17 +64,17 @@
6565 while ( $row !== false ) {
6666 $creators = array();
6767 $dates = array();
68 - $wikipage = $row[0]->getNextObject(); // get the object
 68+ $wikipage = $row[0]->getNextDataValue(); // get the object
6969 foreach ( $row as $field ) {
7070 // for now we ignore everything but creator and date, later we may
7171 // add more things like geolocs, categories, and even a generic
7272 // mechanism to add whatever you want :)
7373 $req = $field->getPrintRequest();
74 - if ( strtolower( $req->getLabel() ) == "creator" ) {
 74+ if ( strtolower( $req->getLabel() ) == 'creator' ) {
7575 foreach ( $field->getContent() as $entry ) {
7676 $creators[] = $entry->getShortWikiText();
7777 }
78 - } elseif ( ( strtolower( $req->getLabel() ) == "date" ) && ( $req->getTypeID() == "_dat" ) ) {
 78+ } elseif ( ( strtolower( $req->getLabel() ) == 'date' ) && ( $req->getTypeID() == '_dat' ) ) {
7979 foreach ( $field->getContent() as $entry ) {
8080 $dates[] = $entry->getXMLSchemaDate();
8181 }
@@ -112,7 +112,7 @@
113113 foreach ( $items as $item ) {
114114 $result .= $item->text();
115115 }
116 - $result .= "</rdf:RDF>";
 116+ $result .= '</rdf:RDF>';
117117 } else { // just make link to feed
118118 if ( $this->getSearchLabel( $outputmode ) ) {
119119 $label = $this->getSearchLabel( $outputmode );
Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_JSONlink.php
@@ -66,7 +66,7 @@
6767 if ( $pr->getMode() != SMWPrintRequest::PRINT_THIS ) {
6868 $values = array();
6969 $finalvalues = '';
70 - while ( ( $value = $field->getNextObject() ) !== false ) {
 70+ while ( ( $value = $field->getNextDataValue() ) !== false ) {
7171 $finalvalues = '';
7272 switch ( $value->getTypeID() ) {
7373 case '_geo':
Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_CSV.php
@@ -59,10 +59,10 @@
6060 while ( $row = $res->getNext() ) {
6161 $row_items = array();
6262
63 - foreach ( $row as $field ) {
 63+ foreach ( $row as /* SMWResultArray */ $field ) {
6464 $growing = array();
6565
66 - while ( ( $object = $field->getNextObject() ) !== false ) {
 66+ while ( ( $object = $field->getNextDataValue() ) !== false ) {
6767 $growing[] = Sanitizer::decodeCharReferences( $object->getWikiValue() );
6868 }
6969
Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_DSV.php
@@ -89,11 +89,11 @@
9090 $rowItems = array();
9191
9292 // Loop over their fields (properties).
93 - foreach ( $row as $field ) {
 93+ foreach ( $row as /* SMWResultArray */ $field ) {
9494 $itemSegments = array();
9595
9696 // Loop over all values for the property.
97 - while ( ( $object = $field->getNextObject() ) !== false ) {
 97+ while ( ( $object = $field->getNextDataValue() ) !== false ) {
9898 $itemSegments[] = Sanitizer::decodeCharReferences( $object->getWikiValue() );
9999 }
100100

Status & tagging log