|
Moodle
2.2.1
http://www.collinsharper.com
|
Go to the source code of this file.
Data Structures | |
| class | moodle_url |
| class | tabobject |
| class | progress_bar |
| class | progress_trace |
| class | null_progress_trace |
| class | text_progress_trace |
| class | html_progress_trace |
| class | html_list_progress_trace |
Namespaces | |
| namespace | core |
| namespace | moodlecore |
Enumerations | |
| enum | FORMAT_MOODLE |
| Constants. More... | |
| enum | FORMAT_HTML |
| enum | FORMAT_PLAIN |
| enum | FORMAT_WIKI |
| enum | FORMAT_MARKDOWN |
| enum | URL_MATCH_BASE |
| enum | URL_MATCH_PARAMS |
| enum | URL_MATCH_EXACT |
Functions | |
| s ($var, $obsolete=false) | |
| Functions. | |
| p ($var, $obsolete=false) | |
| addslashes_js ($var) | |
| strip_querystring ($url) | |
| get_referer ($stripquery=true) | |
| me () | |
| qualified_me () | |
| data_submitted () | |
| break_up_long_words ($string, $maxsize=20, $cutchar=' ') | |
| close_window ($delay=0, $reloadopener=false) | |
| page_doc_link ($text='') | |
| validate_email ($address) | |
| get_file_argument () | |
| format_text_menu () | |
| format_text ($text, $format=FORMAT_MOODLE, $options=NULL, $courseid_do_not_use=NULL) | |
| reset_text_filters_cache () | |
| format_string ($string, $striplinks=true, $options=NULL) | |
| replace_ampersands_not_followed_by_entity ($string) | |
| strip_links ($string) | |
| wikify_links ($string) | |
| format_text_email ($text, $format) | |
| format_module_intro ($module, $activity, $cmid, $filter=true) | |
| trusttext_strip ($text) | |
| trusttext_pre_edit ($object, $field, $context) | |
| trusttext_trusted ($context) | |
| trusttext_active () | |
| clean_text ($text, $format=FORMAT_HTML, $options=array()) | |
| purify_html ($text, $options=array()) | |
| text_to_html ($text, $smiley_ignored=null, $para=true, $newlines=true) | |
| markdown_to_html ($text) | |
| html_to_text ($html, $width=75, $dolinks=true) | |
| highlight ($needle, $haystack, $matchcase=false, $prefix= '< span class="highlight">', $suffix= '</span >') | |
| highlightfast ($needle, $haystack) | |
| get_html_lang ($dir=false) | |
| send_headers ($contenttype, $cacheable=true) | |
| STANDARD WEB PAGE PARTS ///////////////////////////////////////////////////. | |
| link_arrow_right ($text, $url='', $accesshide=false, $addclass='') | |
| link_arrow_left ($text, $url='', $accesshide=false, $addclass='') | |
| get_accesshide ($text, $elem='span', $class='', $attrs='') | |
| get_separator () | |
| print_collapsible_region ($contents, $classes, $id, $caption, $userpref= '', $default=false, $return=false) | |
| print_collapsible_region_start ($classes, $id, $caption, $userpref= '', $default=false, $return=false) | |
| print_collapsible_region_end ($return=false) | |
| print_group_picture ($group, $courseid, $large=false, $return=false, $link=true) | |
| print_recent_activity_note ($time, $user, $text, $link, $return=false, $viewfullnames=null) | |
| navmenulist ($course, $sections, $modinfo, $strsection, $strjumpto, $width=50, $cmid=0) | |
| print_grade_menu ($courseid, $name, $current, $includenograde=true, $return=false) | |
| mdie ($msg='', $errorcode=1) | |
| notice ($message, $link='', $course=NULL) | |
| redirect ($url, $message='', $delay=-1) | |
| obfuscate_email ($email) | |
| obfuscate_text ($plaintext) | |
| obfuscate_mailto ($email, $label='', $dimmed=false) | |
| rebuildnolinktag ($text) | |
| print_maintenance_message () | |
| print_tabs ($tabrows, $selected=NULL, $inactive=NULL, $activated=NULL, $return=false) | |
| convert_tree_to_html ($tree, $row=0) | |
| convert_tabrows_to_tree ($tabrows, $selected, $inactive, $activated) | |
| debugging ($message= '', $level=DEBUG_NORMAL, $backtrace=null) | |
| print_location_comment ($file, $line, $return=false) | |
| right_to_left () | |
| fix_align_rtl ($align) | |
| is_in_popup () | |
| print_password_policy () | |
| enum FORMAT_HTML |
Plain HTML (with some tags stripped)
Definition at line 48 of file weblib.php.
| enum FORMAT_MARKDOWN |
Markdown-formatted text http://daringfireball.net/projects/markdown/
Definition at line 65 of file weblib.php.
| enum FORMAT_MOODLE |
Constants.
Define text formatting types ... eventually we can add Wiki, BBcode etc Does all sorts of transformations and filtering
Definition at line 43 of file weblib.php.
| enum FORMAT_PLAIN |
Plain text (even tags are printed in full)
Definition at line 53 of file weblib.php.
| enum FORMAT_WIKI |
Wiki-formatted text Deprecated: left here just to note that '3' is not used (at the moment) and to catch any latent wiki-like text (which generates an error)
Definition at line 60 of file weblib.php.
| enum URL_MATCH_BASE |
A moodle_url comparison using this flag will return true if the base URLs match, params are ignored
Definition at line 70 of file weblib.php.
| enum URL_MATCH_EXACT |
A moodle_url comparison using this flag will return true if the two URLs are identical, except for the order of the params
Definition at line 78 of file weblib.php.
| enum URL_MATCH_PARAMS |
A moodle_url comparison using this flag will return true if the base URLs match and the params of url1 are part of url2
Definition at line 74 of file weblib.php.
| addslashes_js | ( | $ | var | ) |
Does proper javascript quoting.
Do not use addslashes anymore, because it does not work when magic_quotes_sybase is enabled.
| mixed | $var | String, Array, or Object to add slashes to |
Definition at line 128 of file weblib.php.

