Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
|
Library of functions for web output. More...
Classes | |
class | combined_progress_trace |
Special type of trace that can be used for redirecting to multiple other traces. More... | |
class | error_log_progress_trace |
This subclass of progress_trace outputs to error log. More... | |
class | html_list_progress_trace |
HTML List Progress Tree. More... | |
class | html_progress_trace |
This subclass of progress_trace outputs as HTML. More... | |
class | moodle_url |
Class for creating and manipulating urls. More... | |
class | null_progress_trace |
This subclass of progress_trace does not ouput anything. More... | |
class | progress_trace |
Progress trace class. More... | |
class | progress_trace_buffer |
Special type of trace that can be used for catching of output of other traces. More... | |
class | text_progress_trace |
This subclass of progress_trace outputs to plain text. More... | |
Functions | |
addslashes_js ($var) | |
Does proper javascript quoting. More... | |
break_up_long_words ($string, $maxsize=20, $cutchar=' ') | |
Given some normal text this function will break up any long words to a given size by inserting the given character. More... | |
clean_text ($text, $format=FORMAT_HTML, $options=array()) | |
Cleans raw text removing nasties. More... | |
close_window ($delay=0, $reloadopener=false) | |
Try and close the current window using JavaScript, either immediately, or after a delay. More... | |
content_to_text ($content, $contentformat) | |
Converts texts or strings to plain text. More... | |
data_submitted () | |
Determine if there is data waiting to be processed from a form. More... | |
debugging ($message='', $level=DEBUG_NORMAL, $backtrace=null) | |
Standard Debugging Function. More... | |
extract_draft_file_urls_from_text ($text, $forcehttps=false, $contextid=null, $component=null, $filearea=null, $itemid=null, $filename=null) | |
Factory method for extracting draft file links from arbitrary text using regular expressions. More... | |
fix_align_rtl ($align) | |
Returns swapped left<=> right if in RTL environment. More... | |
format_module_intro ($module, $activity, $cmid, $filter=true) | |
Formats activity intro text. More... | |
format_string ($string, $striplinks=true, $options=null) | |
Given a simple string, this function returns the string processed by enabled string filters if $CFG->filterall is enabled. More... | |
format_text ($text, $format=FORMAT_MOODLE, $options=null, $courseiddonotuse=null) | |
Given text in a variety of format codings, this function returns the text as safe HTML. More... | |
format_text_email ($text, $format) | |
Given text in a variety of format codings, this function returns the text as plain text suitable for plain email. More... | |
format_text_menu () | |
Just returns an array of text formats suitable for a popup menu. More... | |
get_accesshide ($text, $elem='span', $class='', $attrs='') | |
Return a HTML element with the class "accesshide", for accessibility. More... | |
get_file_argument () | |
Extracts file argument either from file parameter or PATH_INFO. More... | |
get_formatted_help_string ($identifier, $component, $ajax=false, $a=null) | |
Get the value of a help string fully prepared for display in the current language. More... | |
get_group_picture_url ($group, $courseid, $large=false, $includetoken=false) | |
Return the url to the group picture. More... | |
get_html_lang ($dir=false) | |
Return a string containing 'lang', xml:lang and optionally 'dir' HTML attributes. More... | |
get_local_referer ($stripquery=true) | |
Returns the cleaned local URL of the HTTP_REFERER less the URL query string parameters if required. More... | |
get_separator () | |
Return the breadcrumb trail navigation separator. More... | |
highlight ($needle, $haystack, $matchcase=false, $prefix='< span class="highlight">', $suffix='</span >') | |
This function will highlight search words in a given string. More... | |
highlightfast ($needle, $haystack) | |
This function will highlight instances of $needle in $haystack. More... | |
html_to_text ($html, $width=75, $dolinks=true) | |
Given HTML text, make it into plain text using external function. More... | |
is_https () | |
Determines whether or not the Moodle site is being served over HTTPS. More... | |
is_in_popup () | |
Returns true if the page is displayed in a popup window. More... | |
link_arrow_left ($text, $url='', $accesshide=false, $addclass='', $addparams=[]) | |
Return the left arrow with text ('previous'), and optionally embedded in a link. More... | |
link_arrow_right ($text, $url='', $accesshide=false, $addclass='', $addparams=[]) | |
Return the right arrow with text ('next'), and optionally embedded in a link. More... | |
markdown_to_html ($text) | |
Given Markdown formatted text, make it into XHTML using external function. More... | |
mdie ($msg='', $errorcode=1) | |
Print an error to STDOUT and exit with a non-zero code. More... | |
me () | |
Returns the name of the current script, WITH the querystring portion. More... | |
navmenulist ($course, $sections, $modinfo, $strsection, $strjumpto, $width=50, $cmid=0) | |
Returns a popup menu with course activity modules. More... | |
notice ($message, $link='', $course=null) | |
Print a message and exit. More... | |
obfuscate_email ($email) | |
Given an email address, this function will return an obfuscated version of it. More... | |
obfuscate_mailto ($email, $label='', $dimmed=false, $subject='', $body='') | |
This function uses the obfuscate_email() and obfuscate_text() to generate a fully obfuscated email link, ready to use. More... | |
obfuscate_text ($plaintext) | |
This function takes some text and replaces about half of the characters with HTML entity equivalents. More... | |
p ($var) | |
Add quotes to HTML characters. More... | |
page_doc_link ($text='') | |
Returns a string containing a link to the user documentation for the current page. More... | |
page_get_doc_link_path (moodle_page $page) | |
Returns the path to use when constructing a link to the docs. More... | |
print_collapsible_region ($contents, $classes, $id, $caption, $userpref='', $default=false, $return=false) | |
Print (or return) a collapsible region, that has a caption that can be clicked to expand or collapse the region. More... | |
print_collapsible_region_end ($return=false) | |
Close a region started with print_collapsible_region_start. More... | |
print_collapsible_region_start ($classes, $id, $caption, $userpref='', $default=false, $return=false, $extracontent=null) | |
Print (or return) the start of a collapsible region. More... | |
print_grade_menu ($courseid, $name, $current, $includenograde=true, $return=false) | |
Prints a grade menu (as part of an existing form) with help showing all possible numerical grades and scales. More... | |
print_group_picture ($group, $courseid, $large=false, $return=false, $link=true, $includetoken=false) | |
Print a specified group's avatar. More... | |
print_location_comment ($file, $line, $return=false) | |
Outputs a HTML comment to the browser. More... | |
print_maintenance_message () | |
Prints a maintenance message from $CFG->maintenance_message or default if empty. | |
print_password_policy () | |
Returns a localized sentence in the current language summarizing the current password policy. More... | |
print_recent_activity_note ($time, $user, $text, $link, $return=false, $viewfullnames=null) | |
Display a recent activity note. More... | |
print_tabs ($tabrows, $selected=null, $inactive=null, $activated=null, $return=false) | |
Returns a string containing a nested list, suitable for formatting into tabs with CSS. More... | |
purify_html ($text, $options=array()) | |
KSES replacement cleaning function - uses HTML Purifier. More... | |
qualified_me () | |
Guesses the full URL of the current script. More... | |
rebuildnolinktag ($text) | |
This function is used to rebuild the <nolink> tag because some formats (PLAIN and WIKI) will transform it to html entities. More... | |
redirect ($url, $message='', $delay=null, $messagetype=core\output\notification::NOTIFY_INFO) | |
Redirects the user to another page, after printing a notice. More... | |
replace_ampersands_not_followed_by_entity ($string) | |
Given a string, performs a negative lookahead looking for any ampersand character that is not followed by a proper HTML entity. More... | |
reset_text_filters_cache ($phpunitreset=false) | |
Resets some data related to filters, called during upgrade or when general filter settings change. More... | |
right_to_left () | |
Returns true if the user is using a right-to-left language. More... | |
s ($var) | |
Add quotes to HTML characters. More... | |
send_headers ($contenttype, $cacheable=true) | |
Send the HTTP headers that Moodle requires. More... | |
set_debugging ($level, $debugdisplay=null) | |
Alter debugging level for the current request, the change is not saved in database. More... | |
strip_links ($string) | |
Given a string, replaces all . More... | |
strip_pluginfile_content ($source) | |
Removes the usage of Moodle files from a text. More... | |
strip_querystring ($url) | |
Remove query string from url. More... | |
text_to_html ($text, $smileyignored=null, $para=true, $newlines=true) | |
Given plain text, makes it into HTML as nicely as possible. More... | |
trusttext_active () | |
Is trusttext feature active? More... | |
trusttext_pre_edit ($object, $field, $context) | |
Must be called before editing of all texts with trust flag. More... | |
trusttext_trusted ($context) | |
Is current user trusted to enter no dangerous XSS in this context? More... | |
validate_email ($address) | |
Validates an email to make sure it makes sense. More... | |
wikify_links ($string) | |
This expression turns links into something nice in a text format. More... | |
Variables | |
const | FORMAT_HTML '1' |
Plain HTML (with some tags stripped). | |
const | FORMAT_MARKDOWN '4' |
Markdown-formatted text http://daringfireball.net/projects/markdown/. | |
const | FORMAT_MOODLE '0' |
Does all sorts of transformations and filtering. | |
const | FORMAT_PLAIN '2' |
Plain text (even tags are printed in full). | |
const | FORMAT_WIKI '3' |
Wiki-formatted text. More... | |
const | URL_MATCH_BASE 0 |
A moodle_url comparison using this flag will return true if the base URLs match, params are ignored. | |
const | URL_MATCH_EXACT 2 |
A moodle_url comparison using this flag will return true if the two URLs are identical, except for the order of the params. | |
const | URL_MATCH_PARAMS 1 |
A moodle_url comparison using this flag will return true if the base URLs match and the params of url1 are part of url2. | |
Library of functions for web output.
Library of all general-purpose Moodle PHP functions and constants that produce HTML output
Other main libraries:
@subpackage lib