http://www.mediawiki.org/wiki/Special:Code/MediaWiki/60378

Revision: 60378
Author:   jeroendedauw
Date:     2009-12-24 23:28:49 +0000 (Thu, 24 Dec 2009)

Log Message:
-----------
Changes for 0.5.1. Modified parameter definitions to work Validator 0.2.

Modified Paths:
--------------
    trunk/extensions/Maps/GoogleMaps/Maps_GoogleMaps.php
    trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispMap.php
    trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispPoint.php
    trunk/extensions/Maps/Maps.php
    trunk/extensions/Maps/Maps_Mapper.php
    trunk/extensions/Maps/Maps_Utils.php
    trunk/extensions/Maps/YahooMaps/Maps_YahooMaps.php
    trunk/extensions/Maps/YahooMaps/Maps_YahooMapsDispMap.php
    trunk/extensions/Maps/YahooMaps/Maps_YahooMapsDispPoint.php

Modified: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMaps.php
===================================================================
--- trunk/extensions/Maps/GoogleMaps/Maps_GoogleMaps.php        2009-12-24 
23:24:43 UTC (rev 60377)
+++ trunk/extensions/Maps/GoogleMaps/Maps_GoogleMaps.php        2009-12-24 
23:28:49 UTC (rev 60378)
@@ -71,7 +71,7 @@
                                                'in_array' => $allowedTypes     
        
                                                ),
                                        'default' => $egMapsGoogleMapsType,
-                                       'output-type' => array('gmaptype')      
                                                                                
+                                       'output-type' => 'gmaptype'             
                                                                
                                        ),
                                'types' => array(
                                        'type' => array('string', 'list'),
@@ -84,11 +84,9 @@
                                        ),
                                'autozoom' => array(
                                        'type' => 'boolean',
-                                       'aliases' => array('auto zoom', 'mouse 
zoom', 'mousezoom'),
-                                       'criteria' => array(
-                                               'in_array' => array('on', 
'off', 'yes', 'no')   
-                                               ),              
-                                       'default' => $egMapsGoogleAutozoom      
                                                                        
+                                       'aliases' => array('auto zoom', 'mouse 
zoom', 'mousezoom'),     
+                                       'default' => $egMapsGoogleAutozoom      
,
+                                       'output-type' => 'boolstr'              
                                                        
                                        ),                                      
                                
                                'class' => array(),
                                'style' => array(),
@@ -193,18 +191,6 @@
        }
        
        /**
-        * TODO: remove
-        * 
-        * Retuns a boolean as string, true if $autozoom is on or yes.
-        *
-        * @param string $autozoom
-        * @return string
-        */
-       public static function getAutozoomJSValue($autozoom) {
-               return MapsMapper::getJSBoolValue(in_array($autozoom, 
array('on', 'yes')));
-       }
-       
-       /**
         * This function ensures backward compatibility with Semantic Google 
Maps and other extensions
         * using $wgGoogleMapsKey instead of $egGoogleMapsKey.
         */
@@ -236,7 +222,6 @@
                if (strlen(trim($overlays)) < 1) {
                        $overlays = $egMapsGMapOverlays;
                } else {
-                       MapsMapper::enforceArrayValues($overlays);
                        $validOverlays = array();
                        foreach ($overlays as $overlay) {
                                $segements = explode('-', $overlay);

Modified: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispMap.php
===================================================================
--- trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispMap.php 2009-12-24 
23:24:43 UTC (rev 60377)
+++ trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispMap.php 2009-12-24 
23:28:49 UTC (rev 60378)
@@ -59,8 +59,6 @@
                
                $onloadFunctions = 
MapsGoogleMaps::addOverlayOutput($this->output, $this->mapName, 
$this->overlays, $this->controls);
                
-               $this->autozoom = 
MapsGoogleMaps::getAutozoomJSValue($this->autozoom);
-               
                $this->output .=<<<END
 
 <div id="$this->mapName" class="$this->class" style="$this->style" ></div>

Modified: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispPoint.php
===================================================================
--- trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispPoint.php       
2009-12-24 23:24:43 UTC (rev 60377)
+++ trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispPoint.php       
2009-12-24 23:28:49 UTC (rev 60378)
@@ -69,8 +69,6 @@
                
                $onloadFunctions = 
MapsGoogleMaps::addOverlayOutput($this->output, $this->mapName, 
$this->overlays, $this->controls);
                
-               $this->autozoom = 
MapsGoogleMaps::getAutozoomJSValue($this->autozoom);
-               
                $this->output .=<<<END
                        
 <div id="$this->mapName" class="$this->class" style="$this->style" ></div>

Modified: trunk/extensions/Maps/Maps.php
===================================================================
--- trunk/extensions/Maps/Maps.php      2009-12-24 23:24:43 UTC (rev 60377)
+++ trunk/extensions/Maps/Maps.php      2009-12-24 23:28:49 UTC (rev 60378)
@@ -33,7 +33,7 @@
        echo '<b>Warning:</b> You need to have <a 
href="http://www.mediawiki.org/wiki/Extension:Validator";>Validator</a> 
installed in order to use <a 
href="http://www.mediawiki.org/wiki/Extension:Maps";>Maps</a>.';
 }
 else {
-       define('Maps_VERSION', '0.5.1 a5');
+       define('Maps_VERSION', '0.5.1 a6');
        
        $egMapsScriptPath       = $wgScriptPath . '/extensions/Maps';
        $egMapsIP                       = $IP . '/extensions/Maps';

Modified: trunk/extensions/Maps/Maps_Mapper.php
===================================================================
--- trunk/extensions/Maps/Maps_Mapper.php       2009-12-24 23:24:43 UTC (rev 
60377)
+++ trunk/extensions/Maps/Maps_Mapper.php       2009-12-24 23:28:49 UTC (rev 
60378)
@@ -32,7 +32,7 @@
                                'type' => 'integer',
                                'criteria' => array(
                                        'in_range' => array(0, 15)
-                                       )                       
+                                       )
                                ),
                        'width' => array(
                                'type' => 'integer',
@@ -74,20 +74,6 @@
        }       
        
        /**
-        * TODO: remove
-        * 
-        * Turns the provided values into an array by splitting it on comma's if
-        * it's not an array yet.
-        *
-        * @param unknown_type $values
-        * @param string $delimeter
-        */
-       public static function enforceArrayValues(&$values, $delimeter = ',') {
-               if (! is_array($values)) $values = explode($delimeter, 
$values); // If not an array yet, split the values
-               for ($i = 0; $i < count($values); $i++) $values[$i] = 
trim($values[$i]); // Trim all values
-       }
-       
-       /**
         * Returns a valid service. When an invalid service is provided, the 
default one will be returned.
         * Aliases are also chancged into the main service names @see 
MapsMapper::getMainServiceName().
         *

Modified: trunk/extensions/Maps/Maps_Utils.php
===================================================================
--- trunk/extensions/Maps/Maps_Utils.php        2009-12-24 23:24:43 UTC (rev 
60377)
+++ trunk/extensions/Maps/Maps_Utils.php        2009-12-24 23:28:49 UTC (rev 
60378)
@@ -178,26 +178,4 @@
                return $lonlat;
        }       
        
-       /**
-        * Returns if the current php version is equal of bigger then the 
provided one.
-        *
-        * @param string $requiredVersion
-        * @return boolean
-        */
-       public static function phpVersionIsEqualOrBigger($requiredVersion) {
-               // TODO: Ensure this works, and does not cause errors for some 
versions.
-               $currentVersion = phpversion();
-
-               for($i = 0; $i < 3; $i++) {
-                       if ($currentVersion[$i] < $requiredVersion[$i]) {
-                               return false; 
-                       }
-                       else if($currentVersion[$i] > $requiredVersion[$i]) {
-                               return true;
-                       } 
-               }
-               
-               return true;
-       }       
-       
 }

