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] [Versions 401 and 402] [Versions 401 and 403]

Private url module utility functions

Copyright: 2009 Petr Skoda {@link http://skodak.org}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 564 lines (20 kb)
Included or required:0 times
Referenced: 3 times
Includes or requires: 0 files

Defines 14 functions


Functions that are not part of a class:

url_appears_valid_url($url)   X-Ref
This methods does weak url validation, we are looking for major problems only,
no strict RFE validation.

param: $url
return: bool true is seems valid, false if definitely not valid URL

url_fix_submitted_url($url)   X-Ref
Fix common URL problems that we want teachers to see fixed
the next time they edit the resource.

This function does not include any XSS protection.

param: string $url
return: string

url_get_full_url($url, $cm, $course, $config=null)   X-Ref
Return full url with all extra parameters

This function does not include any XSS protection.

param: string $url
param: object $cm
param: object $course
param: object $config
return: string url with & encoded as &

url_filter_callback($matches)   X-Ref
Unicode encoding helper callback

param: array $matches
return: string

url_print_header($url, $cm, $course)   X-Ref
Print url header.

param: object $url
param: object $cm
param: object $course
return: void

url_get_intro(object $url, object $cm, bool $ignoresettings = false)   X-Ref
Get url introduction.

param: object $url
param: object $cm
param: bool $ignoresettings print even if not specified in modedit
return: string

url_display_frame($url, $cm, $course)   X-Ref
Display url frames.

param: object $url
param: object $cm
param: object $course
return: does not return

url_print_workaround($url, $cm, $course)   X-Ref
Print url info and link.

param: object $url
param: object $cm
param: object $course

url_display_embed($url, $cm, $course)   X-Ref
Display embedded url file.

param: object $url
param: object $cm
param: object $course

url_get_final_display_type($url)   X-Ref
Decide the best display format.

param: object $url
return: int display type constant

url_get_variable_options($config)   X-Ref
Get the parameters that may be appended to URL

param: object $config url module config options
return: array array describing opt groups

url_get_variable_values($url, $cm, $course, $config)   X-Ref
Get the parameter values that may be appended to URL

param: object $url module instance
param: object $cm
param: object $course
param: object $config module config options
return: array of parameter values

url_get_encrypted_parameter($url, $config)   X-Ref
BC internal function

param: object $url
param: object $config
return: string

url_guess_icon($fullurl, $size = null)   X-Ref
Optimised mimetype detection from general URL

param: $fullurl
param: int $size of the icon.
return: string|null mimetype or null when the filetype is not relevant.