Author: chabotc
Date: Wed Dec  3 10:40:30 2008
New Revision: 723007

URL: http://svn.apache.org/viewvc?rev=723007&view=rev
Log:
Added support for relative paths in message bundle url's, some iGoogle gadgets 
tend to do this

Modified:
    incubator/shindig/trunk/php/src/gadgets/GadgetServer.php

Modified: incubator/shindig/trunk/php/src/gadgets/GadgetServer.php
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/GadgetServer.php?rev=723007&r1=723006&r2=723007&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/GadgetServer.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/GadgetServer.php Wed Dec  3 
10:40:30 2008
@@ -64,7 +64,9 @@
     $contextArray = array();
     $messagesArray = array();
     foreach ($specs as $spec) {
-      if ($spec == null) continue;
+      if ($spec == null) {
+        continue;
+      }
       $uri = $spec->getURI();
       if ($uri == null) {
         if ($spec->getLocaleMessageBundles() != null) {
@@ -74,6 +76,13 @@
         }
         continue;
       }
+      $parsedUri = parse_url($uri);
+      if (empty($parsedUri['host'])) {
+        // relative path's in the locale spec uri
+        $gadgetUrl = $context->getUrl();
+        $gadgetUrl = substr($gadgetUrl, 0, strrpos($gadgetUrl, '/') + 1);
+        $uri = $gadgetUrl.$uri;
+      }
       $requestArray[] = new RemoteContentRequest($uri);
       $contextArray[] = $context;
       $messagesArray[] = null;


Reply via email to