r66351 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66350‎ | r66351 | r66352 >
Date:15:01, 13 May 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Added aliasing support to the getResultFormat function query processor
Modified paths:
  • /trunk/extensions/SemanticCompoundQueries/SCQ_QueryProcessor.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticCompoundQueries/SCQ_QueryProcessor.php
@@ -111,9 +111,17 @@
112112 $format = 'auto';
113113 if ( array_key_exists( 'format', $params ) ) {
114114 $format = strtolower( trim( $params['format'] ) );
115 - global $smwgResultFormats;
 115+ global $smwgResultAliases, $smwgResultFormats;
116116 if ( !array_key_exists( $format, $smwgResultFormats ) ) {
117 - $format = 'auto'; // If it is an unknown format, defaults to list/table again
 117+ $is_alias = false;
 118+ foreach ( $smwgResultAliases as $main_format => $aliases ) {
 119+ if ( in_array( $format, $aliases ) ) {
 120+ $format = $main_format;
 121+ $is_alias = true;
 122+ break;
 123+ }
 124+ }
 125+ if ( !$is_alias ) $format = 'auto'; // If it is an unknown format, defaults to list/table again
118126 }
119127 }
120128 return $format;

Status & tagging log