Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

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

This plugin is used to access files by providing an url

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

Defines 1 class


Class: repository_url  - X-Ref

repository_url class
A subclass of repository, which is used to download a file from a specific url

__construct($repositoryid, $context = SYSCONTEXTID, $options = array()   X-Ref

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

check_login()   X-Ref
No description

print_login()   X-Ref

return: mixed

get_listing($path='', $page='')   X-Ref

return: array
param: mixed $path
param: string $search

parse_file($baseurl, $relativeurl, &$list, $mainfile = false)   X-Ref
Parses one file (either html or css)

param: string $baseurl (optional) URL of the file where link to this file was found
param: string $relativeurl relative or absolute link to the file
param: array $list
param: bool $mainfile true only for main HTML false and false for all embedded/linked files

add_image_to_list($baseurl, $url, &$list)   X-Ref
No description

guess_filename($url, $type)   X-Ref
No description

escape_url($url)   X-Ref
Escapes a url by replacing spaces with %20.

Note: In general moodle does not automatically escape urls, but for the purposes of making this plugin more user friendly
and make it consistent with some other areas in moodle (such as mod_url), urls will automatically be escaped.

If moodle_url or PARAM_URL is changed to clean characters that need to be escaped, then this function can be removed

return: string The escaped url
param: string $url An unescaped url.

supported_returntypes()   X-Ref
No description

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

return: string|null
param: stdClass $url

supported_filetypes()   X-Ref
file types supported by url downloader plugin

return: array

contains_private_data()   X-Ref
Is this repository accessing private data?

return: bool