| 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
It's multibyte savvy and doesn't change anything inside html tags.
| string | $string | the string to be modified |
| int | $maxsize | maximum length of the string to be returned |
| string | $cutchar | the string used to represent word breaks |
Loading the textlib singleton instance. We are going to need it.
First of all, save all the tags inside the text to skip them
Process the string adding the cut when necessary
Finally load the tags back again
Definition at line 755 of file weblib.php.


| clean_text | ( | $ | text, |
| $ | format = FORMAT_HTML, |
||
| $ | options = array() |
||
| ) |
Given raw text (eg typed in by a user), this function cleans it up and removes any nasty tags that could mess up Moodle pages through XSS attacks.
The result must be used as a HTML text fragment, this function can not cleanup random parts of html tags such as url or src attributes.
NOTE: the format parameter was deprecated because we can safely clean only HTML.
| string | $text | The text to be cleaned |
| int | string | $format | deprecated parameter, should always contain FORMAT_HTML or FORMAT_MOODLE |
| array | $options | Array of options; currently only option supported is 'allowid' (if true, does not remove id attributes when cleaning) |
Definition at line 1427 of file weblib.php.


| close_window | ( | $ | delay = 0, |
| $ | reloadopener = false |
||
| ) |
Try and close the current window using JavaScript, either immediately, or after a delay.
Echo's out the resulting XHTML & javascript
object object
| integer | $delay | a delay in seconds before closing the window. Default 0. |
| boolean | $reloadopener | if true, we will see if this window was a pop-up, and try to reload the parent window before this one closes. |
Definition at line 802 of file weblib.php.
| convert_tabrows_to_tree | ( | $ | tabrows, |
| $ | selected, | ||
| $ | inactive, | ||
| $ | activated | ||
| ) |
Convert nested tabrows to a nested array
| array | $tabrows | A [nested] array of tab row objects |
| string | $selected | The tabrow to select (by id) |
| array | $inactive | An array of tabrow id's to make inactive |
| array | $activated | An array of tabrow id's to make active |
Work backwards through the rows (bottom to top) collecting the tree as we go.
Definition at line 2643 of file weblib.php.

| convert_tree_to_html | ( | $ | tree, |
| $ | row = 0 |
||
| ) |
Converts a nested array tree into HTML ul:li [recursive]
| array | $tree | A tree array to convert |
| int | $row | Used in identifying the iteration level and in ul classes |
Definition at line 2578 of file weblib.php.

| data_submitted | ( | ) |
Determine if there is data waiting to be processed from a form
Used on most forms in Moodle to check for data Returns the data as an object, if it's found. This object can be used in foreach loops without casting because it's cast to (array) automatically
Checks that submitted POST data exists and returns it as object.
$_POST
Definition at line 735 of file weblib.php.


