Prepended constants with C_ to avoid reserved words as per https://www.php.net/manual...
[htmlpurifier/darkodev.git] / smoketests / common.php
blobb2c2b4bb4b91cec198fa195cd768739c8c7eda7b
1 <?php
3 header('Content-type: text/html; charset=UTF-8');
5 if (!isset($_GET['standalone'])) {
6 require_once '../library/HTMLPurifier.auto.php';
7 } else {
8 require_once '../library/HTMLPurifier.standalone.php';
10 error_reporting(E_ALL);
12 function escapeHTML($string)
14 $string = HTMLPurifier_Encoder::cleanUTF8($string);
15 $string = htmlspecialchars($string, ENT_COMPAT, 'UTF-8');
16 return $string;
19 if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
20 function fix_magic_quotes(&$array)
22 foreach ($array as $k => $val) {
23 if (!is_array($val)) {
24 $array[$k] = stripslashes($val);
25 } else {
26 fix_magic_quotes($array[$k]);
31 fix_magic_quotes($_GET);
32 fix_magic_quotes($_POST);
33 fix_magic_quotes($_COOKIE);
34 fix_magic_quotes($_REQUEST);
35 fix_magic_quotes($_ENV);
36 fix_magic_quotes($_SERVER);
39 // vim: et sw=4 sts=4