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 310 and 311] [Versions 39 and 311]

(no description)

File Size: 658 lines (22 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Html2Text:: (22 methods):
  legacyConstruct()
  __construct()
  getHtml()
  setHtml()
  set_html()
  getText()
  get_text()
  print_text()
  p()
  setBaseUrl()
  set_base_url()
  convert()
  doConvert()
  converter()
  buildlinkList()
  convertPre()
  convertBlockquotes()
  pregCallback()
  pregPreCallback()
  toupper()
  strtoupper()
  tostrike()


Class: Html2Text  - X-Ref

legacyConstruct($html = '', $fromFile = false, array $options = array()   X-Ref
No description

__construct($html = '', $options = array()   X-Ref

param: string $html    Source HTML
param: array  $options Set configuration options

getHtml()   X-Ref
Get the source HTML

return: string

setHtml($html)   X-Ref
Set the source HTML

param: string $html HTML source content

set_html($html, $from_file = false)   X-Ref


getText()   X-Ref
Returns the text, converted from HTML.

return: string Plain text

get_text()   X-Ref


print_text()   X-Ref


p()   X-Ref


setBaseUrl($baseurl)   X-Ref
Sets a base URL to handle relative links.

param: string $baseurl

set_base_url($baseurl)   X-Ref


convert()   X-Ref
No description

doConvert()   X-Ref
No description

converter(&$text)   X-Ref
No description

buildlinkList($link, $display, $linkOverride = null)   X-Ref
Helper function called by preg_replace() on link replacement.

Maintains an internal list of links to be displayed at the end of the
text, with numeric indices to the original point in the text they
appeared. Also makes an effort at identifying and handling absolute
and relative links.

param: string $link          URL of the link
param: string $display       Part of the text to associate number with
param: null   $linkOverride
return: string

convertPre(&$text)   X-Ref
Helper function for PRE body conversion.

param: string &$text HTML content

convertBlockquotes(&$text)   X-Ref
Helper function for BLOCKQUOTE body conversion.

param: string &$text HTML content

pregCallback($matches)   X-Ref
Callback function for preg_replace_callback use.

param: array  $matches PREG matches
return: string

pregPreCallback( $matches)   X-Ref
Callback function for preg_replace_callback use in PRE content handler.

param: array  $matches PREG matches
return: string

toupper($str)   X-Ref
Strtoupper function with HTML tags and entities handling.

param: string $str Text to convert
return: string Converted text

strtoupper($str)   X-Ref
Strtoupper multibyte wrapper function with HTML entities handling.

param: string $str Text to convert
return: string Converted text

tostrike($str)   X-Ref
Helper function for DEL conversion.

param: string $text HTML content
return: string Converted text