| debugging | ( | $ | message = '', |
| $ | level = DEBUG_NORMAL, |
||
| $ | backtrace = null |
||
| ) |
Standard Debugging Function
Returns true if the current site debugging settings are equal or above specified level. If passed a parameter it will emit a debugging notice similar to trigger_error(). The routing of notices is controlled by $CFG->debugdisplay eg use like this:
1) debugging('a normal debug notice'); 2) debugging('something really picky', DEBUG_ALL); 3) debugging('annoying debug message only for developers', DEBUG_DEVELOPER); 4) if (debugging()) { perform extra debugging operations (do not use print or echo) }
In code blocks controlled by debugging() (such as example 4) any output should be routed via debugging() itself, or the lower-level trigger_error() or error_log(). Using echo or print will break XHTML JS and HTTP headers.
It is also possible to define NO_DEBUG_DISPLAY which redirects the message to error_log.
DEBUG_NORMAL
| string | $message | a message to print |
| int | $level | the level at which this debugging statement should show |
| array | $backtrace | use different backtrace |
Definition at line 2698 of file weblib.php.

| fix_align_rtl | ( | $ | align | ) |
Returns swapped left<=>right if in RTL environment. part of RTL support
| string | $align | align to check |
Definition at line 2786 of file weblib.php.


| format_module_intro | ( | $ | module, |
| $ | activity, | ||
| $ | cmid, | ||
| $ | filter = true |
||
| ) |
Formats activity intro text
object CONTEXT_MODULE
| string | $module | name of module |
| object | $activity | instance of activity |
| int | $cmid | course module id |
| bool | $filter | filter resulting html text |
Definition at line 1342 of file weblib.php.


| 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
This function should be used to print short strings (non html) that need filter processing e.g. activity titles, post subjects, glossary concepts.
bool $strcache
| string | $string | The string to be filtered. Should be plain text, expect possibly for multilang tags. |
| boolean | $striplinks | To strip any link in the result text. Moodle 1.8 default changed from false to true! MDL-8713 |
| array | $options | options array/object or courseid |
Definition at line 1190 of file weblib.php.

| format_text | ( | $ | text, |
| $ | format = FORMAT_MOODLE, |
||
| $ | options = NULL, |
||
| $ | courseid_do_not_use = NULL |
||
| ) |
Given text in a variety of format codings, this function returns the text as safe HTML.
This function should mainly be used for long strings like posts, answers, glossary items etc. For short strings
Options:
trusted : If true the string won't be cleaned. Default false required noclean=true.
noclean : If true the string won't be cleaned. Default false required trusted=true.
nocache : If true the strign will not be cached and will be formatted every call. Default false.
filter : If true the string will be run through applicable filters as well. Default true.
para : If true then the returned string will be wrapped in div tags. Default true.
newlines : If true then lines newline breaks will be converted to HTML newline breaks. Default true.
context : The context that will be used for filtering.
overflowdiv : If set to true the formatted text will be encased in a div
with the class no-overflow before being returned. Default false.
allowid : If true then id attributes will not be removed, even when
using htmlpurifier. Default false.
array $croncache
| string | $text | The text to be formatted. This is raw text originally from user input. |
| int | $format | Identifier of the text format to be used [FORMAT_MOODLE, FORMAT_HTML, FORMAT_PLAIN, FORMAT_MARKDOWN] |
| object/array | $options text formatting options | |
| int | $courseid_do_not_use | deprecated course id, use context option instead |
Definition at line 962 of file weblib.php.

| 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.
FORMAT_MOODLE FORMAT_HTML FORMAT_PLAIN FORMAT_WIKI FORMAT_MARKDOWN
| string | $text | The text to be formatted. This is raw text originally from user input. |
| int | $format | Identifier of the text format to be used [FORMAT_MOODLE, FORMAT_HTML, FORMAT_PLAIN, FORMAT_WIKI, FORMAT_MARKDOWN] |
Definition at line 1304 of file weblib.php.


| format_text_menu | ( | ) |
Just returns an array of text formats suitable for a popup menu
FORMAT_MOODLE FORMAT_HTML FORMAT_PLAIN FORMAT_MARKDOWN
Definition at line 923 of file weblib.php.

