r74251 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74250‎ | r74251 | r74252 >
Date:14:19, 4 October 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.7 - fixed issue with default query printer overriding
Modified paths:
  • /trunk/extensions/SemanticMaps/includes/SM_GeoCoordsValue.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/includes/SM_GeoCoordsValue.php
@@ -34,28 +34,34 @@
3535 public static function addGeoCoordsDefaultFormat( &$format, array $printRequests, array $params ) {
3636 // Only set the format when not set yet. This allows other extensions to override the Semantic Maps behaviour.
3737 if ( $format === false ) {
38 - $allCoords = true;
39 - $hasNonPage = false;
40 -
41 - // Loop through the print requests to determine their types.
42 - foreach( $printRequests as $printRequest ) {
43 - $typeId = $printRequest->getTypeID();
 38+ // Only apply when there is more then one print request.
 39+ // This way requests comming from #show are ignored.
 40+ if ( count( $printRequests ) > 1 ) {
 41+ $allCoords = true;
 42+ $first = true;
4443
45 - // Ignore the page type.
46 - if ( $typeId != '_wpg' ) {
47 - $hasNonPage = true;
 44+ // Loop through the print requests to determine their types.
 45+ foreach( $printRequests as $printRequest ) {
 46+ // Skip the first request, as it's the object.
 47+ if ( $first ) {
 48+ $first = false;
 49+ continue;
 50+ }
4851
 52+ $typeId = $printRequest->getTypeID();
 53+
4954 if ( $typeId != '_geo' ) {
5055 $allCoords = false;
5156 break;
5257 }
5358 }
 59+
 60+ // If they are all coordinates, set the result format to 'map'.
 61+ if ( $allCoords ) {
 62+ $format = 'map';
 63+ }
5464 }
55 -
56 - // If they are all coordinates, set the result format to 'map'.
57 - if ( $allCoords && $hasNonPage ) {
58 - $format = 'map';
59 - }
 65+
6066 }
6167
6268 return true;

Status & tagging log