You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by bh...@apache.org on 2011/03/04 09:29:25 UTC
svn commit: r1077846 - in /shindig/trunk/php: src/gadgets/GadgetFactory.php
src/gadgets/GadgetFeatureRegistry.php test/gadgets/GadgetHtmlRendererTest.php
test/gadgets/GadgetUrlRendererTest.php
Author: bhofmann
Date: Fri Mar 4 08:29:24 2011
New Revision: 1077846
URL: http://svn.apache.org/viewvc?rev=1077846&view=rev
Log:
* Fixed php feature registry to prevent ring dependecies between taming and core libraries because in the old implementation every non core library got the core libraries as dependencies automatically
* Fixed Message Bundle Substitutions
Modified:
shindig/trunk/php/src/gadgets/GadgetFactory.php
shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php
shindig/trunk/php/test/gadgets/GadgetHtmlRendererTest.php
shindig/trunk/php/test/gadgets/GadgetUrlRendererTest.php
Modified: shindig/trunk/php/src/gadgets/GadgetFactory.php
URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/GadgetFactory.php?rev=1077846&r1=1077845&r2=1077846&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/GadgetFactory.php (original)
+++ shindig/trunk/php/src/gadgets/GadgetFactory.php Fri Mar 4 08:29:24 2011
@@ -135,9 +135,6 @@ class GadgetFactory {
} else {
$gadget->substitutions->addSubstitution('MODULE', "ID", 0);
}
- if ($gadget->gadgetSpec->locales) {
- $gadget->substitutions->addSubstitutions('MSG', $gadget->gadgetSpec->locales);
- }
$gadget->substitutions->addSubstitution('BIDI', "START_EDGE", $gadget->rightToLeft ? "right" : "left");
$gadget->substitutions->addSubstitution('BIDI', "END_EDGE", $gadget->rightToLeft ? "left" : "right");
$gadget->substitutions->addSubstitution('BIDI', "DIR", $gadget->rightToLeft ? "rtl" : "ltr");
@@ -186,6 +183,7 @@ class GadgetFactory {
if ($full) $gadget->gadgetSpec->locales = array_merge($full, $gadget->gadgetSpec->locales);
if ($partial) $gadget->gadgetSpec->locales = array_merge($partial, $gadget->gadgetSpec->locales);
if ($all) $gadget->gadgetSpec->locales = array_merge($all, $gadget->gadgetSpec->locales);
+ $gadget->substitutions->addSubstitutions('MSG', $gadget->gadgetSpec->locales);
}
}
Modified: shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php
URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php?rev=1077846&r1=1077845&r2=1077846&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php (original)
+++ shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php Fri Mar 4 08:29:24 2011
@@ -37,11 +37,6 @@ class GadgetFeatureRegistry {
/**
* @var array
*/
- private $coreFeatures;
-
- /**
- * @var array
- */
private $sortedFeatures;
/**
@@ -136,9 +131,8 @@ class GadgetFeatureRegistry {
public function resolveFeatures($needed, &$resultsFound, &$resultsMissing) {
$resultsFound = array();
$resultsMissing = array();
- if (! count($needed)) {
- $needed = $this->coreFeatures;
- }
+ $this->addFeatureToResults($resultsFound, $this->features['core']);
+
foreach ($needed as $featureName) {
$feature = isset($this->features[$featureName]) ? $this->features[$featureName] : null;
if ($feature == null) {
@@ -210,22 +204,10 @@ class GadgetFeatureRegistry {
* gets core features and sorts features
*/
private function processFeatures() {
- // Determine the core features
- $this->coreFeatures = array();
$sortedFeatures = array();
- foreach ($this->features as $feature) {
- if (strtolower(substr($feature['name'], 0, strlen('core'))) == 'core') {
- $this->coreFeatures[$feature['name']] = $feature['name'];
- // first add all core features so that they are sorted to the beginning
- $features[] = $feature['name'];
- }
- }
// Topologically sort all features according to their dependency
$features = array();
foreach ($this->features as $feature) {
- if (isset($this->coreFeatures[$feature['name']])) {
- continue;
- }
$features[] = $feature['name'];
}
$reverseDeps = array();
Modified: shindig/trunk/php/test/gadgets/GadgetHtmlRendererTest.php
URL: http://svn.apache.org/viewvc/shindig/trunk/php/test/gadgets/GadgetHtmlRendererTest.php?rev=1077846&r1=1077845&r2=1077846&view=diff
==============================================================================
--- shindig/trunk/php/test/gadgets/GadgetHtmlRendererTest.php (original)
+++ shindig/trunk/php/test/gadgets/GadgetHtmlRendererTest.php Fri Mar 4 08:29:24 2011
@@ -22,7 +22,7 @@ class MockHtmlGadgetFactory extends Gadg
public function __construct(GadgetContext $context, $token) {
parent::__construct($context, $token);
}
-
+
protected function fetchGadget($gadgetUrl) {
return '<?xml version="1.0" encoding="UTF-8" ?>
<Module>
@@ -50,27 +50,27 @@ class GadgetHtmlRendererTest extends PHP
* @var Gadget
*/
private $gadget;
-
+
/**
* @var GadgetContext
*/
private $gadgetContext;
-
+
/**
* @var GadgetHtmlRender
*/
private $gadgetHtmlRenderer;
-
+
/**
* @var view
*/
private $view;
-
+
/**
* @var DomElement
*/
private $domElement;
-
+
/**
* @var DomDocument
*/
@@ -95,7 +95,7 @@ class GadgetHtmlRendererTest extends PHP
$this->domDocument->preserveWhiteSpace = true;
$this->domDocument->formatOutput = false;
$this->domDocument->strictErrorChecking = false;
- $this->domDocument->recover = false;
+ $this->domDocument->recover = false;
// init $this->element
$this->domElement = $this->domDocument->createElement('test');
@@ -143,7 +143,7 @@ class GadgetHtmlRendererTest extends PHP
$this->fail('two entries with script type extern');
}
$hasExtern = true;
- $this->assertEquals(0, strpos($script['content'], '/gadgets/js/dynamic-height:views.js?'));
+ $this->assertEquals(0, strpos($script['content'], '/gadgets/js/dynamic-height:views:core.js?'), 'could not find string "/gadgets/js/dynamic-height:views:core.js?" in: '. PHP_EOL . $script['content']);
break;
case 'inline':
if ($hasInline) {
Modified: shindig/trunk/php/test/gadgets/GadgetUrlRendererTest.php
URL: http://svn.apache.org/viewvc/shindig/trunk/php/test/gadgets/GadgetUrlRendererTest.php?rev=1077846&r1=1077845&r2=1077846&view=diff
==============================================================================
--- shindig/trunk/php/test/gadgets/GadgetUrlRendererTest.php (original)
+++ shindig/trunk/php/test/gadgets/GadgetUrlRendererTest.php Fri Mar 4 08:29:24 2011
@@ -77,7 +77,7 @@ class GadgetUrlRendererTest extends PHPU
parse_str($parsedUrl['query'], $queryParameters);
$this->assertEquals('example.com', $parsedUrl['host']);
$this->assertEquals('/gadget.php', $parsedUrl['path']);
- $this->assertEquals('dynamic-height:opensocial-0.8.js', $queryParameters['libs']);
+ $this->assertEquals('dynamic-height:core:opensocial-0.8.js', $queryParameters['libs']);
$this->assertEquals('en', $queryParameters['lang']);
$this->assertEquals('US', $queryParameters['country']);
$this->assertEquals('value',$queryParameters['up_key']);
@@ -93,7 +93,7 @@ class GadgetUrlRendererTest extends PHPU
parse_str($parsedUrl['query'], $queryParameters);
$this->assertEquals('example.com', $parsedUrl['host']);
$this->assertEquals('/gadget.php', $parsedUrl['path']);
- $this->assertEquals('dynamic-height:opensocial-0.8.js', $queryParameters['libs']);
+ $this->assertEquals('dynamic-height:core:opensocial-0.8.js', $queryParameters['libs']);
$this->assertEquals('en', $queryParameters['lang']);
$this->assertEquals('US', $queryParameters['country']);
$this->assertEquals('bar',$queryParameters['foo']);