http://www.mediawiki.org/wiki/Special:Code/MediaWiki/83575
Revision: 83575 Author: jeroendedauw Date: 2011-03-09 09:13:23 +0000 (Wed, 09 Mar 2011) Log Message: ----------- throwing out stupid one-method classes Modified Paths: -------------- branches/SemanticMaps0.8/includes/queryprinters/SM_MapPrinter.php branches/SemanticMaps0.8/includes/services/GoogleMaps/SM_GoogleMaps.php branches/SemanticMaps0.8/includes/services/GoogleMaps3/SM_GoogleMaps3.php branches/SemanticMaps0.8/includes/services/OpenLayers/SM_OpenLayers.php Removed Paths: ------------- branches/SemanticMaps0.8/includes/services/GoogleMaps/SM_GoogleMapsQP.php branches/SemanticMaps0.8/includes/services/GoogleMaps3/SM_GoogleMaps3QP.php branches/SemanticMaps0.8/includes/services/OpenLayers/SM_OpenLayersQP.php branches/SemanticMaps0.8/includes/services/YahooMaps/SM_YahooMapsQP.php Modified: branches/SemanticMaps0.8/includes/queryprinters/SM_MapPrinter.php =================================================================== --- branches/SemanticMaps0.8/includes/queryprinters/SM_MapPrinter.php 2011-03-09 09:05:13 UTC (rev 83574) +++ branches/SemanticMaps0.8/includes/queryprinters/SM_MapPrinter.php 2011-03-09 09:13:23 UTC (rev 83575) @@ -8,18 +8,9 @@ * * @author Jeroen De Dauw */ -abstract class SMMapPrinter extends SMWResultPrinter { +class SMMapPrinter extends SMWResultPrinter { /** - * Returns the name of the service to get the correct mapping service object. - * - * @since 0.6.3 - * - * @return string - */ - protected abstract function getServiceName(); - - /** * @since 0.6 * * @var iMappingService @@ -47,12 +38,7 @@ * @param $inline * @param $service iMappingService */ - public function __construct( $format, $inline, /* iMappingService */ $service = null ) { - // TODO: this is a hack since I can't find a way to pass along the service object here when the QP is created in SMW. - if ( $service == null ) { - $service = MapsMappingServices::getServiceInstance( $this->getServiceName() ); - } - + public function __construct( $format, $inline, iMappingService $service ) { $this->service = $service; } Modified: branches/SemanticMaps0.8/includes/services/GoogleMaps/SM_GoogleMaps.php =================================================================== --- branches/SemanticMaps0.8/includes/services/GoogleMaps/SM_GoogleMaps.php 2011-03-09 09:05:13 UTC (rev 83574) +++ branches/SemanticMaps0.8/includes/services/GoogleMaps/SM_GoogleMaps.php 2011-03-09 09:13:23 UTC (rev 83575) @@ -30,7 +30,7 @@ // TODO: the if should not be needed, but when omitted, a fatal error occurs cause the class that's extended by this one is not found. if ( defined( 'SF_VERSION' ) ) $wgAutoloadClasses['SMGoogleMapsFormInput'] = dirname( __FILE__ ) . '/SM_GoogleMapsFormInput.php'; - MapsMappingServices::registerServiceFeature( 'googlemaps2', 'qp', 'SMGoogleMapsQP' ); + MapsMappingServices::registerServiceFeature( 'googlemaps2', 'qp', 'SMMapPrinter' ); MapsMappingServices::registerServiceFeature( 'googlemaps2', 'fi', 'SMGoogleMapsFormInput' ); return true; Deleted: branches/SemanticMaps0.8/includes/services/GoogleMaps/SM_GoogleMapsQP.php =================================================================== --- branches/SemanticMaps0.8/includes/services/GoogleMaps/SM_GoogleMapsQP.php 2011-03-09 09:05:13 UTC (rev 83574) +++ branches/SemanticMaps0.8/includes/services/GoogleMaps/SM_GoogleMapsQP.php 2011-03-09 09:13:23 UTC (rev 83575) @@ -1,21 +0,0 @@ -<?php -/** - * A query printer for maps using the Google Maps API. - * - * @file SM_GoogleMapsQP.php - * @ingroup SMGoogleMaps - * - * @author Robert Buzink - * @author Yaron Koren - * @author Jeroen De Dauw - */ -class SMGoogleMapsQP extends SMMapPrinter { - - /** - * @see SMMapPrinter::getServiceName - */ - protected function getServiceName() { - return 'googlemaps2'; - } - -} Modified: branches/SemanticMaps0.8/includes/services/GoogleMaps3/SM_GoogleMaps3.php =================================================================== --- branches/SemanticMaps0.8/includes/services/GoogleMaps3/SM_GoogleMaps3.php 2011-03-09 09:05:13 UTC (rev 83574) +++ branches/SemanticMaps0.8/includes/services/GoogleMaps3/SM_GoogleMaps3.php 2011-03-09 09:13:23 UTC (rev 83575) @@ -27,7 +27,7 @@ $wgAutoloadClasses['SMGoogleMaps3QP'] = dirname( __FILE__ ) . '/SM_GoogleMaps3QP.php'; - MapsMappingServices::registerServiceFeature( 'googlemaps3', 'qp', 'SMGoogleMaps3QP' ); + MapsMappingServices::registerServiceFeature( 'googlemaps3', 'qp', 'SMMapPrinter' ); return true; } Deleted: branches/SemanticMaps0.8/includes/services/GoogleMaps3/SM_GoogleMaps3QP.php =================================================================== --- branches/SemanticMaps0.8/includes/services/GoogleMaps3/SM_GoogleMaps3QP.php 2011-03-09 09:05:13 UTC (rev 83574) +++ branches/SemanticMaps0.8/includes/services/GoogleMaps3/SM_GoogleMaps3QP.php 2011-03-09 09:13:23 UTC (rev 83575) @@ -1,20 +0,0 @@ -<?php -/** - * A query printer for maps using the Google Maps API v3. - * - * @file SM_GoogleMaps3QP.php - * @ingroup SMGoogleMaps3 - * - * @licence GNU GPL v3 - * @author Jeroen De Dauw < jeroended...@gmail.com > - */ -class SMGoogleMaps3QP extends SMMapPrinter { - - /** - * @see SMMapPrinter::getServiceName - */ - protected function getServiceName() { - return 'googlemaps3'; - } - -} Modified: branches/SemanticMaps0.8/includes/services/OpenLayers/SM_OpenLayers.php =================================================================== --- branches/SemanticMaps0.8/includes/services/OpenLayers/SM_OpenLayers.php 2011-03-09 09:05:13 UTC (rev 83574) +++ branches/SemanticMaps0.8/includes/services/OpenLayers/SM_OpenLayers.php 2011-03-09 09:13:23 UTC (rev 83575) @@ -30,7 +30,7 @@ // TODO: the if should not be needed, but when omitted, a fatal error occurs cause the class that's extended by this one is not found. if ( defined( 'SF_VERSION' ) ) $wgAutoloadClasses['SMOpenLayersFormInput'] = dirname( __FILE__ ) . '/SM_OpenLayersFormInput.php'; - MapsMappingServices::registerServiceFeature( 'openlayers', 'qp', 'SMOpenLayersQP' ); + MapsMappingServices::registerServiceFeature( 'openlayers', 'qp', 'SMMapPrinter' ); MapsMappingServices::registerServiceFeature( 'openlayers', 'fi', 'SMOpenLayersFormInput' ); return true; Deleted: branches/SemanticMaps0.8/includes/services/OpenLayers/SM_OpenLayersQP.php =================================================================== --- branches/SemanticMaps0.8/includes/services/OpenLayers/SM_OpenLayersQP.php 2011-03-09 09:05:13 UTC (rev 83574) +++ branches/SemanticMaps0.8/includes/services/OpenLayers/SM_OpenLayersQP.php 2011-03-09 09:13:23 UTC (rev 83575) @@ -1,20 +0,0 @@ -<?php - -/** - * A query printer for maps using the Open Layers API. - * - * @file SM_OpenLayersQP.php - * @ingroup SMOpenLayers - * - * @author Jeroen De Dauw - */ -class SMOpenLayersQP extends SMMapPrinter { - - /** - * @see SMMapPrinter::getServiceName - */ - protected function getServiceName() { - return 'openlayers'; - } - -} Deleted: branches/SemanticMaps0.8/includes/services/YahooMaps/SM_YahooMapsQP.php =================================================================== --- branches/SemanticMaps0.8/includes/services/YahooMaps/SM_YahooMapsQP.php 2011-03-09 09:05:13 UTC (rev 83574) +++ branches/SemanticMaps0.8/includes/services/YahooMaps/SM_YahooMapsQP.php 2011-03-09 09:13:23 UTC (rev 83575) @@ -1,20 +0,0 @@ -<?php - -/** - * A query printer for maps using the Yahoo Maps API. - * - * @file SM_YahooMapsQP.php - * @ingroup SMYahooMaps - * - * @author Jeroen De Dauw - */ -class SMYahooMapsQP extends SMMapPrinter { - - /** - * @see SMMapPrinter::getServiceName - */ - protected function getServiceName() { - return 'yahoomaps'; - } - -} _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs