Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
filter_multilang Class Reference

Implementation of the Moodle filter API for the Multi-lang filter. More...

Inheritance diagram for filter_multilang:
moodle_text_filter

Public Member Functions

 filter ($text, array $options=array())
 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().
 
 hash ()
 
 setup ($page, $context)
 Setup page with filter requirements and other prepare stuff.
 

Protected Member Functions

 get_parent_lang (string $lang)
 Puts some caching around get_parent_language().
 
 process_match (array $langblock)
 This is the callback used by the preg_replace_callback call above.
 

Protected Attributes

context $context
 The context we are in.
 
array $localconfig
 Any local configuration for this filter in this context.
 

Detailed Description

Implementation of the Moodle filter API for the Multi-lang filter.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ filter()

filter_multilang::filter ( $text,
array $options = array() )

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$textsome HTML content to process.
array$optionsoptions passed to the filters
Return values
stringthe HTML content after the filtering has been applied.

Reimplemented from moodle_text_filter.

◆ get_parent_lang()

filter_multilang::get_parent_lang ( string $lang)
protected

Puts some caching around get_parent_language().

Also handle parent == 'en' in a way that works better for us.

Parameters
string$langa Moodle language code, e.g. 'fr'.
Return values
stringthe parent language.

◆ process_match()

filter_multilang::process_match ( array $langblock)
protected

This is the callback used by the preg_replace_callback call above.

Parameters
array$langblockone of the matches from the regex match.
Return values
stringthe replacement string (one of the possible translations).

The documentation for this class was generated from the following file: