|
| filter ($text, array $options=[]) |
| Override this function to actually implement the filtering.
|
|
| filter_stage_post_clean (string $text, array $options) |
| Filter HTML text at the very end after text is sanitised.
|
|
| filter_stage_pre_clean (string $text, array $options) |
| Filter HTML text before sanitising text.
|
|
| filter_stage_pre_format (string $text, array $options) |
| Filter text before changing format to HTML.
|
|
| filter_stage_string (string $text, array $options) |
| Filter simple text coming from format_string().
|
|
| map_language_code ($moodlelangcode) |
| Perform a mapping of the moodle language code to the equivalent for MathJax.
|
|
| setup ($page, $context) |
| Setup page with filter requirements and other prepare stuff.
|
|
|
| insert_span ($text, $start, $end) |
| Wrap a portion of the $text inside a no link span ().
|
|
| wrap_math_in_nolink ($text) |
| Find math environments in the $text and wrap them in no link spans ().
|
|
|
context | $context |
| The context we are in.
|
|
array | $localconfig |
| Any local configuration for this filter in this context.
|
|
◆ filter()
filter_mathjaxloader\text_filter::filter |
( |
| $text, |
|
|
array | $options = [] ) |
Override this function to actually implement the filtering.
Filter developers must make sure that filtering done after text cleaning does not introduce security vulnerabilities.
- Parameters
-
string | $text | some HTML content to process. |
array | $options | options passed to the filters |
- Return values
-
string | the HTML content after the filtering has been applied. |
Reimplemented from core_filters\text_filter.
◆ filter_stage_post_clean()
core_filters\text_filter::filter_stage_post_clean |
( |
string | $text, |
|
|
array | $options ) |
|
inherited |
Filter HTML text at the very end after text is sanitised.
NOTE: this is called even if $options['noclean'] is true and text is not cleaned.
- Parameters
-
string | $text | |
array | $options | |
- Return values
-
◆ filter_stage_pre_clean()
core_filters\text_filter::filter_stage_pre_clean |
( |
string | $text, |
|
|
array | $options ) |
|
inherited |
Filter HTML text before sanitising text.
NOTE: this is called even if $options['noclean'] is true and text is not cleaned.
- Parameters
-
string | $text | |
array | $options | |
- Return values
-
◆ filter_stage_pre_format()
core_filters\text_filter::filter_stage_pre_format |
( |
string | $text, |
|
|
array | $options ) |
|
inherited |
Filter text before changing format to HTML.
- Parameters
-
string | $text | |
array | $options | |
- Return values
-
◆ filter_stage_string()
core_filters\text_filter::filter_stage_string |
( |
string | $text, |
|
|
array | $options ) |
|
inherited |
Filter simple text coming from format_string().
Note that unless $CFG->formatstringstriptags is disabled HTML tags are not expected in returned value.
- Parameters
-
string | $text | |
array | $options | |
- Return values
-
◆ insert_span()
filter_mathjaxloader\text_filter::insert_span |
( |
| $text, |
|
|
| $start, |
|
|
| $end ) |
|
protected |
Wrap a portion of the $text inside a no link span ().
The whole text is then returned.
- Parameters
-
string | $text | The text to modify. |
int | $start | The start index of the substring in $text that should be wrapped in the span. |
int | $end | The end index of the substring in $text that should be wrapped in the span. |
- Return values
-
string | The whole $text with the span inserted around the defined substring. |
◆ map_language_code()
filter_mathjaxloader\text_filter::map_language_code |
( |
| $moodlelangcode | ) |
|
Perform a mapping of the moodle language code to the equivalent for MathJax.
- Parameters
-
string | $moodlelangcode | - The moodle language code - e.g. en_pirate |
- Return values
-
string | The MathJax language code. |
◆ setup()
filter_mathjaxloader\text_filter::setup |
( |
| $page, |
|
|
| $context ) |
Setup page with filter requirements and other prepare stuff.
Override this method if the filter needs to setup page requirements or needs other stuff to be executed.
Note this method is invoked from {
- See also
- setup_page_for_filters()} for each piece of text being filtered, so it is responsible for controlling its own execution cardinality.
- Parameters
-
moodle_page | $page | the page we are going to add requirements to. |
context | $context | the context which contents are going to be filtered. |
- Since
- Moodle 2.3
Reimplemented from core_filters\text_filter.
◆ wrap_math_in_nolink()
filter_mathjaxloader\text_filter::wrap_math_in_nolink |
( |
| $text | ) |
|
|
protected |
Find math environments in the $text and wrap them in no link spans ().
If math environments are nested, only the outer environment is wrapped in the span.
The recognized math environments are [ ] and $$ $$ for display mathematics and ( ) for inline mathematics.
- Parameters
-
string | $text | The text to filter. |
- Return values
-
array | An array containing the potentially modified text and a boolean that is true if any changes were made to the text. |
The documentation for this class was generated from the following file:
- filter/mathjaxloader/classes/text_filter.php