http://www.mediawiki.org/wiki/Special:Code/MediaWiki/72082
Revision: 72082
Author: jeroendedauw
Date: 2010-09-01 06:01:13 +0000 (Wed, 01 Sep 2010)
Log Message:
-----------
Follow up to r72081
Modified Paths:
--------------
trunk/extensions/Maps/Maps.php
Added Paths:
-----------
trunk/extensions/Maps/Includes/iMappingFeature.php
trunk/extensions/Maps/Includes/iMappingParserFunction.php
Removed Paths:
-------------
trunk/extensions/Maps/Maps_ParserFunctions.php
trunk/extensions/Maps/iMappingFeature.php
trunk/extensions/Maps/iMappingParserFunction.php
Copied: trunk/extensions/Maps/Includes/iMappingFeature.php (from rev 72081,
trunk/extensions/Maps/iMappingFeature.php)
===================================================================
--- trunk/extensions/Maps/Includes/iMappingFeature.php
(rev 0)
+++ trunk/extensions/Maps/Includes/iMappingFeature.php 2010-09-01 06:01:13 UTC
(rev 72082)
@@ -0,0 +1,34 @@
+<?php
+
+/**
+ * Interface that should be implemented by all mapping features that want to
use the.
+ *
+ * @since 0.6.5
+ *
+ * @file iMappingFeature.php
+ * @ingroup Maps
+ *
+ * @author Jeroen De Dauw
+ */
+interface iMappingFeature {
+
+ /**
+ * Adds the HTML specific to the mapping service to the output.
+ *
+ * @since 0.6.5
+ *
+ * @return string
+ */
+ function addSpecificMapHTML();
+
+ /**
+ * Returns the specific parameters by first checking if they have been
initialized yet,
+ * doing to work if this is not the case, and then returning them.
+ *
+ * @since 0.6.5
+ *
+ * @return array
+ */
+ function getSpecificParameterInfo();
+
+}
\ No newline at end of file
Copied: trunk/extensions/Maps/Includes/iMappingParserFunction.php (from rev
72081, trunk/extensions/Maps/iMappingParserFunction.php)
===================================================================
--- trunk/extensions/Maps/Includes/iMappingParserFunction.php
(rev 0)
+++ trunk/extensions/Maps/Includes/iMappingParserFunction.php 2010-09-01
06:01:13 UTC (rev 72082)
@@ -0,0 +1,33 @@
+<?php
+
+/**
+ * Interface that should be implemented by all map display parser functions.
+ *
+* @since 0.6.3
+ *
+ * @file iMappingParserFunction.php
+ * @ingroup Maps
+ *
+ * @author Jeroen De Dauw
+ */
+interface iMappingParserFunction extends iMappingFeature {
+
+ /**
+ * Constructor.
+ *
+ * @param iMappingService $service
+ */
+ function __construct( iMappingService $service );
+
+ /**
+ * Method that serves as the parser function handler.
+ * It's responsible for executing all needed logic, and then creating
the map output.
+ *
+ * @param Parser $parser
+ * @param array $params
+ *
+ * @return array
+ */
+ function getMapHtml( Parser &$parser, array $params );
+
+}
\ No newline at end of file
Modified: trunk/extensions/Maps/Maps.php
===================================================================
--- trunk/extensions/Maps/Maps.php 2010-09-01 05:56:16 UTC (rev 72081)
+++ trunk/extensions/Maps/Maps.php 2010-09-01 06:01:13 UTC (rev 72082)
@@ -101,13 +101,6 @@
$wgAutoloadClasses['MapsGeocoders'] = $incDir .
'Maps_Geocoders.php';
$wgAutoloadClasses['MapsGeocoder'] =
$incDir . 'Maps_Geocoder.php';
- # General function support, required for #display_map and
#display_point(s).
- include_once $egMapsDir . 'Features/Maps_ParserFunctions.php';
- # Required for #display_map.
- include_once $egMapsDir .
'Features/DisplayMap/Maps_DisplayMap.php';
- # Required for #display_point and #display_points.
- include_once $egMapsDir .
'Features/DisplayPoint/Maps_DisplayPoint.php';
-
// Geocoders at "Includes/Geocoders/".
$geoDir = $incDir . 'Geocoders/';
$wgAutoloadClasses['MapsGeonamesGeocoder'] = $geoDir .
'Maps_GeonamesGeocoder.php';
@@ -138,7 +131,7 @@
wfRunHooks( 'MappingServiceLoad' );
// Load the feature classes and interfaces.
- require_once $egMapsDir . 'Features/iMappingFeature.php';
+ require_once $egMapsDir . 'Includes/iMappingFeature.php';
include_once $egMapsDir . 'Includes/iMappingParserFunction.php';
wfRunHooks( 'MappingFeatureLoad' );
Deleted: trunk/extensions/Maps/Maps_ParserFunctions.php
===================================================================
--- trunk/extensions/Maps/Maps_ParserFunctions.php 2010-09-01 05:56:16 UTC
(rev 72081)
+++ trunk/extensions/Maps/Maps_ParserFunctions.php 2010-09-01 06:01:13 UTC
(rev 72082)
@@ -1,139 +0,0 @@
-<?php
-
-/**
- * Initialization file for parser function functionality in the Maps extension.
- * Also contains a common handler for map display parser functions which does
- * service, geoservice and coordinates resolving, and then passes the
parameters
- * to the relevant parser function class.
- *
- * @file Maps_ParserFunctions.php
- * @ingroup Maps
- *
- * @author Jeroen De Dauw
- */
-
-/**
- * A class that holds handlers for the mapping parser functions.
- *
- * @author Jeroen De Dauw
- */
-final class MapsParserFunctions {
-
- /**
- * Initialize the parser functions feature. This function handles the
parser function hook,
- * and will load the required classes.
- *
- * @return true
- */
- public static function initialize() {
- global $egMapsFeatures;
-
- include_once dirname( __FILE__ ) .
'/iMappingParserFunction.php';
-
- // This runs a small hook that enables parser functions to run
initialization code.
- foreach ( $egMapsFeatures['pf'] as $hook ) {
- if ( strpos( $hook, '::' ) !== false ) {
- $hook = explode( '::', $hook );
- }
-
- call_user_func( $hook );
- }
-
- return true;
- }
-
- /**
- * Returns the output for the call to the specified parser function.
- *
- * @param Parser $parser
- * @param array $params
- * @param string $parserFunction
- *
- * @return array
- */
- public static function getMapHtml( Parser &$parser, array $args,
$parserFunction ) {
- global $egValidatorFatalLevel;
-
- array_shift( $args ); // We already know the $parser.
-
- $parameters = array();
- $setService = false;
-
- foreach ( $args as $arg ) {
- $split = explode( '=', $arg );
- $name = strtolower( trim( array_shift( $split ) ) );
-
- if ( count( $split ) > 0 && self::inParamAliases(
$name, 'mappingservice', MapsMapper::getCommonParameters() ) ) {
- if ( !$setService ) {
- $serviceName = implode( '=', $split );
- $parameters[] = 'mappingservice=' .
$serviceName;
- $setService = true;
- }
- } else {
- $parameters[] = $arg;
- }
- }
-
- // Get the instance of the service class.
- $service = MapsMappingServices::getValidServiceInstance(
$setService ? $serviceName : '', $parserFunction );
-
- // Get an instance of the class handling the current parser
function and service.
- $mapClass = $service->getFeatureInstance( $parserFunction );
-
- /*
- * Assembliy of the allowed parameters and their information.
- * The main parameters (the ones that are shared by everything)
are overidden
- * by the feature parameters (the ones specific to a feature).
The result is then
- * again overidden by the service parameters (the ones specific
to the service),
- * and finally by the specific parameters (the ones specific to
a service-feature combination).
- */
- $parameterInfo = array_merge_recursive(
MapsMapper::getCommonParameters(), $mapClass->getFeatureParameters() );
- $parameterInfo = array_merge_recursive( $parameterInfo,
$service->getParameterInfo() );
- $parameterInfo = array_merge_recursive( $parameterInfo,
$mapClass->getSpecificParameterInfo() );
-
- $manager = new ValidatorManager();
-
- $displayMap = $manager->manageParameters(
- $parameters,
- $parameterInfo,
- array( 'coordinates' )
- );
-
- if ( $displayMap ) {
- // Call the function according to the map service to get the HTML
output.
- $output = $mapClass->getMapHtml( $parser, $manager->getParameters(
false ) ) . $manager->getErrorList();
- } else {
- // TODO: Get failiures
- if ( $egValidatorFatalLevel == Validator_ERRORS_WARN ) {
- $output .= htmlspecialchars( wfMsg( '' ) );
- } elseif ( $egValidatorFatalLevel > Validator_ERRORS_WARN ) {
- $output .= htmlspecialchars( wfMsg( '' ) );
- }
- }
-
- // Return the result.
- return array( $output, 'noparse' => true, 'isHTML' => true );
- }
-
- /**
- * Gets if a provided name is present in the aliases array of a
parameter
- * name in the $mainParams array.
- *
- * @param string $name The name you want to check for.
- * @param string $mainParamName The main parameter name.
- * @param array $paramInfo Contains meta data, including aliases, of
the possible parameters.
- * @param boolean $compareMainName Boolean indicating wether the main
name should also be compared.
- *
- * @return boolean
- */
- public static function inParamAliases( $name, $mainParamName, array
$paramInfo = array(), $compareMainName = true ) {
- $equals = $compareMainName && $mainParamName == $name;
-
- if ( !$equals && array_key_exists( $mainParamName, $paramInfo )
) {
- $equals = in_array( $name,
$paramInfo[$mainParamName]['aliases'] );
- }
-
- return $equals;
- }
-
-}
\ No newline at end of file
Deleted: trunk/extensions/Maps/iMappingFeature.php
===================================================================
--- trunk/extensions/Maps/iMappingFeature.php 2010-09-01 05:56:16 UTC (rev
72081)
+++ trunk/extensions/Maps/iMappingFeature.php 2010-09-01 06:01:13 UTC (rev
72082)
@@ -1,34 +0,0 @@
-<?php
-
-/**
- * Interface that should be implemented by all mapping features that want to
use the.
- *
- * @since 0.6.5
- *
- * @file iMappingFeature.php
- * @ingroup Maps
- *
- * @author Jeroen De Dauw
- */
-interface iMappingFeature {
-
- /**
- * Adds the HTML specific to the mapping service to the output.
- *
- * @since 0.6.5
- *
- * @return string
- */
- function addSpecificMapHTML();
-
- /**
- * Returns the specific parameters by first checking if they have been
initialized yet,
- * doing to work if this is not the case, and then returning them.
- *
- * @since 0.6.5
- *
- * @return array
- */
- function getSpecificParameterInfo();
-
-}
\ No newline at end of file
Deleted: trunk/extensions/Maps/iMappingParserFunction.php
===================================================================
--- trunk/extensions/Maps/iMappingParserFunction.php 2010-09-01 05:56:16 UTC
(rev 72081)
+++ trunk/extensions/Maps/iMappingParserFunction.php 2010-09-01 06:01:13 UTC
(rev 72082)
@@ -1,33 +0,0 @@
-<?php
-
-/**
- * Interface that should be implemented by all map display parser functions.
- *
-* @since 0.6.3
- *
- * @file iMappingParserFunction.php
- * @ingroup Maps
- *
- * @author Jeroen De Dauw
- */
-interface iMappingParserFunction extends iMappingFeature {
-
- /**
- * Constructor.
- *
- * @param iMappingService $service
- */
- function __construct( iMappingService $service );
-
- /**
- * Method that serves as the parser function handler.
- * It's responsible for executing all needed logic, and then creating
the map output.
- *
- * @param Parser $parser
- * @param array $params
- *
- * @return array
- */
- function getMapHtml( Parser &$parser, array $params );
-
-}
\ No newline at end of file
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs