/wp-content/plugins/wordpress-seo/vendor/yoast/api-libs/google/auth/Google_AuthNone.php

https://bitbucket.org/carloskikea/helpet · PHP · 48 lines · 24 code · 4 blank · 20 comment · 2 complexity · a3946bcf8b60a092d60744dee1266268 MD5 · raw file

  1. <?php
  2. /*
  3. * Copyright 2010 Google Inc.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /**
  18. * Do-nothing authentication implementation, use this if you want to make un-authenticated calls
  19. * @author Chris Chabot <chabotc@google.com>
  20. * @author Chirag Shah <chirags@google.com>
  21. */
  22. class Yoast_Google_AuthNone extends Yoast_Google_Auth {
  23. public $key = null;
  24. public function __construct() {
  25. global $apiConfig;
  26. if (!empty($apiConfig['developer_key'])) {
  27. $this->setDeveloperKey($apiConfig['developer_key']);
  28. }
  29. }
  30. public function setDeveloperKey($key) {$this->key = $key;}
  31. public function authenticate($service) {/*noop*/}
  32. public function setAccessToken($accessToken) {/* noop*/}
  33. public function getAccessToken() {return null;}
  34. public function createAuthUrl($scope) {return null;}
  35. public function refreshToken($refreshToken) {/* noop*/}
  36. public function revokeToken() {/* noop*/}
  37. public function sign(Yoast_Google_HttpRequest $request) {
  38. if ($this->key) {
  39. $request->setUrl($request->getUrl() . ((strpos($request->getUrl(), '?') === false) ? '?' : '&')
  40. . 'key='.urlencode($this->key));
  41. }
  42. return $request;
  43. }
  44. }