Modified: trunk/extensions/Maps/YahooMaps/Maps_YahooMaps.php
===================================================================
--- trunk/extensions/Maps/YahooMaps/Maps_YahooMaps.php  2009-12-24 23:24:43 UTC 
(rev 60377)
+++ trunk/extensions/Maps/YahooMaps/Maps_YahooMaps.php  2009-12-24 23:28:49 UTC 
(rev 60378)
@@ -54,42 +54,41 @@
                $allowedTypes = MapsYahooMaps::getTypeNames();
                
                $egMapsServices[self::SERVICE_NAME]['parameters'] = array(
-                                                                       'zoom' 
=> array (
-                                                                               
'default' => $egMapsYahooMapsZoom
-                                                                               
),
-                                                                       
'controls' => array(
-                                                                               
'type' => array('string', 'list'),
-                                                                               
'criteria' => array(
-                                                                               
        'in_array' => self::getControlNames()
-                                                                               
),
-                                                                               
'default' => $egMapsYMapControls,
-                                                                               
'output-type' => array('list', ',', '\'')               
-                                                                               
),
-                                                                       'type' 
=> array (
-                                                                               
'aliases' => array('map-type', 'map type'),
-                                                                               
'criteria' => array(
-                                                                               
        'in_array' => $allowedTypes                     
-                                                                               
        ),
-                                                                               
'default' => $egMapsYahooMapsType,
-                                                                               
'output-type' => array('ymaptype')                                              
                                
-                                                                               
),
-                                                                       'types' 
=> array (
-                                                                               
'type' => array('string', 'list'),
-                                                                               
'aliases' => array('map-types', 'map types'),
-                                                                               
'criteria' => array(
-                                                                               
        'in_array' => $allowedTypes
-                                                                               
        ),
-                                                                               
'default' =>  $egMapsYahooMapsTypes,
-                                                                               
'output-types' => array('ymaptypes', 'list')                                    
                                
-                                                                               
),                      
-                                                                       
'autozoom' => array(
-                                                                               
'aliases' => array('auto zoom', 'mouse zoom', 'mousezoom'),
-                                                                               
'criteria' => array(
-                                                                               
        'in_array' => array('on', 'off', 'yes', 'no')   
-                                                                               
        ),
-                                                                               
'default' => $egMapsYahooAutozoom ? 'on' : 'off'                                
                                                                
-                                                                               
),              
-                                                                       );
+                               'zoom' => array (
+                                       'default' => $egMapsYahooMapsZoom
+                                       ),
+                               'controls' => array(
+                                       'type' => array('string', 'list'),
+                                       'criteria' => array(
+                                               'in_array' => 
self::getControlNames()
+                                       ),
+                                       'default' => $egMapsYMapControls,
+                                       'output-type' => array('list', ',', 
'\'')               
+                                       ),
+                               'type' => array (
+                                       'aliases' => array('map-type', 'map 
type'),
+                                       'criteria' => array(
+                                               'in_array' => $allowedTypes     
                
+                                               ),
+                                       'default' => $egMapsYahooMapsType,
+                                       'output-type' => 'ymaptype'
+                                       ),
+                               'types' => array (
+                                       'type' => array('string', 'list'),
+                                       'aliases' => array('map-types', 'map 
types'),
+                                       'criteria' => array(
+                                               'in_array' => $allowedTypes
+                                               ),
+                                       'default' =>  $egMapsYahooMapsTypes,
+                                       'output-types' => array('ymaptypes', 
'list')                                                                    
+                                       ),
+                               'autozoom' => array(
+                                       'type' => 'boolean',
+                                       'aliases' => array('auto zoom', 'mouse 
zoom', 'mousezoom'),
+                                       'default' => $egMapsYahooAutozoom,
+                                       'output-type' => 'boolstr'              
                                                                
+                                       ),              
+                               );
        }
        
        // http://developer.yahoo.com/maps/ajax
@@ -157,33 +156,6 @@
                        $output .= "<script type='$wgJsMimeType' 
src='http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=$egYahooMapsKey'></script>
                        <script type='$wgJsMimeType' 
src='$egMapsScriptPath/YahooMaps/YahooMapFunctions.js?$egMapsStyleVersion'></script>";
                }
