[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/repository/dropbox/ -> lib.php (summary)

This plugin is used to access user's dropbox files

Copyright: 2012 Marina Glancy
Copyright: 2010 Dongsheng Cai {@link http://dongsheng.org}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 732 lines (28 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 1 file
 repository/dropbox/locallib.php

Defines 1 class

repository_dropbox:: (28 methods):
  __construct()
  set_access_key()
  set_access_secret()
  check_login()
  print_login()
  callback()
  get_listing()
  send_thumbnail()
  logout()
  set_option()
  get_option()
  fix_old_style_reference()
  get_file_download_link()
  get_file()
  type_config_form()
  get_type_option_names()
  supported_filetypes()
  supported_returntypes()
  get_link()
  get_file_reference()
  sync_reference()
  cache_file_by_reference()
  get_reference_details()
  get_file_source_info()
  max_cache_bytes()
  send_file()
  cron()
  repository_dropbox_cron()


Class: repository_dropbox  - X-Ref

Repository to access Dropbox files

__construct($repositoryid, $context = SYSCONTEXTID, $options = array()   X-Ref
Constructor of dropbox plugin

param: int $repositoryid
param: stdClass $context
param: array $options

set_access_key($access_key)   X-Ref
Set access key

param: string $access_key

set_access_secret($access_secret)   X-Ref
Set access secret

param: string $access_secret

check_login()   X-Ref
Check if moodle has got access token and secret

return: bool

print_login()   X-Ref
Generate dropbox login url

return: array

callback()   X-Ref
Request access token

return: array

get_listing($path = '', $page = '1')   X-Ref
Get dropbox files

param: string $path
param: int $page
return: array

send_thumbnail($source)   X-Ref
Displays a thumbnail for current user's dropbox file

param: string $string

logout()   X-Ref
Logout from dropbox

return: array

set_option($options = array()   X-Ref
Set dropbox option

param: array $options
return: mixed

get_option($config = '')   X-Ref
Get dropbox options

param: string $config
return: mixed

fix_old_style_reference($reference)   X-Ref
Fixes references in DB that contains user credentials

param: string $reference contents of DB field files_reference.reference

get_file_download_link($sharedurl)   X-Ref
Converts a URL received from dropbox API function 'shares' into URL that
can be used to download/access file directly

param: string $sharedurl
return: string

get_file($reference, $saveas = '')   X-Ref
Downloads a file from external repository and saves it in temp dir

param: string $reference the content of files.reference field or result of
param: string $saveas filename (without path) to save the downloaded file in the
return: array with elements:

type_config_form($mform, $classname = 'repository')   X-Ref
Add Plugin settings input to Moodle form

param: moodleform $mform Moodle form (passed by reference)
param: string $classname repository class name

get_type_option_names()   X-Ref
Option names of dropbox plugin

return: array

supported_filetypes()   X-Ref
Dropbox plugin supports all kinds of files

return: array

supported_returntypes()   X-Ref
User cannot use the external link to dropbox

return: int

get_link($reference)   X-Ref
Return file URL for external link

param: string $reference the result of get_file_reference()
return: string

get_file_reference($source)   X-Ref
Prepare file reference information

param: string $source
return: string file referece

sync_reference(stored_file $file)   X-Ref
No description

cache_file_by_reference($reference, $storedfile)   X-Ref
Cache file from external repository by reference

Dropbox repository regularly caches all external files that are smaller than
{@link repository_dropbox::max_cache_bytes()}

param: string $reference this reference is generated by
param: stored_file $storedfile created file reference

get_reference_details($reference, $filestatus = 0)   X-Ref
Return human readable reference information
{@link stored_file::get_reference()}

param: string $reference
param: int $filestatus status of the file, 0 - ok, 666 - source missing
return: string

get_file_source_info($source)   X-Ref
Return the source information

param: string $source
return: string

max_cache_bytes()   X-Ref
Returns the maximum size of the Dropbox files to cache in moodle

Note that {@link repository_dropbox::sync_reference()} will try to cache images even
when they are bigger in order to generate thumbnails. However there is
a small timeout for downloading images for synchronisation and it will
probably fail if the image is too big.

return: int

send_file($storedfile, $lifetime=null , $filter=0, $forcedownload=false, array $options = null)   X-Ref
Repository method to serve the referenced file

This method is ivoked from {@link send_stored_file()}.
Dropbox repository first caches the file by reading it into temporary folder and then
serves from there.

param: stored_file $storedfile the file that contains the reference
param: int $lifetime Number of seconds before the file should expire from caches (null means $CFG->filelifetime)
param: int $filter 0 (default)=no filtering, 1=all files, 2=html files only
param: bool $forcedownload If true (default false), forces download of file rather than view in browser/plugin
param: array $options additional options affecting the file serving

cron()   X-Ref
Caches all references to Dropbox files in moodle filepool

Invoked by {@link repository_dropbox_cron()}. Only files smaller than
{@link repository_dropbox::max_cache_bytes()} and only files which
synchronisation timeout have not expired are cached.

repository_dropbox_cron()   X-Ref
Dropbox plugin cron task




Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1