| get_accesshide | ( | $ | text, |
| $ | elem = 'span', |
||
| $ | class = '', |
||
| $ | attrs = '' |
||
| ) |
Return a HTML element with the class "accesshide", for accessibility. Please use cautiously - where possible, text should be visible!
| string | $text | Plain text. |
| string | $elem | Lowercase element name, default "span". |
| string | $class | Additional classes for the element. |
| string | $attrs | Additional attributes string in the form, "name='value' name2='value2'" |
Definition at line 1830 of file weblib.php.

Extracts file argument either from file parameter or PATH_INFO Note: $scriptname parameter is not needed anymore
string $_SERVER PARAM_PATH
Definition at line 877 of file weblib.php.


| get_html_lang | ( | $ | dir = false | ) |
Return a string containing 'lang', xml:lang and optionally 'dir' HTML attributes. Internationalisation, for print_header and backup/restorelib.
| bool | $dir | Default false |
Definition at line 1703 of file weblib.php.


| get_referer | ( | $ | stripquery = true | ) |
Returns the URL of the HTTP_REFERER, less the querystring portion if required
$_SERVER
| boolean | $stripquery | if true, also removes the query part of the url. |
Definition at line 169 of file weblib.php.


| get_separator | ( | ) |
Return the breadcrumb trail navigation separator.
Definition at line 1839 of file weblib.php.

| highlight | ( | $ | needle, |
| $ | haystack, | ||
| $ | matchcase = false, |
||
| $ | prefix = '<span class="highlight">', |
||
| $ | suffix = '</span>' |
||
| ) |
This function will highlight search words in a given string
It cares about HTML and will not ruin links. It's best to use this function after performing any conversions to HTML.
| string | $needle | The search string. Syntax like "word1 +word2 -word3" is dealt with correctly. |
| string | $haystack | The string (HTML) within which to highlight the search terms. |
| boolean | $matchcase | whether to do case-sensitive. Default case-insensitive. |
| string | $prefix | the string to put before each search term found. |
| string | $suffix | the string to put after each search term found. |
Quick bail-out in trivial cases.
Break up the search term into words, discard any -words and build a regexp.
Another chance to bail-out if $search was only -words
Find all the HTML tags in the input, and store them in a placeholders array.
In $hastack, replace each HTML tag with the corresponding placeholder.
In the resulting string, Do the highlighting.
Turn the placeholders back into HTML tags.
Definition at line 1612 of file weblib.php.

| highlightfast | ( | $ | needle, |
| $ | haystack | ||
| ) |
This function will highlight instances of $needle in $haystack
It's faster that the above function highlight() and doesn't care about HTML or anything.
| string | $needle | The string to search for |
| string | $haystack | The string to search for $needle in |
Definition at line 1671 of file weblib.php.


| html_to_text | ( | $ | html, |
| $ | width = 75, |
||
| $ | dolinks = true |
||
| ) |
Given HTML text, make it into plain text using external function
| string | $html | The text to be converted. |
| integer | $width | Width to wrap the text at. (optional, default 75 which is a good value for email. 0 means do not limit line length.) |
| boolean | $dolinks | By default, any links in the HTML are collected, and printed as a list at the end of the HTML. If you don't want that, set this argument to false. |
Definition at line 1587 of file weblib.php.

| is_in_popup | ( | ) |
Returns true if the page is displayed in a popup window. Gets the information from the URL parameter inpopup.
Definition at line 2805 of file weblib.php.

| link_arrow_left | ( | $ | text, |
| $ | url = '', |
||
| $ | accesshide = false, |
||
| $ | addclass = '' |
||
| ) |
Return the left arrow with text ('previous'), and optionally embedded in a link.
object
| string | $text | HTML/plain text label (set to blank only for breadcrumb separator cases). |
| string | $url | An optional link to use in a surrounding HTML anchor. |
| bool | $accesshide | True if text should be hidden (for screen readers only). |
| string | $addclass | Additional class names for the link, or the arrow character. |
Definition at line 1796 of file weblib.php.


| link_arrow_right | ( | $ | text, |
| $ | url = '', |
||
| $ | accesshide = false, |
||
| $ | addclass = '' |
||
| ) |
Return the right arrow with text ('next'), and optionally embedded in a link.
object
| string | $text | HTML/plain text label (set to blank only for breadcrumb separator cases). |
| string | $url | An optional link to use in a surrounding HTML anchor. |
| bool | $accesshide | True if text should be hidden (for screen readers only). |
| string | $addclass | Additional class names for the link, or the arrow character. |
Definition at line 1762 of file weblib.php.


