[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Source view] [Print] [Project Stats]
(no description)
File Size: | 750 lines (26 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
html2text:: (16 methods):
html2text()
set_html()
get_text()
print_text()
p()
set_allowed_tags()
set_base_url()
_convert()
_converter()
_build_link_list()
_convert_pre()
_convert_blockquotes()
_preg_callback()
_preg_pre_callback()
_toupper()
_strtoupper()
html2text( $source = '', $from_file = false, $do_links = true, $width = 75 ) X-Ref |
Constructor. If the HTML source string (or file) is supplied, the class will instantiate with that source propagated, all that has to be done it to call get_text(). param: string $source HTML content param: boolean $from_file Indicates $source is a file to pull content from param: boolean $do_links Indicate whether a table of link URLs is desired param: integer $width Maximum width of the formatted text, 0 for no limit return: void |
set_html( $source, $from_file = false ) X-Ref |
Loads source HTML into memory, either from $source string or a file. param: string $source HTML content param: boolean $from_file Indicates $source is a file to pull content from return: void |
get_text() X-Ref |
Returns the text, converted from HTML. return: string |
print_text() X-Ref |
Prints the text, converted from HTML. return: void |
p() X-Ref |
Alias to print_text(), operates identically. return: void |
set_allowed_tags( $allowed_tags = '' ) X-Ref |
Sets the allowed HTML tags to pass through to the resulting text. Tags should be in the form "<p>", with no corresponding closing tag. return: void |
set_base_url( $url = '' ) X-Ref |
Sets a base URL to handle relative links. return: void |
_convert() X-Ref |
Workhorse function that does actual conversion (calls _converter() method). return: void |
_converter(&$text) X-Ref |
Workhorse function that does actual conversion. First performs custom tag replacement specified by $search and $replace arrays. Then strips any remaining HTML tags, reduces whitespace and newlines to a readable format, and word wraps the text to $width characters. param: string Reference to HTML content string return: void |
_build_link_list( $link, $display ) 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 return: string |
_convert_pre(&$text) X-Ref |
Helper function for PRE body conversion. param: string HTML content |
_convert_blockquotes(&$text) X-Ref |
Helper function for BLOCKQUOTE body conversion. param: string HTML content |
_preg_callback($matches) X-Ref |
Callback function for preg_replace_callback use. param: array PREG matches return: string |
_preg_pre_callback($matches) X-Ref |
Callback function for preg_replace_callback use in PRE content handler. param: array 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 |
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |