Edit File by line
/home/barbar84/www/wp-conte.../plugins/updraftp.../includes/Google
File: Client.php
*/
[500] Fix | Delete
public function setAssertionCredentials(Google_Auth_AssertionCredentials $creds)
[501] Fix | Delete
{
[502] Fix | Delete
$this->getAuth()->setAssertionCredentials($creds);
[503] Fix | Delete
}
[504] Fix | Delete
[505] Fix | Delete
/**
[506] Fix | Delete
* Set the scopes to be requested. Must be called before createAuthUrl().
[507] Fix | Delete
* Will remove any previously configured scopes.
[508] Fix | Delete
* @param array $scopes, ie: array('https://www.googleapis.com/auth/plus.login',
[509] Fix | Delete
* 'https://www.googleapis.com/auth/moderator')
[510] Fix | Delete
*/
[511] Fix | Delete
public function setScopes($scopes)
[512] Fix | Delete
{
[513] Fix | Delete
$this->requestedScopes = array();
[514] Fix | Delete
$this->addScope($scopes);
[515] Fix | Delete
}
[516] Fix | Delete
[517] Fix | Delete
/**
[518] Fix | Delete
* This functions adds a scope to be requested as part of the OAuth2.0 flow.
[519] Fix | Delete
* Will append any scopes not previously requested to the scope parameter.
[520] Fix | Delete
* A single string will be treated as a scope to request. An array of strings
[521] Fix | Delete
* will each be appended.
[522] Fix | Delete
* @param $scope_or_scopes string|array e.g. "profile"
[523] Fix | Delete
*/
[524] Fix | Delete
public function addScope($scope_or_scopes)
[525] Fix | Delete
{
[526] Fix | Delete
if (is_string($scope_or_scopes) && !in_array($scope_or_scopes, $this->requestedScopes)) {
[527] Fix | Delete
$this->requestedScopes[] = $scope_or_scopes;
[528] Fix | Delete
} else if (is_array($scope_or_scopes)) {
[529] Fix | Delete
foreach ($scope_or_scopes as $scope) {
[530] Fix | Delete
$this->addScope($scope);
[531] Fix | Delete
}
[532] Fix | Delete
}
[533] Fix | Delete
}
[534] Fix | Delete
[535] Fix | Delete
/**
[536] Fix | Delete
* Returns the list of scopes requested by the client
[537] Fix | Delete
* @return array the list of scopes
[538] Fix | Delete
*
[539] Fix | Delete
*/
[540] Fix | Delete
public function getScopes()
[541] Fix | Delete
{
[542] Fix | Delete
return $this->requestedScopes;
[543] Fix | Delete
}
[544] Fix | Delete
[545] Fix | Delete
/**
[546] Fix | Delete
* Declare whether batch calls should be used. This may increase throughput
[547] Fix | Delete
* by making multiple requests in one connection.
[548] Fix | Delete
*
[549] Fix | Delete
* @param boolean $useBatch True if the batch support should
[550] Fix | Delete
* be enabled. Defaults to False.
[551] Fix | Delete
*/
[552] Fix | Delete
public function setUseBatch($useBatch)
[553] Fix | Delete
{
[554] Fix | Delete
// This is actually an alias for setDefer.
[555] Fix | Delete
$this->setDefer($useBatch);
[556] Fix | Delete
}
[557] Fix | Delete
[558] Fix | Delete
/**
[559] Fix | Delete
* Declare whether making API calls should make the call immediately, or
[560] Fix | Delete
* return a request which can be called with ->execute();
[561] Fix | Delete
*
[562] Fix | Delete
* @param boolean $defer True if calls should not be executed right away.
[563] Fix | Delete
*/
[564] Fix | Delete
public function setDefer($defer)
[565] Fix | Delete
{
[566] Fix | Delete
$this->deferExecution = $defer;
[567] Fix | Delete
}
[568] Fix | Delete
[569] Fix | Delete
/**
[570] Fix | Delete
* Helper method to execute deferred HTTP requests.
[571] Fix | Delete
*
[572] Fix | Delete
* @param $request Google_Http_Request|Google_Http_Batch
[573] Fix | Delete
* @throws Google_Exception
[574] Fix | Delete
* @return object of the type of the expected class or array.
[575] Fix | Delete
*/
[576] Fix | Delete
public function execute($request)
[577] Fix | Delete
{
[578] Fix | Delete
if ($request instanceof UDP_Google_Http_Request) {
[579] Fix | Delete
$request->setUserAgent(
[580] Fix | Delete
$this->getApplicationName()
[581] Fix | Delete
. " " . self::USER_AGENT_SUFFIX
[582] Fix | Delete
. $this->getLibraryVersion()
[583] Fix | Delete
);
[584] Fix | Delete
if (!$this->getClassConfig("UDP_Google_Http_Request", "disable_gzip")) {
[585] Fix | Delete
$request->enableGzip();
[586] Fix | Delete
}
[587] Fix | Delete
$request->maybeMoveParametersToBody();
[588] Fix | Delete
return UDP_Google_Http_REST::execute($this, $request);
[589] Fix | Delete
} else if ($request instanceof Google_Http_Batch) {
[590] Fix | Delete
return $request->execute();
[591] Fix | Delete
} else {
[592] Fix | Delete
throw new Google_Exception("Do not know how to execute this type of object.");
[593] Fix | Delete
}
[594] Fix | Delete
}
[595] Fix | Delete
[596] Fix | Delete
/**
[597] Fix | Delete
* Whether or not to return raw requests
[598] Fix | Delete
* @return boolean
[599] Fix | Delete
*/
[600] Fix | Delete
public function shouldDefer()
[601] Fix | Delete
{
[602] Fix | Delete
return $this->deferExecution;
[603] Fix | Delete
}
[604] Fix | Delete
[605] Fix | Delete
/**
[606] Fix | Delete
* @return Google_Auth_Abstract Authentication implementation
[607] Fix | Delete
*/
[608] Fix | Delete
public function getAuth()
[609] Fix | Delete
{
[610] Fix | Delete
if (!isset($this->auth)) {
[611] Fix | Delete
$class = $this->config->getAuthClass();
[612] Fix | Delete
$this->auth = new $class($this);
[613] Fix | Delete
}
[614] Fix | Delete
return $this->auth;
[615] Fix | Delete
}
[616] Fix | Delete
[617] Fix | Delete
/**
[618] Fix | Delete
* @return UDP_Google_IO_Abstract IO implementation
[619] Fix | Delete
*/
[620] Fix | Delete
public function getIo()
[621] Fix | Delete
{
[622] Fix | Delete
if (!isset($this->io)) {
[623] Fix | Delete
$class = $this->config->getIoClass();
[624] Fix | Delete
$this->io = new $class($this);
[625] Fix | Delete
}
[626] Fix | Delete
return $this->io;
[627] Fix | Delete
}
[628] Fix | Delete
[629] Fix | Delete
/**
[630] Fix | Delete
* @return Google_Cache_Abstract Cache implementation
[631] Fix | Delete
*/
[632] Fix | Delete
public function getCache()
[633] Fix | Delete
{
[634] Fix | Delete
if (!isset($this->cache)) {
[635] Fix | Delete
$class = $this->config->getCacheClass();
[636] Fix | Delete
$this->cache = new $class($this);
[637] Fix | Delete
}
[638] Fix | Delete
return $this->cache;
[639] Fix | Delete
}
[640] Fix | Delete
[641] Fix | Delete
/**
[642] Fix | Delete
* @return Google_Logger_Abstract Logger implementation
[643] Fix | Delete
*/
[644] Fix | Delete
public function getLogger()
[645] Fix | Delete
{
[646] Fix | Delete
if (!isset($this->logger)) {
[647] Fix | Delete
$class = $this->config->getLoggerClass();
[648] Fix | Delete
$this->logger = new $class($this);
[649] Fix | Delete
}
[650] Fix | Delete
return $this->logger;
[651] Fix | Delete
}
[652] Fix | Delete
[653] Fix | Delete
/**
[654] Fix | Delete
* Retrieve custom configuration for a specific class.
[655] Fix | Delete
* @param $class string|object - class or instance of class to retrieve
[656] Fix | Delete
* @param $key string optional - key to retrieve
[657] Fix | Delete
* @return array
[658] Fix | Delete
*/
[659] Fix | Delete
public function getClassConfig($class, $key = null)
[660] Fix | Delete
{
[661] Fix | Delete
if (!is_string($class)) {
[662] Fix | Delete
$class = get_class($class);
[663] Fix | Delete
}
[664] Fix | Delete
return $this->config->getClassConfig($class, $key);
[665] Fix | Delete
}
[666] Fix | Delete
[667] Fix | Delete
/**
[668] Fix | Delete
* Set configuration specific to a given class.
[669] Fix | Delete
* $config->setClassConfig('Google_Cache_File',
[670] Fix | Delete
* array('directory' => '/tmp/cache'));
[671] Fix | Delete
* @param $class string|object - The class name for the configuration
[672] Fix | Delete
* @param $config string key or an array of configuration values
[673] Fix | Delete
* @param $value string optional - if $config is a key, the value
[674] Fix | Delete
*
[675] Fix | Delete
*/
[676] Fix | Delete
public function setClassConfig($class, $config, $value = null)
[677] Fix | Delete
{
[678] Fix | Delete
if (!is_string($class)) {
[679] Fix | Delete
$class = get_class($class);
[680] Fix | Delete
}
[681] Fix | Delete
$this->config->setClassConfig($class, $config, $value);
[682] Fix | Delete
[683] Fix | Delete
}
[684] Fix | Delete
[685] Fix | Delete
/**
[686] Fix | Delete
* @return string the base URL to use for calls to the APIs
[687] Fix | Delete
*/
[688] Fix | Delete
public function getBasePath()
[689] Fix | Delete
{
[690] Fix | Delete
return $this->config->getBasePath();
[691] Fix | Delete
}
[692] Fix | Delete
[693] Fix | Delete
/**
[694] Fix | Delete
* @return string the name of the application
[695] Fix | Delete
*/
[696] Fix | Delete
public function getApplicationName()
[697] Fix | Delete
{
[698] Fix | Delete
return $this->config->getApplicationName();
[699] Fix | Delete
}
[700] Fix | Delete
[701] Fix | Delete
/**
[702] Fix | Delete
* Are we running in Google AppEngine?
[703] Fix | Delete
* return bool
[704] Fix | Delete
*/
[705] Fix | Delete
public function isAppEngine()
[706] Fix | Delete
{
[707] Fix | Delete
return (isset($_SERVER['SERVER_SOFTWARE']) &&
[708] Fix | Delete
strpos($_SERVER['SERVER_SOFTWARE'], 'Google App Engine') !== false);
[709] Fix | Delete
}
[710] Fix | Delete
}
[711] Fix | Delete
[712] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function