Release 4.5.0
[htmlpurifier.git] / smoketests / common.php
blobc4e5eb38865a681176ab442a6f77b2a4c33bbb94
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) {
13 $string = HTMLPurifier_Encoder::cleanUTF8($string);
14 $string = htmlspecialchars($string, ENT_COMPAT, 'UTF-8');
15 return $string;
18 if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
19 function fix_magic_quotes(&$array) {
20 foreach ($array as $k => $val) {
21 if (!is_array($val)) {
22 $array[$k] = stripslashes($val);
23 } else {
24 fix_magic_quotes($array[$k]);
29 fix_magic_quotes($_GET);
30 fix_magic_quotes($_POST);
31 fix_magic_quotes($_COOKIE);
32 fix_magic_quotes($_REQUEST);
33 fix_magic_quotes($_ENV);
34 fix_magic_quotes($_SERVER);
37 // vim: et sw=4 sts=4