* * All rights reserved. * * * * 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. * * * * Author(s): Jon Abernathy * * * * Last modified: 11/07/03 * * * *************************************************************************/ /** * Takes HTML and converts it to formatted, plain text. * * Thanks to Alexander Krug (http://www.krugar.de/) to pointing out and * correcting an error in the regexp search array. Fixed 7/30/03. * * Updated set_html() function's file reading mechanism, 9/25/03. * * Thanks to Joss Sanglier (http://www.dancingbear.co.uk/) for adding * several more HTML entity codes to the $search and $replace arrays. * Updated 11/7/03. * * @author Jon Abernathy * @version 0.4 * @since PHP 4.0.2 */ class html2text { /** * Contains the HTML content to convert. * * @var string $html * @access public */ var $html; /** * Contains the converted, formatted text. * * @var string $text * @access public */ var $text; /** * Maximum width of the formatted text, in columns. * * @var integer $width * @access public */ var $width = 70; /** * List of preg* regular expression patterns to search for, * used in conjunction with $replace. * * @var array $search * @access public * @see $replace */ var $search = array( "/\r/", // Non-legal carriage return "/[\n\t]+/", // Newlines and tabs '/]*>.*?<\/script>/i', //