-       }
-
-       /**
-        * Retuns a boolean as string, true if $autozoom is on or yes.
-        *
-        * @param string $autozoom
-        * @return string
-        */
-       public static function getAutozoomJSValue($autozoom) {
-               return MapsMapper::getJSBoolValue(in_array($autozoom, 
array('on', 'yes')));
        }       
-
-       /**
-        * Returns a JS items string with the provided types. The earth type 
will
-        * be added to it when it's not present and $enableEarth is true. If 
there are
-        * no types, the default will be used.
-        *
-        * @param array $types
-        * @param boolean $enableEarth
-        * @return string
-        */
-       public static function createTypesString(array &$types) {       
-               global $egMapsYahooMapsTypes, $egMapsYahooMapTypesValid;
-               
-               $types = MapsMapper::getValidTypes($types, 
$egMapsYahooMapsTypes, $egMapsYahooMapTypesValid, array(__CLASS__, 
'getYMapType'));
-                       
-               return MapsMapper::createJSItemsString($types, null, false, 
false);
-       }               
        
 }                                                                      
\ No newline at end of file

Modified: trunk/extensions/Maps/YahooMaps/Maps_YahooMapsDispMap.php
===================================================================
--- trunk/extensions/Maps/YahooMaps/Maps_YahooMapsDispMap.php   2009-12-24 
23:24:43 UTC (rev 60377)
+++ trunk/extensions/Maps/YahooMaps/Maps_YahooMapsDispMap.php   2009-12-24 
23:28:49 UTC (rev 60378)
@@ -47,8 +47,6 @@
         */             
        public function addSpecificMapHTML() {
                global $wgJsMimeType;
-
-               $this->autozoom = 
MapsYahooMaps::getAutozoomJSValue($this->autozoom);   
                
                $this->output .= <<<END
                <div id="$this->mapName" style="width: {$this->width}px; 
height: {$this->height}px;"></div>  

Modified: trunk/extensions/Maps/YahooMaps/Maps_YahooMapsDispPoint.php
===================================================================
--- trunk/extensions/Maps/YahooMaps/Maps_YahooMapsDispPoint.php 2009-12-24 
23:24:43 UTC (rev 60377)
+++ trunk/extensions/Maps/YahooMaps/Maps_YahooMapsDispPoint.php 2009-12-24 
23:28:49 UTC (rev 60378)
@@ -61,8 +61,6 @@
        public function addSpecificMapHTML() {
                global $wgJsMimeType;
                
-               $this->autozoom = 
MapsYahooMaps::getAutozoomJSValue($this->autozoom);   
-               
                $this->output .= <<<END
                <div id="$this->mapName" style="width: {$this->width}px; 
height: {$this->height}px;"></div>  
                



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to