[fusion-commits] r2777 - in sandbox/redline_advanced_stylization: common/php layers/MapGuide/php widgets/FeatureInfo widgets/QuickPlot widgets/Theme/classes

svn_fusion at osgeo.org svn_fusion at osgeo.org
Wed Sep 11 01:01:44 PDT 2013


Author: jng
Date: 2013-09-11 01:01:44 -0700 (Wed, 11 Sep 2013)
New Revision: 2777

Modified:
   sandbox/redline_advanced_stylization/common/php/Xml2JSON.php
   sandbox/redline_advanced_stylization/layers/MapGuide/php/GetSelectionProperties.php
   sandbox/redline_advanced_stylization/layers/MapGuide/php/Legend.php
   sandbox/redline_advanced_stylization/layers/MapGuide/php/LoadMap.php
   sandbox/redline_advanced_stylization/layers/MapGuide/php/LoadScaleRanges.php
   sandbox/redline_advanced_stylization/layers/MapGuide/php/MapMenu.php
   sandbox/redline_advanced_stylization/layers/MapGuide/php/Query.php
   sandbox/redline_advanced_stylization/layers/MapGuide/php/SaveSelection.php
   sandbox/redline_advanced_stylization/layers/MapGuide/php/UserManager.php
   sandbox/redline_advanced_stylization/layers/MapGuide/php/Utilities.php
   sandbox/redline_advanced_stylization/widgets/FeatureInfo/featureinfocontroller.php
   sandbox/redline_advanced_stylization/widgets/QuickPlot/GenerateLegend.php
   sandbox/redline_advanced_stylization/widgets/Theme/classes/theme.php
Log:
Fix more PHP 5.5 compatibility issues:
 - Use "new stdClass()" for anonymous objects that are to be converted as JSON
 - Do not use static DOMDocument::loadXML() as this is not allowed in strict mode. Use instance-based proceess (make a DOMDocument, call loadXML() on the instance)

Modified: sandbox/redline_advanced_stylization/common/php/Xml2JSON.php
===================================================================
--- sandbox/redline_advanced_stylization/common/php/Xml2JSON.php	2013-09-11 07:28:51 UTC (rev 2776)
+++ sandbox/redline_advanced_stylization/common/php/Xml2JSON.php	2013-09-11 08:01:44 UTC (rev 2777)
@@ -62,7 +62,8 @@
 //echo "/*";
 //print_r($xml);
 //echo "*/";
-$document = DOMDocument::loadXML($xml);
+$document = new DOMDocument();
+$document->loadXML($xml);
 if ($document == null) {
     die ('/* invalid xml document:'.$xml.' */');
 }

Modified: sandbox/redline_advanced_stylization/layers/MapGuide/php/GetSelectionProperties.php
===================================================================
--- sandbox/redline_advanced_stylization/layers/MapGuide/php/GetSelectionProperties.php	2013-09-11 07:28:51 UTC (rev 2776)
+++ sandbox/redline_advanced_stylization/layers/MapGuide/php/GetSelectionProperties.php	2013-09-11 08:01:44 UTC (rev 2777)
@@ -58,14 +58,14 @@
         $srsMap = $srsFactory->Create($srsDefMap);
 
         /*holds selection array*/
-        $properties = NULL;
+        $properties = new stdClass();
         $properties->layers = array();
 
         //process
         header('Content-type: application/json');
         header('X-JSON: true');
         $layers = $selection->GetLayers();
-        $result = NULL;
+        $result = new stdClass();
         if ($layers != null)
         {
             $nLayers = $layers->GetCount();
@@ -160,14 +160,14 @@
                 {
                     $oMin = $oExtents->GetLowerLeftCoordinate();
                     $oMax = $oExtents->GetUpperRightCoordinate();
-                    $result->extents = NULL;
+                    $result->extents = new stdClass();
                     $result->extents->minx = $oMin->GetX();
                     $result->extents->miny = $oMin->GetY();
                     $result->extents->maxx = $oMax->GetX();
                     $result->extents->maxy = $oMax->GetY();
 
                     /*keep the full extents of the selection when saving the selection in the session*/
-                    $properties->extents = NULL;
+                    $properties->extents = new stdClass();
                     $properties->extents->minx = $oMin->GetX();
                     $properties->extents->miny = $oMin->GetY();
                     $properties->extents->maxx = $oMax->GetX();
@@ -179,6 +179,7 @@
                     $layerName = $layer->GetName();
                     array_push($result->layers, $layerName);
                     $layerClassName = $layer->GetFeatureClassName();
+                    $result->$layerName = new stdClass();
                     $result->$layerName->featureCount = $selection->GetSelectedFeaturesCount($layer, $layerClassName);
                 }
 

Modified: sandbox/redline_advanced_stylization/layers/MapGuide/php/Legend.php
===================================================================
--- sandbox/redline_advanced_stylization/layers/MapGuide/php/Legend.php	2013-09-11 07:28:51 UTC (rev 2776)
+++ sandbox/redline_advanced_stylization/layers/MapGuide/php/Legend.php	2013-09-11 08:01:44 UTC (rev 2777)
@@ -118,7 +118,8 @@
     $resID = $layer->GetLayerDefinition();
     $layerContent = $resourceService->GetResourceContent($resID);
 
-    $xmldoc = DOMDocument::loadXML(ByteReaderToString($layerContent));
+    $xmldoc = new DOMDocument();
+    $xmldoc->loadXML(ByteReaderToString($layerContent));
     $type = 0;
     $scaleRanges = $xmldoc->getElementsByTagName('VectorScaleRange');
     if($scaleRanges->length == 0) {

Modified: sandbox/redline_advanced_stylization/layers/MapGuide/php/LoadMap.php
===================================================================
--- sandbox/redline_advanced_stylization/layers/MapGuide/php/LoadMap.php	2013-09-11 07:28:51 UTC (rev 2776)
+++ sandbox/redline_advanced_stylization/layers/MapGuide/php/LoadMap.php	2013-09-11 08:01:44 UTC (rev 2777)
@@ -123,7 +123,8 @@
     
     //Any code that may need the map definition xml document can use $mdfDoc
     $mapContent = $resourceService->GetResourceContent(new MgResourceIdentifier($mapid));
-    $mdfDoc = DOMDocument::loadXML(ByteReaderToString($mapContent));
+    $mdfDoc = new DOMDocument();
+    $mdfDoc->loadXML(ByteReaderToString($mapContent));
     
     $mapObj->backgroundColor = getMapBackgroundColor($map, $mdfDoc);
 
@@ -151,10 +152,12 @@
     for($i=0;$i<$layers->GetCount();$i++)
     {
         $ldfContent = $layerDefinitionContents->GetItem($i);
-        $ldfdoc = DOMDocument::LoadXML($ldfContent);
+        $ldfdoc = new DOMDocument();
+        $ldfdoc->loadXML($ldfContent);
         array_push($layerDocs, $ldfdoc);
         $fsContent = $featureSourceContents->GetItem($i);
-        $fsDoc = DOMDocument::LoadXML($fsContent);
+        $fsDoc = new DOMDocument();
+        $fsDoc->loadXML($fsContent);
         array_push($fsDocs, $fsDoc);
     }
     
@@ -264,7 +267,8 @@
             if ($xmldoc == NULL) {
                 $resID = $layer->GetLayerDefinition();
                 $layerContent = $resourceService->GetResourceContent($resID);
-                $xmldoc = DOMDocument::loadXML(ByteReaderToString($layerContent));
+                $xmldoc = new DOMDocument();
+                $xmldoc->loadXML(ByteReaderToString($layerContent));
             }
             $gridlayers = $xmldoc->getElementsByTagName('GridLayerDefinition');
             if ($gridlayers->length > 0)
@@ -301,7 +305,8 @@
     if ($xmldoc == NULL) {
         $resId = $map->GetMapDefinition();
         $mapContent = $resourceService->GetResourceContent($resId);
-        $xmldoc = DOMDocument::loadXML(ByteReaderToString($mapContent));
+        $xmldoc = new DOMDocument();
+        $xmldoc->loadXML(ByteReaderToString($mapContent));
     }
     $bgColor = $xmldoc->getElementsByTagName('BackgroundColor');
     if ($bgColor->length > 0) {
@@ -318,7 +323,8 @@
     if ($xmldoc == NULL) {
         $resID = $layer->GetLayerDefinition();
         $layerContent = $resourceService->GetResourceContent($resID);
-        $xmldoc = DOMDocument::loadXML(ByteReaderToString($layerContent));
+        $xmldoc = new DOMDocument();
+        $xmldoc->loadXML(ByteReaderToString($layerContent));
     }
     $type = 0;
     $scaleRanges = $xmldoc->getElementsByTagName('VectorScaleRange');

Modified: sandbox/redline_advanced_stylization/layers/MapGuide/php/LoadScaleRanges.php
===================================================================
--- sandbox/redline_advanced_stylization/layers/MapGuide/php/LoadScaleRanges.php	2013-09-11 07:28:51 UTC (rev 2776)
+++ sandbox/redline_advanced_stylization/layers/MapGuide/php/LoadScaleRanges.php	2013-09-11 08:01:44 UTC (rev 2777)
@@ -63,7 +63,7 @@
 $map->Open($resourceService, $mapName);
 $layers=$map->GetLayers();
 
-$scaleObj = NULL;
+$scaleObj = new stdClass();
 $scaleObj->layers = array();
 
 for($i=0;$i<$layers->GetCount();$i++)
@@ -73,10 +73,8 @@
         isset($_SESSION['scale_ranges'][$layer->GetObjectId()]))
     {
         $scaleranges = $_SESSION['scale_ranges'][$layer->GetObjectId()];
-        $layerObj = NULL;
+        $layerObj = new stdClass();
         $layerObj->uniqueId = $layer->GetObjectId();
-        $layerObj = NULL;
-        $layerObj->uniqueId = $layer->GetObjectId();
         
         $ldfId = $layer->GetLayerDefinition();
         foreach ($scaleranges as $sr)

Modified: sandbox/redline_advanced_stylization/layers/MapGuide/php/MapMenu.php
===================================================================
--- sandbox/redline_advanced_stylization/layers/MapGuide/php/MapMenu.php	2013-09-11 07:28:51 UTC (rev 2776)
+++ sandbox/redline_advanced_stylization/layers/MapGuide/php/MapMenu.php	2013-09-11 08:01:44 UTC (rev 2777)
@@ -44,7 +44,8 @@
 $maps = $resourceService->EnumerateResources($rootId, -1, 'MapDefinition');
 
 //make a list of maps to query for names
-$mapListXml = DOMDocument::loadXML(ByteReaderToString($maps));
+$mapListXml = new DOMDocument();
+$mapListXml->loadXML(ByteReaderToString($maps));
 //$aMapAssoc = Array();
 $aMapIds = $mapListXml->getElementsByTagName('ResourceId');
 

Modified: sandbox/redline_advanced_stylization/layers/MapGuide/php/Query.php
===================================================================
--- sandbox/redline_advanced_stylization/layers/MapGuide/php/Query.php	2013-09-11 07:28:51 UTC (rev 2776)
+++ sandbox/redline_advanced_stylization/layers/MapGuide/php/Query.php	2013-09-11 08:01:44 UTC (rev 2777)
@@ -156,7 +156,8 @@
 
             //get the layer filter value if supplied
             $layerReader = $resourceService->GetResourceContent($layerObj->GetLayerDefinition());
-            $xmldoc = DOMDocument::loadXML(ByteReaderToString($layerReader));
+            $xmldoc = new DOMDocument();
+            $xmldoc->loadXML(ByteReaderToString($layerReader));
             $xpathObj = new domXPath($xmldoc);
             $xpathStr = "/LayerDefinition/VectorLayerDefinition/Filter"; //TODO: need this for DWF or Grid layers?
             $xpathQuery = $xpathObj->query($xpathStr);

Modified: sandbox/redline_advanced_stylization/layers/MapGuide/php/SaveSelection.php
===================================================================
--- sandbox/redline_advanced_stylization/layers/MapGuide/php/SaveSelection.php	2013-09-11 07:28:51 UTC (rev 2776)
+++ sandbox/redline_advanced_stylization/layers/MapGuide/php/SaveSelection.php	2013-09-11 08:01:44 UTC (rev 2777)
@@ -63,7 +63,7 @@
         if ($layers && $layers->GetCount() >= 0)
         {
             $result->hasSelection = true;
-            $result->extents = NULL;
+            $result->extents = new stdClass();
             if($getExtents)
             {
                 $featureService = $siteConnection->CreateService(MgServiceType::FeatureService);

Modified: sandbox/redline_advanced_stylization/layers/MapGuide/php/UserManager.php
===================================================================
--- sandbox/redline_advanced_stylization/layers/MapGuide/php/UserManager.php	2013-09-11 07:28:51 UTC (rev 2776)
+++ sandbox/redline_advanced_stylization/layers/MapGuide/php/UserManager.php	2013-09-11 08:01:44 UTC (rev 2777)
@@ -296,7 +296,8 @@
             } else {
                 $byteReader = $site->EnumerateGroups();
             }
-            $xmldoc = DOMDocument::loadXML(ByteReaderToString($byteReader));
+            $xmldoc = new DOMDocument();
+            $xmldoc->loadXML(ByteReaderToString($byteReader));
             $groupNodeList = $xmldoc->getElementsByTagName('Group');
             for ($i=0; $i<$groupNodeList->length; $i++) {
                 $group = $groupNodeList->item($i);

Modified: sandbox/redline_advanced_stylization/layers/MapGuide/php/Utilities.php
===================================================================
--- sandbox/redline_advanced_stylization/layers/MapGuide/php/Utilities.php	2013-09-11 07:28:51 UTC (rev 2776)
+++ sandbox/redline_advanced_stylization/layers/MapGuide/php/Utilities.php	2013-09-11 08:01:44 UTC (rev 2777)
@@ -612,7 +612,8 @@
     $mappings = array();
     if ($xmldoc == NULL) {
         $byteReader = $resourceService->GetResourceContent($layer->GetLayerDefinition());
-        $xmldoc = DOMDocument::loadXML(ByteReaderToString($byteReader));
+        $xmldoc = new DOMDocument();
+        $xmldoc->loadXML(ByteReaderToString($byteReader));
     }
     $mappingNodeList = $xmldoc->getElementsByTagName('PropertyMapping');
     for ($i=0; $i<$mappingNodeList->length; $i++) {
@@ -632,7 +633,8 @@
     $dataSourceId = new MgResourceIdentifier($layer->GetFeatureSourceId());
     if ($xmldoc == NULL) {
         $byteReader = $resourceService->GetResourceContent($dataSourceId);
-        $xmldoc = DOMDocument::loadXML(ByteReaderToString($byteReader));
+        $xmldoc = new DOMDocument();
+        $xmldoc->loadXML(ByteReaderToString($byteReader));
     }
     $parameterList = $xmldoc->getElementsByTagName('Parameter');
     for ($i=0; $i<$parameterList->length; $i++) {
@@ -775,6 +777,7 @@
         $layerName = GetEncodedLayerName($layerName);    
     }
 
+    $properties->$layerName = new stdClass();
     $properties->$layerName->propertynames = array();
     $properties->$layerName->propertyvalues = array();
     $properties->$layerName->propertytypes = array();

Modified: sandbox/redline_advanced_stylization/widgets/FeatureInfo/featureinfocontroller.php
===================================================================
--- sandbox/redline_advanced_stylization/widgets/FeatureInfo/featureinfocontroller.php	2013-09-11 07:28:51 UTC (rev 2776)
+++ sandbox/redline_advanced_stylization/widgets/FeatureInfo/featureinfocontroller.php	2013-09-11 08:01:44 UTC (rev 2777)
@@ -52,7 +52,7 @@
         $selection = new MgSelection($map);
         $selection->Open($resourceService, $mapName);
 
-        $properties = NULL;
+        $properties = new stdClass();
 
         if ($selection->Contains($layer, $className)) {
             $featureReader = $selection->GetSelectedFeatures($layer, $className, new MgStringCollection());

Modified: sandbox/redline_advanced_stylization/widgets/QuickPlot/GenerateLegend.php
===================================================================
--- sandbox/redline_advanced_stylization/widgets/QuickPlot/GenerateLegend.php	2013-09-11 07:28:51 UTC (rev 2776)
+++ sandbox/redline_advanced_stylization/widgets/QuickPlot/GenerateLegend.php	2013-09-11 08:01:44 UTC (rev 2777)
@@ -190,7 +190,8 @@
             
             $ldfId = $layer->GetLayerDefinition();
             $layerContent = $resourceService->GetResourceContent($ldfId);
-            $xmldoc = DOMDocument::loadXML(ByteReaderToString($layerContent));
+            $xmldoc = new DOMDocument();
+            $xmldoc->loadXML(ByteReaderToString($layerContent));
             $scaleRanges = $xmldoc->getElementsByTagName('VectorScaleRange');
             if ($scaleRanges->length == 0) {
                 $scaleRanges = $xmldoc->getElementsByTagName('GridScaleRange');

Modified: sandbox/redline_advanced_stylization/widgets/Theme/classes/theme.php
===================================================================
--- sandbox/redline_advanced_stylization/widgets/Theme/classes/theme.php	2013-09-11 07:28:51 UTC (rev 2776)
+++ sandbox/redline_advanced_stylization/widgets/Theme/classes/theme.php	2013-09-11 08:01:44 UTC (rev 2777)
@@ -122,7 +122,8 @@
         $layerDefResId = $layer->GetLayerDefinition();
         $byteReader = $resourceService->GetResourceContent($layerDefResId);
 
-        $doc = DOMDocument::loadXML($byteReader->ToString());
+        $doc = new DOMDocument();
+        $doc->loadXML($byteReader->ToString());
         $nodeList = $doc->getElementsByTagName('VectorScaleRange');
 
         foreach ($nodeList as $node)
@@ -240,7 +241,8 @@
 
         // Load the Layer Definition and Navigate to the specified <VectorScaleRange>
 
-        $doc = DOMDocument::loadXML($byteReader->ToString());
+        $doc = new DOMDocument();
+        $doc->loadXML($byteReader->ToString());
         $version = $doc->documentElement->getAttribute('version');
         $template = 'templates/arearuletemplate-'.$version.'.xml';
         $layerDefList = $doc->getElementsByTagName('VectorLayerDefinition');
@@ -342,7 +344,8 @@
                     $this->InterpolateColor($portion, $this->args['FILLFROM'], $this->args['FILLTO'], $this->args['FILLTRANS']),
                     $this->InterpolateColor($portion, $this->args['LINEFROM'], $this->args['LINETO'], 0));
 
-                $areaDoc = DOMDocument::loadXML($areaRuleXML);
+                $areaDoc = new DOMDocument();
+                $areaDoc->loadXML($areaRuleXML);
                 $areaNode = $doc->importNode($areaDoc->documentElement, true);
                 if($areaTypeStyle != null)
                 {
@@ -396,7 +399,8 @@
                     $this->InterpolateColor($portion, $this->args['FILLFROM'], $this->args['FILLTO'], $this->args['FILLTRANS']),
                     $this->InterpolateColor($portion, $this->args['LINEFROM'], $this->args['LINETO'], 0));
 
-                $areaDoc = DOMDocument::loadXML($areaRuleXML);
+                $areaDoc = new DOMDocument();
+                $areaDoc->loadXML($areaRuleXML);
                 $areaNode = $doc->importNode($areaDoc->documentElement, true);
                 if($areaTypeStyle != null)
                 {



More information about the fusion-commits mailing list