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/05/07 16:13:51 UTC
svn commit: r654115 - in /incubator/shindig/trunk/php/src: common/ gadgets/
gadgets/http/ gadgets/samplecontainer/ socialdata/ socialdata/http/
socialdata/opensocial/ socialdata/opensocial/model/
socialdata/samplecontainer/
Author: chabotc
Date: Wed May 7 07:13:48 2008
New Revision: 654115
URL: http://svn.apache.org/viewvc?rev=654115&view=rev
Log:
Re-formatted to not have tabs on empty lines in classes between functions and added missing license header
Modified:
incubator/shindig/trunk/php/src/common/BlobCrypter.php
incubator/shindig/trunk/php/src/common/Cache.php
incubator/shindig/trunk/php/src/common/CacheFile.php
incubator/shindig/trunk/php/src/common/CacheMemcache.php
incubator/shindig/trunk/php/src/common/Crypto.php
incubator/shindig/trunk/php/src/common/HttpServlet.php
incubator/shindig/trunk/php/src/common/Locale.php
incubator/shindig/trunk/php/src/common/RemoteContent.php
incubator/shindig/trunk/php/src/common/RemoteContentFetcher.php
incubator/shindig/trunk/php/src/common/RemoteContentRequest.php
incubator/shindig/trunk/php/src/common/UrlGenerator.php
incubator/shindig/trunk/php/src/gadgets/ContainerConfig.php
incubator/shindig/trunk/php/src/gadgets/FeatureSpec.php
incubator/shindig/trunk/php/src/gadgets/Gadget.php
incubator/shindig/trunk/php/src/gadgets/GadgetBlacklist.php
incubator/shindig/trunk/php/src/gadgets/GadgetContext.php
incubator/shindig/trunk/php/src/gadgets/GadgetFeature.php
incubator/shindig/trunk/php/src/gadgets/GadgetFeatureFactory.php
incubator/shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php
incubator/shindig/trunk/php/src/gadgets/GadgetId.php
incubator/shindig/trunk/php/src/gadgets/GadgetServer.php
incubator/shindig/trunk/php/src/gadgets/GadgetSpecParser.php
incubator/shindig/trunk/php/src/gadgets/JsFeatureLoader.php
incubator/shindig/trunk/php/src/gadgets/JsLibrary.php
incubator/shindig/trunk/php/src/gadgets/JsLibraryFeatureFactory.php
incubator/shindig/trunk/php/src/gadgets/JsonRpcGadgetContext.php
incubator/shindig/trunk/php/src/gadgets/JsonRpcHandler.php
incubator/shindig/trunk/php/src/gadgets/LocaleSpec.php
incubator/shindig/trunk/php/src/gadgets/MessageBundle.php
incubator/shindig/trunk/php/src/gadgets/MessageBundleParser.php
incubator/shindig/trunk/php/src/gadgets/Substitutions.php
incubator/shindig/trunk/php/src/gadgets/UserPref.php
incubator/shindig/trunk/php/src/gadgets/UserPrefs.php
incubator/shindig/trunk/php/src/gadgets/http/JsonRpcServlet.php
incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicBlobCrypter.php
incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicGadgetBlacklist.php
incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicGadgetTokenDecoder.php
incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicRemoteContent.php
incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicRemoteContentFetcher.php
incubator/shindig/trunk/php/src/socialdata/DataResponse.php
incubator/shindig/trunk/php/src/socialdata/GadgetDataHandler.php
incubator/shindig/trunk/php/src/socialdata/http/GadgetDataServlet.php
incubator/shindig/trunk/php/src/socialdata/opensocial/ActivitiesService.php
incubator/shindig/trunk/php/src/socialdata/opensocial/DataService.php
incubator/shindig/trunk/php/src/socialdata/opensocial/PeopleService.php
incubator/shindig/trunk/php/src/socialdata/opensocial/model/Activity.php
incubator/shindig/trunk/php/src/socialdata/opensocial/model/idSpec.php
incubator/shindig/trunk/php/src/socialdata/samplecontainer/BasicActivitiesService.php
incubator/shindig/trunk/php/src/socialdata/samplecontainer/BasicDataService.php
incubator/shindig/trunk/php/src/socialdata/samplecontainer/BasicPeopleService.php
incubator/shindig/trunk/php/src/socialdata/samplecontainer/StateFileDataHandler.php
Modified: incubator/shindig/trunk/php/src/common/BlobCrypter.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/common/BlobCrypter.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/common/BlobCrypter.php (original)
+++ incubator/shindig/trunk/php/src/common/BlobCrypter.php Wed May 7 07:13:48 2008
@@ -27,7 +27,7 @@
*
*/
abstract class BlobCrypter {
-
+
/**
* Time stamps, encrypts, and signs a blob.
*
@@ -37,7 +37,7 @@
* @throws BlobCrypterException
*/
abstract public function wrap(Array $in);
-
+
/**
* Unwraps a blob.
*
Modified: incubator/shindig/trunk/php/src/common/Cache.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/common/Cache.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/common/Cache.php (original)
+++ incubator/shindig/trunk/php/src/common/Cache.php Wed May 7 07:13:48 2008
@@ -21,10 +21,10 @@
class CacheException extends Exception {}
abstract class Cache {
-
+
abstract function get($key);
-
+
abstract function set($key, $value);
-
+
abstract function delete($key);
}
\ No newline at end of file
Modified: incubator/shindig/trunk/php/src/common/CacheFile.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/common/CacheFile.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/common/CacheFile.php (original)
+++ incubator/shindig/trunk/php/src/common/CacheFile.php Wed May 7 07:13:48 2008
@@ -33,7 +33,7 @@
class CacheFile extends Cache {
-
+
function get($key)
{
$cacheFile = $this->getCacheFile($key);
@@ -48,7 +48,7 @@
}
return false;
}
-
+
function set($key, $value)
{
// use the first 2 characters of the hash as a directory prefix
@@ -68,7 +68,7 @@
throw new CacheException("Could not store data in cache file");
}
}
-
+
function delete($key)
{
$file = $this->getCacheFile($key);
@@ -76,12 +76,12 @@
throw new CacheException("Cache file could not be deleted");
}
}
-
+
private function getCacheDir($hash)
{
return Config::get('cache_root') . '/' . substr($hash, 0, 2);
}
-
+
private function getCacheFile($hash)
{
return $this->getCacheDir($hash) . '/' . $hash;
Modified: incubator/shindig/trunk/php/src/common/CacheMemcache.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/common/CacheMemcache.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/common/CacheMemcache.php (original)
+++ incubator/shindig/trunk/php/src/common/CacheMemcache.php Wed May 7 07:13:48 2008
@@ -25,7 +25,7 @@
*/
class CacheMemcache extends Cache {
private $connection = false;
-
+
public function __construct()
{
if (! function_exists('memcache_connect')) {
@@ -37,7 +37,7 @@
$this->host = Config::get('cache_host');
$this->port = Config::get('cache_port');
}
-
+
public function __destruct()
{
// if we were connected, close the connection again
@@ -45,7 +45,7 @@
memcache_close($this->connection);
}
}
-
+
// I prefer lazy initalization since the cache isn't used every request
// so this potentially saves a lot of overhead
private function connect()
@@ -54,14 +54,14 @@
throw new CacheException("Couldn't connect to memcache server");
}
}
-
+
private function check()
{
if (! $this->connection) {
$this->connect();
}
}
-
+
// using memcache_add behavior for cache stampeding prevention
private function add($key, $var, $timeout)
{
@@ -70,7 +70,7 @@
throw new CacheException("Couldn't add to cache");
}
}
-
+
public function get($key)
{
$this->check();
@@ -79,7 +79,7 @@
}
return $ret;
}
-
+
public function set($key, $value)
{
$this->check();
@@ -87,7 +87,7 @@
throw new CacheException("Couldn't store data in cache");
}
}
-
+
function delete($key)
{
Modified: incubator/shindig/trunk/php/src/common/Crypto.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/common/Crypto.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/common/Crypto.php (original)
+++ incubator/shindig/trunk/php/src/common/Crypto.php Wed May 7 07:13:48 2008
@@ -51,11 +51,11 @@
* Length of HMAC SHA1 output
*/
public static $HMAC_SHA1_LEN = 20;
-
+
private function __construct()
{
}
-
+
public static function hmacSha1Verify($key, $in, $expected)
{
$hmac = Crypto::hmacSha1($key, $in);
@@ -63,16 +63,16 @@
throw new GeneralSecurityException("HMAC verification failure");
}
}
-
+
public static function aes128cbcEncrypt($key, $text)
{
/* Open the cipher */
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, '');
- if (!$td) {
+ if (! $td) {
throw new GeneralSecurityException('Invalid mcrypt cipher, check your libmcrypt library and php-mcrypt extention');
}
// replaced MCRYPT_DEV_RANDOM with MCRYPT_RAND since windows doesn't have /dev/rand :)
- srand((double) microtime() * 1000000);
+ srand((double)microtime() * 1000000);
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
/* Intialize encryption */
mcrypt_generic_init($td, $key, $iv);
@@ -86,7 +86,7 @@
*/
return $iv . $encrypted;
}
-
+
public static function aes128cbcDecrypt($key, $encrypted_text)
{
/* Open the cipher */
@@ -103,7 +103,7 @@
/* Show string */
return trim($decrypted);
}
-
+
public static function hmacSha1($key, $data)
{
$blocksize = 64;
Modified: incubator/shindig/trunk/php/src/common/HttpServlet.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/common/HttpServlet.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/common/HttpServlet.php (original)
+++ incubator/shindig/trunk/php/src/common/HttpServlet.php Wed May 7 07:13:48 2008
@@ -30,7 +30,7 @@
private $noCache = false;
private $cacheTime;
public $noHeaders = false;
-
+
/**
* Enables output buffering so we can do correct header handling in the destructor
*
@@ -42,7 +42,7 @@
// to do our header magic, we need output buffering on
ob_start();
}
-
+
/**
* Code ran after the event handler, adds headers etc to the request
* If noHeaders is false, it adds all the correct http/1.1 headers to the request
@@ -97,7 +97,7 @@
echo $content;
}
}
-
+
/**
* Sets the time in seconds that the browser's cache should be
* considered out of date (through the Expires header)
@@ -108,7 +108,7 @@
{
$this->cacheTime = $time;
}
-
+
/**
* Returns the time in seconds that the browser is allowed to cache the content
*
@@ -118,7 +118,7 @@
{
return $this->cacheTime;
}
-
+
/**
* Sets the content type of this request (forinstance: text/html or text/javascript, etc)
*
@@ -128,7 +128,7 @@
{
$this->contentType = $type;
}
-
+
/**
* Returns the current content type
*
@@ -138,7 +138,7 @@
{
return $this->contentType;
}
-
+
/**
* returns the current last modified time stamp
*
@@ -148,7 +148,7 @@
{
return $this->lastModified;
}
-
+
/**
* Sets the last modified timestamp. It automaticly checks if this timestamp
* is larger then its current timestamp, and if not ignores the call
@@ -159,7 +159,7 @@
{
$this->lastModified = max($this->lastModified, $modified);
}
-
+
/**
* Sets the noCache boolean. If its set to true, no-caching headers will be send
* (pragma no cache, expiration in the past)
@@ -170,7 +170,7 @@
{
$this->noCache = $cache;
}
-
+
/**
* returns the noCache boolean
*
Modified: incubator/shindig/trunk/php/src/common/Locale.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/common/Locale.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/common/Locale.php (original)
+++ incubator/shindig/trunk/php/src/common/Locale.php Wed May 7 07:13:48 2008
@@ -7,13 +7,13 @@
class Locale {
public $language;
public $country;
-
+
public function __construct($language, $country)
{
$this->language = $language;
$this->country = $country;
}
-
+
public function equals($obj)
{
if (! ($obj instanceof Locale)) {
@@ -21,12 +21,12 @@
}
return ($obj->language == $this->language && $obj->country == $this->country);
}
-
+
public function getLanguage()
{
return $this->language;
}
-
+
public function getCountry()
{
return $this->country;
Modified: incubator/shindig/trunk/php/src/common/RemoteContent.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/common/RemoteContent.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/common/RemoteContent.php (original)
+++ incubator/shindig/trunk/php/src/common/RemoteContent.php Wed May 7 07:13:48 2008
@@ -29,6 +29,6 @@
class RemoteContentException extends Exception {}
abstract class RemoteContent {
-
+
abstract public function fetch($request, $context);
}
Modified: incubator/shindig/trunk/php/src/common/RemoteContentFetcher.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/common/RemoteContentFetcher.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/common/RemoteContentFetcher.php (original)
+++ incubator/shindig/trunk/php/src/common/RemoteContentFetcher.php Wed May 7 07:13:48 2008
@@ -19,6 +19,6 @@
*/
abstract class RemoteContentFetcher {
-
+
abstract public function fetchRequest($request);
}
\ No newline at end of file
Modified: incubator/shindig/trunk/php/src/common/RemoteContentRequest.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/common/RemoteContentRequest.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/common/RemoteContentRequest.php (original)
+++ incubator/shindig/trunk/php/src/common/RemoteContentRequest.php Wed May 7 07:13:48 2008
@@ -30,106 +30,106 @@
private $httpCode = false;
private $contentType = null;
public $handle = false;
-
+
public function __construct($url, $headers = false, $postBody = false)
{
$this->url = $url;
$this->headers = $headers;
$this->postBody = $postBody;
}
-
+
// returns a hash code which identifies this request, used for caching
// takes url and postbody into account for constructing the sha1 checksum
public function toHash()
{
return sha1($this->url . $this->postBody);
}
-
+
public function getContentType()
{
return $this->contentType;
}
-
+
public function getHttpCode()
{
return $this->httpCode;
}
-
+
public function getResponseContent()
{
return $this->responseContent;
}
-
+
public function getResponseHeaders()
{
return $this->responseHeaders;
}
-
+
public function getResponseSize()
{
return $this->responseSize;
}
-
+
public function getHeaders()
{
return $this->headers;
}
-
+
public function isPost()
{
return ($this->postBody != false);
}
-
+
public function hasHeaders()
{
return ! empty($this->headers);
}
-
+
public function getPostBody()
{
return $this->postBody;
}
-
+
public function getUrl()
{
return $this->url;
}
-
+
public function setContentType($type)
{
$this->contentType = $type;
}
-
+
public function setHttpCode($code)
{
$this->httpCode = intval($code);
}
-
+
public function setResponseContent($content)
{
$this->responseContent = $content;
}
-
+
public function setResponseHeaders($headers)
{
$this->responseHeaders = $headers;
}
-
+
public function setResponseSize($size)
{
$this->responseSize = intval($size);
}
-
+
public function setHeaders($headers)
{
$this->headers = $headers;
}
-
+
public function setPostBody($postBody)
{
$this->postBody = $postBody;
}
-
+
public function setUrl($url)
{
$this->url = $url;
Modified: incubator/shindig/trunk/php/src/common/UrlGenerator.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/common/UrlGenerator.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/common/UrlGenerator.php (original)
+++ incubator/shindig/trunk/php/src/common/UrlGenerator.php Wed May 7 07:13:48 2008
@@ -19,10 +19,11 @@
*/
class UrlGenerator {
- static function getIframeURL($gadget, $context)
+
+ static function getIframeURL($gadget, $context)
{
$inlineJs = '';
- foreach ( $gadget->getJsLibraries() as $library ) {
+ foreach ($gadget->getJsLibraries() as $library) {
$type = $library->getType();
if ($type != 'URL') {
$inlineJs .= $library->getContent() . "\n";
@@ -40,19 +41,10 @@
if ($value == null) {
$value = $pref->getDefaultValue();
}
- $up .= '&up_'.urlencode($name).'='.urlencode($value);
+ $up .= '&up_' . urlencode($name) . '=' . urlencode($value);
}
// note: put the URL last, else some browsers seem to get confused (reported by hi5)
- return
- Config::get('default_iframe_prefix').
- 'container='.$context->getContainer().
- ($context->getIgnoreCache() ? 'nocache=1' : '&v='.$v).
- ($context->getModuleId() != 0 ? '&mid='.$context->getModuleId() : '').
- '&lang='.$context->getLocale()->getLanguage().
- '&country='.$context->getLocale()->getCountry().
- '&view='.$view->getName().
- $up.
- '&url='.urlencode($context->getUrl());
+ return Config::get('default_iframe_prefix') . 'container=' . $context->getContainer() . ($context->getIgnoreCache() ? 'nocache=1' : '&v=' . $v) . ($context->getModuleId() != 0 ? '&mid=' . $context->getModuleId() : '') . '&lang=' . $context->getLocale()->getLanguage() . '&country=' . $context->getLocale()->getCountry() . '&view=' . $view->getName() . $up . '&url=' . urlencode($context->getUrl());
}
}
Modified: incubator/shindig/trunk/php/src/gadgets/ContainerConfig.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/ContainerConfig.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/ContainerConfig.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/ContainerConfig.php Wed May 7 07:13:48 2008
@@ -22,14 +22,14 @@
public $default_container = 'default';
public $container_key = 'gadgets.container';
private $config = array();
-
+
public function __construct($defaultContainer)
{
if (! empty($defaultContainer)) {
$this->loadContainers($defaultContainer);
}
}
-
+
private function loadContainers($containers)
{
if (! file_exists($containers) || ! is_dir($containers)) {
@@ -47,7 +47,7 @@
}
}
}
-
+
private function loadFromFile($file)
{
$contents = file_get_contents($file);
@@ -64,7 +64,7 @@
$this->config[$container][$key] = $val;
}
}
-
+
public function getConfig($container, $name)
{
$config = array();
@@ -77,7 +77,7 @@
return $config;
}
-
+
// Code sniplet borrowed from: http://nl.php.net/manual/en/function.array-merge-recursive.php#81409
// default array merge recursive doesn't overwrite values, but creates multiple elementents for that key,
// which is not what we want here, we want array_merge like behavior
Modified: incubator/shindig/trunk/php/src/gadgets/FeatureSpec.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/FeatureSpec.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/FeatureSpec.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/FeatureSpec.php Wed May 7 07:13:48 2008
@@ -22,17 +22,17 @@
public $name;
public $params = array();
public $optional;
-
+
public function getName()
{
return $this->name;
}
-
+
public function getParams()
{
return $this->params;
}
-
+
public function isOptional()
{
return $this->optional;
Modified: incubator/shindig/trunk/php/src/gadgets/Gadget.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/Gadget.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/Gadget.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/Gadget.php Wed May 7 07:13:48 2008
@@ -63,7 +63,7 @@
public $scaling;
public $scrolling;
public $views = array();
-
+
public function __construct($id = false, $context)
{
if ($id) {
@@ -75,62 +75,62 @@
$this->substitutions = new Substitutions();
$this->jsLibraries = array();
}
-
+
public function setId($id)
{
$this->id = $id;
}
-
+
public function setPrefs($prefs)
{
$this->userPrefValues = $prefs;
}
-
+
public function getAuthor()
{
return $this->substitutions->substitute($this->author);
}
-
+
public function getAuthorEmail()
{
return $this->substitutions->substitute($this->authorEmail);
}
-
+
public function getMessageBundle()
{
return $this->messageBundle;
}
-
+
public function getDescription()
{
return $this->substitutions->substitute($this->description);
}
-
+
public function getDirectoryTitle()
{
return $this->substitutions->substitute($this->directoryTitle);
}
-
+
public function getId()
{
return $this->id;
}
-
+
public function getJsLibraries()
{
return $this->jsLibraries;
}
-
+
public function addJsLibrary($library)
{
$this->jsLibraries[] = $library;
}
-
+
public function getLocaleSpecs()
{
return $this->localeSpecs;
}
-
+
public function getFeatureParams($gadget, $feature)
{
//FIXME not working atm
@@ -142,7 +142,7 @@
return $spec->getParams();
}
}
-
+
public function getPreloads()
{
$ret = array();
@@ -151,32 +151,32 @@
}
return $ret;
}
-
+
public function getRequires()
{
return $this->requires;
}
-
+
public function getScreenshot()
{
return $this->substitutions->substitute($this->screenshot);
}
-
+
public function getSubstitutions()
{
return $this->substitutions;
}
-
+
public function getThumbnail()
{
return $this->substitutions->substitute($this->thumbnail);
}
-
+
public function getTitle()
{
return $this->substitutions->substitute($this->title);
}
-
+
public function getTitleUrl()
{
$ret = null;
@@ -185,112 +185,112 @@
}
return $ret;
}
-
+
public function getAuthorAffiliation()
{
$this->substitutions->substitute($this->authorAffiliation);
}
-
+
public function getAuthorLocation()
{
$this->substitutions->substitute($this->authorLocation);
}
-
+
public function getAuthorPhoto()
{
$this->substitutions->substitute($this->authorPhoto);
}
-
+
public function getAuthorAboutme()
{
$this->substitutions->substitute($this->authorAboutMe);
}
-
+
public function getAuthorQuote()
{
$this->substitutions->substitute($this->authorQuote);
}
-
+
public function getAuthorLink()
{
$this->substitutions->substitute($this->authorLink);
}
-
+
public function getShowStats()
{
return $this->showStats;
}
-
+
public function getShowInDirectory()
{
return $this->showInDirectory;
}
-
+
public function getString()
{
$this->substitutions->substitute($this->string);
}
-
+
public function getWidth()
{
return $this->width;
}
-
+
public function getHeight()
{
return $this->height;
}
-
+
public function getCategory()
{
return $this->category;
}
-
+
public function getCategory2()
{
return $this->category2;
}
-
+
public function getSingleton()
{
return $this->singleton;
}
-
+
public function getRenderInline()
{
return $this->renderInline;
}
-
+
public function getScaling()
{
return $this->scaling;
}
-
+
public function getScrolling()
{
return $this->scrolling;
}
-
+
public function getUserPrefs()
{
return $this->userPrefs;
}
-
+
public function getUserPrefValues()
{
return $this->userPrefValues;
}
-
+
public function setMessageBundle($messageBundle)
{
$this->messageBundle = $messageBundle;
}
-
+
public function getViews()
{
return $this->views;
}
-
+
public function getView($viewName)
{
return isset($this->views[$viewName]) ? $this->views[$viewName] : $this->views[DEFAULT_VIEW];
Modified: incubator/shindig/trunk/php/src/gadgets/GadgetBlacklist.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/GadgetBlacklist.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/GadgetBlacklist.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/GadgetBlacklist.php Wed May 7 07:13:48 2008
@@ -19,6 +19,6 @@
*/
abstract class GadgetBlacklist {
-
+
abstract function isBlacklisted($url);
}
\ No newline at end of file
Modified: incubator/shindig/trunk/php/src/gadgets/GadgetContext.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/GadgetContext.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/GadgetContext.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/GadgetContext.php Wed May 7 07:13:48 2008
@@ -41,7 +41,7 @@
private $forcedJsLibs = null;
private $containerConfig = null;
private $container = null;
-
+
public function __construct($renderingContext)
{
// Rendering context is set by the calling event handler (either GADGET or CONTAINER)
@@ -57,7 +57,7 @@
//NOTE All classes are initialized when called (aka lazy loading) because we don't
//need all of them in every situation
}
-
+
private function getContainerParam()
{
$container = 'default';
@@ -73,18 +73,18 @@
}
return $container;
}
-
+
private function getIgnoreCacheParam()
{
// Support both the old Orkut style &bpc and new standard style &nocache= params
return (isset($_GET['nocache']) && intval($_GET['nocache']) == 1) || (isset($_GET['bpc']) && intval($_GET['bpc']) == 1);
}
-
+
private function getFocedJsLibsParam()
{
return isset($_GET['libs']) ? trim($_GET['libs']) : null;
}
-
+
private function getUrlParam()
{
if (! empty($_GET['url'])) {
@@ -94,17 +94,17 @@
}
return null;
}
-
+
private function getModuleIdParam()
{
return isset($_GET['mid']) && is_numeric($_GET['mid']) ? intval($_GET['mid']) : 0;
}
-
+
private function getViewParam()
{
return ! empty($_GET['view']) ? $_GET['view'] : DEFAULT_VIEW;
}
-
+
private function instanceBlacklist()
{
$blackListClass = Config::get('blacklist_class');
@@ -114,7 +114,7 @@
return null;
}
}
-
+
private function instanceUserPrefs()
{
$prefs = array();
@@ -127,24 +127,24 @@
}
return new UserPrefs($prefs);
}
-
+
private function instanceGadgetId($url, $moduleId)
{
return new GadgetId($url, $moduleId);
}
-
+
private function instanceHttpFetcher()
{
$remoteContent = Config::get('remote_content');
return new $remoteContent();
}
-
+
private function instanceCache()
{
$dataCache = Config::get('data_cache');
return new $dataCache();
}
-
+
private function instanceRegistry()
{
// Profiling showed 40% of the processing time was spend in the feature registry
@@ -155,7 +155,7 @@
}
return $registry;
}
-
+
private function instanceLocale()
{
$language = 'all';
@@ -178,17 +178,17 @@
}
return new Locale($language, $country);
}
-
+
private function instanceContainerConfig()
{
return new ContainerConfig(Config::get('container_path'));
}
-
+
public function getContainer()
{
return $this->container;
}
-
+
public function getContainerConfig()
{
if ($this->containerConfig == null) {
@@ -196,7 +196,7 @@
}
return $this->containerConfig;
}
-
+
public function getCache()
{
if ($this->cache == null) {
@@ -204,7 +204,7 @@
}
return $this->cache;
}
-
+
public function getGadgetId()
{
if ($this->gadgetId == null) {
@@ -212,12 +212,12 @@
}
return $this->gadgetId;
}
-
+
public function getModuleId()
{
return $this->moduleId;
}
-
+
public function getRegistry()
{
if ($this->registry == null) {
@@ -225,12 +225,12 @@
}
return $this->registry;
}
-
+
public function getUrl()
{
return $this->url;
}
-
+
public function getUserPrefs()
{
if ($this->userPrefs == null) {
@@ -238,97 +238,97 @@
}
return $this->userPrefs;
}
-
+
public function getView()
{
return $this->view;
}
-
+
public function setContainer($container)
{
$this->container = $container;
}
-
+
public function setContainerConfig($containerConfig)
{
$this->containerConfig = $containerConfig;
}
-
+
public function setBlacklist($blacklist)
{
$this->blacklist = $blacklist;
}
-
+
public function setCache($cache)
{
$this->cache = $cache;
}
-
+
public function setGadgetId($gadgetId)
{
$this->gadgetId = $gadgetId;
}
-
+
public function setHttpFetcher($httpFetcher)
{
$this->httpFetcher = $httpFetcher;
}
-
+
public function setLocale($locale)
{
$this->locale = $locale;
}
-
+
public function setModuleId($moduleId)
{
$this->moduleId = $moduleId;
}
-
+
public function setRegistry($registry)
{
$this->registry = $registry;
}
-
+
public function setRenderingContext($renderingContext)
{
$this->renderingContext = $renderingContext;
}
-
+
public function setUrl($url)
{
$this->url = $url;
}
-
+
public function setUserPrefs($userPrefs)
{
$this->userPrefs = $userPrefs;
}
-
+
public function setView($view)
{
$this->view = $view;
}
-
+
public function setIgnoreCache($ignoreCache)
{
$this->ignoreCache = $ignoreCache;
}
-
+
public function setForcedJsLibs($forcedJsLibs)
{
$this->forcedJsLibs = $forcedJsLibs;
}
-
+
public function getIgnoreCache()
{
return $this->ignoreCache;
}
-
+
public function getForcedJsLibs()
{
return $this->forcedJsLibs;
}
-
+
public function getBlacklist()
{
if ($this->blacklist == null) {
@@ -336,12 +336,12 @@
}
return $this->blacklist;
}
-
+
public function getRenderingContext()
{
return $this->renderingContext;
}
-
+
public function getHttpFetcher()
{
if ($this->httpFetcher == null) {
@@ -349,7 +349,7 @@
}
return $this->httpFetcher;
}
-
+
public function getLocale()
{
if ($this->locale == null) {
@@ -357,7 +357,7 @@
}
return $this->locale;
}
-
+
public function getFeatureRegistry()
{
return $this->registry;
Modified: incubator/shindig/trunk/php/src/gadgets/GadgetFeature.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/GadgetFeature.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/GadgetFeature.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/GadgetFeature.php Wed May 7 07:13:48 2008
@@ -19,8 +19,8 @@
*/
abstract class GadgetFeature {
-
+
abstract public function prepare($gadget, $context, $params);
-
+
abstract public function process($gadget, $context, $params);
}
\ No newline at end of file
Modified: incubator/shindig/trunk/php/src/gadgets/GadgetFeatureFactory.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/GadgetFeatureFactory.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/GadgetFeatureFactory.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/GadgetFeatureFactory.php Wed May 7 07:13:48 2008
@@ -19,6 +19,6 @@
*/
abstract class GadgetFeatureFactory {
-
+
abstract public function create();
}
\ No newline at end of file
Modified: incubator/shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php Wed May 7 07:13:48 2008
@@ -23,13 +23,13 @@
private $core = array();
private $coreDone = false;
private $debug;
-
+
public function __construct($featurePath, $debug = false)
{
$this->debug = $debug;
$this->registerFeatures($featurePath);
}
-
+
public function registerFeatures($featurePath)
{
if (empty($featurePath) || $featurePath == null) {
@@ -54,7 +54,7 @@
$this->coreDone = true;
}
}
-
+
public function register($name, $deps, $feature)
{
// Core entries must come first.
@@ -69,17 +69,17 @@
}
return $entry;
}
-
+
private function validateFeatureGraph()
{
// TODO: ensure that features form a DAG and that all deps are provided
}
-
+
public function getAllFeatures()
{
return $this->features;
}
-
+
public function getIncludedFeatures($needed, &$resultsFound, &$resultsMissing)
{
$resultsFound = array();
@@ -99,7 +99,7 @@
}
return count($resultsMissing) == 0;
}
-
+
private function addEntryToSet(&$results, $entry)
{
foreach ($entry->deps as $dep) {
@@ -107,7 +107,7 @@
}
$results[$entry->name] = $entry->name;
}
-
+
public function getEntry($name)
{
return $this->features[$name];
@@ -119,7 +119,7 @@
public $name;
public $deps = array();
public $feature;
-
+
public function __construct($name, $deps, $feature, $registry)
{
$this->name = $name;
@@ -131,17 +131,17 @@
}
$this->feature = $feature;
}
-
+
public function getName()
{
return $this->name;
}
-
+
public function getDependencies()
{
return $this->deps;
}
-
+
public function getFeature()
{
return $this->feature;
Modified: incubator/shindig/trunk/php/src/gadgets/GadgetId.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/GadgetId.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/GadgetId.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/GadgetId.php Wed May 7 07:13:48 2008
@@ -3,23 +3,23 @@
class GadgetId {
private $uri;
private $moduleId;
-
+
public function GadgetId($uri, $moduleId)
{
$this->uri = $uri;
$this->moduleId = $moduleId;
}
-
+
public function getURI()
{
return $this->uri;
}
-
+
public function getModuleId()
{
return $this->moduleId;
}
-
+
public function getKey()
{
return $this->getURI();
Modified: incubator/shindig/trunk/php/src/gadgets/GadgetServer.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/GadgetServer.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/GadgetServer.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/GadgetServer.php Wed May 7 07:13:48 2008
@@ -24,14 +24,14 @@
*/
class GadgetServer {
-
+
public function processGadget($context)
{
$gadget = $this->specLoad($context);
$this->featuresLoad($gadget, $context);
return $gadget;
}
-
+
private function specLoad($context)
{
if ($context->getBlacklist() != null && $context->getBlacklist()->isBlacklisted($context->getUrl())) {
@@ -46,7 +46,7 @@
$gadget = $specParser->parse($xml->getResponseContent(), $context);
return $gadget;
}
-
+
private function getBundle($localeSpec, $context)
{
if ($localeSpec != null) {
@@ -61,7 +61,7 @@
}
return null;
}
-
+
private function localeSpec($gadget, $locale)
{
$localeSpecs = $gadget->getLocaleSpecs();
@@ -73,7 +73,7 @@
}
return null;
}
-
+
private function getLocaleSpec($gadget, $context)
{
$locale = $context->getLocale();
@@ -89,7 +89,7 @@
}
return $localeSpec;
}
-
+
private function featuresLoad($gadget, $context)
{
//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
Modified: incubator/shindig/trunk/php/src/gadgets/GadgetSpecParser.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/GadgetSpecParser.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/GadgetSpecParser.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/GadgetSpecParser.php Wed May 7 07:13:48 2008
@@ -21,7 +21,7 @@
class SpecParserException extends Exception {}
class GadgetSpecParser {
-
+
public function parse($xml, $context)
{
if (empty($xml)) {
@@ -53,7 +53,7 @@
//TODO Parse icons
return $gadget;
}
-
+
private function processModulePrefs(&$gadget, $ModulePrefs)
{
$attributes = $ModulePrefs->attributes();
@@ -93,7 +93,7 @@
$gadget->localeSpecs[] = $this->processLocale($locale);
}
}
-
+
private function processLocale($locale)
{
$attributes = $locale->attributes();
@@ -109,7 +109,7 @@
$locale->locale = new Locale($languageAttr, $countryAttr);
return $locale;
}
-
+
private function processUserPref(&$gadget, $pref)
{
$attributes = $pref->attributes();
@@ -136,7 +136,7 @@
}
$gadget->userPrefs[] = $preference;
}
-
+
private function processContent(&$gadget, $content)
{
$attributes = $content->attributes();
@@ -157,12 +157,12 @@
} else {
if ($gadget->views[$view]->getName() == $viewSpec->getName() && $viewSpec->getType() != $gadget->views[$view]->getType()) {
throw new SpecParserException("You may not mix content " . " types in the same view.");
- }
+ }
$gadget->views[$view]->addContent($html);
}
}
}
-
+
private function processFeature(&$gadget, $feature, $required)
{
$featureSpec = new FeatureSpec();
Modified: incubator/shindig/trunk/php/src/gadgets/JsFeatureLoader.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/JsFeatureLoader.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/JsFeatureLoader.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/JsFeatureLoader.php Wed May 7 07:13:48 2008
@@ -20,12 +20,12 @@
class JsFeatureLoader {
private $debug;
-
+
public function __construct($debug)
{
$this->debug = $debug;
}
-
+
public function loadFeatures($path, $registry)
{
$registered = array();
@@ -42,7 +42,7 @@
}
return $entries;
}
-
+
private function loadFiles($path, &$features)
{
if (is_dir($path)) {
@@ -63,7 +63,7 @@
}
return $features;
}
-
+
private function processFile($file)
{
$feature = null;
@@ -74,7 +74,7 @@
}
return $feature;
}
-
+
private function register(&$registry, $feature, $registered, $all)
{
if (isset($registered[$feature->name])) {
@@ -89,7 +89,7 @@
$registered[] = $feature->name;
return $registry->register($feature->name, $feature->deps, $factory);
}
-
+
private function parse($content, $path)
{
$doc = simplexml_load_string($content);
@@ -111,7 +111,7 @@
}
return $feature;
}
-
+
private function processContext(&$feature, $context, $isContainer)
{
foreach ($context->script as $script) {
Modified: incubator/shindig/trunk/php/src/gadgets/JsLibrary.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/JsLibrary.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/JsLibrary.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/JsLibrary.php Wed May 7 07:13:48 2008
@@ -23,30 +23,30 @@
private $type;
private $content;
private $featureName; // used to track what feature this belongs to
-
+
public function __construct($type, $content, $featureName = '')
{
$this->featureName = $featureName;
$this->type = $type;
$this->content = $content;
}
-
+
public function getType()
{
return $this->type;
}
-
+
public function getContent()
{
return $this->content;
}
-
+
public function getFeatureName()
{
return $this->featureName;
}
-
+
public function toString()
{
if ($this->type == 'URL') {
@@ -55,7 +55,7 @@
return "<script><!--\n" . $this->content . "\n--></script>";
}
}
-
+
static function create($type, $content, $debug)
{
$feature = '';
@@ -70,7 +70,7 @@
}
return new JsLibrary($type, $content, $feature);
}
-
+
static private function loadData($name, $type, $debug)
{
// we don't really do 'resources', so limiting this to files only
@@ -79,7 +79,7 @@
}
return null;
}
-
+
static private function loadFile($fileName, $debug)
{
if (empty($fileName)) {
Modified: incubator/shindig/trunk/php/src/gadgets/JsLibraryFeatureFactory.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/JsLibraryFeatureFactory.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/JsLibraryFeatureFactory.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/JsLibraryFeatureFactory.php Wed May 7 07:13:48 2008
@@ -20,18 +20,18 @@
class JsLibraryFeatureFactory extends GadgetFeatureFactory {
private $JsLibraryFeature;
-
+
public function __construct($gadgetLibraries, $containerLibraries)
{
// since we don't do strict type checking, this is one constructor for both a class, or a array of classes
$this->JsLibraryFeature = new JsLibraryFeature($gadgetLibraries, $containerLibraries);
}
-
+
public function create()
{
return $this->JsLibraryFeature;
}
-
+
public function getLibraries($context)
{
return $context == 'GADGET' ? $this->JsLibraryFeature->gadgetLibraries : $this->JsLibraryFeature->containerLibraries;
@@ -41,7 +41,7 @@
class JsLibraryFeature extends GadgetFeature {
public $containerLibraries = array();
public $gadgetLibraries = array();
-
+
public function __construct($gadgetLibraries, $containerLibraries)
{
// we have a single constructor for both a single and multiple libraries, so handle it in code instead
@@ -56,12 +56,12 @@
$this->containerLibraries[] = $containerLibraries;
}
}
-
+
public function prepare($gadget, $context, $params)
{
// do nothing
}
-
+
public function process($gadget, $context, $params)
{
$libraries = array();
Modified: incubator/shindig/trunk/php/src/gadgets/JsonRpcGadgetContext.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/JsonRpcGadgetContext.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/JsonRpcGadgetContext.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/JsonRpcGadgetContext.php Wed May 7 07:13:48 2008
@@ -5,7 +5,7 @@
private $view = null;
private $url = null;
private $container = null;
-
+
public function __construct($jsonContext, $url)
{
parent::__construct('GADGET');
@@ -14,22 +14,22 @@
$this->locale = new Locale($jsonContext->language, $jsonContext->country);
$this->container = $jsonContext->container;
}
-
+
public function getUrl()
{
return $this->url;
}
-
+
public function getView()
{
return $this->view;
}
-
+
public function getLocale()
{
return $this->locale;
}
-
+
public function getContainer()
{
return $this->container;
Modified: incubator/shindig/trunk/php/src/gadgets/JsonRpcHandler.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/JsonRpcHandler.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/JsonRpcHandler.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/JsonRpcHandler.php Wed May 7 07:13:48 2008
@@ -1,7 +1,7 @@
<?php
class JsonRpcHandler {
-
+
public function process($requests)
{
$response = array();
@@ -19,7 +19,7 @@
}
return $response;
}
-
+
private function makeResponse($gadget, $gadgetModuleId, $gadgetUrl, $context)
{
$response = array();
@@ -64,7 +64,7 @@
$response['titleUrl'] = $gadget->getTitleUrl();
$response['directoryTitle'] = $gadget->getDirectoryTitle();
$response['author'] = $gadget->getAuthor();
- $response['iframeUrl'] = UrlGenerator::getIframeURL($gadget, $context);
+ $response['iframeUrl'] = UrlGenerator::getIframeURL($gadget, $context);
$response['userPrefs'] = $prefs;
return $response;
}
Modified: incubator/shindig/trunk/php/src/gadgets/LocaleSpec.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/LocaleSpec.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/LocaleSpec.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/LocaleSpec.php Wed May 7 07:13:48 2008
@@ -22,17 +22,17 @@
public $url;
public $locale;
public $rightToLeft;
-
+
public function getURI()
{
return $this->url;
}
-
+
public function getLocale()
{
return $this->locale;
}
-
+
public function isRightToLeft()
{
return $this->rightToLeft;
Modified: incubator/shindig/trunk/php/src/gadgets/MessageBundle.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/MessageBundle.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/MessageBundle.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/MessageBundle.php Wed May 7 07:13:48 2008
@@ -20,12 +20,12 @@
class MessageBundle {
private $messages;
-
+
public function __construct($messages = array())
{
$this->messages = $messages;
}
-
+
public function getMessages()
{
return $this->messages;
Modified: incubator/shindig/trunk/php/src/gadgets/MessageBundleParser.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/MessageBundleParser.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/MessageBundleParser.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/MessageBundleParser.php Wed May 7 07:13:48 2008
@@ -19,7 +19,7 @@
*/
class MessageBundleParser {
-
+
private function processMessage(&$messages, $msg)
{
$attr = $msg->attributes();
@@ -27,7 +27,7 @@
$messages[trim($attr['name'])] = trim($msg);
}
}
-
+
public function parse($xml)
{
$doc = simplexml_load_string($xml);
Modified: incubator/shindig/trunk/php/src/gadgets/Substitutions.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/Substitutions.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/Substitutions.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/Substitutions.php Wed May 7 07:13:48 2008
@@ -22,26 +22,26 @@
private $types = array('MESSAGE' => 'MSG', 'BIDI' => 'BIDI', 'USER_PREF' => 'UP', 'MODULE' => 'MODULE');
private $substitutions = array();
-
+
public function __construct()
{
foreach ($this->types as $type) {
$this->substitutions[$type] = array();
}
}
-
+
public function addSubstitution($type, $key, $value)
{
$this->substitutions[$type]["__{$type}_{$key}__"] = $value;
}
-
+
public function addSubstitutions($type, $array)
{
foreach ($array as $key => $value) {
$this->addSubstitution($type, $key, $value);
}
}
-
+
public function substitute($input)
{
foreach ($this->types as $type) {
@@ -49,7 +49,7 @@
}
return $input;
}
-
+
public function substituteType($type, $input)
{
return str_replace(array_keys($this->substitutions[$type]), array_values($this->substitutions[$type]), $input);
Modified: incubator/shindig/trunk/php/src/gadgets/UserPref.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/UserPref.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/UserPref.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/UserPref.php Wed May 7 07:13:48 2008
@@ -27,32 +27,32 @@
public $required;
public $enumValues;
public $contentType;
-
+
public function getName()
{
return $this->name;
}
-
+
public function getDisplayName()
{
return $this->displayName;
}
-
+
public function getDefaultValue()
{
return $this->defaultValue;
}
-
+
public function isRequired()
{
return $this->required;
}
-
+
public function getDataType()
{
return $this->dataType;
}
-
+
public function getEnumValues()
{
return $this->enumValues;
Modified: incubator/shindig/trunk/php/src/gadgets/UserPrefs.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/UserPrefs.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/UserPrefs.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/UserPrefs.php Wed May 7 07:13:48 2008
@@ -20,17 +20,17 @@
class UserPrefs {
private $prefs = array();
-
+
public function __construct($prefs)
{
$this->prefs = $prefs;
}
-
+
public function getPrefs()
{
return $this->prefs;
}
-
+
public function getPref($name)
{
return isset($this->prefs[$name]) ? $this->prefs[$name] : null;
Modified: incubator/shindig/trunk/php/src/gadgets/http/JsonRpcServlet.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/http/JsonRpcServlet.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/http/JsonRpcServlet.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/http/JsonRpcServlet.php Wed May 7 07:13:48 2008
@@ -19,6 +19,7 @@
*/
class JsonRpcServlet extends HttpServlet {
+
public function doPost()
{
try {
@@ -46,7 +47,7 @@
echo "</body></html>";
}
}
-
+
public function doGet()
{
header("HTTP/1.0 400 Bad Request", true, 400);
Modified: incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicBlobCrypter.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicBlobCrypter.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicBlobCrypter.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicBlobCrypter.php Wed May 7 07:13:48 2008
@@ -1,4 +1,5 @@
<?php
+
/**
* This class provides basic binary blob encryption and decryption, for use with the security token
*
@@ -26,13 +27,13 @@
private $cipherKey;
private $hmacKey;
-
+
public function __construct()
{
$this->cipherKey = Config::get('token_cipher_key');
$this->hmacKey = Config::get('token_hmac_key');
}
-
+
/**
* {@inheritDoc}
*/
@@ -44,7 +45,7 @@
$b64 = base64_encode($cipherText . $hmac);
return $b64;
}
-
+
private function serializeAndTimestamp(Array $in)
{
$encoded = "";
@@ -54,7 +55,7 @@
$encoded .= $this->TIMESTAMP_KEY . "=" . time();
return $encoded;
}
-
+
/**
* {@inheritDoc}
*/
@@ -83,7 +84,7 @@
}
return $out;
}
-
+
private function deserialize($plain)
{
$map = array();
@@ -100,7 +101,7 @@
}
return $map;
}
-
+
private function checkTimestamp(Array $out, $maxAge)
{
$minTime = (int)$out[$this->TIMESTAMP_KEY] - $this->CLOCK_SKEW_ALLOWANCE;
Modified: incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicGadgetBlacklist.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicGadgetBlacklist.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicGadgetBlacklist.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicGadgetBlacklist.php Wed May 7 07:13:48 2008
@@ -20,7 +20,7 @@
class BasicGadgetBlacklist {
private $rules = array();
-
+
public function __construct()
{
$file = Config::get('base_path') . '/blacklist.txt';
@@ -29,7 +29,7 @@
$this->rules = explode("\n", file_get_contents($file));
}
}
-
+
function isBlacklisted($url)
{
foreach ($this->rules as $rule) {
Modified: incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicGadgetTokenDecoder.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicGadgetTokenDecoder.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicGadgetTokenDecoder.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicGadgetTokenDecoder.php Wed May 7 07:13:48 2008
@@ -25,7 +25,7 @@
private $CONTAINER_INDEX = 3;
private $APP_URL_INDEX = 4;
private $MODULE_ID_INDEX = 5;
-
+
/**
* {@inheritDoc}
*
Modified: incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicRemoteContent.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicRemoteContent.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicRemoteContent.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicRemoteContent.php Wed May 7 07:13:48 2008
@@ -19,7 +19,7 @@
*/
class BasicRemoteContent extends RemoteContent {
-
+
public function fetch($request, $context)
{
$cache = Config::get('data_cache');
Modified: incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicRemoteContentFetcher.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicRemoteContentFetcher.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicRemoteContentFetcher.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicRemoteContentFetcher.php Wed May 7 07:13:48 2008
@@ -24,7 +24,7 @@
class BasicRemoteContentFetcher extends RemoteContentFetcher {
private $requests = array();
-
+
public function fetchRequest($request)
{
$request->handle = curl_init();
Modified: incubator/shindig/trunk/php/src/socialdata/DataResponse.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/socialdata/DataResponse.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/socialdata/DataResponse.php (original)
+++ incubator/shindig/trunk/php/src/socialdata/DataResponse.php Wed May 7 07:13:48 2008
@@ -21,28 +21,28 @@
public $responses;
public $error;
-
+
public function __construct($responses = array(), $error = null)
{
$this->error = $error;
$this->responses = $responses;
}
-
+
public function getResponses()
{
return $this->responses;
}
-
+
public function setResponses($responses)
{
$this->responses = $responses;
}
-
+
public function getError()
{
return $this->error;
}
-
+
public function setError($error)
{
$this->error = $error;
Modified: incubator/shindig/trunk/php/src/socialdata/GadgetDataHandler.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/socialdata/GadgetDataHandler.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/socialdata/GadgetDataHandler.php (original)
+++ incubator/shindig/trunk/php/src/socialdata/GadgetDataHandler.php Wed May 7 07:13:48 2008
@@ -18,7 +18,7 @@
*/
abstract class GadgetDataHandler {
-
+
/**
* Determines whether this handler should be used to process the request
*
@@ -27,7 +27,7 @@
* this json request
*/
abstract function shouldHandle($requestType);
-
+
/**
* Constructs a ResponseItem based on the parameters in the RequestItem
*
Modified: incubator/shindig/trunk/php/src/socialdata/http/GadgetDataServlet.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/socialdata/http/GadgetDataServlet.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/socialdata/http/GadgetDataServlet.php (original)
+++ incubator/shindig/trunk/php/src/socialdata/http/GadgetDataServlet.php Wed May 7 07:13:48 2008
@@ -1,4 +1,22 @@
<?php
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+
// Response item error codes
define('NOT_IMPLEMENTED', "notImplemented");
define('UNAUTHORIZED', "unauthorized");
Modified: incubator/shindig/trunk/php/src/socialdata/opensocial/ActivitiesService.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/socialdata/opensocial/ActivitiesService.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/socialdata/opensocial/ActivitiesService.php (original)
+++ incubator/shindig/trunk/php/src/socialdata/opensocial/ActivitiesService.php Wed May 7 07:13:48 2008
@@ -18,7 +18,7 @@
*/
abstract class ActivitiesService {
-
+
/**
* Returns a list of activities that correspond to the passed in person ids.
* @param ids The ids of the people to fetch activities for.
@@ -26,7 +26,7 @@
* @return a response item with the list of activities.
*/
abstract public function getActivities($ids, $token);
-
+
/**
* Creates the passed in activity for the given user. Once createActivity is
* called, getActivities will be able to return the Activity.
Modified: incubator/shindig/trunk/php/src/socialdata/opensocial/DataService.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/socialdata/opensocial/DataService.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/socialdata/opensocial/DataService.php (original)
+++ incubator/shindig/trunk/php/src/socialdata/opensocial/DataService.php Wed May 7 07:13:48 2008
@@ -18,7 +18,7 @@
*/
abstract class DataService {
-
+
/**
* Fetch data for a list of ids.
* @param ids The list of ids
@@ -28,7 +28,7 @@
* there was a problem
*/
abstract public function getPersonData($ids, $keys, $token);
-
+
/**
* Updates the data key for the given person with the new value.
*
Modified: incubator/shindig/trunk/php/src/socialdata/opensocial/PeopleService.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/socialdata/opensocial/PeopleService.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/socialdata/opensocial/PeopleService.php (original)
+++ incubator/shindig/trunk/php/src/socialdata/opensocial/PeopleService.php Wed May 7 07:13:48 2008
@@ -20,7 +20,7 @@
abstract class PeopleService {
public $sortOrder = array('topFriends', 'name');
public $filterType = array('all', 'hasApp');
-
+
/**
* Returns a list of people ids that the other handlers (currently data
* and activities) can use to fetch their own objects
@@ -30,7 +30,7 @@
* @throws JSONException If the idSpec is malformed
*/
abstract public function getIds($idSpec, $token);
-
+
/**
* Returns a list of people that correspond to the passed in person ids.
* @param ids The ids of the people to fetch.
Modified: incubator/shindig/trunk/php/src/socialdata/opensocial/model/Activity.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/socialdata/opensocial/model/Activity.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/socialdata/opensocial/model/Activity.php (original)
+++ incubator/shindig/trunk/php/src/socialdata/opensocial/model/Activity.php Wed May 7 07:13:48 2008
@@ -35,178 +35,178 @@
public $titleId;
public $url;
public $userId;
-
+
public function __construct($id, $userId)
{
$this->id = $id;
$this->userId = $userId;
}
-
+
public function getAppId()
{
return $this->appId;
}
-
+
public function setAppId($appId)
{
$this->appId = $appId;
}
-
+
public function getBody()
{
return $this->body;
}
-
+
public function setBody($body)
{
$this->body = $body;
}
-
+
public function getBodyId()
{
return $this->bodyId;
}
-
+
public function setBodyId($bodyId)
{
$this->bodyId = $bodyId;
}
-
+
public function getExternalId()
{
return $this->externalId;
}
-
+
public function setExternalId($externalId)
{
$this->externalId = $externalId;
}
-
+
public function getId()
{
return $this->id;
}
-
+
public function setId($id)
{
$this->id = $id;
}
-
+
public function getMediaItems()
{
return $this->mediaItems;
}
-
+
public function setMediaItems($mediaItems)
{
$this->mediaItems = $mediaItems;
}
-
+
public function getPostedTime()
{
return $this->postedTime;
}
-
+
public function setPostedTime($postedTime)
{
$this->postedTime = $postedTime;
}
-
+
public function getPriority()
{
return $this->priority;
}
-
+
public function setPriority($priority)
{
$this->priority = $priority;
}
-
+
public function getStreamFaviconUrl()
{
return $this->streamFaviconUrl;
}
-
+
public function setStreamFaviconUrl($streamFaviconUrl)
{
$this->streamFaviconUrl = $streamFaviconUrl;
}
-
+
public function getStreamSourceUrl()
{
return $this->streamSourceUrl;
}
-
+
public function setStreamSourceUrl($streamSourceUrl)
{
$this->streamSourceUrl = $streamSourceUrl;
}
-
+
public function getStreamTitle()
{
return $this->streamTitle;
}
-
+
public function setStreamTitle($streamTitle)
{
$this->streamTitle = $streamTitle;
}
-
+
public function getStreamUrl()
{
return $this->streamUrl;
}
-
+
public function setStreamUrl($streamUrl)
{
$this->streamUrl = $streamUrl;
}
-
+
public function getTemplateParams()
{
return $this->templateParams;
}
-
+
public function setTemplateParams($templateParams)
{
$this->templateParams = $templateParams;
}
-
+
public function getTitle()
{
return $this->title;
}
-
+
public function setTitle($title)
{
$this->title = $title;
}
-
+
public function getTitleId()
{
return $this->titleId;
}
-
+
public function setTitleId($titleId)
{
$this->titleId = $titleId;
}
-
+
public function getUrl()
{
return $this->url;
}
-
+
public function setUrl($url)
{
$this->url = $url;
}
-
+
public function getUserId()
{
return $this->userId;
}
-
+
public function setUserId($userId)
{
$this->userId = $userId;
Modified: incubator/shindig/trunk/php/src/socialdata/opensocial/model/idSpec.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/socialdata/opensocial/model/idSpec.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/socialdata/opensocial/model/idSpec.php (original)
+++ incubator/shindig/trunk/php/src/socialdata/opensocial/model/idSpec.php Wed May 7 07:13:48 2008
@@ -22,13 +22,13 @@
public $jsonSpec;
public $type;
-
+
public function __construct($jsonSpec, $type)
{
$this->jsonSpec = $jsonSpec;
$this->type = $type;
}
-
+
static public function fromJson($jsonIdSpec)
{
if (! empty($jsonIdSpec) && in_array((string)$jsonIdSpec, idSpec::$types)) {
@@ -40,7 +40,7 @@
}
return new IdSpec($jsonIdSpec, $idSpecEnum);
}
-
+
/**
* Only valid for IdSpecs of type USER_IDS
* @return A list of the user ids in the id spec
@@ -58,7 +58,7 @@
}
return $userIds;
}
-
+
public function getType()
{
return $this->type;
Modified: incubator/shindig/trunk/php/src/socialdata/samplecontainer/BasicActivitiesService.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/socialdata/samplecontainer/BasicActivitiesService.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/socialdata/samplecontainer/BasicActivitiesService.php (original)
+++ incubator/shindig/trunk/php/src/socialdata/samplecontainer/BasicActivitiesService.php Wed May 7 07:13:48 2008
@@ -18,7 +18,7 @@
*/
class BasicActivitiesService {
-
+
public function getActivities($ids, $token)
{
$allActivities = XmlStateFileFetcher::get()->getActivities();
@@ -31,7 +31,7 @@
// TODO: Sort them
return new ResponseItem(null, null, $activities);
}
-
+
public function createActivity($personId, $activity, $token)
{
// TODO: Validate the activity and do any template expanding
Modified: incubator/shindig/trunk/php/src/socialdata/samplecontainer/BasicDataService.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/socialdata/samplecontainer/BasicDataService.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/socialdata/samplecontainer/BasicDataService.php (original)
+++ incubator/shindig/trunk/php/src/socialdata/samplecontainer/BasicDataService.php Wed May 7 07:13:48 2008
@@ -18,7 +18,7 @@
*/
class BasicDataService extends DataService {
-
+
public function getPersonData($ids, $keys, $token)
{
$allData = XmlStateFileFetcher::get()->getAppData();
@@ -37,7 +37,7 @@
}
return new ResponseItem(null, null, $data);
}
-
+
public function updatePersonData($id, $key, $value, $token)
{
if (! BasicDataService::isValidKey($key)) {
@@ -46,7 +46,7 @@
XmlStateFileFetcher::get()->setAppData($id, $key, $value);
return new ResponseItem(null, null, array());
}
-
+
/**
* Determines whether the input is a valid key. Valid keys match the regular
* expression [\w\-\.]+.
Modified: incubator/shindig/trunk/php/src/socialdata/samplecontainer/BasicPeopleService.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/socialdata/samplecontainer/BasicPeopleService.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/socialdata/samplecontainer/BasicPeopleService.php (original)
+++ incubator/shindig/trunk/php/src/socialdata/samplecontainer/BasicPeopleService.php Wed May 7 07:13:48 2008
@@ -18,7 +18,7 @@
*/
class BasicPeopleService extends PeopleService {
-
+
private function comparator($person, $person1)
{
$name = $person['name']->getUnstructured();
@@ -28,7 +28,7 @@
}
return ($name < $name1) ? - 1 : 1;
}
-
+
public function getPeople($ids, $sortOrder, $filter, $first, $max, $profileDetails, $token)
{
$allPeople = XmlStateFileFetcher::get()->getAllPeople();
@@ -77,7 +77,7 @@
$collection = new ApiCollection($people, $first, $totalSize);
return new ResponseItem(null, null, $collection);
}
-
+
public function getIds($idSpec, $token)
{
$friendIds = XmlStateFileFetcher::get()->getFriendIds();
Modified: incubator/shindig/trunk/php/src/socialdata/samplecontainer/StateFileDataHandler.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/socialdata/samplecontainer/StateFileDataHandler.php?rev=654115&r1=654114&r2=654115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/socialdata/samplecontainer/StateFileDataHandler.php (original)
+++ incubator/shindig/trunk/php/src/socialdata/samplecontainer/StateFileDataHandler.php Wed May 7 07:13:48 2008
@@ -2,12 +2,12 @@
class StateFileDataHandler extends GadgetDataHandler {
private $handles = array('DUMP_STATE', 'SET_STATE', 'SET_EVILNESS');
-
+
public function shouldHandle($requestType)
{
return in_array($requestType, $this->handles);
}
-
+
public function handleRequest($request)
{
// do stuff