* * * * This script is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * The GNU General Public License can be found at * * http://www.gnu.org/copyleft/gpl.html. * * * * This script is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * *************************************************************************/ /** * Converts HTML to formatted plain text */ class Html2Text { /** * Contains the HTML content to convert. * * @type string */ protected $html; /** * Contains the converted, formatted text. * * @type string */ protected $text; /** * Maximum width of the formatted text, in columns. * * Set this value to 0 (or less) to ignore word wrapping * and not constrain text to a fixed-width column. * * @type integer */ protected $width = 70; /** * List of preg* regular expression patterns to search for, * used in conjunction with $replace. * * @type array * @see $replace */ protected $search = array( "/\r/", // Non-legal carriage return "/[\n\t]+/", // Newlines and tabs '/]*>.*?<\/head>/i', // '/]*>.*?<\/script>/i', //