| markdown_to_html | ( | $ | text | ) |
Given Markdown formatted text, make it into XHTML using external function
object
| string | $text | The markdown formatted text to be converted. |
Definition at line 1564 of file weblib.php.


| mdie | ( | $ | msg = '', |
| $ | errorcode = 1 |
||
| ) |
Print an error to STDOUT and exit with a non-zero code. For commandline scripts. Default errorcode is 1.
Very useful for perl-like error-handling:
do_somethting() or mdie("Something went wrong");
| string | $msg | Error message |
| integer | $errorcode | Error code to emit |
Definition at line 2197 of file weblib.php.
| me | ( | ) |
Returns the name of the current script, WITH the querystring portion.
This function is necessary because PHP_SELF and REQUEST_URI and SCRIPT_NAME return different things depending on a lot of things like your OS, Web server, and the way PHP is compiled (ie. as a CGI, module, ISAPI, etc.) NOTE: This function returns false if the global variables needed are not set.
string
Definition at line 193 of file weblib.php.

| navmenulist | ( | $ | course, |
| $ | sections, | ||
| $ | modinfo, | ||
| $ | strsection, | ||
| $ | strjumpto, | ||
| $ | width = 50, |
||
| $ | cmid = 0 |
||
| ) |
Returns a popup menu with course activity modules
Given a course This function returns a small popup menu with all the course activity modules in it, as a navigation menu outputs a simple list structure in XHTML The data is taken from the serialised array stored in the course record
object CONTEXT_COURSE
| course | $course | A $COURSE object. |
| string | $sections | |
| string | $modinfo | |
| string | $strsection | |
| string | $strjumpto | |
| int | $width | |
| string | $cmid |
Don't show excess hidden sections
Definition at line 2061 of file weblib.php.

| notice | ( | $ | message, |
| $ | link = '', |
||
| $ | course = NULL |
||
| ) |
Print a message and exit.
| string | $message | The message to print in the notice |
| string | $link | The link to use for the continue button |
| object | $course | A course object |
Definition at line 2210 of file weblib.php.


| obfuscate_email | ( | $ | ) |
Given an email address, this function will return an obfuscated version of it
| string | The email address to obfuscate |
Definition at line 2383 of file weblib.php.

| obfuscate_mailto | ( | $ | email, |
| $ | label = '', |
||
| $ | dimmed = false |
||
| ) |
This function uses the obfuscate_email() and obfuscate_text() to generate a fully obfuscated email link, ready to use.
| string | The email address to display | |
| string | $label | The text to displayed as hyperlink to $email |
| boolean | $dimmed | If true then use css class 'dimmed' for hyperlink |
Definition at line 2438 of file weblib.php.


| obfuscate_text | ( | $ | plaintext | ) |
This function takes some text and replaces about half of the characters with HTML entity equivalents. Return string is obviously longer.
| string | $plaintext | The text to be obfuscated |
Definition at line 2406 of file weblib.php.

| p | ( | $ | var, |
| $ | obsolete = false |
||
| ) |
Add quotes to HTML characters
Prints $var with HTML characters (like "<", ">", etc.) properly quoted. This function simply calls s()
| string | $var | the string potentially containing HTML characters |
| boolean | $obsolete | no longer used. |
Definition at line 116 of file weblib.php.


| page_doc_link | ( | $ | text = '' | ) |
Returns a string containing a link to the user documentation for the current page. Also contains an icon by default. Shown to teachers and admin only.
object object
| string | $text | The text to be displayed for the link |
| string | $iconpath | The path to the icon to be displayed |
Definition at line 834 of file weblib.php.

| 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.
If JavaScript is off, then the region will always be expanded.
| string | $contents | the contents of the box. |
| string | $classes | class names added to the div that is output. |
| string | $id | id added to the div that is output. Must not be blank. |
| string | $caption | text displayed at the top. Clicking on this will cause the region to expand or contract. |
| string | $userpref | the name of the user preference that stores the user's preferred default state. (May be blank if you do not wish the state to be persisted. |
| boolean | $default | Initial collapsed state to use if the user_preference it not set. |
| boolean | $return | if true, return the HTML as a string, rather than printing it. |
Definition at line 1860 of file weblib.php.

