aboutsummaryrefslogtreecommitdiffstats
path: root/lib/htmlpurifier/smoketests/basic.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-05-12 17:57:41 -0700
committerfriendica <info@friendica.com>2012-07-18 20:40:31 +1000
commit7a40f4354b32809af3d0cfd6e3af0eda02ab0e0a (patch)
treea9c3d91209cff770bb4b613b1b95e61a7bbc5a2b /lib/htmlpurifier/smoketests/basic.php
parentcd727cb26b78a1dade09d510b071446898477356 (diff)
downloadvolse-hubzilla-7a40f4354b32809af3d0cfd6e3af0eda02ab0e0a.tar.gz
volse-hubzilla-7a40f4354b32809af3d0cfd6e3af0eda02ab0e0a.tar.bz2
volse-hubzilla-7a40f4354b32809af3d0cfd6e3af0eda02ab0e0a.zip
some important stuff we'll need
Diffstat (limited to 'lib/htmlpurifier/smoketests/basic.php')
-rw-r--r--lib/htmlpurifier/smoketests/basic.php73
1 files changed, 73 insertions, 0 deletions
diff --git a/lib/htmlpurifier/smoketests/basic.php b/lib/htmlpurifier/smoketests/basic.php
new file mode 100644
index 000000000..1c361727c
--- /dev/null
+++ b/lib/htmlpurifier/smoketests/basic.php
@@ -0,0 +1,73 @@
+<?php
+
+require_once 'common.php';
+
+// todo : modularize the HTML in to separate files
+
+$allowed = array(
+ 'allElements' => true,
+ 'legacy' => true
+);
+
+$page = isset($_GET['p']) ? $_GET['p'] : false;
+if (!isset($allowed[$page])) $page = false;
+
+$strict = isset($_GET['d']) ? (bool) $_GET['d'] : false;
+
+echo '<?xml version="1.0" encoding="UTF-8" ?>';
+?>
+<?php if ($strict) { ?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1- Strict.dtd">
+<?php } else { ?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-loose.dtd">
+<?php } ?>
+<html>
+<head>
+ <title>HTML Purifier Basic Smoketest</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<?php
+ if ($page) {
+ if (file_exists("basic/$page.css")) {
+ ?><link rel="stylesheet" href="basic/<?php echo $page ?>.css" type="text/css" /><?php
+ }
+ }
+?>
+</head>
+<body>
+<?php
+
+if ($page) {
+?>
+<div style="float:right;"><div><?php echo $strict ? 'Strict' : 'Loose'; ?>:
+<a href="?d=<?php echo (int) !$strict; ?>&amp;p=<?php echo $page ?>">Swap</a></div>
+<a href="http://validator.w3.org/check?uri=referer"><img
+ src="http://www.w3.org/Icons/valid-xhtml10"
+ alt="Valid XHTML 1.0 Transitional" height="31" width="88" style="border:0;" /></a>
+</div>
+<?php
+ $config = HTMLPurifier_Config::createDefault();
+ $config->set('Attr.EnableID', true);
+ $config->set('HTML.Strict', $strict);
+ $purifier = new HTMLPurifier($config);
+ echo $purifier->purify(file_get_contents("basic/$page.html"));
+} else {
+ ?>
+ <h1>HTML Purifier Basic Smoketest Index</h1>
+ <ul>
+ <?php
+ foreach ($allowed as $val => $b) {
+ ?><li><a href="?p=<?php echo $val ?>"><?php echo $val ?></a></li><?php
+ }
+ ?></ul><?php
+}
+
+?>
+</body>
+</html>
+<?php
+
+// vim: et sw=4 sts=4