Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
booktool_importhtml

Namespaces

namespace  booktool_importhtml\privacy
  
 

Classes

class  booktool_importhtml\privacy\provider
 Privacy provider implementation for booktool_importhtml. More...
 
class  booktool_importhtml_form
 

Functions

 booktool_importhtml_extend_settings_navigation (settings_navigation $settings, navigation_node $node)
 Adds module specific settings to the settings block.
 
 toolbook_importhtml_fix_encoding ($html)
 Convert some html content to utf8, getting original encoding from html headers.
 
 toolbook_importhtml_fix_path ($path)
 Normalize paths to be absolute.
 
 toolbook_importhtml_get_chapter_files ($package, $type)
 Returns all the html files (chapters) from a file package.
 
 toolbook_importhtml_import_chapters ($package, $type, $book, $context, $verbose=true)
 Import HTML pages packaged into one zip archive.
 
 toolbook_importhtml_parse_body ($html)
 Extract the body from any html contents.
 
 toolbook_importhtml_parse_headings ($html)
 Parse the headings of the imported package of type 'typeonefile' (currently unsupported)
 
 toolbook_importhtml_parse_styles ($html)
 Parse the links to external css sheets of the imported html content.
 
 toolbook_importhtml_parse_title ($html, $default)
 Extract the title of any html content, getting it from the title tag.
 

Variables

 $capabilities
 
 $plugin = 2024041600
 
$plugin component = 'booktool_importhtml'
 
$plugin version = 2024042200
 

Detailed Description

Function Documentation

◆ booktool_importhtml_extend_settings_navigation()

booktool_importhtml_extend_settings_navigation ( settings_navigation $settings,
navigation_node $node )

Adds module specific settings to the settings block.

Parameters
settings_navigation$settingsThe settings navigation object
navigation_node$nodeThe node to add module settings to

◆ toolbook_importhtml_fix_encoding()

toolbook_importhtml_fix_encoding ( $html)

Convert some html content to utf8, getting original encoding from html headers.

Parameters
string$htmlhtml content to convert
Return values
stringhtml content converted to utf8

◆ toolbook_importhtml_fix_path()

toolbook_importhtml_fix_path ( $path)

Normalize paths to be absolute.

Parameters
string$pathoriginal path with MS/relative separators
Return values
stringthe normalized and cleaned absolute path

◆ toolbook_importhtml_get_chapter_files()

toolbook_importhtml_get_chapter_files ( $package,
$type )

Returns all the html files (chapters) from a file package.

Parameters
stored_file$packagefile to be processed
string$typetype of the package ('typezipdirs' or 'typezipfiles')
Return values
arraythe html files found in the package

◆ toolbook_importhtml_import_chapters()

toolbook_importhtml_import_chapters ( $package,
$type,
$book,
$context,
$verbose = true )

Import HTML pages packaged into one zip archive.

Parameters
stored_file$package
string$typetype of the package ('typezipdirs' or 'typezipfiles')
stdClass$book
context_module$context
bool$verbose

◆ toolbook_importhtml_parse_body()

toolbook_importhtml_parse_body ( $html)

Extract the body from any html contents.

Parameters
string$htmlthe html to parse
Return values
stringthe contents of the body

◆ toolbook_importhtml_parse_headings()

toolbook_importhtml_parse_headings ( $html)

Parse the headings of the imported package of type 'typeonefile' (currently unsupported)

Parameters
string$htmlhtml content to parse
Todo
implement this once the type 'typeonefile' is enabled

◆ toolbook_importhtml_parse_styles()

toolbook_importhtml_parse_styles ( $html)

Parse the links to external css sheets of the imported html content.

Parameters
string$htmlhtml content to parse
Return values
stringall the links to external css sheets

◆ toolbook_importhtml_parse_title()

toolbook_importhtml_parse_title ( $html,
$default )

Extract the title of any html content, getting it from the title tag.

Parameters
string$htmlthe html to parse
string$defaultdefault title to apply if no title is found
Return values
stringthe resulting title

Variable Documentation

◆ $capabilities

$capabilities
Initial value:
= array(
'booktool/importhtml:import' => array(
'riskbitmask' => RISK_XSS,
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW,
)
),
)
const CAP_ALLOW
Allow permission, overrides CAP_PREVENT defined in parent contexts.
Definition accesslib.php:115
const RISK_XSS
Capability allows user to add scripted content - see
Definition accesslib.php:143
const CONTEXT_MODULE
Course module context level - one instance for each course module.
Definition accesslib.php:130