incubator-zeta-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From der...@apache.org
Subject [zeta-commits] svn commit: r1001199 - /incubator/zetacomponents/trunk/Feed/src/modules/georss_module.php
Date Sat, 25 Sep 2010 11:55:25 GMT
Author: derick
Date: Sat Sep 25 11:55:25 2010
New Revision: 1001199

URL: http://svn.apache.org/viewvc?rev=1001199&view=rev
Log:
- Added support for GeoRSS/box.

Modified:
    incubator/zetacomponents/trunk/Feed/src/modules/georss_module.php

Modified: incubator/zetacomponents/trunk/Feed/src/modules/georss_module.php
URL: http://svn.apache.org/viewvc/incubator/zetacomponents/trunk/Feed/src/modules/georss_module.php?rev=1001199&r1=1001198&r2=1001199&view=diff
==============================================================================
--- incubator/zetacomponents/trunk/Feed/src/modules/georss_module.php (original)
+++ incubator/zetacomponents/trunk/Feed/src/modules/georss_module.php Sat Sep 25 11:55:25
2010
@@ -136,14 +136,14 @@ class ezcFeedGeoRssModule extends ezcFee
         switch ( $this->level )
         {
             case 'feed':
-                if ( in_array( $name, array( 'lat', 'long', 'point', 'where' ) ) )
+                if ( in_array( $name, array( 'lat', 'long', 'point', 'where', 'box' ) ) )
                 {
                     return true;
                 }
                 break;
 
             case 'item':
-                if ( in_array( $name, array( 'lat', 'long', 'point', 'where' ) ) )
+                if ( in_array( $name, array( 'lat', 'long', 'point', 'where', 'box' ) ) )
                 {
                     return true;
                 }
@@ -172,6 +172,7 @@ class ezcFeedGeoRssModule extends ezcFee
                 case 'long':
                 case 'point':
                 case 'where':
+                case 'box':
                     $node = new ezcFeedTextElement();
                     break;
             }
@@ -233,6 +234,14 @@ class ezcFeedGeoRssModule extends ezcFee
                     $element = $this->add( 'long' );
                     $element->text = $long;
                     break;
+                case 'box':
+                    $value = $node->textContent;
+                    list( $lat1, $long1, $lat2, $long2 ) = explode( ' ', $value );
+                    $element = $this->add( 'lat' );
+                    $element->text = ( $lat1 + $lat2 ) / 2;
+                    $element = $this->add( 'long' );
+                    $element->text = ( $long1 + $long2 ) /2;
+                    break;
             }
         }
     }



Mime
View raw message