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/10/28 01:30:45 UTC
svn commit: r1190091 - in /shindig/branches/php_namespace_refactoring/php:
NOTICE config/container.php index.php phpunit.xml.dist
Author: bhofmann
Date: Thu Oct 27 23:30:45 2011
New Revision: 1190091
URL: http://svn.apache.org/viewvc?rev=1190091&view=rev
Log:
namespace refactoring
Modified:
shindig/branches/php_namespace_refactoring/php/NOTICE
shindig/branches/php_namespace_refactoring/php/config/container.php
shindig/branches/php_namespace_refactoring/php/index.php
shindig/branches/php_namespace_refactoring/php/phpunit.xml.dist
Modified: shindig/branches/php_namespace_refactoring/php/NOTICE
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/NOTICE?rev=1190091&r1=1190090&r2=1190091&view=diff
==============================================================================
--- shindig/branches/php_namespace_refactoring/php/NOTICE (original)
+++ shindig/branches/php_namespace_refactoring/php/NOTICE Thu Oct 27 23:30:45 2011
@@ -19,10 +19,13 @@ This product includes software (Zend) de
Zend Technologies Ltd (http://framework.zend.com/).
This product includes software (JSMin) developed by
-Douglas Crockford (http://www.crockford.com/).
+Douglas Crockford (http://www.crockford.com/).
-This product includes software (OAuth.php) developed by
+This product includes software (OAuth.php) developed by
Andy Smith (http://oauth.googlecode.com/svn/code/php/LICENSE.txt)
This product includes software (Caja) developed by
Google Inc. (http://code.google.com/p/google-caja/).
+
+This product includes software (Symfony ClassLoader) developed by
+Fabien Potencier (https://github.com/symfony/ClassLoader)
\ No newline at end of file
Modified: shindig/branches/php_namespace_refactoring/php/config/container.php
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/config/container.php?rev=1190091&r1=1190090&r2=1190091&view=diff
==============================================================================
--- shindig/branches/php_namespace_refactoring/php/config/container.php (original)
+++ shindig/branches/php_namespace_refactoring/php/config/container.php Thu Oct 27 23:30:45 2011
@@ -78,23 +78,23 @@ $shindigConfig = array(
'default_iframe_prefix' => '/gadgets/ifr?',
'servlet_map' => array(
- '/container' => 'ContentFilesServlet',
- '/samplecontainer' => 'ContentFilesServlet',
- '/gadgets/resources' => 'ResourcesFilesServlet',
- '/gadgets/js' => 'JsServlet',
- '/gadgets/proxy' => 'ProxyServlet',
- '/gadgets/makeRequest' => 'MakeRequestServlet',
- '/gadgets/ifr' => 'GadgetRenderingServlet',
- '/gadgets/metadata' => 'MetadataServlet',
- '/gadgets/oauthcallback' => 'OAuthCallbackServlet',
- '/gadgets/api/rpc' => 'JsonRpcServlet',
- '/gadgets/api/rest' => 'DataServiceServlet',
- '/social/rest' => 'DataServiceServlet',
- '/social/rpc' => 'CompatibilityJsonRpcServlet',
- '/rpc' => 'JsonRpcServlet',
- '/public.crt' => 'CertServlet',
- '/public.cer' => 'CertServlet',
- '/' => 'ContentFilesServlet',
+ '/container' => 'apache\shindig\gadgets\servlet\ContentFilesServlet',
+ '/samplecontainer' => 'apache\shindig\gadgets\servlet\ContentFilesServlet',
+ '/gadgets/resources' => 'apache\shindig\gadgets\servlet\ResourcesFilesServlet',
+ '/gadgets/js' => 'apache\shindig\gadgets\servlet\JsServlet',
+ '/gadgets/proxy' => 'apache\shindig\gadgets\servlet\ProxyServlet',
+ '/gadgets/makeRequest' => 'apache\shindig\gadgets\servlet\MakeRequestServlet',
+ '/gadgets/ifr' => 'apache\shindig\gadgets\servlet\GadgetRenderingServlet',
+ '/gadgets/metadata' => 'apache\shindig\gadgets\servlet\MetadataServlet',
+ '/gadgets/oauthcallback' => 'apache\shindig\gadgets\servlet\OAuthCallbackServlet',
+ '/gadgets/api/rpc' => 'apache\shindig\social\servlet\JsonRpcServlet',
+ '/gadgets/api/rest' => 'apache\shindig\social\servlet\DataServiceServlet',
+ '/social/rest' => 'apache\shindig\social\servlet\DataServiceServlet',
+ '/social/rpc' => 'apache\shindig\social\servlet\CompatibilityJsonRpcServlet',
+ '/rpc' => 'apache\shindig\social\servlet\JsonRpcServlet',
+ '/public.crt' => 'apache\shindig\gadgets\servlet\CertServlet',
+ '/public.cer' => 'apache\shindig\gadgets\servlet\CertServlet',
+ '/' => 'apache\shindig\gadgets\servlet\ContentFilesServlet',
),
// The X-XRDS-Location value for your implementing container, see http://code.google.com/p/partuza/source/browse/trunk/Library/XRDS.php for an example
@@ -147,28 +147,28 @@ $shindigConfig = array(
'extension_autoloader' => false,
// Configurable classes. Change these to the class name to use, and make sure the auto-loader can find them
- 'blacklist_class' => 'BasicGadgetBlacklist',
- 'remote_content' => 'BasicRemoteContent',
- 'remote_content_fetcher' => 'BasicRemoteContentFetcher',
- 'security_token_signer' => 'BasicSecurityTokenDecoder',
- 'security_token' => 'BasicSecurityToken',
- 'oauth_lookup_service' => 'BasicOAuthLookupService',
+ 'blacklist_class' => 'apache\shindig\gadgets\sample\BasicGadgetBlacklist',
+ 'remote_content' => 'apache\shindig\common\sample\BasicRemoteContent',
+ 'remote_content_fetcher' => 'apache\shindig\common\sample\BasicRemoteContentFetcher',
+ 'security_token_signer' => 'apache\shindig\common\sample\BasicSecurityTokenDecoder',
+ 'security_token' => 'apache\shindig\common\sample\BasicSecurityToken',
+ 'oauth_lookup_service' => 'apache\shindig\common\sample\BasicOAuthLookupService',
// The OAuth Store is used to store the (gadgets/)oauth proxy credentials it obtained on behalf of the user/gadget combo
- 'oauth_store' => 'BasicOAuthStore',
- 'gadget_oauth_token_store' => 'BasicGadgetOAuthTokenStore',
+ 'oauth_store' => 'apache\shindig\gadgets\oauth\BasicOAuthStore',
+ 'gadget_oauth_token_store' => 'apache\shindig\gadgets\oauth\BasicGadgetOAuthTokenStore',
// handler for ApiServlet
'service_handler' => array(
- 'people' => 'PersonHandler',
- 'activities' => 'ActivityHandler',
- 'appdata' => 'AppDataHandler',
- 'groups' => 'GroupHandler',
- 'messages' => 'MessagesHandler',
- 'cache' => 'InvalidateHandler',
- 'system' => 'SystemHandler',
- 'albums' => 'AlbumHandler',
- 'mediaitems' => 'MediaItemHandler',
- 'http' => 'HttpHandler',
+ 'people' => 'apache\shindig\social\service\PersonHandler',
+ 'activities' => 'apache\shindig\social\service\ActivityHandler',
+ 'appdata' => 'apache\shindig\social\service\AppDataHandler',
+ 'groups' => 'apache\shindig\social\service\GroupHandler',
+ 'messages' => 'apache\shindig\social\service\MessagesHandler',
+ 'cache' => 'apache\shindig\social\service\InvalidateHandler',
+ 'system' => 'apache\shindig\social\service\SystemHandler',
+ 'albums' => 'apache\shindig\social\service\AlbumHandler',
+ 'mediaitems' => 'apache\shindig\social\service\MediaItemHandler',
+ 'http' => 'apache\shindig\social\service\HttpHandler',
),
// class is the name of the concrete input converter class
@@ -176,13 +176,13 @@ $shindigConfig = array(
// into the params array or null if you want to overwrite params with the decoded
// array or false if you do not want to add the decoded params
'service_input_converter' => array(
- 'people' => array('class' => 'InputPeopleConverter', 'targetField' => false),
- 'activities' => array('class' => 'InputActivitiesConverter', 'targetField' => 'activity'),
- 'appdata' => array('class' => 'InputAppDataConverter', 'targetField' => 'data'),
- 'messages' => array('class' => 'InputMessagesConverter', 'targetField' => 'entity'),
- 'cache' => array('class' => 'InputInvalidateConverter', 'targetField' => null),
- 'albums' => array('class' => 'InputAlbumsConverter', 'targetField' => 'album'),
- 'mediaitems' => array('class' => 'InputMediaItemsConverter', 'targetField' => 'mediaItem'),
+ 'people' => array('class' => 'apache\shindig\social\converters\InputPeopleConverter', 'targetField' => false),
+ 'activities' => array('class' => 'apache\shindig\social\converters\InputActivitiesConverter', 'targetField' => 'activity'),
+ 'appdata' => array('class' => 'apache\shindig\social\converters\InputAppDataConverter', 'targetField' => 'data'),
+ 'messages' => array('class' => 'apache\shindig\social\converters\InputMessagesConverter', 'targetField' => 'entity'),
+ 'cache' => array('class' => 'apache\shindig\social\converters\InputInvalidateConverter', 'targetField' => null),
+ 'albums' => array('class' => 'apache\shindig\social\converters\InputAlbumsConverter', 'targetField' => 'album'),
+ 'mediaitems' => array('class' => 'apache\shindig\social\converters\InputMediaItemsConverter', 'targetField' => 'mediaItem'),
),
// available gadget renderer with the class as key and the needed attributes in the
@@ -190,39 +190,39 @@ $shindigConfig = array(
// the attribute value has to match this string, if it's a boolean the attribute
// just has to be available or not available
'gadget_renderer' => array(
- 'GadgetHtmlRenderer' => array('type' => 'HTML', 'href' => false),
- 'GadgetHrefRenderer' => array('type' => 'HTML', 'href' => true),
- 'GadgetUrlRenderer' => array('type' => 'URL'),
+ 'apache\shindig\gadgets\render\GadgetHtmlRenderer' => array('type' => 'HTML', 'href' => false),
+ 'apache\shindig\gadgets\render\GadgetHrefRenderer' => array('type' => 'HTML', 'href' => true),
+ 'apache\shindig\gadgets\render\GadgetUrlRenderer' => array('type' => 'URL'),
),
- 'gadget_class' => 'Gadget',
- 'gadget_context_class' => 'GadgetContext',
- 'gadget_factory_class' => 'GadgetFactory',
- 'gadget_spec_parser' => 'GadgetSpecParser',
- 'gadget_spec_class' => 'GadgetSpec',
- 'substitution_class' => 'Substitutions',
- 'proxy_handler' => 'ProxyHandler',
- 'makerequest_handler' => 'MakeRequestHandler',
- 'makerequest_class' => 'MakeRequest',
- 'container_config_class' => 'ContainerConfig',
+ 'gadget_class' => 'apache\shindig\gadgets\Gadget',
+ 'gadget_context_class' => 'apache\shindig\gadgets\GadgetContext',
+ 'gadget_factory_class' => 'apache\shindig\gadgets\GadgetFactory',
+ 'gadget_spec_parser' => 'apache\shindig\gadgets\GadgetSpecParser',
+ 'gadget_spec_class' => 'apache\shindig\gadgets\GadgetSpec',
+ 'substitution_class' => 'apache\shindig\gadgets\Substitutions',
+ 'proxy_handler' => 'apache\shindig\gadgets\ProxyHandler',
+ 'makerequest_handler' => 'apache\shindig\gadgets\MakeRequestHandler',
+ 'makerequest_class' => 'apache\shindig\gadgets\MakeRequest',
+ 'container_config_class' => 'apache\shindig\gadgets\ContainerConfig',
// Caching back-end's to use. Shindig ships with CacheStorageFile, CacheStorageApc and CacheStorageMemcache support
// The data cache is primarily used for remote content (proxied files, gadget spec, etc)
// and the feature_cache is used to cache the parsed features xml structure and javascript
// On a production system you probably want to use CacheStorageApc for features, and CacheStorageMemcache for the data cache
- 'data_cache' => 'CacheStorageFile',
- 'feature_cache' => 'CacheStorageFile',
+ 'data_cache' => 'apache\shindig\common\sample\CacheStorageFile',
+ 'feature_cache' => 'apache\shindig\common\sample\CacheStorageFile',
// RESTful API data service classes to use
// See http://code.google.com/p/partuza/source/browse/#svn/trunk/Shindig for a MySql powered example
- 'person_service' => 'JsonDbOpensocialService',
- 'activity_service' => 'JsonDbOpensocialService',
- 'app_data_service' => 'JsonDbOpensocialService',
- 'group_service' => 'JsonDbOpensocialService',
- 'messages_service' => 'JsonDbOpensocialService',
- 'invalidate_service' => 'DefaultInvalidateService',
- 'album_service' => 'JsonDbOpensocialService',
- 'media_item_service' => 'JsonDbOpensocialService',
+ 'person_service' => 'apache\shindig\social\sample\JsonDbOpensocialService',
+ 'activity_service' => 'apache\shindig\social\sample\JsonDbOpensocialService',
+ 'app_data_service' => 'apache\shindig\social\sample\JsonDbOpensocialService',
+ 'group_service' => 'apache\shindig\social\sample\JsonDbOpensocialService',
+ 'messages_service' => 'apache\shindig\social\sample\JsonDbOpensocialService',
+ 'invalidate_service' => 'apache\shindig\social\sample\DefaultInvalidateService',
+ 'album_service' => 'apache\shindig\social\sample\JsonDbOpensocialService',
+ 'media_item_service' => 'apache\shindig\social\sample\JsonDbOpensocialService',
// Also scan these directories when looking for <Class>.php files. You can include multiple paths by seperating them with a ,
// To enable classes in the extras package you have to add this class path
Modified: shindig/branches/php_namespace_refactoring/php/index.php
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/index.php?rev=1190091&r1=1190090&r2=1190091&view=diff
==============================================================================
--- shindig/branches/php_namespace_refactoring/php/index.php (original)
+++ shindig/branches/php_namespace_refactoring/php/index.php Thu Oct 27 23:30:45 2011
@@ -18,104 +18,7 @@
* under the License.
*/
-// Some people forget to set their timezone in their php.ini,
-// this prevents that from generating warnings
-@date_default_timezone_set(@date_default_timezone_get());
+include 'src/apache/shindig/bootstrap.php';
-include_once ('src/common/Config.php');
-include_once ('src/common/File.php');
-
-if (Config::get('debug')) {
- // Basic sanity check if we have all required modules
- $modules = array('json', 'SimpleXML', 'libxml', 'curl', 'openssl');
- // if plain text tokens are disallowed we require mcrypt
- if (! Config::get('allow_plaintext_token')) {
- $modules[] = 'mcrypt';
- }
- // if you selected the memcache caching backend, you need the memcache extention too :)
- if (Config::get('data_cache') == 'CacheMemcache') {
- $modules[] = 'memcache';
- }
- foreach ($modules as $module) {
- if (! extension_loaded($module)) {
- die("Shindig requires the {$module} extention, see <a href='http://www.php.net/{$module}'>http://www.php.net/{$module}</a> for more info");
- }
- }
-
- if (get_magic_quotes_gpc()) {
- die("Your environment has magic_quotes_gpc enabled which will interfere with Shindig. Please set 'magic_quotes_gpc' to 'Off' in php.ini");
- }
-
- $populate_raw_post = strtolower(ini_get("always_populate_raw_post_data"));
- if (!isset($populate_raw_post) || $populate_raw_post === "0" || $populate_raw_post === "Off") {
- die("Your environment does not have always_populate_raw_post_data enabled which will interfere with Shindig. Please set 'always_populate_raw_post_data' to 'On' in php.ini");
- }
-}
-
-// All configurable classes are autoloaded (see config.php for the configurable classes)
-// To load these, we scan our entire directory structure
-function __autoload($className) {
- $locations = array('src/common', 'src/common/sample', 'src/gadgets', 'src/gadgets/servlet',
- 'src/gadgets/oauth', 'src/gadgets/render', 'src/gadgets/sample', 'src/social', 'src/social/servlet',
- 'src/social/service', 'src/social/opensocial', 'src/social/model', 'src/social/spi',
- 'src/social/converters', 'src/social/oauth', 'src/social/sample');
- $extension_class_paths = Config::get('extension_class_paths');
- if (! empty($extension_class_paths)) {
- $locations = array_merge(explode(',', $extension_class_paths), $locations);
- }
- // Check for the presense of this class in our all our directories.
- $fileName = $className . '.php';
- foreach ($locations as $path) {
- if (file_exists("{$path}/$fileName")) {
- require $path . '/' . $fileName;
- return;
- }
- }
- if (($loader = Config::get('extension_autoloader')) && function_exists($loader)) {
- call_user_func($loader, $className);
- }
-}
-
-//get servlet map and prefix the servlet paths
-$configServletMap = Config::get('servlet_map');
-$webPrefix = Config::get('web_prefix');
-$servletMap = array();
-foreach ($configServletMap as $path => $servlet) {
- $servletMap[$webPrefix . $path] = $servlet;
-}
-
-// Try to match the request url to our servlet mapping
-$servlet = false;
-$uri = $_SERVER["REQUEST_URI"];
-foreach ($servletMap as $url => $class) {
- if (substr($uri, 0, strlen($url)) == $url) {
- //FIXME temporary hack to support both /proxy and /makeRequest with the same event handler
- // /makeRequest == /proxy?output=js
- if ($url == $webPrefix . '/gadgets/makeRequest') {
- $_GET['output'] = 'js';
- }
- $servlet = $class;
- break;
- }
-}
-
-// If we found a correlating servlet, instance and call it. Otherwise give a 404 error
-if ($servlet) {
- $class = new $class();
- $method = $_SERVER['REQUEST_METHOD'];
- // Not all clients support the PUT, HEAD & DELETE http methods, they depend on the X-HTTP-Method-Override instead
- if ($method == 'POST' && isset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'])) {
- $method = $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'];
- }
- $method = 'do' . ucfirst(strtolower($method));
- if (is_callable(array($class, $method))) {
- $class->$method();
- } else {
- header("HTTP/1.0 405 Method Not Allowed");
- echo "<html><body><h1>405 Method Not Allowed</h1></body></html>";
- }
-} else {
- // Unhandled event, display simple 404 error
- header("HTTP/1.0 404 Not Found");
- echo "<html><body><h1>404 Not Found</h1></body></html>";
-}
+$frontController = new \apache\shindig\FrontController();
+$frontController->run();
\ No newline at end of file
Modified: shindig/branches/php_namespace_refactoring/php/phpunit.xml.dist
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/phpunit.xml.dist?rev=1190091&r1=1190090&r2=1190091&view=diff
==============================================================================
--- shindig/branches/php_namespace_refactoring/php/phpunit.xml.dist (original)
+++ shindig/branches/php_namespace_refactoring/php/phpunit.xml.dist Thu Oct 27 23:30:45 2011
@@ -17,19 +17,20 @@
* specific language governing permissions and limitations
* under the License.
-->
-<phpunit backupGlobals="false"
- backupStaticAttributes="false"
+<phpunit backupGlobals="true"
syntaxCheck="false"
- stopOnFailure="false">
+ bootstrap="test/bootstrap.php"
+ stopOnFailure="false"
+ verbose="true">
<testsuites>
<testsuite name="shindig-php">
- <file>test/ShindigAllTests.php</file>
+ <directory>test/gadgets</directory>
</testsuite>
</testsuites>
<logging>
- <log type="coverage-html" target="target/site/coverage-report/"
+ <log type="coverage-html" target="target/site/coverage-report/"
title="Shindig PHP Coverage"
charset="UTF-8" yui="true" highlight="true"
lowUpperBound="34" highLowerBound="70"/>