Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 401 and 402] [Versions 401 and 403]

(no description)

File Size: 456 lines (14 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: Google_Config  - X-Ref

A class to contain the library configuration for the Google API client.

__construct($ini_file_location = null)   X-Ref
Create a new Google_Config. Can accept an ini file location with the
local configuration. For example:
application_name="My App"

param: [$ini_file_location] - optional - The location of the ini file to load

setClassConfig($class, $config, $value = null)   X-Ref
Set configuration specific to a given class.
$config->setClassConfig('Google_Cache_File',
array('directory' => '/tmp/cache'));

param: $class string The class name for the configuration
param: $config string key or an array of configuration values
param: $value string optional - if $config is a key, the value

getClassConfig($class, $key = null)   X-Ref
No description

getCacheClass()   X-Ref
Return the configured cache class.

return: string

getLoggerClass()   X-Ref
Return the configured logger class.

return: string

getAuthClass()   X-Ref
Return the configured Auth class.

return: string

setAuthClass($class)   X-Ref
Set the auth class.

param: $class string the class name to set

setIoClass($class)   X-Ref
Set the IO class.

param: $class string the class name to set

setCacheClass($class)   X-Ref
Set the cache class.

param: $class string the class name to set

setLoggerClass($class)   X-Ref
Set the logger class.

param: $class string the class name to set

getIoClass()   X-Ref
Return the configured IO class.

return: string

setApplicationName($name)   X-Ref
Set the application name, this is included in the User-Agent HTTP header.

param: string $name

getApplicationName()   X-Ref

return: string the name of the application

setClientId($clientId)   X-Ref
Set the client ID for the auth class.

param: $clientId string - the API console client ID

setClientSecret($secret)   X-Ref
Set the client secret for the auth class.

param: $secret string - the API console client secret

setRedirectUri($uri)   X-Ref
Set the redirect uri for the auth class. Note that if using the
Javascript based sign in flow, this should be the string 'postmessage'.

param: $uri string - the URI that users should be redirected to

setRequestVisibleActions($rva)   X-Ref
Set the app activities for the auth class.

param: $rva string a space separated list of app activity types

setAccessType($access)   X-Ref
Set the the access type requested (offline or online.)

param: $access string - the access type

setApprovalPrompt($approval)   X-Ref
Set when to show the approval prompt (auto or force)

param: $approval string - the approval request

setLoginHint($hint)   X-Ref
Set the login hint (email address or sub identifier)

param: $hint string

setDeveloperKey($key)   X-Ref
Set the developer key for the auth class. Note that this is separate value
from the client ID - if it looks like a URL, its a client ID!

param: $key string - the API console developer key

setHostedDomain($hd)   X-Ref
Set the hd (hosted domain) parameter streamlines the login process for
Google Apps hosted accounts. By including the domain of the user, you
restrict sign-in to accounts at that domain.

This should not be used to ensure security on your application - check
the hd values within an id token (@see Google_Auth_LoginTicket) after sign
in to ensure that the user is from the domain you were expecting.

param: $hd string - the domain to use.

setPrompt($prompt)   X-Ref
Set the prompt hint. Valid values are none, consent and select_account.
If no value is specified and the user has not previously authorized
access, then the user is shown a consent screen.

param: $prompt string

setOpenidRealm($realm)   X-Ref
openid.realm is a parameter from the OpenID 2.0 protocol, not from OAuth
2.0. It is used in OpenID 2.0 requests to signify the URL-space for which
an authentication request is valid.

param: $realm string - the URL-space to use.

setIncludeGrantedScopes($include)   X-Ref
If this is provided with the value true, and the authorization request is
granted, the authorization will include any previous authorizations
granted to this user/application combination for other scopes.

param: $include boolean - the URL-space to use.

getBasePath()   X-Ref

return: string the base URL to use for API calls

setAuthConfig($key, $value)   X-Ref
Set the auth configuration for the current auth class.

param: $key - the key to set
param: $value - the parameter value