From 16577c1924941194e353f97c61a0c7320b429d8b Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Sat, 20 Dec 2014 15:27:21 -0800 Subject: [PATCH] relocate autoloader to src/Google (backport from master) --- README.md | 2 +- autoload.php | 33 -------------------------------- examples/appengineauth.php | 2 +- examples/batch.php | 2 +- examples/fileupload.php | 2 +- examples/idtoken.php | 2 +- examples/multi-api.php | 2 +- examples/service-account.php | 2 +- examples/simple-query.php | 2 +- examples/simplefileupload.php | 2 +- examples/user-example.php | 2 +- src/Google/Auth/Abstract.php | 2 +- src/Google/Auth/AppIdentity.php | 2 +- src/Google/Auth/AssertionCredentials.php | 2 +- src/Google/Auth/Exception.php | 2 +- src/Google/Auth/LoginTicket.php | 2 +- src/Google/Auth/OAuth2.php | 2 +- src/Google/Auth/Simple.php | 2 +- src/Google/Cache/Apc.php | 2 +- src/Google/Cache/Exception.php | 2 +- src/Google/Cache/File.php | 2 +- src/Google/Cache/Memcache.php | 2 +- src/Google/Cache/Null.php | 2 +- src/Google/Client.php | 2 +- src/Google/Collection.php | 2 +- src/Google/Http/Batch.php | 2 +- src/Google/Http/CacheParser.php | 2 +- src/Google/Http/MediaFileUpload.php | 2 +- src/Google/Http/REST.php | 2 +- src/Google/Http/Request.php | 2 +- src/Google/IO/Abstract.php | 2 +- src/Google/IO/Curl.php | 2 +- src/Google/IO/Exception.php | 2 +- src/Google/IO/Stream.php | 2 +- src/Google/Logger/Abstract.php | 2 +- src/Google/Logger/Exception.php | 2 +- src/Google/Logger/File.php | 2 +- src/Google/Logger/Null.php | 2 +- src/Google/Logger/Psr.php | 2 +- src/Google/Service/Exception.php | 2 +- src/Google/Service/Resource.php | 2 +- src/Google/Signer/P12.php | 2 +- src/Google/Verifier/Pem.php | 2 +- src/Google/autoload.php | 32 +++++++++++++++++++++++++++++++ tests/OAuthHelper.php | 2 +- tests/bootstrap.php | 2 +- 46 files changed, 76 insertions(+), 77 deletions(-) delete mode 100644 autoload.php create mode 100644 src/Google/autoload.php diff --git a/README.md b/README.md index 7508aeb..752dad9 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ See the examples/ directory for examples of the key client features. ```PHP setApplicationName("Client_Library_Examples"); diff --git a/autoload.php b/autoload.php deleted file mode 100644 index 3815c52..0000000 --- a/autoload.php +++ /dev/null @@ -1,33 +0,0 @@ - 3) { - // Maximum class file path depth in this project is 3. - $classPath = array_slice($classPath, 0, 3); - } - $filePath = dirname(__FILE__) . '/src/' . implode('/', $classPath) . '.php'; - if (file_exists($filePath)) { - require_once($filePath); - } -} - -spl_autoload_register('google_api_php_client_autoload'); diff --git a/examples/appengineauth.php b/examples/appengineauth.php index 4300c70..91b649a 100644 --- a/examples/appengineauth.php +++ b/examples/appengineauth.php @@ -21,7 +21,7 @@ include_once "templates/base.php"; Make an API request authenticated via the AppIdentity service on AppEngine. ************************************************/ -require_once realpath(dirname(__FILE__) . '/../autoload.php'); +require_once realpath(dirname(__FILE__) .autoload.php'); echo pageHeader("AppIdentity Account Access"); diff --git a/examples/batch.php b/examples/batch.php index 3a51ab9..1efe53f 100644 --- a/examples/batch.php +++ b/examples/batch.php @@ -22,7 +22,7 @@ echo pageHeader("Batching Queries"); books API again as an example, but this time we will batch up two queries into a single call. ************************************************/ -require_once realpath(dirname(__FILE__) . '/../autoload.php'); +require_once realpath(dirname(__FILE__) .autoload.php'); /************************************************ We create the client and set the simple API diff --git a/examples/fileupload.php b/examples/fileupload.php index 0940e1c..9b3d27c 100644 --- a/examples/fileupload.php +++ b/examples/fileupload.php @@ -17,7 +17,7 @@ include_once "templates/base.php"; session_start(); -require_once realpath(dirname(__FILE__) . '/../autoload.php'); +require_once realpath(dirname(__FILE__) .autoload.php'); /************************************************ We'll setup an empty 20MB file to upload. diff --git a/examples/idtoken.php b/examples/idtoken.php index 963f35b..c354c11 100644 --- a/examples/idtoken.php +++ b/examples/idtoken.php @@ -17,7 +17,7 @@ include_once "templates/base.php"; session_start(); -require_once realpath(dirname(__FILE__) . '/../autoload.php'); +require_once realpath(dirname(__FILE__) .autoload.php'); /************************************************ ATTENTION: Fill in these values! Make sure diff --git a/examples/multi-api.php b/examples/multi-api.php index 3780287..0f5dfeb 100644 --- a/examples/multi-api.php +++ b/examples/multi-api.php @@ -17,7 +17,7 @@ include_once "templates/base.php"; session_start(); -require_once realpath(dirname(__FILE__) . '/../autoload.php'); +require_once realpath(dirname(__FILE__) .autoload.php'); /************************************************ ATTENTION: Fill in these values! Make sure diff --git a/examples/service-account.php b/examples/service-account.php index 4cc0840..7d0d848 100644 --- a/examples/service-account.php +++ b/examples/service-account.php @@ -21,7 +21,7 @@ include_once "templates/base.php"; Make an API request authenticated with a service account. ************************************************/ -require_once realpath(dirname(__FILE__) . '/../autoload.php'); +require_once realpath(dirname(__FILE__) .autoload.php'); /************************************************ ATTENTION: Fill in these values! You can get diff --git a/examples/simple-query.php b/examples/simple-query.php index e22790b..0cc139e 100644 --- a/examples/simple-query.php +++ b/examples/simple-query.php @@ -25,7 +25,7 @@ echo pageHeader("Simple API Access"); should use our quota, which is higher than the anonymous quota (which is limited per IP). ************************************************/ -require_once realpath(dirname(__FILE__) . '/../autoload.php'); +require_once realpath(dirname(__FILE__) .autoload.php'); /************************************************ We create the client and set the simple API diff --git a/examples/simplefileupload.php b/examples/simplefileupload.php index 1d8fbda..8e198a3 100644 --- a/examples/simplefileupload.php +++ b/examples/simplefileupload.php @@ -17,7 +17,7 @@ include_once "templates/base.php"; session_start(); -require_once realpath(dirname(__FILE__) . '/../autoload.php'); +require_once realpath(dirname(__FILE__) .autoload.php'); /************************************************ We'll setup an empty 1MB file to upload. diff --git a/examples/user-example.php b/examples/user-example.php index 4370b08..e950b98 100644 --- a/examples/user-example.php +++ b/examples/user-example.php @@ -17,7 +17,7 @@ include_once "templates/base.php"; session_start(); -require_once realpath(dirname(__FILE__) . '/../autoload.php'); +require_once realpath(dirname(__FILE__) .autoload.php'); /************************************************ ATTENTION: Fill in these values! Make sure diff --git a/src/Google/Auth/Abstract.php b/src/Google/Auth/Abstract.php index c1e36dc..d099937 100644 --- a/src/Google/Auth/Abstract.php +++ b/src/Google/Auth/Abstract.php @@ -15,7 +15,7 @@ * limitations under the License. */ -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); /** * Abstract class for the Authentication in the API client diff --git a/src/Google/Auth/AppIdentity.php b/src/Google/Auth/AppIdentity.php index ff96a9d..c40b37d 100644 --- a/src/Google/Auth/AppIdentity.php +++ b/src/Google/Auth/AppIdentity.php @@ -22,7 +22,7 @@ */ use google\appengine\api\app_identity\AppIdentityService; -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); /** * Authentication via the Google App Engine App Identity service. diff --git a/src/Google/Auth/AssertionCredentials.php b/src/Google/Auth/AssertionCredentials.php index 2b92c57..97ef4e0 100644 --- a/src/Google/Auth/AssertionCredentials.php +++ b/src/Google/Auth/AssertionCredentials.php @@ -15,7 +15,7 @@ * limitations under the License. */ -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); /** * Credentials object used for OAuth 2.0 Signed JWT assertion grants. diff --git a/src/Google/Auth/Exception.php b/src/Google/Auth/Exception.php index 81c795a..be43955 100644 --- a/src/Google/Auth/Exception.php +++ b/src/Google/Auth/Exception.php @@ -15,7 +15,7 @@ * limitations under the License. */ -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); class Google_Auth_Exception extends Google_Exception { diff --git a/src/Google/Auth/LoginTicket.php b/src/Google/Auth/LoginTicket.php index b29abdf..6415533 100644 --- a/src/Google/Auth/LoginTicket.php +++ b/src/Google/Auth/LoginTicket.php @@ -15,7 +15,7 @@ * limitations under the License. */ -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); /** * Class to hold information about an authenticated login. diff --git a/src/Google/Auth/OAuth2.php b/src/Google/Auth/OAuth2.php index 58e86e5..0c72a64 100644 --- a/src/Google/Auth/OAuth2.php +++ b/src/Google/Auth/OAuth2.php @@ -15,7 +15,7 @@ * limitations under the License. */ -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); /** * Authentication class that deals with the OAuth 2 web-server authentication flow diff --git a/src/Google/Auth/Simple.php b/src/Google/Auth/Simple.php index 3c85ae3..5514cf5 100644 --- a/src/Google/Auth/Simple.php +++ b/src/Google/Auth/Simple.php @@ -15,7 +15,7 @@ * limitations under the License. */ -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); /** * Simple API access implementation. Can either be used to make requests diff --git a/src/Google/Cache/Apc.php b/src/Google/Cache/Apc.php index 7c9a075..72eeb10 100644 --- a/src/Google/Cache/Apc.php +++ b/src/Google/Cache/Apc.php @@ -15,7 +15,7 @@ * limitations under the License. */ -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); /** * A persistent storage class based on the APC cache, which is not diff --git a/src/Google/Cache/Exception.php b/src/Google/Cache/Exception.php index a1d2d7a..9a73a82 100644 --- a/src/Google/Cache/Exception.php +++ b/src/Google/Cache/Exception.php @@ -15,7 +15,7 @@ * limitations under the License. */ -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); class Google_Cache_Exception extends Google_Exception { diff --git a/src/Google/Cache/File.php b/src/Google/Cache/File.php index e4c99ad..4ad53bf 100644 --- a/src/Google/Cache/File.php +++ b/src/Google/Cache/File.php @@ -15,7 +15,7 @@ * limitations under the License. */ -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); /* * This class implements a basic on disk storage. While that does diff --git a/src/Google/Cache/Memcache.php b/src/Google/Cache/Memcache.php index c9fb4bc..2afce67 100644 --- a/src/Google/Cache/Memcache.php +++ b/src/Google/Cache/Memcache.php @@ -15,7 +15,7 @@ * limitations under the License. */ -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); /** * A persistent storage class based on the memcache, which is not diff --git a/src/Google/Cache/Null.php b/src/Google/Cache/Null.php index 0cd24c5..56c6edb 100644 --- a/src/Google/Cache/Null.php +++ b/src/Google/Cache/Null.php @@ -15,7 +15,7 @@ * limitations under the License. */ -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); /** * A blank storage class, for cases where caching is not diff --git a/src/Google/Client.php b/src/Google/Client.php index 1de6c59..98794b2 100644 --- a/src/Google/Client.php +++ b/src/Google/Client.php @@ -15,7 +15,7 @@ * limitations under the License. */ -require_once realpath(dirname(__FILE__) . '/../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/autoload.php'); /** * The Google API Client diff --git a/src/Google/Collection.php b/src/Google/Collection.php index dbb2855..eebe56b 100644 --- a/src/Google/Collection.php +++ b/src/Google/Collection.php @@ -1,6 +1,6 @@ diff --git a/src/Google/Http/CacheParser.php b/src/Google/Http/CacheParser.php index 298317c..2fea46f 100644 --- a/src/Google/Http/CacheParser.php +++ b/src/Google/Http/CacheParser.php @@ -15,7 +15,7 @@ * limitations under the License. */ -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); /** * Implement the caching directives specified in rfc2616. This diff --git a/src/Google/Http/MediaFileUpload.php b/src/Google/Http/MediaFileUpload.php index 87f3762..7d6d5f1 100644 --- a/src/Google/Http/MediaFileUpload.php +++ b/src/Google/Http/MediaFileUpload.php @@ -15,7 +15,7 @@ * limitations under the License. */ -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); /** * @author Chirag Shah diff --git a/src/Google/Http/REST.php b/src/Google/Http/REST.php index 6ac9f07..3adfede 100644 --- a/src/Google/Http/REST.php +++ b/src/Google/Http/REST.php @@ -15,7 +15,7 @@ * limitations under the License. */ -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); /** * This class implements the RESTful transport of apiServiceRequest()'s diff --git a/src/Google/Http/Request.php b/src/Google/Http/Request.php index 9811c14..1c302a7 100644 --- a/src/Google/Http/Request.php +++ b/src/Google/Http/Request.php @@ -15,7 +15,7 @@ * limitations under the License. */ -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); /** * HTTP Request to be executed by IO classes. Upon execution, the diff --git a/src/Google/IO/Abstract.php b/src/Google/IO/Abstract.php index fc8edbe..cb8e619 100644 --- a/src/Google/IO/Abstract.php +++ b/src/Google/IO/Abstract.php @@ -19,7 +19,7 @@ * Abstract IO base class */ -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); abstract class Google_IO_Abstract { diff --git a/src/Google/IO/Curl.php b/src/Google/IO/Curl.php index 8bd6738..8bf1213 100644 --- a/src/Google/IO/Curl.php +++ b/src/Google/IO/Curl.php @@ -21,7 +21,7 @@ * @author Stuart Langley */ -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); class Google_IO_Curl extends Google_IO_Abstract { diff --git a/src/Google/IO/Exception.php b/src/Google/IO/Exception.php index 98e9d25..cb0b6ec 100644 --- a/src/Google/IO/Exception.php +++ b/src/Google/IO/Exception.php @@ -15,7 +15,7 @@ * limitations under the License. */ -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); class Google_IO_Exception extends Google_Exception { diff --git a/src/Google/IO/Stream.php b/src/Google/IO/Stream.php index 35f9d90..5345544 100644 --- a/src/Google/IO/Stream.php +++ b/src/Google/IO/Stream.php @@ -21,7 +21,7 @@ * @author Stuart Langley */ -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); class Google_IO_Stream extends Google_IO_Abstract { diff --git a/src/Google/Logger/Abstract.php b/src/Google/Logger/Abstract.php index 571918c..9d07e58 100644 --- a/src/Google/Logger/Abstract.php +++ b/src/Google/Logger/Abstract.php @@ -15,7 +15,7 @@ * limitations under the License. */ -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); /** * Abstract logging class based on the PSR-3 standard. diff --git a/src/Google/Logger/Exception.php b/src/Google/Logger/Exception.php index 7c828e6..f1a7927 100644 --- a/src/Google/Logger/Exception.php +++ b/src/Google/Logger/Exception.php @@ -15,7 +15,7 @@ * limitations under the License. */ -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); class Google_Logger_Exception extends Google_Exception { diff --git a/src/Google/Logger/File.php b/src/Google/Logger/File.php index f337471..a9efa4d 100644 --- a/src/Google/Logger/File.php +++ b/src/Google/Logger/File.php @@ -15,7 +15,7 @@ * limitations under the License. */ -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); /** * File logging class based on the PSR-3 standard. diff --git a/src/Google/Logger/Null.php b/src/Google/Logger/Null.php index 9c5f64a..0feb24f 100644 --- a/src/Google/Logger/Null.php +++ b/src/Google/Logger/Null.php @@ -15,7 +15,7 @@ * limitations under the License. */ -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); /** * Null logger based on the PSR-3 standard. diff --git a/src/Google/Logger/Psr.php b/src/Google/Logger/Psr.php index d577244..da565ca 100644 --- a/src/Google/Logger/Psr.php +++ b/src/Google/Logger/Psr.php @@ -15,7 +15,7 @@ * limitations under the License. */ -require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); +require_once realpath(dirname(__FILE__) . '/../autoload.php'); /** * Psr logging class based on the PSR-3 standard. diff --git a/src/Google/Service/Exception.php b/src/Google/Service/Exception.php index 65c1fcc..502229c 100644 --- a/src/Google/Service/Exception.php +++ b/src/Google/Service/Exception.php @@ -1,6 +1,6 @@ setScopes( diff --git a/tests/bootstrap.php b/tests/bootstrap.php index e1783a0..327b974 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -15,7 +15,7 @@ * limitations under the License. */ -require_once dirname(__FILE__) . '/../autoload.php'; +require_once dirname(__FILE__) . '/../src/Google/autoload.php'; require_once dirname(__FILE__) . '/BaseTest.php'; date_default_timezone_set('UTC'); -- 2.2.0