Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Public Attributes | Protected Attributes | List of all members
filter_displayh5p Class Reference

Display H5P filter. More...

Inheritance diagram for filter_displayh5p:
moodle_text_filter

Public Member Functions

 filter ($text, array $options=array())
 Function filter replaces any h5p-sources. More...
 
 hash ()
 
 setup ($page, $context)
 Setup page with filter requirements and other prepare stuff. More...
 

Public Attributes

 $localurl = '#\?url=([^" <]*[::/]+[^" <]*::.h5p)([?][^"]*)?#'
 
if(empty( $h5pcontents) &&empty( $h5links)) foreach($h5plinks as $h5plink) $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: