Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Minor updates and optimizations

Updated license comments; removed extraneous Google auth method
libraries from loading as well as related functions (OAuth, OAuth2,
etc.)
  • Loading branch information...
commit b869f9222201d757c84a99dc9b01c07b5e5d01a6 1 parent ed59dfe
Neil Mansilla mansilladev authored
20 examples/articles_headlines.php
@@ -16,10 +16,19 @@
16 16 */
17 17 session_start();
18 18
  19 +// Client library (network/authentication)
19 20 require_once "../google-api-php-client/src/apiClient.php";
  21 +
  22 +// USA TODAY resource/method library
20 23 require_once "../google-api-php-client/src/contrib/apiArticlesapiService.php";
  24 +
  25 +// Instantiate client
21 26 $client = new apiClient();
  27 +
  28 +// Set credentials
22 29 $client->setDeveloperKey("YOUR_API_KEY");
  30 +
  31 +// Instantiate service
23 32 $service = new apiArticlesapiService($client);
24 33
25 34 $StoryList = new StoryList;
@@ -72,7 +81,8 @@
72 81 <option value="nba">nba</option>
73 82 <option value="nhl">nhl</option>
74 83 <option value="collegefootball">collegefootball</option>
75   - <option value="collegebasketball">collegebasketball</option>
  84 + <option
  85 + value="collegebasketball">collegebasketball</option>
76 86 <option value="highschool">highschool</option>
77 87 <option value="motorsports">motorsports</option>
78 88 <option value="golf">golf</option>
@@ -94,10 +104,10 @@
94 104 ?>
95 105 <hr />Results<br /><br />
96 106 <?php
97   - /*
98   - * Iterate through each story object, and hyperlink the
99   - * title of each article
100   - */
  107 +/*
  108 + * Iterate through each story object, and hyperlink the
  109 + * title of each article
  110 + */
