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.
/lib/ -> googleapi.php (source)

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 401 and 403]

Simple implementation of some Google API functions for Moodle.

Copyright: Dan Poltawski <talktodan@gmail.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 258 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

google_docs:: (5 methods):
  __construct()
  reset_curl_state()
  get_file_list()
  send_file()
  download_file()

google_oauth:: (4 methods):
  auth_url()
  token_url()
  reset_state()
  request()


Class: google_docs  - X-Ref

Class for manipulating google documents through the google data api.

Docs for this can be found here:
{@link http://code.google.com/apis/documents/docs/2.0/developers_guide_protocol.html}

__construct(google_oauth $googleoauth)   X-Ref
Constructor.

param: google_oauth $googleoauth oauth curl class for making authenticated requests

reset_curl_state()   X-Ref
Resets state on oauth curl object and set GData protocol
version


get_file_list($search = '')   X-Ref
Returns a list of files the user has formated for files api

param: string $search A search string to do full text search on the documents
return: mixed Array of files formated for fileapoi

send_file($file)   X-Ref
Sends a file object to google documents

param: object $file File object
return: boolean True on success

download_file($url, $path, $timeout = 0)   X-Ref
Downloads a file using authentication

param: string $url url of file
param: string $path path to save file to
param: int $timeout request timeout, default 0 which means no timeout
return: array stucture for repository download_file

Class: google_oauth  - X-Ref

OAuth 2.0 client for Google Services

auth_url()   X-Ref
Returns the auth url for OAuth 2.0 request

return: string the auth url

token_url()   X-Ref
Returns the token url for OAuth 2.0 request

return: string the auth url

reset_state()   X-Ref
Resets headers and response for multiple requests


request($url, $options = array()   X-Ref
Make a HTTP request, we override the parents because we do not
want to send accept headers (this was a change in the parent class and we want to keep the old behaviour).

param: string $url The URL to request
param: array $options
param: mixed $acceptheader Not used.
return: bool