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

Display H5P filter. More...

Inheritance diagram for filter_displayh5p:

Public Member Functions

 filter ($text, array $options=array())
 Function filter replaces any h5p-sources.
 
 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.
 

Public Attributes

 $localurl = '#\?url=([^" <]*[::/]+[^" <]*::.h5p)([?][^"]*)?#'
 
if(empty($h5pcontents) &&empty($h5links)) foreach( $h5plinks as $h5plink) foreach($h5pcontents as $h5pcontent) $result = filter_phrases($text, $h5pcontents, null, null, false, true)
 
 $result
 
return $result
 

Protected Attributes

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

Detailed Description

Display H5P filter.

This filter will replace any occurrence of H5P URLs with the corresponding H5P content embed code

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

Member Function Documentation

◆ filter()

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

Function filter replaces any h5p-sources.

Parameters
string$textHTML content to process
array$optionsoptions passed to the filters
Return values
string

Reimplemented from moodle_text_filter.

Member Data Documentation

◆ $result

filter_displayh5p::$result
Initial value:
= preg_replace_callback($localurl,
function ($matches) {
$baseurl = rawurlencode($matches[1]);
if (!empty($matches[2])) {
$match = explode('?', $matches[2]);
if (!empty($match[1])) {
$baseurl = $baseurl."&".$match[1];
}
}
return "?url=".$baseurl;
}, $result)

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