| print_collapsible_region_end | ( | $ | return = false | ) |
Close a region started with print_collapsible_region_start.
| boolean | $return | if true, return the HTML as a string, rather than printing it. |
Definition at line 1923 of file weblib.php.

| print_collapsible_region_start | ( | $ | classes, |
| $ | id, | ||
| $ | caption, | ||
| $ | userpref = '', |
||
| $ | default = false, |
||
| $ | return = false |
||
| ) |
Print (or return) the start of a collapsible region, that has a caption that can be clicked to expand or collapse the region. If JavaScript is off, then the region will always be expanded.
| string | $classes | class names added to the div that is output. |
| string | $id | id added to the div that is output. Must not be blank. |
| string | $caption | text displayed at the top. Clicking on this will cause the region to expand or contract. |
| string | $userpref | the name of the user preference that stores the user's preferred default state. (May be blank if you do not wish the state to be persisted. |
| boolean | $default | Initial collapsed state to use if the user_preference it not set. |
| boolean | $return | if true, return the HTML as a string, rather than printing it. |
Definition at line 1886 of file weblib.php.


| 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
Finish documenting this function
Deprecate: this is only used in a few contrib modules
object
| int | $courseid | The course ID |
| string | $name | |
| string | $current | |
| boolean | $includenograde | Include those with no grades |
| boolean | $return | If set to true returns rather than echo's |
Definition at line 2154 of file weblib.php.

| print_group_picture | ( | $ | group, |
| $ | courseid, | ||
| $ | large = false, |
||
| $ | return = false, |
||
| $ | link = true |
||
| ) |
Print a specified group's avatar.
object CONTEXT_COURSE
| array | stdClass | $group | A single group object OR array of groups. |
| int | $courseid | The course ID. |
| boolean | $large | Default small picture, or large. |
| boolean | $return | If false print picture, otherwise return the output as string |
| boolean | $link | Enclose image in a link to view specified course? |
Definition at line 1945 of file weblib.php.


| print_location_comment | ( | $ | file, |
| $ | line, | ||
| $ | return = false |
||
| ) |
Outputs a HTML comment to the browser. This is used for those hard-to-debug pages that use bits from many different files in very confusing ways (e.g. blocks).
print_location_comment(__FILE__, __LINE__);
| string | $file | |
| integer | $line | |
| boolean | $return | Whether to return or print the comment |
Definition at line 2761 of file weblib.php.
Prints a maintenance message from $CFG->maintenance_message or default if empty
Definition at line 2473 of file weblib.php.


Returns a localized sentence in the current language summarizing the current password policy
Definition at line 3115 of file weblib.php.

| print_recent_activity_note | ( | $ | time, |
| $ | user, | ||
| $ | text, | ||
| $ | link, | ||
| $ | return = false, |
||
| $ | viewfullnames = null |
||
| ) |
Display a recent activity note
CONTEXT_SYSTEM string $strftimerecent
| object | A time object | |
| object | A user object | |
| string | $text | Text for display for the note |
| string | $link | The link to wrap around the text |
| bool | $return | If set to true the HTML is returned rather than echo'd |
| string | $viewfullnames |
Definition at line 2012 of file weblib.php.