101 111 foreach ($StoryList->getStories() as $story) {
102 112 echo("<a href='" . $story->getLink() . "' target='_blank'>");
103 113 echo($story -> getTitle());
14 examples/census_population.php
@@ -16,10 +16,19 @@
16 16 */
17 17 session_start();
18 18
  19 +// Client library (network/authentication)
19 20 require_once "../google-api-php-client/src/apiClient.php";
  21 +
  22 +// USA TODAY resource/method library
20 23 require_once "../google-api-php-client/src/contrib/apiCensusapiService.php";
  24 +
  25 +// Instantiate client
21 26 $client = new apiClient();
22   -$client->setDeveloperKey("YOUR_KEY_HERE");
  27 +
  28 +// Set credentials
  29 +$client->setDeveloperKey("YOUR_API_KEY");
  30 +
  31 +// Instantiate service
23 32 $service = new apiCensusapiService($client);
24 33
25 34 $response = "";
@@ -64,7 +73,8 @@ class="well">
64 73 value="greenville" /></td></tr>
65 74 <tr><td>keyname</td><td><input type="text" name="keyname"
66 75 value="placename" /></td></tr>
67   - <tr><td>sumlevid</td><td><input type="text" name="sumlevid"
  76 + <tr><td>sumlevid</td><td><input type="text"
  77 + name="sumlevid"
68 78 value="4,6" /></td></tr>
69 79 </table>
70 80 <br />
17 examples/community_feed.php
@@ -16,10 +16,19 @@
16 16 */
17 17 session_start();
18 18
  19 +// Client library (network/authentication)
19 20 require_once "../google-api-php-client/src/apiClient.php";
  21 +
  22 +// USA TODAY resource/method library
20 23 require_once "../google-api-php-client/src/contrib/apiArticlesapiService.php";
  24 +
  25 +// Instantiate client
21 26 $client = new apiClient();
22   -$client->setDeveloperKey("YOUR_KEY_HERE");
  27 +
  28 +// Set credentials
  29 +$client->setDeveloperKey("YOUR_API_KEY");
  30 +
  31 +// Instantiate service
23 32 $service = new apiArticlesapiService($client);
24 33
25 34 $StoryList = new StoryList;
@@ -64,7 +73,8 @@
64 73 <option value="todayinthesky">todayinthesky</option>
65 74 <option value="driveon">driveon</option>
66 75 <option value="campusrivalry">campusrivalry</option>
67   - <option value="christinebrennan">christinebrennan</option>
  76 + <option
  77 + value="christinebrennan">christinebrennan</option>
68 78 <option value="dailypitch">dailypitch</option>
69 79 <option value="fantasyjoe">fantasyjoe</option>
70 80 <option value="fantasywindup">fantasywindup</option>
@@ -84,7 +94,8 @@
84 94 <br />
85 95 <br />
86 96 <br />
87   - <input type="submit" value="Search Community Blog Articles" />
  97 + <input type="submit"
  98 + value="Search Community Blog Articles" />
88 99 </form>
89 100 </div>
90 101 <?php
22 google-api-php-client/src/apiClient.php
@@ -20,7 +20,7 @@
20 20 *
21 21 * Note that the original work's copyright and license information is located at
22 22 * the top of this file. Any modifications made by Mashery, Inc. are licensed
23   - * under the MIT License.
  23 + * under the following license.
24 24 *
25 25 * Copyright (c) 2012 Mashery, Inc.
26 26 *
@@ -147,26 +147,6 @@ public function setAuthClass($authClassName) {
147 147 self::$auth = new $authClassName();
148 148 }
149 149
150   - public function authenticate() {
151   - $service = $this->prepareService();
152   - $this->authenticated = true;
153   - return self::$auth->authenticate($service);
154   - }
155   -
156   - /**
157   - * Construct the OAuth 2.0 authorization request URI.
158   - * @return string
159   - */
160   - public function createAuthUrl() {
161   - $service = $this->prepareService();
162   - return self::$auth->createAuthUrl($service['scope']);
163   - }
164   -
165   - private function prepareService() {
166   - $service = $this->defaultService;
167   - return $service;
168   - }
169   -
170 150 /**
171 151 * Set the developer key to use, these are obtained through the API Console.
172 152 * @see http://code.google.com/apis/console-help/#generatingdevkeys
40 google-api-php-client/src/auth/apiAuth.php
@@ -15,9 +15,37 @@
15 15 * limitations under the License.
16 16 */
17 17
  18 + /*
  19 + * This file has been modified by Mashery, Inc.
  20 + *
  21 + * Note that the original work's copyright and license information is located at
  22 + * the top of this file. Any modifications made by Mashery, Inc. are licensed
  23 + * under the following license.
  24 + *
  25 + * Copyright (c) 2012 Mashery, Inc.
  26 + *
  27 + * Permission is hereby granted, free of charge, to any person obtaining
  28 + * a copy of this software and associated documentation files (the
  29 + * "Software"), to deal in the Software without restriction, including
  30 + * without limitation the rights to use, copy, modify, merge, publish,
  31 + * distribute, sublicense, and/or sell copies of the Software, and to
  32 + * permit persons to whom the Software is furnished to do so, subject to
  33 + * the following conditions:
  34 +
  35 + * The above copyright notice and this permission notice shall be
  36 + * included in all copies or substantial portions of the Software.
  37 +
  38 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  39 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  40 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  41 + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  42 + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  43 + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  44 + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  45 + *
  46 + * @author Neil Mansilla <neil@mashery.com>
  47 + */
18 48 require_once "apiAuthNone.php";
19   -require_once "apiOAuth.php";
20   -require_once "apiOAuth2.php";
21 49
22 50 /**
23 51 * Abstract class for the Authentication in the API client
@@ -25,13 +53,5 @@
25 53 *
26 54 */
27 55 abstract class apiAuth {
28   - abstract public function authenticate($service);
29 56 abstract public function sign(apiHttpRequest $request);
30   - abstract public function createAuthUrl($scope);
31   -
32   - abstract public function getAccessToken();
33   - abstract public function setAccessToken($accessToken);
34   - abstract public function setDeveloperKey($developerKey);
35   - abstract public function refreshToken($refreshToken);
36   - abstract public function revokeToken();
37 57 }
8 google-api-php-client/src/auth/apiAuthNone.php
@@ -26,7 +26,7 @@
26 26 *
27 27 * Note that the original work's copyright and license information is located at
28 28 * the top of this file. Any modifications made by Mashery, Inc. are licensed
29   - * under the MIT License.
  29 + * under the following license.
30 30 *
31 31 * Copyright (c) 2012 Mashery, Inc.
32 32 *
@@ -63,12 +63,6 @@ public function __construct() {
63 63 }
64 64
65 65 public function setDeveloperKey($key) {$this->key = $key;}
66   - public function authenticate($service) {/*noop*/}
67   - public function setAccessToken($accessToken) {/* noop*/}
68   - public function getAccessToken() {return null;}
69   - public function createAuthUrl($scope) {return null;}
70   - public function refreshToken($refreshToken) {/* noop*/}
71   - public function revokeToken() {/* noop*/}
72 66
73 67 public function sign(apiHttpRequest $request) {
74 68 global $apiConfig;
2  google-api-php-client/src/config.php
@@ -20,7 +20,7 @@
20 20 *
21 21 * Note that the original work's copyright and license information is located at
22 22 * the top of this file. Any modifications made by Mashery, Inc. are licensed
23   - * under the MIT License.
  23 + * under the following license.
24 24 *
25 25 * Copyright (c) 2012 Mashery, Inc.
26 26 *

0 comments on commit b869f92

Please sign in to comment.
Something went wrong with that request. Please try again.