|
|
@ -164,7 +164,7 @@ class html2text
|
|
|
|
'$this->_build_link_list("\\1", "\\2")', // <a href="">
|
|
|
|
'$this->_build_link_list("\\1", "\\2")', // <a href="">
|
|
|
|
"strtoupper(\"\n\n\\1\n\n\")", // H1 - H3
|
|
|
|
"strtoupper(\"\n\n\\1\n\n\")", // H1 - H3
|
|
|
|
"ucwords(\"\n\n\\1\n\n\")", // H4 - H6
|
|
|
|
"ucwords(\"\n\n\\1\n\n\")", // H4 - H6
|
|
|
|
"\n\n\t", // <P>
|
|
|
|
"\n", // <P>
|
|
|
|
"\n", // <br>
|
|
|
|
"\n", // <br>
|
|
|
|
'strtoupper("\\1")', // <b>
|
|
|
|
'strtoupper("\\1")', // <b>
|
|
|
|
'_\\1_', // <i>
|
|
|
|
'_\\1_', // <i>
|
|
|
@ -233,6 +233,15 @@ class html2text
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
var $_link_list = array();
|
|
|
|
var $_link_list = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Boolean flag, true if a table of link URLs should be listed after the text.
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @var boolean $_do_links
|
|
|
|
|
|
|
|
* @access private
|
|
|
|
|
|
|
|
* @see html2text()
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
var $_do_links = true;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Constructor.
|
|
|
|
* Constructor.
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -242,15 +251,17 @@ class html2text
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param string $source HTML content
|
|
|
|
* @param string $source HTML content
|
|
|
|
* @param boolean $from_file Indicates $source is a file to pull content from
|
|
|
|
* @param boolean $from_file Indicates $source is a file to pull content from
|
|
|
|
|
|
|
|
* @param boolean $do_link_table indicate whether a table of link URLs is desired
|
|
|
|
* @access public
|
|
|
|
* @access public
|
|
|
|
* @return void
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function html2text( $source = '', $from_file = false )
|
|
|
|
function html2text( $source = '', $from_file = false, $do_link_table = true )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( !empty($source) ) {
|
|
|
|
if ( !empty($source) ) {
|
|
|
|
$this->set_html($source, $from_file);
|
|
|
|
$this->set_html($source, $from_file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->set_base_url();
|
|
|
|
$this->set_base_url();
|
|
|
|
|
|
|
|
$this->_do_links = $produce_link_table;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -409,6 +420,8 @@ class html2text
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function _build_link_list($link, $display)
|
|
|
|
function _build_link_list($link, $display)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (! $this->_do_links) return $display;
|
|
|
|
|
|
|
|
|
|
|
|
$link_lc = strtolower($link);
|
|
|
|
$link_lc = strtolower($link);
|
|
|
|
|
|
|
|
|
|
|
|
if (substr($link_lc, 0, 7) == 'http://' || substr($link_lc, 0, 8) == 'https://' || substr($link_lc, 0, 7) == 'mailto:')
|
|
|
|
if (substr($link_lc, 0, 7) == 'http://' || substr($link_lc, 0, 8) == 'https://' || substr($link_lc, 0, 7) == 'mailto:')
|
|
|
|