function __construct($params) { parent::__construct($params); // TODO: Better support for other character sets? $this->charset = 'UTF-8'; }
function error_page($params, $message = null) { if (!$params['error']) { $params['error'] = "404 Not Found"; } header("{$_SERVER["SERVER_PROTOCOL"]} {$params['error']}"); $head = <<<HTML <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" /> <title>Boost C++ Libraries - 404 Not Found</title> HTML; $content = '<h1>' . html_encode($params['error']) . '</h1><p>File "' . html_encode($params['file']) . '" not found.</p><p>'; if (!empty($params['zipfile'])) { $content .= "Unzip error: "; } $content .= html_encode($message); $content .= '</p>'; $filter = new BoostFilters($params); $filter->display_template(array('head' => $head, 'content' => $content)); }
<!DOCTYPE html> <html> <head> <title>Filter Tests</title> </head> <body> <h1>Filter Tests</h1> <?php require_once dirname(__FILE__) . '/../boost_archive.php'; BoostFilters::$template = __DIR__ . '/template.php'; $failure_count = 0; function filter_test($filter, $params, $expected) { ob_start(); echo_filtered($filter, $params); $result = ob_get_clean(); if (trim($result) != trim($expected)) { global $failure_count; ++$failure_count; echo "<h2>Failure for filter {$filter}</h2>", '<p>Expected:</p><pre>', html_encode($expected), '</pre><p>Result:</p><pre>', html_encode($result), '</pre>'; } } /* Plain Text */ $test_text = <<<EOL Hello World! EOL; $test_text_expected = <<<EOL <!DOCTYPE html> <html>