Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.
/lib/ -> googleapi.php (source)

Differences Between: [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 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: 464 lines (17 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 classes

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

google_picasa:: (8 methods):
  __construct()
  send_file()
  get_file_list()
  get_album_photos()
  get_last_album_name()
  do_photo_search()
  get_albums()
  get_photo_details()

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_picasa  - X-Ref

Class for manipulating picasa through the google data api.

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

__construct(google_oauth $googleoauth)   X-Ref
Constructor.

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

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

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

get_file_list($path = '')   X-Ref
Returns list of photos for file picker.
If top level then returns list of albums, otherwise
photos within an album.

param: string $path The path to files (assumed to be albumid)
return: mixed $files A list of files for the file picker

get_album_photos($albumid)   X-Ref
Returns list of photos in album specified

param: int $albumid Photo album to list photos from
return: mixed $files A list of files for the file picker

get_last_album_name()   X-Ref
Returns the name of the album for which get_photo_details was called last time.

return: string

do_photo_search($query)   X-Ref
Does text search on the users photos and returns
matches in format for picasa api

param: string $query Search terms
return: mixed $files A list of files for the file picker

get_albums()   X-Ref
Gets all the users albums and returns them as a list of folders
for the file picker

return: mixes $files Array in the format get_listing uses for folders

get_photo_details($rawxml)   X-Ref
Recieves XML from a picasa list of photos and returns
array in format for file picker.

param: string $rawxml XML from picasa api
return: mixed $files A list of files for the file picker

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