r82957 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82956‎ | r82957 | r82958 >
Date:20:53, 28 February 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
== true, really? >_>
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_CSV.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_CSV.php
@@ -42,28 +42,35 @@
4343
4444 protected function getResultText( $res, $outputmode ) {
4545 $result = '';
 46+
4647 if ( $outputmode == SMW_OUTPUT_FILE ) { // make CSV file
4748 $csv = fopen( 'php://temp', 'r+' );
48 - if ( $this->mShowHeaders == true ) {
 49+
 50+ if ( $this->mShowHeaders ) {
4951 $header_items = array();
 52+
5053 foreach ( $res->getPrintRequests() as $pr ) {
5154 $header_items[] = $pr->getLabel();
5255 }
 56+
5357 fputcsv( $csv, $header_items, $this->m_sep );
5458 }
 59+
5560 while ( $row = $res->getNext() ) {
5661 $row_items = array();
 62+
5763 foreach ( $row as $field ) {
5864 $growing = array();
 65+
5966 while ( ( $object = $field->getNextObject() ) !== false ) {
60 - $text = Sanitizer::decodeCharReferences( $object->getWikiValue() );
61 - // decode: CSV knows nothing of possible HTML entities
62 - $growing[] = $text;
63 - } // while...
 67+ $growing[] = Sanitizer::decodeCharReferences( $object->getWikiValue() );
 68+ }
 69+
6470 $row_items[] = implode( ',', $growing );
65 - } // foreach...
 71+ }
 72+
6673 fputcsv( $csv, $row_items, $this->m_sep );
67 - } // while...
 74+ }
6875
6976 rewind( $csv );
7077 $result .= stream_get_contents( $csv );

Status & tagging log