Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

(no description)

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

Defines 1 class

Html2Text:: (21 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()


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

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
No description

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