Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/updraftp.../includes/Google/Auth
File: Simple.php
<?php
[0] Fix | Delete
/*
[1] Fix | Delete
* Copyright 2010 Google Inc.
[2] Fix | Delete
*
[3] Fix | Delete
* Licensed under the Apache License, Version 2.0 (the "License");
[4] Fix | Delete
* you may not use this file except in compliance with the License.
[5] Fix | Delete
* You may obtain a copy of the License at
[6] Fix | Delete
*
[7] Fix | Delete
* http://www.apache.org/licenses/LICENSE-2.0
[8] Fix | Delete
*
[9] Fix | Delete
* Unless required by applicable law or agreed to in writing, software
[10] Fix | Delete
* distributed under the License is distributed on an "AS IS" BASIS,
[11] Fix | Delete
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
[12] Fix | Delete
* See the License for the specific language governing permissions and
[13] Fix | Delete
* limitations under the License.
[14] Fix | Delete
*/
[15] Fix | Delete
[16] Fix | Delete
if (!class_exists('UDP_Google_Client')) {
[17] Fix | Delete
require_once dirname(__FILE__) . '/../autoload.php';
[18] Fix | Delete
}
[19] Fix | Delete
[20] Fix | Delete
/**
[21] Fix | Delete
* Simple API access implementation. Can either be used to make requests
[22] Fix | Delete
* completely unauthenticated, or by using a Simple API Access developer
[23] Fix | Delete
* key.
[24] Fix | Delete
*/
[25] Fix | Delete
class Google_Auth_Simple extends Google_Auth_Abstract
[26] Fix | Delete
{
[27] Fix | Delete
private $client;
[28] Fix | Delete
[29] Fix | Delete
public function __construct(UDP_Google_Client $client, $config = null)
[30] Fix | Delete
{
[31] Fix | Delete
$this->client = $client;
[32] Fix | Delete
}
[33] Fix | Delete
[34] Fix | Delete
/**
[35] Fix | Delete
* Perform an authenticated / signed apiHttpRequest.
[36] Fix | Delete
* This function takes the apiHttpRequest, calls apiAuth->sign on it
[37] Fix | Delete
* (which can modify the request in what ever way fits the auth mechanism)
[38] Fix | Delete
* and then calls apiCurlIO::makeRequest on the signed request
[39] Fix | Delete
*
[40] Fix | Delete
* @param Google_Http_Request $request
[41] Fix | Delete
* @return Google_Http_Request The resulting HTTP response including the
[42] Fix | Delete
* responseHttpCode, responseHeaders and responseBody.
[43] Fix | Delete
*/
[44] Fix | Delete
public function authenticatedRequest(UDP_Google_Http_Request $request)
[45] Fix | Delete
{
[46] Fix | Delete
$request = $this->sign($request);
[47] Fix | Delete
return $this->io->makeRequest($request);
[48] Fix | Delete
}
[49] Fix | Delete
[50] Fix | Delete
public function sign(UDP_Google_Http_Request $request)
[51] Fix | Delete
{
[52] Fix | Delete
$key = $this->client->getClassConfig($this, 'developer_key');
[53] Fix | Delete
if ($key) {
[54] Fix | Delete
$this->client->getLogger()->debug(
[55] Fix | Delete
'Simple API Access developer key authentication'
[56] Fix | Delete
);
[57] Fix | Delete
$request->setQueryParam('key', $key);
[58] Fix | Delete
}
[59] Fix | Delete
return $request;
[60] Fix | Delete
}
[61] Fix | Delete
}
[62] Fix | Delete
[63] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function