Skip to content

Commit 1d56122

Browse files
committed
Use autoloader instead of requiring class files
For backwards compatibility (if someone still includes a class file directly instead of using the autoloader), we make sure to always use the autoloader whenever appropriate. Addresses googleapis#341
1 parent a721134 commit 1d56122

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+59
-146
lines changed

examples/appengineauth.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@
2121
Make an API request authenticated via the
2222
AppIdentity service on AppEngine.
2323
************************************************/
24-
set_include_path("../src/" . PATH_SEPARATOR . get_include_path());
25-
require_once 'Google/Client.php';
26-
require_once 'Google/Auth/AppIdentity.php';
27-
require_once 'Google/Service/Storage.php';
24+
require_once realpath(dirname(__FILE__) . '/../autoload.php');
2825

2926
echo pageHeader("AppIdentity Account Access");
3027

examples/batch.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@
2222
books API again as an example, but this time we
2323
will batch up two queries into a single call.
2424
************************************************/
25-
set_include_path("../src/" . PATH_SEPARATOR . get_include_path());
26-
require_once 'Google/Client.php';
27-
require_once 'Google/Service/Books.php';
28-
require_once 'Google/Http/Batch.php';
25+
require_once realpath(dirname(__FILE__) . '/../autoload.php');
2926

3027
/************************************************
3128
We create the client and set the simple API

examples/fileupload.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@
1717
include_once "templates/base.php";
1818
session_start();
1919

20-
set_include_path("../src/" . PATH_SEPARATOR . get_include_path());
21-
require_once 'Google/Client.php';
22-
require_once 'Google/Http/MediaFileUpload.php';
23-
require_once 'Google/Service/Drive.php';
20+
require_once realpath(dirname(__FILE__) . '/../autoload.php');
2421

2522
/************************************************
2623
We'll setup an empty 20MB file to upload.

examples/idtoken.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
include_once "templates/base.php";
1818
session_start();
1919

20-
set_include_path("../src/" . PATH_SEPARATOR . get_include_path());
21-
require_once 'Google/Client.php';
20+
require_once realpath(dirname(__FILE__) . '/../autoload.php');
2221

2322
/************************************************
2423
ATTENTION: Fill in these values! Make sure

examples/multi-api.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@
1717
include_once "templates/base.php";
1818
session_start();
1919

20-
set_include_path("../src/" . PATH_SEPARATOR . get_include_path());
21-
require_once 'Google/Client.php';
22-
require_once 'Google/Service/YouTube.php';
23-
require_once 'Google/Service/Drive.php';
20+
require_once realpath(dirname(__FILE__) . '/../autoload.php');
2421

2522
/************************************************
2623
ATTENTION: Fill in these values! Make sure

examples/service-account.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
Make an API request authenticated with a service
2222
account.
2323
************************************************/
24-
set_include_path("../src/" . PATH_SEPARATOR . get_include_path());
25-
require_once 'Google/Client.php';
26-
require_once 'Google/Service/Books.php';
24+
require_once realpath(dirname(__FILE__) . '/../autoload.php');
2725

2826
/************************************************
2927
ATTENTION: Fill in these values! You can get

examples/simple-query.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@
2525
should use our quota, which is higher than the
2626
anonymous quota (which is limited per IP).
2727
************************************************/
28-
set_include_path("../src/" . PATH_SEPARATOR . get_include_path());
29-
require_once 'Google/Client.php';
30-
require_once 'Google/Service/Books.php';
28+
require_once realpath(dirname(__FILE__) . '/../autoload.php');
3129

3230
/************************************************
3331
We create the client and set the simple API

examples/simplefileupload.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@
1717
include_once "templates/base.php";
1818
session_start();
1919

20-
set_include_path("../src/" . PATH_SEPARATOR . get_include_path());
21-
require_once 'Google/Client.php';
22-
require_once 'Google/Http/MediaFileUpload.php';
23-
require_once 'Google/Service/Drive.php';
20+
require_once realpath(dirname(__FILE__) . '/../autoload.php');
2421

2522
/************************************************
2623
We'll setup an empty 1MB file to upload.

examples/user-example.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
include_once "templates/base.php";
1818
session_start();
1919

20-
set_include_path("../src/" . PATH_SEPARATOR . get_include_path());
21-
require_once 'Google/Client.php';
22-
require_once 'Google/Service/Urlshortener.php';
20+
require_once realpath(dirname(__FILE__) . '/../autoload.php');
2321

2422
/************************************************
2523
ATTENTION: Fill in these values! Make sure

src/Google/Auth/Abstract.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
require_once "Google/Http/Request.php";
17+
18+
require_once realpath(dirname(__FILE__) . '/../../../autoload.php');
1819

1920
/**
2021
* Abstract class for the Authentication in the API client

0 commit comments

Comments
 (0)