summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2008-08-30 12:35:36 +0000
committeralecpl <alec@alec.pl>2008-08-30 12:35:36 +0000
commite7f85bd27474e1b1bbb9522dd019f8bbe3ca7bd1 (patch)
treeec3c2bdd463a5d92a5bb67509d9c5f99bad7ec5d
parent8ac6fd094af2ecc93ad8f750a0731c043f7f8a2a (diff)
- applied RC's patches after html2text update
-rw-r--r--program/lib/html2text.php21
1 files changed, 18 insertions, 3 deletions
diff --git a/program/lib/html2text.php b/program/lib/html2text.php
index ee7b0dc40..efc38a630 100644
--- a/program/lib/html2text.php
+++ b/program/lib/html2text.php
@@ -314,6 +314,15 @@ class html2text
*/
var $_link_count = 0;
+ /**
+ * 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.
*
@@ -323,15 +332,20 @@ class html2text
*
* @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
* @access public
* @return void
*/
- function html2text( $source = '', $from_file = false )
+ function html2text( $source = '', $from_file = false, $do_links = true, $width = 75 )
{
if ( !empty($source) ) {
$this->set_html($source, $from_file);
}
+
$this->set_base_url();
+ $this->_do_links = $do_links;
+ $this->width = $width;
}
/**
@@ -350,7 +364,6 @@ class html2text
else
$this->html = $source;
-
$this->_converted = false;
}
@@ -495,7 +508,9 @@ class html2text
*/
function _build_link_list( $link, $display )
{
- if ( substr($link, 0, 7) == 'http://' || substr($link, 0, 8) == 'https://' ||
+ if ( !$this->_do_links ) return $display;
+
+ if ( substr($link, 0, 7) == 'http://' || substr($link, 0, 8) == 'https://' ||
substr($link, 0, 7) == 'mailto:' ) {
$this->_link_count++;
$this->_link_list .= "[" . $this->_link_count . "] $link\n";