3 * XML message parser - doesn't do anything other than an XML well-formedness check
5 * @author Ant P <p@cpi.merseine.nu>
6 * @license file://../COPYING
9 require_once 'lib/iface.Message3.php';
11 class Post_XML
implements Message3
13 private $output = null;
15 function __construct($input, $formatting = null)
17 if ( strpos($input, '<script') !== false ||
strpos($input, '-moz-binding') !== false ) {
18 throw new Exception('Your post contains something that looks like HTML scripting.');
21 // No nl2br here, anyone using this should know what they're doing
22 $this->output
= str_replace("\r\n", "\n", $input);
27 // Check for malformed XML, doesn't really do much else
28 $parser = xml_parser_create('UTF-8');
30 if ( !xml_parse($parser, '<div>'.$this->output
.'</div>', true) ) {
31 throw new InvalidInputException(xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser));