|
static | delete_service_descriptions (string $component) |
| Delete all pre-built services, related tokens, and external functions information defined for the specified component.
|
|
static | format_string ( $content, $context, $striplinks=true, $options=[]) |
| Format the string to be returned properly as requested by the either the web service server, either by an internally call.
|
|
static | format_text ( $text, $textformat, $context, $component=null, $filearea=null, $itemid=null, $options=null) |
| Format the text to be returned properly as requested by the either the web service server, either by an internally call.
|
|
static | generate_token (int $tokentype, stdClass $service, int $userid, context $context, int $validuntil=0, string $iprestriction='', string $name='') |
| Create and return a session linked token.
|
|
static | generate_token_for_current_user (stdClass $service) |
| Generate or return an existing token for the current authenticated user.
|
|
static | generate_token_name () |
| Generate token name.
|
|
static | get_area_files ($contextid, $component, $filearea, $itemid=false, $useitemidinurl=true) |
| Returns all area files (optionally limited by itemid).
|
|
static | get_service_by_id (int $serviceid) |
| Get a service by its id.
|
|
static | get_service_by_name (string $name) |
| Get a service by its name.
|
|
static | log_token_request (stdClass $token) |
| Set the last time a token was sent and trigger the core\event\webservice_token_sent event.
|
|
static | validate_courses ( $courseids, $courses=[], $addcontext=false, $keepfails=false) |
| Validate a list of courses, returning the complete course objects for valid courses.
|
|
static | validate_format ($format) |
| Validate text field format against known FORMAT_XXX.
|
|
Utility functions for the external API.
- Copyright
- 2015 Juan Leyva
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
static core_external\util::format_text |
( |
| $text, |
|
|
| $textformat, |
|
|
| $context, |
|
|
| $component = null, |
|
|
| $filearea = null, |
|
|
| $itemid = null, |
|
|
| $options = null ) |
|
static |
Format the text to be returned properly as requested by the either the web service server, either by an internally call.
The caller can change the format (raw, filter, file, fileurl) with the core_external\settings singleton All web service servers must set this singleton when parsing the $_GET and $_POST.
Options are the same that in {
- See also
- format_text()} with some changes in defaults to provide backwards compatibility:
trusted : If true the string won't be cleaned. Default false.
noclean : If true the string won't be cleaned only if trusted is also true. Default false.
nocache : If true the string will not be cached and will be formatted every call. Default false.
filter : Can be set to false to force filters off, else observes {
-
core_external\settings}.
para : If true then the returned string will be wrapped in div tags.
Default (different from format_text) false.
Default changed because div tags are not commonly needed.
newlines : If true then lines newline breaks will be converted to HTML newline breaks. Default true.
context : Not used! Using contextid parameter instead.
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 (different from
format_text) true. Default changed id attributes are commonly needed.
blanktarget : If true all tags will have target="_blank" added unless target is explicitly specified.
- Parameters
-
string | null | $text | The content that may contain ULRs in need of rewriting.
|
string | int | null | $textformat | The text format.
|
context | $context | This parameter and the next two identify the file area to use.
|
string | null | $component | |
string | null | $filearea | helps identify the file area.
|
int | string | null | $itemid | helps identify the file area.
|
array | stdClass | null | $options | text formatting options
|
- Return values
-