Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Files | Namespaces | Classes | Functions | Variables
booktool_importhtml

Files

file  access.php
 Book import capability definition.
 
file  import_form.php
 Book import form.
 
file  lib.php
 HTML import lib.
 
file  locallib.php
 HTML import lib.
 
file  provider.php
 Privacy provider implementation for booktool_importhtml.
 
file  version.php
 Book import plugin version info.
 

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. More...
 
 toolbook_importhtml_fix_encoding ($html)
 Convert some html content to utf8, getting original encoding from html headers. More...
 
 toolbook_importhtml_fix_path ($path)
 Normalize paths to be absolute. More...
 
 toolbook_importhtml_get_chapter_files ($package, $type)
 Returns all the html files (chapters) from a file package. More...
 
 toolbook_importhtml_import_chapters ($package, $type, $book, $context, $verbose=true)
 Import HTML pages packaged into one zip archive. More...
 
 toolbook_importhtml_parse_body ($html)
 Extract the body from any html contents. More...
 
 toolbook_importhtml_parse_headings ($html)
 Parse the headings of the imported package of type 'typeonefile' (currently unsupported) More...
 
 toolbook_importhtml_parse_styles ($html)
 Parse the links to external css sheets of the imported html content. More...
 
 toolbook_importhtml_parse_title ($html, $default)
 Extract the title of any html content, getting it from the title tag. More...
 

Variables

 $capabilities
 
 $plugin = 2020060900
 
$plugin component = 'booktool_importhtml'
 
$plugin version = 2020061500
 

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