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 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]

Recourse module like helper functions

Copyright: 2009 Petr Skoda (http://skodak.org)
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 281 lines (9 kb)
Included or required:0 times
Referenced: 1 time
Includes or requires: 0 files

Defines 7 functions


Functions that are not part of a class:

resourcelib_try_file_migration($filepath, $cmid, $courseid, $component, $filearea, $itemid)   X-Ref
Try on demand migration of file from old course files

param: string $filepath old file path
param: int $cmid migrated course module if
param: int $courseid
param: string $component
param: string $filearea new file area
param: int $itemid migrated file item id
return: mixed, false if not found, stored_file instance if migrated to new area

resourcelib_get_displayoptions(array $enabled, $current=null)   X-Ref
Returns list of available display options

param: array $enabled list of options enabled in module configuration
param: int $current current display options for existing instances
return: array of key=>name pairs

resourcelib_guess_url_mimetype($fullurl)   X-Ref
Tries to guess correct mimetype for arbitrary URL

param: string $fullurl
return: string mimetype

resourcelib_get_extension($fullurl)   X-Ref
Looks for the extension.

param: string $fullurl
return: string file extension

resourcelib_embed_image($fullurl, $title)   X-Ref
Returns image embedding html.

param: string $fullurl
param: string $title
return: string html

resourcelib_embed_pdf($fullurl, $title, $clicktoopen)   X-Ref
Returns general link or pdf embedding html.

param: string $fullurl
param: string $title
param: string $clicktoopen
return: string html

resourcelib_embed_general($fullurl, $title, $clicktoopen, $mimetype)   X-Ref
Returns general link or file embedding html.

param: string $fullurl
param: string $title
param: string $clicktoopen
param: string $mimetype
return: string html