mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-11-14 01:08:41 +00:00
6c9c8f2380
- Restore printTokens() git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1570 48356398-32a2-884e-a903-53898d9a118a
36 lines
941 B
PHP
36 lines
941 B
PHP
<?php
|
|
|
|
header('Content-type: text/html; charset=UTF-8');
|
|
|
|
if (!isset($_GET['standalone'])) {
|
|
require_once '../library/HTMLPurifier.auto.php';
|
|
} else {
|
|
require_once '../library/HTMLPurifier.standalone.php';
|
|
}
|
|
error_reporting(E_ALL);
|
|
|
|
function escapeHTML($string) {
|
|
$string = HTMLPurifier_Encoder::cleanUTF8($string);
|
|
$string = htmlspecialchars($string, ENT_COMPAT, 'UTF-8');
|
|
return $string;
|
|
}
|
|
|
|
if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
|
|
function fix_magic_quotes(&$array) {
|
|
foreach ($array as $k => $val) {
|
|
if (!is_array($val)) {
|
|
$array[$k] = stripslashes($val);
|
|
} else {
|
|
fix_magic_quotes($array[$k]);
|
|
}
|
|
}
|
|
}
|
|
|
|
fix_magic_quotes($_GET);
|
|
fix_magic_quotes($_POST);
|
|
fix_magic_quotes($_COOKIE);
|
|
fix_magic_quotes($_REQUEST);
|
|
fix_magic_quotes($_ENV);
|
|
fix_magic_quotes($_SERVER);
|
|
}
|