Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 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: 0 times
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

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

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

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

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

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

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

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

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

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

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

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