Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 400 and 403]

HTML import lib

Copyright: 2011 Petr Skoda {@link http://skodak.org}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 346 lines (14 kb)
Included or required: 1 time
Referenced: 1 time
Includes or requires: 1 file
 mod/book/tool/importhtml/lib.php

Defines 8 functions


Functions that are not part of a class:

toolbook_importhtml_import_chapters($package, $type, $book, $context, $verbose = true)   X-Ref
Import HTML pages packaged into one zip archive

param: stored_file $package
param: string $type type of the package ('typezipdirs' or 'typezipfiles')
param: stdClass $book
param: context_module $context
param: bool $verbose

toolbook_importhtml_parse_headings($html)   X-Ref
Parse the headings of the imported package of type 'typeonefile'
(currently unsupported)

param: string $html html content to parse

toolbook_importhtml_parse_styles($html)   X-Ref
Parse the links to external css sheets of the imported html content

return: string all the links to external css sheets
param: string $html html content to parse

toolbook_importhtml_fix_path($path)   X-Ref
Normalize paths to be absolute

return: string the normalized and cleaned absolute path
param: string $path original path with MS/relative separators

toolbook_importhtml_fix_encoding($html)   X-Ref
Convert some html content to utf8, getting original encoding from html headers

return: string html content converted to utf8
param: string $html html content to convert

toolbook_importhtml_parse_body($html)   X-Ref
Extract the body from any html contents

return: string the contents of the body
param: string $html the html to parse

toolbook_importhtml_parse_title($html, $default)   X-Ref
Extract the title of any html content, getting it from the title tag

return: string the resulting title
param: string $html the html to parse
param: string $default default title to apply if no title is found

toolbook_importhtml_get_chapter_files($package, $type)   X-Ref
Returns all the html files (chapters) from a file package

return: array the html files found in the package
param: stored_file $package file to be processed
param: string $type type of the package ('typezipdirs' or 'typezipfiles')