| 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.
object
| array | $tabrows | An array of rows where each row is an array of tab objects |
| string | $selected | The id of the selected tab (whatever row it's on) |
| array | $inactive | An array of ids of inactive tabs that are not selectable. |
| array | $activated | An array of ids of other tabs that are currently activated |
| bool | $return | If true output is returned rather then echo'd |
$inactive must be an array
$activated must be an array
Convert the tab rows into a tree that's easier to process
Print out the current tree of tabs (this function is recursive)
We're done!
Definition at line 2539 of file weblib.php.


| purify_html | ( | $ | text, |
| $ | options = array() |
||
| ) |
KSES replacement cleaning function - uses HTML Purifier.
| string | $text | The (X)HTML string to purify |
| array | $options | Array of options; currently only option supported is 'allowid' (if set, does not remove id attributes when cleaning) |
Definition at line 1459 of file weblib.php.


| qualified_me | ( | ) |
Returns the name of the current script, WITH the full URL.
This function is necessary because PHP_SELF and REQUEST_URI and SCRIPT_NAME return different things depending on a lot of things like your OS, Web server, and the way PHP is compiled (ie. as a CGI, module, ISAPI, etc. NOTE: This function returns false if the global variables needed are not set.
Like me() but returns a full URL
string
Definition at line 212 of file weblib.php.

| rebuildnolinktag | ( | $ | text | ) |
This function is used to rebuild the <nolink> tag because some formats (PLAIN and WIKI) will transform it to html entities
| string | $text | Text to search for nolink tag in |
Definition at line 2462 of file weblib.php.

| redirect | ( | $ | url, |
| $ | message = '', |
||
| $ | delay = -1 |
||
| ) |
Redirects the user to another page, after printing a notice
This function calls the OUTPUT redirect method, echo's the output and then dies to ensure nothing else happens.
Good practice: You should call this method before starting page output by using any of the OUTPUT methods.
| moodle_url | string | $url | A moodle_url to redirect to. Strings are not to be trusted! |
| string | $message | The message to display to the user |
| int | $delay | The delay before redirecting |
Definition at line 2249 of file weblib.php.

| 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. If any is found, it is replaced by &. The string is then returned.
| string | $string |
Definition at line 1266 of file weblib.php.

Resets all data related to filters, called during upgrade or when filter settings change.
object object
Definition at line 1166 of file weblib.php.


| right_to_left | ( | ) |
Definition at line 2774 of file weblib.php.

| s | ( | $ | var, |
| $ | obsolete = false |
||
| ) |
Functions.
Add quotes to HTML characters
Returns $var with HTML characters (like "<", ">", etc.) properly quoted. This function is very similar to p()
| string | $var | the string potentially containing HTML characters |
| boolean | $obsolete | no longer used. |
Definition at line 94 of file weblib.php.
| send_headers | ( | $ | contenttype, |
| $ | cacheable = true |
||
| ) |
STANDARD WEB PAGE PARTS ///////////////////////////////////////////////////.
Send the HTTP headers that Moodle requires.
| $cacheable | Can this page be cached on back? |
Definition at line 1725 of file weblib.php.

| strip_links | ( | $ | string | ) |
Given a string, replaces all .* by .* and returns the string.
| string | $string |
Definition at line 1276 of file weblib.php.

| strip_querystring | ( | $ | url | ) |
Remove query string from url
Takes in a URL and returns it without the querystring portion
| string | $url | the url which may have a query string attached |
Definition at line 153 of file weblib.php.

| text_to_html | ( | $ | text, |
| $ | smiley_ignored = null, |
||
| $ | para = true, |
||
| $ | newlines = true |
||
| ) |
Given plain text, makes it into HTML as nicely as possible. May contain HTML tags already
Do not abuse this function. It is intended as lower level formatting feature used by {
| string | $text | The string to convert. |
| boolean | $smiley_ignored | Was used to determine if smiley characters should convert to smiley images, ignored now |
| boolean | $para | If true then the returned string will be wrapped in div tags |
| boolean | $newlines | If true then lines newline breaks will be converted to HTML newline breaks. |
Remove any whitespace that may be between HTML tags
Remove any returns that precede or follow HTML tags
Make returns into HTML newlines.
Wrap the whole thing in a div if required
Definition at line 1535 of file weblib.php.

| trusttext_active | ( | ) |
Is trusttext feature active?
Definition at line 1406 of file weblib.php.

| trusttext_pre_edit | ( | $ | object, |
| $ | field, | ||
| $ | context | ||
| ) |
Must be called before editing of all texts with trust flag. Removes all XSS nasties from texts stored in database if needed.
| object | $object | data object with xxx, xxxformat and xxxtrust fields |
| string | $field | name of text field |
| object | $context | active context |
Definition at line 1378 of file weblib.php.

| trusttext_strip | ( | $ | text | ) |
Legacy function, used for cleaning of old forum and glossary text only.
object
| string | $text | text that may contain legacy TRUSTTEXT marker |
Definition at line 1358 of file weblib.php.
| trusttext_trusted | ( | $ | context | ) |
Is current user trusted to enter no dangerous XSS in this context?
Please note the user must be in fact trusted everywhere on this server!!
| object | $context |
Definition at line 1397 of file weblib.php.


| validate_email | ( | $ | address | ) |
Validates an email to make sure it makes sense.
| string | $address | The email address to validate. |
Definition at line 858 of file weblib.php.

| wikify_links | ( | $ | string | ) |
This expression turns links into something nice in a text format. (Russell Jungwirth)
| string | $string |
Definition at line 1286 of file weblib.php.
