You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by ch...@apache.org on 2008/06/12 13:50:27 UTC
svn commit: r667051 - in /incubator/shindig/trunk/php/src: common/ gadgets/
gadgets/oauth/
Author: chabotc
Date: Thu Jun 12 04:50:27 2008
New Revision: 667051
URL: http://svn.apache.org/viewvc?rev=667051&view=rev
Log:
Formatting fixes, plus line wrapping @ 100
Modified:
incubator/shindig/trunk/php/src/common/CacheMemcache.php
incubator/shindig/trunk/php/src/gadgets/Gadget.php
incubator/shindig/trunk/php/src/gadgets/GadgetServer.php
incubator/shindig/trunk/php/src/gadgets/GadgetSpecParser.php
incubator/shindig/trunk/php/src/gadgets/JsLibrary.php
incubator/shindig/trunk/php/src/gadgets/JsonRpcHandler.php
incubator/shindig/trunk/php/src/gadgets/LinkSpec.php
incubator/shindig/trunk/php/src/gadgets/ProxyGadgetContext.php
incubator/shindig/trunk/php/src/gadgets/Substitutions.php
incubator/shindig/trunk/php/src/gadgets/oauth/OAuth.php
incubator/shindig/trunk/php/src/gadgets/oauth/OAuthStore.php
Modified: incubator/shindig/trunk/php/src/common/CacheMemcache.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/common/CacheMemcache.php?rev=667051&r1=667050&r2=667051&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/common/CacheMemcache.php (original)
+++ incubator/shindig/trunk/php/src/common/CacheMemcache.php Thu Jun 12 04:50:27 2008
@@ -98,7 +98,7 @@
public function get($key, $expiration = false)
{
$this->check();
- if (!$expiration) {
+ if (! $expiration) {
// default to global cache time
$expiration = Config::Get('cache_time');
}
@@ -116,7 +116,8 @@
{
$this->check();
// we store it with the cache_time default expiration so objects will atleast get cleaned eventually.
- if (memcache_set($this->connection, $key, array('time' => time(), 'data' => $value), 0, Config::Get('cache_time')) === false) {
+ if (memcache_set($this->connection, $key, array('time' => time(),
+ 'data' => $value), 0, Config::Get('cache_time')) === false) {
throw new CacheException("Couldn't store data in cache");
}
}
Modified: incubator/shindig/trunk/php/src/gadgets/Gadget.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/Gadget.php?rev=667051&r1=667050&r2=667051&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/Gadget.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/Gadget.php Thu Jun 12 04:50:27 2008
@@ -291,7 +291,7 @@
{
return $this->links;
}
-
+
public function getLink($rel)
{
foreach ($this->links as $link) {
@@ -301,7 +301,7 @@
}
return false;
}
-
+
public function getViews()
{
return $this->views;
Modified: incubator/shindig/trunk/php/src/gadgets/GadgetServer.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/GadgetServer.php?rev=667051&r1=667050&r2=667051&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/GadgetServer.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/GadgetServer.php Thu Jun 12 04:50:27 2008
@@ -47,7 +47,7 @@
return $gadget;
}
- private function getBundle(LocaleSpec $localeSpec=null, $context)
+ private function getBundle(LocaleSpec $localeSpec = null, $context)
{
if ($localeSpec != null) {
$uri = $localeSpec->getURI();
@@ -101,24 +101,24 @@
//NOTE i've been a bit liberal here with folding code into this function, while it did get a bit long, the many include()'s are slowing us down
// Should really clean this up a bit in the future though
$localeSpec = $this->getLocaleSpec($gadget, $context);
-
+
// get the message bundle for this gadget
$bundle = $this->getBundle($localeSpec, $context);
-
+
//FIXME this is a half-assed solution between following the refactoring and maintaining some of the old code, fixing this up later
$gadget->setMessageBundle($bundle);
-
+
// perform substitutions
$substitutor = $gadget->getSubstitutions();
-
+
// Module ID
$substitutor->addSubstitution('MODULE', "ID", $gadget->getId()->getModuleId());
-
+
// Messages (multi-language)
if ($bundle) {
$gadget->getSubstitutions()->addSubstitutions('MSG', $bundle->getMessages());
}
-
+
// Bidi support
$rtl = false;
if ($localeSpec != null) {
@@ -128,7 +128,7 @@
$substitutor->addSubstitution('BIDI', "END_EDGE", $rtl ? "left" : "right");
$substitutor->addSubstitution('BIDI', "DIR", $rtl ? "rtl" : "ltr");
$substitutor->addSubstitution('BIDI', "REVERSE_DIR", $rtl ? "ltr" : "rtl");
-
+
// userPref's
$upValues = $gadget->getUserPrefValues();
foreach ($gadget->getUserPrefs() as $pref) {
@@ -142,7 +142,7 @@
}
$substitutor->addSubstitution('USER_PREF', $name, $value);
}
-
+
// Process required / desired features
$requires = $gadget->getRequires();
$needed = array();
Modified: incubator/shindig/trunk/php/src/gadgets/GadgetSpecParser.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/GadgetSpecParser.php?rev=667051&r1=667050&r2=667051&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/GadgetSpecParser.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/GadgetSpecParser.php Thu Jun 12 04:50:27 2008
@@ -96,7 +96,7 @@
$gadget->localeSpecs[] = $this->processLocale($locale, $context);
}
}
-
+
private function processLink($link)
{
$attributes = $link->attributes();
@@ -117,9 +117,9 @@
$localeMessageBundles = array();
if ($messageAttr == '') {
$messageBundle = $locale->messagebundle;
- if (!empty($messageBundle)) {
+ if (! empty($messageBundle)) {
$messageName = $messageBundle->msg;
- if (!empty($messageName)) {
+ if (! empty($messageName)) {
foreach ($messageName as $name) {
$attrs = $name->attributes();
$localeMessageBundle = new LocalMessageBundle((string)$attrs['name'], (string)$name);
Modified: incubator/shindig/trunk/php/src/gadgets/JsLibrary.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/JsLibrary.php?rev=667051&r1=667050&r2=667051&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/JsLibrary.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/JsLibrary.php Thu Jun 12 04:50:27 2008
@@ -65,12 +65,10 @@
public function toString()
{
- //FIXME purely for debugging, remove this asap!
- // puts a //LIB: <name of feature> above the JS of the feature
if ($this->type == 'URL') {
- return "<!-- \n\n//LIB: ".$this->featureName."\n -->" . "<script src=\"" . $this->getContent() . "\"></script>";
+ return "<script src=\"" . $this->getContent() . "\"></script>";
} else {
- return "\n\n//LIB: ".$this->featureName."\n"."<script><!--\n" . $this->getContent() . "\n--></script>";
+ return "\n<script><!--\n" . $this->getContent() . "\n--></script>\n";
}
}
Modified: incubator/shindig/trunk/php/src/gadgets/JsonRpcHandler.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/JsonRpcHandler.php?rev=667051&r1=667050&r2=667051&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/JsonRpcHandler.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/JsonRpcHandler.php Thu Jun 12 04:50:27 2008
@@ -14,7 +14,8 @@
$gadget = $gadgetServer->processGadget($context);
$response[] = $this->makeResponse($gadget, $gadgetModuleId, $gadgetUrl, $context);
} catch (Exception $e) {
- $response[] = array('errors' => array($e->getMessage()), 'moduleId' => $gadgetModuleId, 'url' => $gadgetUrl);
+ $response[] = array('errors' => array($e->getMessage()),
+ 'moduleId' => $gadgetModuleId, 'url' => $gadgetUrl);
}
}
return $response;
@@ -25,7 +26,9 @@
$response = array();
$prefs = array();
foreach ($gadget->getUserPrefs() as $pref) {
- $prefs[$pref->getName()] = array('displayName' => $pref->getDisplayName(), 'type' => $pref->getDataType(), 'default' => $pref->getDefaultValue(), 'enumValues' => $pref->getEnumValues());
+ $prefs[$pref->getName()] = array('displayName' => $pref->getDisplayName(),
+ 'type' => $pref->getDataType(), 'default' => $pref->getDefaultValue(),
+ 'enumValues' => $pref->getEnumValues());
}
$features = array();
foreach ($gadget->getRequires() as $feature) {
Modified: incubator/shindig/trunk/php/src/gadgets/LinkSpec.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/LinkSpec.php?rev=667051&r1=667050&r2=667051&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/LinkSpec.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/LinkSpec.php Thu Jun 12 04:50:27 2008
@@ -32,7 +32,7 @@
{
return $this->rel;
}
-
+
public function getHref()
{
return $this->href;
Modified: incubator/shindig/trunk/php/src/gadgets/ProxyGadgetContext.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/ProxyGadgetContext.php?rev=667051&r1=667050&r2=667051&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/ProxyGadgetContext.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/ProxyGadgetContext.php Thu Jun 12 04:50:27 2008
@@ -2,9 +2,9 @@
class ProxyGadgetContext extends GadgetContext {
- public function __construct($url)
- {
- parent::__construct('GADGET');
- $this->url = $url;
- }
+ public function __construct($url)
+ {
+ parent::__construct('GADGET');
+ $this->url = $url;
+ }
}
Modified: incubator/shindig/trunk/php/src/gadgets/Substitutions.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/Substitutions.php?rev=667051&r1=667050&r2=667051&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/Substitutions.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/Substitutions.php Thu Jun 12 04:50:27 2008
@@ -19,7 +19,8 @@
*/
class Substitutions {
- private $types = array('MESSAGE' => 'MSG', 'BIDI' => 'BIDI', 'USER_PREF' => 'UP', 'MODULE' => 'MODULE');
+ private $types = array('MESSAGE' => 'MSG', 'BIDI' => 'BIDI', 'USER_PREF' => 'UP',
+ 'MODULE' => 'MODULE');
private $substitutions = array();
Modified: incubator/shindig/trunk/php/src/gadgets/oauth/OAuth.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/oauth/OAuth.php?rev=667051&r1=667050&r2=667051&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/oauth/OAuth.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/oauth/OAuth.php Thu Jun 12 04:50:27 2008
@@ -283,8 +283,11 @@
public static function from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters = NULL)
{
$parameters = is_array($parameters) ? $parameters : array();
- $defaults = array("oauth_nonce" => OAuthRequest::generate_nonce(), "oauth_timestamp" => OAuthRequest::generate_timestamp(), "oauth_consumer_key" => $consumer->key, // quick hack to make this demo'able
-'synd' => 'partuza', 'container' => 'partuza');
+ $defaults = array("oauth_nonce" => OAuthRequest::generate_nonce(),
+ "oauth_timestamp" => OAuthRequest::generate_timestamp(),
+ "oauth_consumer_key" => $consumer->key, // quick hack to make this demo'able
+'synd' => 'partuza',
+ 'container' => 'partuza');
$parameters = array_merge($defaults, $parameters);
if (isset($token)) {
$parameters['oauth_token'] = $token;
@@ -386,7 +389,8 @@
foreach ($params as $key => $value) {
$this->parameters[$key] = $value;
}
- $parts = array($this->get_normalized_http_method(), $this->get_normalized_http_url(), $this->get_signable_parameters());
+ $parts = array($this->get_normalized_http_method(), $this->get_normalized_http_url(),
+ $this->get_signable_parameters());
$parts = array_map(array('OAuthUtil', 'urlencodeRFC3986'), $parts);
$this->parameters = $tmp;
return implode('&', $parts);
Modified: incubator/shindig/trunk/php/src/gadgets/oauth/OAuthStore.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/oauth/OAuthStore.php?rev=667051&r1=667050&r2=667051&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/oauth/OAuthStore.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/oauth/OAuthStore.php Thu Jun 12 04:50:27 2008
@@ -19,19 +19,27 @@
*/
interface OAuthStore {
+
public function setOAuthServiceProviderInfo($providerKey, $providerInfo);
+
public function getOAuthServiceProviderInfo($providerKey);
+
public function setOAuthConsumerKeyAndSecret($providerKey, $keyAndSecret);
+
public function setTokenAndSecret($tokenKey, $tokenInfo);
+
public function getOAuthAccessorTokenKey(TokenKey $tokenKey);
}
class OAuthStoreVars {
public static $HttpMethod = array('GET' => 'GET', 'POST' => 'POST');
- public static $SignatureType = array('HMAC_SHA1' => 'HMAC_SHA1', 'RSA_SHA1' => 'RSA_SHA1', 'PLAINTEXT' => 'PLAINTEXT');
- public static $KeyType = array('HMAC_SYMMETRIC' => 'HMAC_SYMMETRIC', 'RSA_PRIVATE' => 'RSA_PRIVATE');
- public static $OAuthParamLocation = array('AUTH_HEADER' => 'auth_header', 'POST_BODY' => 'post_body', 'URI_QUERY' => 'uri_query');
+ public static $SignatureType = array('HMAC_SHA1' => 'HMAC_SHA1', 'RSA_SHA1' => 'RSA_SHA1',
+ 'PLAINTEXT' => 'PLAINTEXT');
+ public static $KeyType = array('HMAC_SYMMETRIC' => 'HMAC_SYMMETRIC',
+ 'RSA_PRIVATE' => 'RSA_PRIVATE');
+ public static $OAuthParamLocation = array('AUTH_HEADER' => 'auth_header',
+ 'POST_BODY' => 'post_body', 'URI_QUERY' => 'uri_query');
}
class AccesorInfo {