Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
filter_mediaplugin Class Reference

Automatic media embedding filter class. More...

Inheritance diagram for filter_mediaplugin:

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

 embed_alternatives ($urls, $name, $width, $height, $options)
 Renders media files (audio or video) using suitable embedded player.
 
 process_media_tag ($fulltext)
 Replaces <video> or <audio> tag with processed contents.
 

Protected Attributes

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

Detailed Description

Automatic media embedding filter class.

It is highly recommended to configure servers to be compatible with our slasharguments, otherwise the "?d=600x400" may not work.

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

Member Function Documentation

◆ embed_alternatives()

filter_mediaplugin::embed_alternatives ( $urls,
$name,
$width,
$height,
$options )
protected

Renders media files (audio or video) using suitable embedded player.

Wrapper for core_media_manager::embed_alternatives()

Parameters
array$urlsArray of moodle_url to media files
string$nameOptional user-readable name to display in download link
int$widthWidth in pixels (optional)
int$heightHeight in pixels (optional)
array$optionsArray of key/value pairs
Return values
stringHTML content of embed

◆ filter()

filter_mediaplugin::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.

◆ process_media_tag()

filter_mediaplugin::process_media_tag ( $fulltext)
protected

Replaces <video> or <audio> tag with processed contents.

Parameters
string$fulltextcomplete HTML snipped "<video ...>...</video>" or "<audio ...>....</audio>"
Return values
string

◆ setup()

filter_mediaplugin::setup ( $page,
$context )

Setup page with filter requirements and other prepare stuff.

Parameters
moodle_page$pageThe page we are going to add requirements to.
context$contextThe context which contents are going to be filtered.

Reimplemented from moodle_text_filter.


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